Class BaseStartupScene
- java.lang.Object
-
- ch.sahits.game.openpatrician.javafx.OpenPatricianScene
-
- ch.sahits.game.openpatrician.display.scene.BaseStartupScene
-
- Direct Known Subclasses:
CreditsScene
,HanseaticHistoryScene
,LoadGameScene
,StartupScene
public abstract class BaseStartupScene extends OpenPatricianScene
Base class for all startup scenes featuring the paper scroll. To get the writing onto the scroll the effectcreatePerspectiveTransform()
must be applied. This effect however does not change the bounds of the involved controls. Therefore the following steps have to be taken:- Define the bounds of the transformed control in polygonDefinition.xml
- Create a Polygon
// Load the polygons for the scene with the name startup from the indicated file List<ch.sahits.game.graphic.data.Polygon> startupPolygons = polygonLoader.getPolygon("/polygonDefinition.xml", "startup"); // Find the polygon with the name polygonName and create an instance Polygon untransformed = polygonLoader.toJavaFXPolygon(polygonLoader.find(startupPolygons, polygonName));
- Add a change listener to the hoverProperty of the Polygon. The change listener updates the appearance of the of the control
- Add a mouse clicked listener to handle click events
- Add all polygons into an unmanaged group and add them to the root element
- Author:
- Andi Hotz, (c) Sahits GmbH, 2013 Created on Aug 10, 2013
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
BaseStartupScene.LabelHoverChangeListener
ChangeListener which changes the style class of the label upon a boolean change.
-
Field Summary
Fields Modifier and Type Field Description private IImageLoader
imsLoader
protected javafx.scene.image.ImageView
paperScroll
private SceneChangeable
sceneChangeable
protected double
untransformedHeight
protected double
untransformedWidth
-
Constructor Summary
Constructors Constructor Description BaseStartupScene(javafx.scene.layout.Region root)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
changeScene(OpenPatricianScene scene)
protected javafx.scene.layout.Pane
createBaseSceneLayout()
Create the base scene layout containing the paper scroll.protected javafx.scene.effect.PerspectiveTransform
createPerspectiveTransform()
Define the perspective transform that will map a rectangle (control) to the paper scroll.SceneChangeable
getSceneChangeable()
protected abstract java.lang.String
getStyleSheetFilename()
Define the stylesheet name to be applied for this scene.void
setSceneChangeable(SceneChangeable sceneChangeable)
-
Methods inherited from class ch.sahits.game.openpatrician.javafx.OpenPatricianScene
heightChange, widthChange
-
-
-
-
Field Detail
-
imsLoader
@Autowired @Qualifier("xmlImageLoader") private IImageLoader imsLoader
-
paperScroll
protected javafx.scene.image.ImageView paperScroll
-
untransformedWidth
protected double untransformedWidth
-
untransformedHeight
protected double untransformedHeight
-
sceneChangeable
private SceneChangeable sceneChangeable
-
-
Method Detail
-
getStyleSheetFilename
protected abstract java.lang.String getStyleSheetFilename()
Define the stylesheet name to be applied for this scene.- Returns:
- file name for the style sheet.
-
createBaseSceneLayout
protected final javafx.scene.layout.Pane createBaseSceneLayout()
Create the base scene layout containing the paper scroll. Add the style sheet defined ingetStyleSheetFilename()
. Initialize dimensions- Returns:
- Root stack pane.
-
createPerspectiveTransform
protected final javafx.scene.effect.PerspectiveTransform createPerspectiveTransform()
Define the perspective transform that will map a rectangle (control) to the paper scroll.- Returns:
- transfrom effect to be applied onto the control
-
getSceneChangeable
public SceneChangeable getSceneChangeable()
-
setSceneChangeable
public void setSceneChangeable(SceneChangeable sceneChangeable)
-
changeScene
public void changeScene(OpenPatricianScene scene)
-
-