-
public class BoardGameApplication
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
BoardGameApplication.Companion
-
Field Summary
Fields Modifier and Type Field Description private String
title
private Number
windowWidth
private Number
windowHeight
private Boolean
isMaximized
private Visual
background
private Function0<Unit>
onWindowShown
private Function0<Unit>
onWindowClosed
-
Constructor Summary
Constructors Constructor Description BoardGameApplication(String windowTitle, Number width, Number height)
Creates the BoardGameApplication with optional title and dimension. BoardGameApplication(String windowTitle, AspectRatio aspectRatio)
Creates the BoardGameApplication with optional title and aspect ratio.
-
Method Summary
Modifier and Type Method Description final String
getTitle()
final Unit
setTitle(String title)
final Number
getWindowWidth()
final Unit
setWindowWidth(Number windowWidth)
final Number
getWindowHeight()
final Unit
setWindowHeight(Number windowHeight)
final Boolean
getIsMaximized()
final Unit
setIsMaximized(Boolean isMaximized)
final Visual
getBackground()
final Unit
setBackground(Visual background)
final Function0<Unit>
getOnWindowShown()
Gets invoked when the application was started and the window was shown. final Unit
setOnWindowShown(Function0<Unit> onWindowShown)
Gets invoked when the application was started and the window was shown. final Function0<Unit>
getOnWindowClosed()
Gets invoked after the application window was closed. final Unit
setOnWindowClosed(Function0<Unit> onWindowClosed)
Gets invoked after the application window was closed. final Optional<ButtonType>
showDialog(Dialog dialog)
Shows a dialog and blocks further thread execution. final Optional<List<File>>
showFileDialog(FileDialog dialog)
Shows the given FileDialog. final Unit
showMenuScene(MenuScene scene, Number fadeTime)
Shows given MenuScene. final Unit
hideMenuScene(Number fadeTime)
Hides currently shown MenuScene. final Unit
showGameScene(BoardGameScene scene)
Shows given BoardGameScene. final Unit
setSceneAlignment(Alignment newAlignment)
Sets Alignment of all Scenes in this BoardGameApplication. final Unit
setHorizontalSceneAlignment(HorizontalAlignment newHorizontalAlignment)
Sets HorizontalAlignment of all Scenes in this BoardGameApplication. final Unit
setVerticalSceneAlignment(VerticalAlignment newVerticalAlignment)
Sets VerticalAlignment of all Scenes in this BoardGameApplication. final Unit
setScaleMode(ScaleMode newScaleMode)
Sets ScaleMode of all Scenes in this BoardGameApplication. final Unit
repaint()
Manually refreshes currently displayed Scenes. final Unit
show()
Shows the BoardGameApplication. final Unit
exit()
Returns the show function, thus closing the application window. -
-
Constructor Detail
-
BoardGameApplication
BoardGameApplication(String windowTitle, Number width, Number height)
Creates the BoardGameApplication with optional title and dimension.- Parameters:
windowTitle
- Title for the application window.width
- Initial window width.height
- Initial window height.
-
BoardGameApplication
BoardGameApplication(String windowTitle, AspectRatio aspectRatio)
Creates the BoardGameApplication with optional title and aspect ratio.- Parameters:
windowTitle
- Title for the application window.aspectRatio
- Initial aspect ratio of application window.
-
-
Method Detail
-
getWindowWidth
final Number getWindowWidth()
-
setWindowWidth
final Unit setWindowWidth(Number windowWidth)
-
getWindowHeight
final Number getWindowHeight()
-
setWindowHeight
final Unit setWindowHeight(Number windowHeight)
-
getIsMaximized
final Boolean getIsMaximized()
-
setIsMaximized
final Unit setIsMaximized(Boolean isMaximized)
-
getBackground
final Visual getBackground()
-
setBackground
final Unit setBackground(Visual background)
-
getOnWindowShown
final Function0<Unit> getOnWindowShown()
Gets invoked when the application was started and the window was shown.
-
setOnWindowShown
final Unit setOnWindowShown(Function0<Unit> onWindowShown)
Gets invoked when the application was started and the window was shown.
-
getOnWindowClosed
final Function0<Unit> getOnWindowClosed()
Gets invoked after the application window was closed.
-
setOnWindowClosed
final Unit setOnWindowClosed(Function0<Unit> onWindowClosed)
Gets invoked after the application window was closed.
-
showDialog
final Optional<ButtonType> showDialog(Dialog dialog)
Shows a dialog and blocks further thread execution.
- Parameters:
dialog
- The Dialog to show
-
showFileDialog
final Optional<List<File>> showFileDialog(FileDialog dialog)
Shows the given FileDialog.
- Parameters:
dialog
- The FileDialog to be shown.
-
showMenuScene
final Unit showMenuScene(MenuScene scene, Number fadeTime)
Shows given MenuScene. If BoardGameScene is currently displayed, it gets deactivated and blurred.
- Parameters:
scene
- MenuScene to show.fadeTime
- Time to fade in, specified in milliseconds.
-
hideMenuScene
final Unit hideMenuScene(Number fadeTime)
Hides currently shown MenuScene. Activates BoardGameScene if present.
- Parameters:
fadeTime
- Time to fade out in milliseconds.
-
showGameScene
final Unit showGameScene(BoardGameScene scene)
Shows given BoardGameScene.
- Parameters:
scene
- BoardGameScene to show.
-
setSceneAlignment
final Unit setSceneAlignment(Alignment newAlignment)
Sets Alignment of all Scenes in this BoardGameApplication.
- Parameters:
newAlignment
- New alignment to set.
-
setHorizontalSceneAlignment
final Unit setHorizontalSceneAlignment(HorizontalAlignment newHorizontalAlignment)
Sets HorizontalAlignment of all Scenes in this BoardGameApplication.
- Parameters:
newHorizontalAlignment
- New alignment to set.
-
setVerticalSceneAlignment
final Unit setVerticalSceneAlignment(VerticalAlignment newVerticalAlignment)
Sets VerticalAlignment of all Scenes in this BoardGameApplication.
- Parameters:
newVerticalAlignment
- New alignment to set.
-
setScaleMode
final Unit setScaleMode(ScaleMode newScaleMode)
Sets ScaleMode of all Scenes in this BoardGameApplication.
- Parameters:
newScaleMode
- New scale mode to set.
-
show
final Unit show()
Shows the BoardGameApplication.
-
-
-
-