Class AbstractFxSpriteFactory<S,B extends AbstractFxSpriteFactory<S,B>>

  • Type Parameters:
    S - the generic type for the player's status.
    B - the generic type of the builder to be returned upon invoking builder methods.
    All Implemented Interfaces:
    FxSpriteFactory<S>, org.refcodes.checkerboard.SpriteFactory<javafx.scene.Node,S,FxCheckerboardViewer<?,S>>, org.refcodes.factory.ContextLookupFactory<IMG,S,CBV>


    public abstract class AbstractFxSpriteFactory<S,B extends AbstractFxSpriteFactory<S,B>>
    extends java.lang.Object
    implements FxSpriteFactory<S>
    A factory for creating JavaFx "sprites".
    • Constructor Detail

      • AbstractFxSpriteFactory

        public AbstractFxSpriteFactory​()
    • Method Detail

      • getScaleFactor

        public double getScaleFactor​()
        Gets the scale factor.
        Returns:
        the scale factor
      • setScaleFactor

        public void setScaleFactor​(double aScaleFactor)
        Sets the scale factor.
        Parameters:
        aScaleFactor - the new scale factor
      • withScaleFactor

        public B withScaleFactor​(double aScaleFactor)
        With scale factor.
        Parameters:
        aScaleFactor - the scale factor
        Returns:
        the nf
      • getOpacity

        public double getOpacity​()
        Gets the opacity.
        Returns:
        the opacity
      • setOpacity

        public void setOpacity​(double aOpacity)
        Sets the opacity.
        Parameters:
        aOpacity - the new opacity
      • withOpacity

        public B withOpacity​(double aOpacity)
        With opacity.
        Parameters:
        aOpacity - the opacity
        Returns:
        the nf
      • getScaleX

        protected static double getScaleX​(javafx.scene.Node aSprite,
                                          FxCheckerboardViewer<?,?> aCheckerboard)
        Gets the scale X.
        Parameters:
        aSprite - the sprite
        aCheckerboard - the checkerboard
        Returns:
        the scale X
      • getScaleY

        protected static double getScaleY​(javafx.scene.Node aSprite,
                                          FxCheckerboardViewer<?,?> aCheckerboard)
        Gets the scale Y.
        Parameters:
        aSprite - the sprite
        aCheckerboard - the checkerboard
        Returns:
        the scale Y
      • toInitNode

        protected <N extends javafx.scene.Node> N toInitNode​(N aSprite,
                                                             FxCheckerboardViewer<?,?> aCheckerboard)
        Inits the sprite.
        Type Parameters:
        N - The type of the sprite to be used.
        Parameters:
        aSprite - the sprite
        aCheckerboard - the checkerboard
        Returns:
        the node
      • toInitNode

        protected <N extends javafx.scene.Node> N toInitNode​(double aScale,
                                                             N aSprite,
                                                             FxCheckerboardViewer<?,?> aCheckerboard)
        Inits the sprite.
        Type Parameters:
        N - The type of the sprite to be used.
        Parameters:
        aSprite - the sprite
        aScale - The scale between 0 and 1.
        aCheckerboard - the checkerboard.
        Returns:
        the node