BoardGameScene

open class BoardGameScene(    width: Number = DEFAULT_SCENE_WIDTH,     height: Number = DEFAULT_SCENE_HEIGHT,     background: Visual = ColorVisual.WHITE) : Scene<ComponentView>

Baseclass for BGW game scenes.

Extend this class in order to create your own game scene.

Parameters

width

Scene in virtual coordinates. Default: DEFAULT_SCENE_WIDTH.

height

Scene in virtual coordinates. Default: DEFAULT_SCENE_HEIGHT.

background

BoardGameSceneVisual. Default: ColorVisual.WHITE.

Constructors

Link copied to clipboard
fun BoardGameScene(    width: Number = DEFAULT_SCENE_WIDTH,     height: Number = DEFAULT_SCENE_HEIGHT,     background: Visual = ColorVisual.WHITE)

Functions

Link copied to clipboard
fun addComponents(vararg components: ComponentView)

Adds all given ComponentViews to the root node and rootComponents list.

Link copied to clipboard
fun clearComponents()

Removes all ComponentViews from the root node and rootComponents list.

Link copied to clipboard
fun findPathToChild(node: ComponentView): List<ComponentView>

Searches node recursively through the visual tree and logs path where the node appears as first component and the rootNode as last.

Link copied to clipboard
fun lock()

Locks Scene from any user input.

Link copied to clipboard
fun playAnimation(animation: Animation)

Plays given Animation.

Link copied to clipboard
fun removeComponents(vararg components: ComponentView)

Removes all given ComponentViews from the root node and rootComponents list.

Link copied to clipboard
fun unlock()

Unlocks Scene for user input.

Properties

Link copied to clipboard
var background: Visual

The background Visual of this Scene.

Link copied to clipboard
val components: List<ComponentView>

Returns all root components that are currently contained in this Scene.

Link copied to clipboard
val draggedComponent: DynamicComponentView?

Currently dragged ComponentView encapsulated in a DragDataObject or null if no DynamicComponentView is currently dragged.

Link copied to clipboard
val height: Double

The height of this Scene in virtual coordinates.

Link copied to clipboard
val lockedProperty: BooleanProperty

Property that indicates if this BoardGameScene is locked from user input.

Link copied to clipboard
var onKeyPressed: (KeyEvent) -> Unit?

Gets invoked with a KeyEvent whenever a key is pressed.

Link copied to clipboard
var onKeyReleased: (KeyEvent) -> Unit?

Gets invoked with a KeyEvent whenever a key is released.

Link copied to clipboard
var onKeyTyped: (KeyEvent) -> Unit?

Gets invoked with a KeyEvent whenever a Character is typed. Gets invoked after onKeyPressed .

Link copied to clipboard
var onSceneHid: () -> Unit?

Gets invoked with no event whenever a scene is hid.

Link copied to clipboard
var onSceneShown: () -> Unit?

Gets invoked with no event whenever a scene is shown.

Link copied to clipboard
var opacity: Double

Opacity of the background of this Scene.

Link copied to clipboard
val rootNode: RootComponent<ComponentView>

The root node of this Scene.

Link copied to clipboard
val width: Double

The width of this Scene in virtual coordinates.