BoardGameApplication

open class BoardGameApplication(    windowTitle: String = DEFAULT_WINDOW_TITLE,     aspectRatio: AspectRatio = AspectRatio(),     windowMode: WindowMode? = null)

Baseclass for all BGW Applications. Extend from this class in order to create your own game application. You may only instantiate one application.

Scenes get shown by calling showMenuScene and showGameScene. Application starts by calling show.

See also

Parameters

windowTitle

Title for the application window. Gets displayed in the title bar. Default: DEFAULT_WINDOW_TITLE.

aspectRatio

Initial aspect ratio of application window. Default: empty AspectRatio constructor.

windowMode

Initial window mode. Overrides isMaximized and isFullScreen if passed. Refer to WindowMode docs for further information about the effects.

Constructors

Link copied to clipboard
fun BoardGameApplication(    windowTitle: String = DEFAULT_WINDOW_TITLE,     width: Number = DEFAULT_WINDOW_WIDTH,     height: Number = DEFAULT_WINDOW_HEIGHT,     windowMode: WindowMode? = null)

Creates the BoardGameApplication with optional title and dimension. May only be called once per execution.

Link copied to clipboard
fun BoardGameApplication(    windowTitle: String = DEFAULT_WINDOW_TITLE,     aspectRatio: AspectRatio = AspectRatio(),     windowMode: WindowMode? = null)

Creates the BoardGameApplication with optional title and aspect ratio. May only be called once per execution.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun exit()

Returns the show function, thus closing the application window.

Link copied to clipboard
fun hideMenuScene(fadeTime: Number = DEFAULT_FADE_TIME)

Hides currently shown MenuScene. Activates BoardGameScene if present.

Link copied to clipboard
fun repaint()

Manually refreshes currently displayed Scenes.

Link copied to clipboard
fun setHorizontalSceneAlignment(newHorizontalAlignment: HorizontalAlignment)
Link copied to clipboard
fun setScaleMode(newScaleMode: ScaleMode)

Sets ScaleMode of all Scenes in this BoardGameApplication.

Link copied to clipboard
fun setSceneAlignment(newAlignment: Alignment)

Sets Alignment of all Scenes in this BoardGameApplication.

Link copied to clipboard
fun setVerticalSceneAlignment(newVerticalAlignment: VerticalAlignment)
Link copied to clipboard
fun show()
Link copied to clipboard
fun showDialog(dialog: Dialog): Optional<ButtonType>

Shows a dialog and blocks further thread execution.

Link copied to clipboard
fun showDialogNonBlocking(dialog: Dialog)

Shows a dialog without blocking further thread execution.

Link copied to clipboard
fun showFileDialog(dialog: FileDialog): Optional<List<File>>

Shows the given FileDialog.

Link copied to clipboard
fun showGameScene(scene: BoardGameScene)

Shows given BoardGameScene.

Link copied to clipboard
fun showMenuScene(scene: MenuScene, fadeTime: Number = DEFAULT_FADE_TIME)

Shows given MenuScene. If BoardGameScene is currently displayed, it gets deactivated and blurred.

Properties

Link copied to clipboard
var background: Visual

Background Visual for the BoardGameApplication.

Link copied to clipboard
var fullscreenExitCombination: KeyEvent?

Specifies the KeyCombination that will allow the user to exit full screen mode. A value of 'null' will not match any KeyEvent and will make it so the user is not able to escape from fullscreen mode.

Link copied to clipboard
var fullscreenExitCombinationHint: String?

Specifies the KeyCombination hint that will be shown upon entering fullscreen mode. Hint will only be shown if an exit combination other than 'null' has been set.

Link copied to clipboard
var icon: ImageVisual?

Window icon displayed in the title and task bar.

Link copied to clipboard
var isFullScreen: Boolean

Sets this BoardGameApplication's fullscreen mode. true for fullscreen mode, false for default window.

Link copied to clipboard
var isMaximized: Boolean

Sets this BoardGameApplication's maximized mode.

Link copied to clipboard
var onWindowClosed: () -> Unit? = null

Gets invoked after the application window was closed.

Link copied to clipboard
var onWindowShown: () -> Unit? = null

Gets invoked when the application was started and the window was shown.

Link copied to clipboard
var title: String

Window title displayed in the title bar.

Link copied to clipboard
var windowHeight: Number

Sets this BoardGameApplication's preferred height. Only affects non-maximized, non-fullscreen windows.

Link copied to clipboard
var windowWidth: Number

Sets this BoardGameApplication's preferred width. Only affects non-maximized, non-fullscreen windows.