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 ch.sahits.game.openpatrician.javafx.OpenPatricianSceneBase 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 classBaseStartupScene.LabelHoverChangeListenerChangeListener which changes the style class of the label upon a boolean change.
-
Field Summary
Fields Modifier and Type Field Description protected javafx.scene.image.ImageViewpaperScrollprotected doubleuntransformedHeightprotected doubleuntransformedWidth
-
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 voidchangeScene(ch.sahits.game.openpatrician.javafx.OpenPatricianScene scene)protected javafx.scene.layout.PanecreateBaseSceneLayout()Create the base scene layout containing the paper scroll.protected javafx.scene.effect.PerspectiveTransformcreatePerspectiveTransform()Define the perspective transform that will map a rectangle (control) to the paper scroll.SceneChangeablegetSceneChangeable()protected abstract java.lang.StringgetStyleSheetFilename()Define the stylesheet name to be applied for this scene.voidsetSceneChangeable(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(ch.sahits.game.openpatrician.javafx.OpenPatricianScene scene)
-
-