Package squidpony.squidgrid.gui.gdx
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
-
Field Details
-
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
Makes a Glyph of the given char in the given Color, at the specified world coordinates.- Parameters:
shown
- the char to showcolor
- the Color to use; if null this will instead useSColor.TRANSPARENT
x
- x position in world coordinatesy
- y position in world coordinates
-
Glyph
Makes a Glyph of the given char in the given packed float color, at the specified world coordinates.- Parameters:
shown
- the char to showcolor
- the packed float color to use, as produced byColor.toFloatBits()
x
- x position in world coordinatesy
- y position in world coordinates
-
-
Method Details
-
getSymbol
- Specified by:
getSymbol
in interfaceICellVisible
- Returns:
- a char that can be used to represent this ICellVisible on a grid
-
getPackedColor
Gets the color of this Glyph as a packed float color; does not allocate any objects.- Specified by:
getPackedColor
in interfaceICellVisible
- Returns:
- the color of this Glyph as a packed float
-
setPackedColor
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
- Overrides:
toString
in classcom.badlogic.gdx.scenes.scene2d.Actor
-
draw
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 classcom.badlogic.gdx.scenes.scene2d.Actor
- Parameters:
batch
- the batch should be between begin() and end(), usually handled by StageparentAlpha
- Multiplied with this Glyph's alpha, allowing a parent's alpha to affect all children.
-