public class SquidMessageBox extends SparseLayers
Modifier and Type | Field and Description |
---|---|
protected int |
messageIndex |
protected java.util.ArrayList<squidpony.panel.IColoredString<com.badlogic.gdx.graphics.Color>> |
messages |
animationCount, backgrounds, defaultBackground, defaultForeground, defaultPackedBackground, defaultPackedForeground, font, glyphs, gridHeight, gridWidth, layers, mapping, scc
Constructor and Description |
---|
SquidMessageBox(int gridWidth,
int gridHeight)
Creates a bare-bones panel with all default values for text rendering.
|
SquidMessageBox(int gridWidth,
int gridHeight,
int cellWidth,
int cellHeight)
Creates a panel with the given grid and cell size.
|
SquidMessageBox(int gridWidth,
int gridHeight,
TextCellFactory factory)
Builds a panel with the given grid size and all other parameters determined by the factory.
|
SquidMessageBox(int gridWidth,
int gridHeight,
TextCellFactory factory,
squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> center)
Builds a panel with the given grid size and all other parameters determined by the factory.
|
Modifier and Type | Method and Description |
---|---|
void |
appendMessage(squidpony.panel.IColoredString<com.badlogic.gdx.graphics.Color> message)
A common way of using this class.
|
void |
appendMessage(java.lang.String message)
The primary way of using this class.
|
void |
appendWrappingMessage(squidpony.panel.IColoredString<com.badlogic.gdx.graphics.Color> message)
Appends a new line as an IColoredString to the message listing and scrolls to the bottom.
|
void |
appendWrappingMessage(java.lang.String message)
Appends a new line to the message listing and scrolls to the bottom.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
float parentAlpha)
Draws the SparseLayers and all glyphs it tracks.
|
void |
nudgeDown()
Used internally to scroll down by one line, but can also be triggered by your code.
|
void |
nudgeUp()
Used internally to scroll up by one line, but can also be triggered by your code.
|
void |
setBounds(float x,
float y,
float width,
float height)
Set the x, y position of the lower left corner, plus set the width and height.
|
addLayer, addLayer, blend, bump, bump, burst, burst, burst, burst, calculateConsistentLightAmount, calculateConsistentLightModifier, calculateConsistentLightModifier, cellHeight, cellWidth, clear, clear, clear, clear, fillArea, fillArea, fillBackground, fillBackground, findLayer, frontChars, frontChars, getBackgrounds, getColorCenter, getDefaultBackgroundColor, getDefaultForegroundColor, getFont, getGridHeight, getGridWidth, getLayer, getLayerCount, getScc, glyph, glyph, glyphFromGrid, glyphFromGrid, gridHeight, gridWidth, gridX, gridY, hasActiveAnimations, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, putBorders, putBordersCaptioned, putChars, putChars, putChars, putWithConsistentLight, putWithConsistentLight, putWithConsistentLight, putWithConsistentLight, putWithConsistentLight, putWithConsistentLight, putWithConsistentLight, putWithConsistentLight, putWithConsistentLight, putWithLight, putWithLight, putWithLight, putWithLight, putWithLight, putWithLight, putWithLight, putWithLight, putWithLight, putWithLight, putWithLight, putWithLight, putWithReverseConsistentLight, putWithReverseConsistentLight, putWithReverseConsistentLight, putWithReverseConsistentLight, putWithReverseConsistentLight, putWithReverseLight, putWithReverseLight, recallToGrid, recallToGrid, recolor, recolor, recolor, recolor, recolor, recolor, recolor, recolor, removeGlyph, setBackgrounds, setColorCenter, setDefaultBackground, setDefaultForeground, setFont, setLayer, setScc, setTextSize, slide, slide, summon, summon, summon, summon, tint, tint, tint, tint, tint, tint, tint, tint, wiggle, wiggle, worldX, worldY
act, addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, 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, scaleChanged, screenToLocalCoordinates, 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, toString
protected java.util.ArrayList<squidpony.panel.IColoredString<com.badlogic.gdx.graphics.Color>> messages
protected int messageIndex
public SquidMessageBox(int gridWidth, int gridHeight)
gridWidth
- the number of cells horizontallygridHeight
- the number of cells vertically, must be at least 3public SquidMessageBox(int gridWidth, int gridHeight, int cellWidth, int cellHeight)
gridWidth
- the number of cells horizontallygridHeight
- the number of cells verticallycellWidth
- the number of horizontal pixels in each cellcellHeight
- the number of vertical pixels in each cellpublic SquidMessageBox(int gridWidth, int gridHeight, TextCellFactory factory)
gridWidth
- the number of cells horizontallygridHeight
- the number of cells verticallyfactory
- the factory to use for cell renderingpublic SquidMessageBox(int gridWidth, int gridHeight, TextCellFactory factory, squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> center)
gridWidth
- the number of cells horizontallygridHeight
- the number of cells verticallyfactory
- the factory to use for cell renderingcenter
- ignored.public void appendMessage(java.lang.String message)
message
- a String that should be no longer than gridWidth - 2; will be truncated otherwise.public void appendWrappingMessage(java.lang.String message)
message
- a String; this method has no specific length restrictionspublic void appendMessage(squidpony.panel.IColoredString<com.badlogic.gdx.graphics.Color> message)
message
- an IColoredString that should be no longer than gridWidth - 2; will be truncated otherwise.public void appendWrappingMessage(squidpony.panel.IColoredString<com.badlogic.gdx.graphics.Color> message)
message
- an IColoredString with type parameter Color; this method has no specific length restrictionspublic void nudgeUp()
public void nudgeDown()
public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)
SparseLayers
Batch.begin()
must have already been called on the
batch, and Batch.end()
should be called after this returns and before the rendering code finishes for the
frame.
batch
if using a distance field or MSDF font and the shader is currently not
configured for such a font; it does not reset the shader to the default so that multiple Actors can all use the
same shader and so specific extra glyphs or other items can be rendered after calling draw(). If you need to draw
both a distance field font and full-color art, you should set the shader on the Batch to null when you want to
draw full-color art, and end the Batch between drawing this object and the other art.draw
in class SparseLayers
batch
- a Batch such as a FilterBatch
that must be between a begin() and end() call; usually done by StageparentAlpha
- currently ignoredpublic void setBounds(float x, float y, float width, float height)
setBounds
in class com.badlogic.gdx.scenes.scene2d.Actor
x
- x position in pixels or other units that libGDX is set to usey
- y position in pixels or other units that libGDX is set to usewidth
- the width in pixels (usually) of the message box; changes on resizeheight
- the height in pixels (usually) of the message box; changes on resizeCopyright © Eben Howard 2012–2022. All rights reserved.