Class OpenPatricianApplication
- java.lang.Object
-
- javafx.application.Application
-
- ch.sahits.game.openpatrician.standalone.OpenPatricianApplication
-
- All Implemented Interfaces:
IOpenPatricianApplicationWindow
,SceneChangeable
@SpringBootApplication @Import(StandaloneConfiguration.class) public class OpenPatricianApplication extends javafx.application.Application implements IOpenPatricianApplicationWindow
Spring boot application starting the JavaFX UI.- Author:
- Andi Hotz, (c) Sahits GmbH, 2018 Created on Mar 23, 2018
-
-
Field Summary
Fields Modifier and Type Field Description private org.springframework.context.ApplicationContext
context
private boolean
fullscreen
private GamePropertyUtility
gamePropertyUtility
private int
height
private AggregateEventHandler<javafx.scene.input.KeyEvent>
keyEventHandlerAggregate
private MouseClickLocationEventHandler
mouseClickEventHandler
private javafx.stage.Stage
primaryStage
private StartupService
startupService
private int
width
-
Fields inherited from interface ch.sahits.game.openpatrician.display.IOpenPatricianApplicationWindow
MIN_HEIGHT, MIN_WIDTH
-
-
Constructor Summary
Constructors Constructor Description OpenPatricianApplication()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addKeyEventHandler(javafx.event.EventHandler<javafx.scene.input.KeyEvent> eventHandler)
Add a key event handler to the application.void
changeScene(OpenPatricianScene scene)
Change the scene of the applicationdouble
getSceneHeight()
Retrieve the height of the current scene.double
getSceneWidth()
Retrieve the width of the current scene.void
init()
static void
main(java.lang.String[] args)
private void
setCursor(javafx.scene.Scene scene)
void
start(javafx.stage.Stage primaryStage)
void
stop()
private void
stopUIApplicationContext()
Closing the application context for the user interface.void
updateFullscreenMode()
Toggle between full screen and non full screen mode.
-
-
-
Field Detail
-
startupService
private StartupService startupService
-
gamePropertyUtility
private GamePropertyUtility gamePropertyUtility
-
width
private int width
-
height
private int height
-
fullscreen
private boolean fullscreen
-
primaryStage
private javafx.stage.Stage primaryStage
-
keyEventHandlerAggregate
private final AggregateEventHandler<javafx.scene.input.KeyEvent> keyEventHandlerAggregate
-
mouseClickEventHandler
private final MouseClickLocationEventHandler mouseClickEventHandler
-
context
private org.springframework.context.ApplicationContext context
-
-
Method Detail
-
addKeyEventHandler
private void addKeyEventHandler(javafx.event.EventHandler<javafx.scene.input.KeyEvent> eventHandler)
Add a key event handler to the application.- Parameters:
eventHandler
- to be added.
-
main
public static void main(java.lang.String[] args)
-
init
public void init()
- Overrides:
init
in classjavafx.application.Application
-
start
public void start(javafx.stage.Stage primaryStage)
- Specified by:
start
in classjavafx.application.Application
-
setCursor
private void setCursor(javafx.scene.Scene scene)
-
changeScene
public void changeScene(OpenPatricianScene scene)
Description copied from interface:SceneChangeable
Change the scene of the application- Specified by:
changeScene
in interfaceSceneChangeable
- Parameters:
scene
- new scene to change to.- See Also:
SceneChangeable.changeScene(OpenPatricianScene)
-
updateFullscreenMode
public void updateFullscreenMode()
Toggle between full screen and non full screen mode.
-
getSceneWidth
public double getSceneWidth()
Description copied from interface:SceneChangeable
Retrieve the width of the current scene. This is required to update the width dimension of the new scene. This is due to this bug: https://javafx-jira.kenai.com/browse/RT-30392- Specified by:
getSceneWidth
in interfaceSceneChangeable
- Returns:
- scene width
-
getSceneHeight
public double getSceneHeight()
Description copied from interface:SceneChangeable
Retrieve the height of the current scene. This is required to update the height dimension of the new scene. This is due to this bug: https://javafx-jira.kenai.com/browse/RT-30392- Specified by:
getSceneHeight
in interfaceSceneChangeable
- Returns:
- scene height
-
stop
public void stop() throws java.lang.Exception
- Overrides:
stop
in classjavafx.application.Application
- Throws:
java.lang.Exception
-
stopUIApplicationContext
private void stopUIApplicationContext()
Closing the application context for the user interface.
-
-