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

java.lang.Object
org.refcodes.checkerboard.alt.javafx.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<Node,​S,​FxCheckerboardViewer<?,​S>>, org.refcodes.factory.ContextLookupFactory<Node,​S,​FxCheckerboardViewer<?,​S>>

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

    • AbstractFxSpriteFactory

      public AbstractFxSpriteFactory()
  • Method Details

    • 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​(Node aSprite, FxCheckerboardViewer<?,​?> aCheckerboard)
      Gets the scale X.
      Parameters:
      aSprite - the sprite
      aCheckerboard - the checkerboard
      Returns:
      the scale X
    • getScaleY

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

      protected <N extends 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 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