Class TextCellFactory.Glyph

java.lang.Object
com.badlogic.gdx.scenes.scene2d.Actor
squidpony.squidgrid.gui.gdx.TextCellFactory.Glyph
All Implemented Interfaces:
ICellVisible
Enclosing class:
TextCellFactory

public class TextCellFactory.Glyph
extends com.badlogic.gdx.scenes.scene2d.Actor
implements ICellVisible
A kind of Actor for one char (with one color) that is innately drawn with a specific TextCellFactory, and will match the layout behavior of that TextCellFactory when it is used for other purposes. This is an inner class of TextCellFactory, and can't be constructed without a TextCellFactory being involved; usually you instantiate Glyphs with TextCellFactory.glyph(char, Color, float, float) or an overload of that method on TextCellFactory.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface squidpony.squidgrid.gui.gdx.ICellVisible

    ICellVisible.Basic, ICellVisible.Named
  • Field Summary

    Fields 
    Modifier and Type Field Description
    char shown
    The char that will be shown for this Glyph.
  • Constructor Summary

    Constructors 
    Constructor Description
    Glyph()
    Makes an orange '@' Glyph at 0,0 in world coordinates.
    Glyph​(char shown, float color, float x, float y)
    Makes a Glyph of the given char in the given packed float color, at the specified world coordinates.
    Glyph​(char shown, com.badlogic.gdx.graphics.Color color, float x, float y)
    Makes a Glyph of the given char in the given Color, at the specified world coordinates.
  • Method Summary

    Modifier and Type Method Description
    void draw​(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)
    Draws the actor.
    float getPackedColor()
    Gets the color of this Glyph as a packed float color; does not allocate any objects.
    char getSymbol()  
    void setPackedColor​(float color)
    Sets the color of this Glyph with the given packed float color; does not allocate any objects.
    String toString()  

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor

    act, addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebug, drawDebugBounds, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasKeyboardFocus, hasParent, hasScrollFocus, hit, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setStage, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, sizeChanged, stageToLocalCoordinates, toBack, toFront

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • shown

      public char shown
      The char that will be shown for this Glyph.
  • Constructor Details

    • Glyph

      public Glyph()
      Makes an orange '@' Glyph at 0,0 in world coordinates.
    • Glyph

      public Glyph​(char shown, com.badlogic.gdx.graphics.Color color, float x, float y)
      Makes a Glyph of the given char in the given Color, at the specified world coordinates.
      Parameters:
      shown - the char to show
      color - the Color to use; if null this will instead use SColor.TRANSPARENT
      x - x position in world coordinates
      y - y position in world coordinates
    • Glyph

      public Glyph​(char shown, float color, float x, float y)
      Makes a Glyph of the given char in the given packed float color, at the specified world coordinates.
      Parameters:
      shown - the char to show
      color - the packed float color to use, as produced by Color.toFloatBits()
      x - x position in world coordinates
      y - y position in world coordinates
  • Method Details

    • getSymbol

      public char getSymbol()
      Specified by:
      getSymbol in interface ICellVisible
      Returns:
      a char that can be used to represent this ICellVisible on a grid
    • getPackedColor

      public float getPackedColor()
      Gets the color of this Glyph as a packed float color; does not allocate any objects.
      Specified by:
      getPackedColor in interface ICellVisible
      Returns:
      the color of this Glyph as a packed float
    • setPackedColor

      public void setPackedColor​(float color)
      Sets the color of this Glyph with the given packed float color; does not allocate any objects.
      Parameters:
      color - the color to set this Glyph to, as a packed float
    • toString

      public String toString()
      Overrides:
      toString in class com.badlogic.gdx.scenes.scene2d.Actor
    • draw

      public void draw​(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)
      Draws the actor. The batch is configured to draw in the parent's coordinate system. Batch.begin() must have already been called on the batch before this method.
      Overrides:
      draw in class com.badlogic.gdx.scenes.scene2d.Actor
      Parameters:
      batch - the batch should be between begin() and end(), usually handled by Stage
      parentAlpha - Multiplied with this Glyph's alpha, allowing a parent's alpha to affect all children.