Class 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 effect createPerspectiveTransform() must be applied. This effect however does not change the bounds of the involved controls. Therefore the following steps have to be taken:
    1. Define the bounds of the transformed control in polygonDefinition.xml
    2. 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));
       
    3. Add a change listener to the hoverProperty of the Polygon. The change listener updates the appearance of the of the control
    4. Add a mouse clicked listener to handle click events
    5. 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
    • Field Detail

      • imsLoader

        @Autowired
        @Qualifier("xmlImageLoader")
        private IImageLoader imsLoader
      • paperScroll

        protected javafx.scene.image.ImageView paperScroll
      • untransformedWidth

        protected double untransformedWidth
      • untransformedHeight

        protected double untransformedHeight
    • Constructor Detail

      • BaseStartupScene

        public BaseStartupScene​(javafx.scene.layout.Region root)
    • 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 in getStyleSheetFilename(). 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
      • setSceneChangeable

        public void setSceneChangeable​(SceneChangeable sceneChangeable)