public class SparseLayers extends com.badlogic.gdx.scenes.scene2d.Actor implements IPackedColorPanel
TextCellFactory.Glyph
items that can be added to using glyph(char, Color, int, int)
or one of
several other methods; these Glyphs can have effects performed on them that are analogous to the effects on
SquidPanel
's AnimatedEntity
effects, such as
slide(TextCellFactory.Glyph, int, int, int, int, float, Runnable)
. Unlike SquidPanel and SquidLayers, this
class does not typically provide many overloads for each method, and usually limits the overloads to one that takes
a packed float color and one that takes a libGDX Color
, and all the other parameters are expected to be
specified explicitly rather than relying on default behavior. SparseLayers tends to perform better than SquidLayers,
especially when a lot of the map is unassigned/blank. It will cause less GC pressure when packed floats are used, and
because SColor
constants pre-calculate their packed float values, using the overloads that take a Color will
perform a little better when given an SColor than a plain libGDX Color. This class makes heavy use of
SColor.lerpFloatColors(float, float, float)
because it should cause no GC pressure (it doesn't create
temporary Color objects), and if you don't want to mutate Colors in-place (which is a bad idea for constants), then
using lerpFloatColors with the packed float color API here should be very effective.
TextCellFactory
called font
,
a float[][]
called backgrounds
that stores packed float colors, an ArrayList of
SparseTextMap
that implements the sparse drawing behavior of foreground chars called layers
, and so
on.
Modifier and Type | Field and Description |
---|---|
int |
animationCount
Deprecated.
Use
hasActiveAnimations() instead of adjusting this manually |
float[][] |
backgrounds
A 2D float array of background colors as packed floats.
|
com.badlogic.gdx.graphics.Color |
defaultBackground
The default foreground color when none is specified, as a Color object.
|
com.badlogic.gdx.graphics.Color |
defaultForeground
The default foreground color when none is specified, as a Color object.
|
float |
defaultPackedBackground
The value of
defaultForeground as a float, for easier usage with the methods that use floats for colors. |
float |
defaultPackedForeground
The value of
defaultForeground as a float, for easier usage with the methods that use floats for colors. |
TextCellFactory |
font
The TextCellFactory that is used to determine font size as well as cell size; must be initialized, usually using
TextCellFactory.initBySize() , if this is changed after construction. |
java.util.ArrayList<TextCellFactory.Glyph> |
glyphs
A list of individually-movable Glyph objects.
|
int |
gridHeight |
int |
gridWidth |
java.util.ArrayList<SparseTextMap> |
layers
A list of SparseTextMap objects, with each representing a foreground layer.
|
protected com.badlogic.gdx.utils.IntIntMap |
mapping |
squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> |
scc
An IColorCenter to affect color caching and filtering; usually a SquidColorCenter, which can be easily obtained
via
DefaultResources.getSCC() . |
Modifier | Constructor and Description |
---|---|
protected |
SparseLayers() |
|
SparseLayers(int gridWidth,
int gridHeight) |
|
SparseLayers(int gridWidth,
int gridHeight,
float cellWidth,
float cellHeight) |
|
SparseLayers(int gridWidth,
int gridHeight,
float cellWidth,
float cellHeight,
TextCellFactory font) |
|
SparseLayers(int gridWidth,
int gridHeight,
float cellWidth,
float cellHeight,
TextCellFactory font,
float xOffset,
float yOffset) |
Modifier and Type | Method and Description |
---|---|
SparseTextMap |
addLayer()
Adds a layer as a SparseTextMap to this SparseLayers and returns the one just added.
|
SparseTextMap |
addLayer(int association)
Adds a layer as a SparseTextMap to this SparseLayers and returns the one just added, or returns an existing layer
if one is already associated with the given number.
|
void |
blend(int x,
int y,
float color,
float mixBy)
Using the existing background color at the position x,y, this performs color blending from that existing color to
the given color (as a float), using the mixBy parameter to determine how much of the color parameter to use (1f
will set the color in this to the parameter, while 0f for mixBy will ignore the color parameter entirely).
|
void |
bump(float delay,
TextCellFactory.Glyph glyph,
squidpony.squidgrid.Direction direction,
float duration,
java.lang.Runnable postRunnable)
Start a bumping animation in the given direction after delay seconds, that will last duration seconds; runs
postRunnable after the duration completes if postRunnable is non-null.
|
void |
bump(TextCellFactory.Glyph glyph,
squidpony.squidgrid.Direction direction,
float duration)
Start a bumping animation in the given direction that will last duration seconds.
|
void |
burst(float delay,
int x,
int y,
int distance,
squidpony.squidgrid.Radius measurement,
char shown,
float startColor,
float endColor,
float duration,
java.lang.Runnable postRunnable)
Convenience method to produce an explosion, splash, or burst effect.
|
void |
burst(float delay,
int x,
int y,
int distance,
squidpony.squidgrid.Radius measurement,
java.lang.CharSequence choices,
float startColor,
float endColor,
float duration,
java.lang.Runnable postRunnable)
Convenience method to produce an explosion, splash, or burst effect.
|
void |
burst(int x,
int y,
int distance,
squidpony.squidgrid.Radius measurement,
char shown,
float startColor,
float endColor,
float duration)
Convenience method to produce an explosion, splash, or burst effect.
|
void |
burst(int x,
int y,
int distance,
squidpony.squidgrid.Radius measurement,
java.lang.CharSequence choices,
float startColor,
float endColor,
float duration)
Convenience method to produce an explosion, splash, or burst effect.
|
float |
calculateConsistentLightAmount(float lightAmount,
float modifier)
Allows you to reproduce the effects of
putWithConsistentLight(int, int, char, float, float, float, double, float)
without recalculating the modifier many times per frame. |
float |
calculateConsistentLightModifier()
Gets a modifier that should be given to
calculateConsistentLightAmount(float, float) ; this only needs to
be called at most once per frame. |
float |
calculateConsistentLightModifier(float flickerSpeed)
Gets a modifier that should be given to
calculateConsistentLightAmount(float, float) ; this only needs to
be called at most once per frame. |
int |
cellHeight() |
int |
cellWidth() |
void |
clear()
Removes all background colors, setting them to transparent, and all foreground chars in all layers.
|
void |
clear(int layer)
Removes all foreground chars in the requested layer; does not affect the background or other layers.
|
void |
clear(int x,
int y)
Removes the foreground chars, where present, in all layers at the given x,y position.
|
void |
clear(int x,
int y,
int layer)
Removes the foreground char, if present, in the given layer at the given x,y position.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
float parentAlpha)
Draws the SparseLayers and all glyphs it tracks.
|
void |
fillArea(com.badlogic.gdx.graphics.Color color,
int x,
int y,
int width,
int height)
Changes the background color in an area to all have the given color, as a libGDX Color (or SColor, etc.).
|
void |
fillArea(float color,
int x,
int y,
int width,
int height)
Changes the background color in an area to all have the given color, as a packed float.
|
void |
fillBackground(com.badlogic.gdx.graphics.Color color)
Fills all of the background with the given color as libGDX Color object.
|
void |
fillBackground(float color)
Fills all of the background with the given color as a packed float.
|
int |
findLayer(SparseTextMap layerMap)
Finds the layer number associated with layerMap, or -1 if the given SparseTextMap is not in this SparseLayers.
|
char[][] |
frontChars()
Gets the "front-most" chars visible in this SparseLayers and returns them as a char[][].
|
char[][] |
frontChars(char[][] buffer)
Gets the "front-most" chars visible in this SparseLayers and stores them in the given char[][]
buffer . |
float[][] |
getBackgrounds()
Gets a direct reference to the 2D float array this uses for background colors.
|
squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> |
getColorCenter()
Gets the IColorCenter this can use to filter Color objects; this is usually a
SquidColorCenter . |
com.badlogic.gdx.graphics.Color |
getDefaultBackgroundColor() |
com.badlogic.gdx.graphics.Color |
getDefaultForegroundColor() |
TextCellFactory |
getFont()
Gets a direct reference to the TextCellFactory this uses to draw and size its text items and cells.
|
int |
getGridHeight()
The same as
gridHeight() ; here for compatibility with SquidPanel. |
int |
getGridWidth()
The same as
gridWidth() ; here for compatibility with SquidPanel. |
SparseTextMap |
getLayer(int layer)
Gets the layer, as a SparseTextMap, that is associated with the given int.
|
int |
getLayerCount()
Gets the number of layers currently used in this SparseLayers; if a layer is put into that is equal to or greater
than this layer count, then a new layer is created to hold the latest placement.
|
squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> |
getScc()
Gets the IColorCenter for Color objects (almost always a SquidColorCenter, but this isn't guaranteed) that this
uses to cache and possibly alter Colors that given to it as parameters.
|
TextCellFactory.Glyph |
glyph(char shown,
com.badlogic.gdx.graphics.Color color,
int x,
int y)
Produces a single char with a color, that can be positioned independently of the contents of this SparseLayers.
|
TextCellFactory.Glyph |
glyph(char shown,
float color,
int x,
int y)
Produces a single char with a color, that can be positioned independently of the contents of this SparseLayers.
|
TextCellFactory.Glyph |
glyphFromGrid(int x,
int y)
"Promotes" a colorful char in the first layer to a Glyph that can be positioned independently of the contents of
this SparseLayers.
|
TextCellFactory.Glyph |
glyphFromGrid(int x,
int y,
int layer)
"Promotes" a colorful char in the given layer to a Glyph that can be positioned independently of the contents of
this SparseLayers.
|
int |
gridHeight() |
int |
gridWidth() |
int |
gridX(float worldX)
Used internally to go between world positions and grid positions.
|
int |
gridY(float worldY)
Used internally to go between world positions and grid positions.
|
boolean |
hasActiveAnimations()
Gets whether any animations or other scene2d Actions are running on this SparseLayers.
|
void |
put(char[][] chars,
com.badlogic.gdx.graphics.Color[][] colors)
Places the given char 2D array, if-non-null, in the default foreground color starting at x=0, y=0, while also
setting the background colors to match the given Color 2D array.
|
void |
put(char[][] chars,
com.badlogic.gdx.graphics.Color[][] fgColors,
com.badlogic.gdx.graphics.Color[][] bgColors)
Places the given char 2D array, if-non-null, with the given foreground colors in the first Color 2D array,
starting at x=0, y=0, while also setting the background colors to match the second Color 2D array.
|
void |
put(char[][] chars,
float[][] colors)
Places the given char 2D array, if-non-null, in the default foreground color starting at x=0, y=0, while also
setting the background colors to match the given 2D array of colors as packed floats.
|
void |
put(char[][] chars,
float[][] fgColors,
float[][] bgColors)
Places the given char 2D array, if-non-null, with the given foreground colors in the first float 2D array,
starting at x=0, y=0, while also setting the background colors to match the second float 2D array.
|
void |
put(com.badlogic.gdx.graphics.Color[][] colors)
Sets the background colors to match the given Color 2D array.
|
void |
put(float[][] colors)
Sets the background colors to match the given 2D array of colors as packed floats.
|
void |
put(int x,
int y,
char c)
Puts the character
c at (x, y) with the default foreground. |
void |
put(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color color)
Puts the character
c at (x, y) with some color . |
void |
put(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color foreground,
com.badlogic.gdx.graphics.Color background)
Puts the char c at the position x,y with the given foreground and background colors.
|
void |
put(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color foreground,
com.badlogic.gdx.graphics.Color background,
int layer)
Puts the char c at the position x,y in the requested layer with the given foreground and background colors.
|
void |
put(int x,
int y,
char c,
float foreground)
Puts the char c at the position x,y with the given foreground color as an encoded float (the kind produced by
Color.toFloatBits() ). |
void |
put(int x,
int y,
char c,
float foreground,
float background)
Puts the char c at the position x,y with the given foreground and background colors as encoded floats, such as
those produced by
Color.toFloatBits() . |
void |
put(int x,
int y,
char c,
float foreground,
float background,
int layer)
Puts the char c at the position x,y in the requested layer with the given foreground and background colors as
encoded floats, such as those produced by
Color.toFloatBits() . |
void |
put(int x,
int y,
com.badlogic.gdx.graphics.Color color)
Changes the background at position x,y to the given Color.
|
void |
put(int x,
int y,
float color)
Changes the background at position x,y to the given color as an encoded float.
|
void |
put(int x,
int y,
ICellVisible cell)
Puts the ICellVisible cell at the position x,y; does not change the background.
|
void |
put(int x,
int y,
ICellVisible cell,
float background)
Puts the ICellVisible cell at the position x,y with the given background color as an encoded float, such as
those produced by
Color.toFloatBits() . |
void |
put(int xOffset,
int yOffset,
squidpony.panel.IColoredString<? extends com.badlogic.gdx.graphics.Color> cs)
Puts the given string horizontally with the first character at the given
offset, using the colors that
cs provides. |
void |
put(int xOffset,
int yOffset,
java.lang.String string,
com.badlogic.gdx.graphics.Color foreground)
Puts the given string horizontally with the first character at the given
offset.
|
void |
put(int x,
int y,
java.lang.String text,
com.badlogic.gdx.graphics.Color foreground,
com.badlogic.gdx.graphics.Color background)
Puts text at the position x,y with the given foreground and background colors.
|
void |
put(int x,
int y,
java.lang.String text,
com.badlogic.gdx.graphics.Color foreground,
com.badlogic.gdx.graphics.Color background,
int layer)
Puts text at the position x,y in the requested layer with the given foreground and background colors.
|
void |
put(int x,
int y,
java.lang.String text,
float foreground,
float background)
Puts text at the position x,y with the given foreground and background colors as encoded floats, such as
those produced by
Color.toFloatBits() . |
void |
put(int x,
int y,
java.lang.String text,
float foreground,
float background,
int layer)
Puts text at the position x,y in the requested layer with the given foreground and background colors as encoded
floats, such as those produced by
Color.toFloatBits() . |
void |
putBorders(float color,
java.lang.String caption) |
void |
putBordersCaptioned(float color,
squidpony.panel.IColoredString<com.badlogic.gdx.graphics.Color> caption) |
void |
putChars(char[][] chars)
Places the given char 2D array, if-non-null, in the default foreground color starting at x=0, y=0.
|
void |
putChars(char[][] chars,
com.badlogic.gdx.graphics.Color[][] foregrounds)
Places the given char 2D array, if-non-null, in the foreground starting at x=0, y=0.
|
void |
putChars(char[][] chars,
float[][] foregrounds)
Places the given char 2D array, if-non-null, in the foreground starting at x=0, y=0.
|
void |
putWithConsistentLight(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color foreground,
com.badlogic.gdx.graphics.Color background,
com.badlogic.gdx.graphics.Color lightColor,
float lightAmount)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithConsistentLight(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color foreground,
com.badlogic.gdx.graphics.Color background,
com.badlogic.gdx.graphics.Color lightColor,
float lightAmount,
float flickerSpeed)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithConsistentLight(int x,
int y,
char c,
float foreground,
float background,
float lightColor,
double lightAmount)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithConsistentLight(int x,
int y,
char c,
float foreground,
float background,
float lightColor,
double lightAmount,
float flickerSpeed)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithConsistentLight(int x,
int y,
char c,
float foreground,
float background,
float lightColor,
float lightAmount)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithConsistentLight(int x,
int y,
com.badlogic.gdx.graphics.Color background,
com.badlogic.gdx.graphics.Color lightColor,
float lightAmount)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithConsistentLight(int x,
int y,
com.badlogic.gdx.graphics.Color background,
com.badlogic.gdx.graphics.Color lightColor,
float lightAmount,
float flickerSpeed)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithConsistentLight(int x,
int y,
float background,
float lightColor,
float lightAmount)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithConsistentLight(int x,
int y,
float background,
float lightColor,
float lightAmount,
float flickerSpeed)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithLight(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color foreground,
com.badlogic.gdx.graphics.Color background,
com.badlogic.gdx.graphics.Color lightColor,
double lightAmount)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, while also putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithLight(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color foreground,
com.badlogic.gdx.graphics.Color background,
com.badlogic.gdx.graphics.Color lightColor,
float lightAmount)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, while also putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithLight(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color foreground,
com.badlogic.gdx.graphics.Color background,
com.badlogic.gdx.graphics.Color lightColor,
float lightAmount,
squidpony.squidmath.Noise.Noise3D flicker)
A convenience method that handles blending the background color with a specified light color, by a specific
amount that will be adjusted by the given
Noise.Noise3D object, while also putting a char on the screen;
as a whole this affects one x,y position and will change what it puts as the time (in milliseconds) changes. |
void |
putWithLight(int x,
int y,
char c,
float foreground,
float background,
float lightColor,
double lightAmount)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, while also putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithLight(int x,
int y,
char c,
float foreground,
float background,
float lightColor,
float lightAmount)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, while also putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithLight(int x,
int y,
char c,
float foreground,
float background,
float lightColor,
float lightAmount,
squidpony.squidmath.Noise.Noise3D flicker)
A convenience method that handles blending the background color with a specified light color, by a specific
amount that will be adjusted by the given
Noise.Noise3D object, while also putting a char on the screen;
as a whole this affects one x,y position and will change what it puts as the time (in milliseconds) changes. |
void |
putWithLight(int x,
int y,
com.badlogic.gdx.graphics.Color background,
com.badlogic.gdx.graphics.Color lightColor,
double lightAmount)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithLight(int x,
int y,
com.badlogic.gdx.graphics.Color background,
com.badlogic.gdx.graphics.Color lightColor,
float lightAmount)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithLight(int x,
int y,
com.badlogic.gdx.graphics.Color background,
com.badlogic.gdx.graphics.Color lightColor,
float lightAmount,
squidpony.squidmath.Noise.Noise3D flicker)
A convenience method that handles blending the background color with a specified light color, by a specific
amount that will be adjusted by the given
Noise.Noise3D object, without putting a char on the screen;
as a whole this affects one x,y position and will change what it puts as the time (in milliseconds) changes. |
void |
putWithLight(int x,
int y,
float background,
float lightColor,
double lightAmount)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithLight(int x,
int y,
float background,
float lightColor,
float lightAmount)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithLight(int x,
int y,
float background,
float lightColor,
float lightAmount,
squidpony.squidmath.Noise.Noise3D flicker)
A convenience method that handles blending the background color with a specified light color, by a specific
amount that will be adjusted by the given
Noise.Noise3D object, without putting a char on the screen;
as a whole this affects one x,y position and will change what it puts as the time (in milliseconds) changes. |
void |
putWithReverseConsistentLight(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color foreground,
com.badlogic.gdx.graphics.Color background,
com.badlogic.gdx.graphics.Color lightColor,
double lightAmount,
float flickerSpeed)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithReverseConsistentLight(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color foreground,
com.badlogic.gdx.graphics.Color background,
com.badlogic.gdx.graphics.Color lightColor,
float lightAmount)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithReverseConsistentLight(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color foreground,
com.badlogic.gdx.graphics.Color background,
com.badlogic.gdx.graphics.Color lightColor,
float lightAmount,
float flickerSpeed)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithReverseConsistentLight(int x,
int y,
char c,
float foreground,
float background,
float lightColor,
float lightAmount)
A convenience method that handles blending the foreground color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position and placed the background
as-is.
|
void |
putWithReverseConsistentLight(int x,
int y,
char c,
float foreground,
float background,
float lightColor,
float lightAmount,
float flickerSpeed)
A convenience method that handles blending the foreground color with a specified light color, by a specific
amount, without putting a char on the screen; as a whole this affects one x,y position and placed the background
as-is.
|
void |
putWithReverseLight(int x,
int y,
char c,
float foreground,
float background,
float lightColor,
double lightAmount)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, while also putting a char on the screen; as a whole this affects one x,y position.
|
void |
putWithReverseLight(int x,
int y,
char c,
float foreground,
float background,
float lightColor,
float lightAmount)
A convenience method that handles blending the background color with a specified light color, by a specific
amount, while also putting a char on the screen; as a whole this affects one x,y position.
|
void |
recallToGrid(TextCellFactory.Glyph glyph)
Brings a Glyph back into normal rendering, removing it from the Glyphs this class knows about and filling the
grid's char at the Glyph's position in the first layer with the Glyph's char and color.
|
void |
recallToGrid(TextCellFactory.Glyph glyph,
int layer)
Brings a Glyph back into normal rendering, removing it from the Glyphs this class knows about and filling the
grid's char at the Glyph's position in the given layer with the Glyph's char and color.
|
void |
recolor(float delay,
int x,
int y,
float encodedColor,
float duration)
Changes the background at position x,y so it becomes the given encodedColor, waiting for
delay (in
seconds) before performing it, taking duration seconds. |
void |
recolor(float delay,
int x,
int y,
float encodedColor,
float duration,
java.lang.Runnable postRunnable)
Changes the background at position x,y so it becomes the given encodedColor, waiting for
delay (in
seconds) before performing it, taking duration seconds. |
void |
recolor(float delay,
int x,
int y,
int layer,
float encodedColor,
float duration)
Changes the foreground in the given layer at position x,y so it becomes the given encodedColor, waiting for
delay (in seconds) before performing it, taking duration seconds. |
void |
recolor(float delay,
int x,
int y,
int layer,
float encodedColor,
float duration,
java.lang.Runnable postRunnable)
Changes the foreground in the given layer at position x,y so it becomes the given encodedColor, waiting for
delay (in seconds) before performing it, taking duration seconds. |
void |
recolor(int x,
int y,
com.badlogic.gdx.graphics.Color color,
float duration)
Changes the background at position x,y so it becomes the given color, taking duration seconds.
|
void |
recolor(int x,
int y,
float encodedColor,
float duration)
Changes the background at position x,y so it becomes the given encodedColor, taking duration seconds.
|
void |
recolor(int x,
int y,
int layer,
com.badlogic.gdx.graphics.Color color,
float duration)
Changes the foreground in the given layer at position x,y so it becomes the given color, taking duration
seconds.
|
void |
recolor(int x,
int y,
int layer,
float encodedColor,
float duration)
Changes the foreground in the given layer at position x,y so it becomes the given encodedColor, taking duration
seconds.
|
void |
removeGlyph(TextCellFactory.Glyph glyph)
A way to remove a Glyph from the group of glyphs this renders, while also ending any animations or other Actions
that the removed Glyph was scheduled to perform.
|
void |
setBackgrounds(float[][] backgrounds)
Changes the reference this uses for the float array for background colors; this will not accept null parameters,
nor will it accept any 2D array with dimensions that do not match the (unchanging) gridWidth and gridHeight of
this SparseLayers.
|
protected void |
setColorCenter(squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> icc)
Method to change the backing
IColorCenter . |
void |
setDefaultBackground(com.badlogic.gdx.graphics.Color color)
Sets the default background color.
|
void |
setDefaultForeground(com.badlogic.gdx.graphics.Color color)
Sets the default foreground color.
|
void |
setFont(TextCellFactory font)
Sets the TextCellFactory this uses to draw and size its text items and cells.
|
void |
setLayer(int layerNumber,
SparseTextMap contents)
Sets the SparseTextMap associated with the given layerNumber to the given contents.
|
void |
setScc(squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> scc)
Sets the IColorCenter for Color objects that this uses to cache and modify Colors given to it; does not accept
null parameters.
|
SparseLayers |
setTextSize(float wide,
float high)
Changes the width and height of chars the font renders, inside the same cell size.
|
void |
slide(float delay,
TextCellFactory.Glyph glyph,
int startX,
int startY,
int newX,
int newY,
float duration,
java.lang.Runnable postRunnable)
Slides
glyph from (xstartX,startY) to (newx, newy) after waiting delay seconds. |
void |
slide(TextCellFactory.Glyph glyph,
int startX,
int startY,
int newX,
int newY,
float duration,
java.lang.Runnable postRunnable)
Slides
glyph from (xstartX,startY) to (newx, newy) . |
void |
summon(float startX,
float startY,
float endX,
float endY,
char shown,
float startColor,
float endColor,
float duration)
Create a new Glyph at (startX, startY) in world coordinates (often pixels on the screen) using the char shown
with the given startColor, and immediately starts changing color to endColor, changing position so it ends at the
world coordinates (endX, endY), taking duration seconds to complete before removing the Glyph.
|
void |
summon(float delay,
float startX,
float startY,
float endX,
float endY,
char shown,
float startColor,
float endColor,
float duration,
java.lang.Runnable postRunnable)
Create a new Glyph at (startX, startY) in world coordinates (often pixels on the screen) using the char shown
with the given startColor, and after delay seconds, starts changing color to endColor, changing position so it
ends at the world coordinates (endX, endY), taking duration seconds to complete before running postRunnable (if
it is non-null) and finally removing the Glyph.
|
void |
summon(float delay,
int startX,
int startY,
int endX,
int endY,
char shown,
float startColor,
float endColor,
float duration,
java.lang.Runnable postRunnable)
Create a new Glyph at (startX, startY) using the char shown with the given startColor, and after delay seconds,
starts changing color to endColor, changing position so it ends on the cell (endX, endY), taking duration seconds
to complete before running postRunnable (if it is non-null) and finally removing the Glyph.
|
void |
summon(int startX,
int startY,
int endX,
int endY,
char shown,
float startColor,
float endColor,
float duration)
Create a new Glyph at (startX, startY) using the char shown with the given startColor, and immediately starts
changing color to endColor, changing position so it ends on the cell (endX, endY), taking duration seconds to
complete before removing the Glyph.
|
void |
tint(float delay,
int x,
int y,
float encodedColor,
float duration,
java.lang.Runnable postRunnable)
Tints the background at position x,y so it becomes the given encodedColor, waiting for
delay (in seconds)
before performing it, then after the tint is complete it returns the cell to its original color, taking duration
seconds. |
void |
tint(float delay,
int x,
int y,
int layer,
float encodedColor,
float duration,
java.lang.Runnable postRunnable)
Tints the foreground in the given layer at position x,y so it becomes the given encodedColor, waiting for
delay (in seconds) before performing it, then after the tint is complete it returns the cell to its
original color, taking duration seconds. |
void |
tint(float delay,
TextCellFactory.Glyph glyph,
float encodedColor,
float duration,
java.lang.Runnable postRunnable)
Tints the given glyph (which may or may not be part of the
glyphs list this holds) so it becomes the
given encodedColor, waiting for delay (in seconds) before performing it, then after the tint is complete
it returns the cell to its original color, taking duration seconds. |
void |
tint(int x,
int y,
com.badlogic.gdx.graphics.Color color,
float duration)
Tints the background at position x,y so it becomes the given encodedColor, then after the tint is complete it
returns the cell to its original color, taking duration seconds.
|
void |
tint(int x,
int y,
float encodedColor,
float duration)
Tints the background at position x,y so it becomes the given encodedColor, then after the tint is complete it
returns the cell to its original color, taking duration seconds.
|
void |
tint(int x,
int y,
int layer,
com.badlogic.gdx.graphics.Color color,
float duration)
Tints the foreground in the given layer at position x,y so it becomes the given encodedColor, then after the tint
is complete it returns the cell to its original color, taking duration seconds.
|
void |
tint(int x,
int y,
int layer,
float encodedColor,
float duration)
Tints the foreground in the given layer at position x,y so it becomes the given encodedColor, then after the tint
is complete it returns the cell to its original color, taking duration seconds.
|
void |
tint(TextCellFactory.Glyph glyph,
float encodedColor,
float duration)
Tints the given glyph (which may or may not be part of the
glyphs list this holds) so it becomes the
given encodedColor, then after the tint is complete it returns the cell to its original color, taking duration
seconds. |
void |
wiggle(float delay,
TextCellFactory.Glyph glyph,
float duration,
java.lang.Runnable postRunnable)
Starts a wiggling animation for the object at the given location, after waiting delay seconds, for the given
duration in seconds; runs postRunnable afterwards if it is non-null.
|
void |
wiggle(TextCellFactory.Glyph glyph,
float duration)
Starts an wiggling animation for the object at the given location for the given duration in seconds.
|
float |
worldX(int gridX)
Used internally to go between grid positions and world positions.
|
float |
worldY(int gridY)
Used internally to go between grid positions and world positions.
|
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, 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, toString
public int gridWidth
public int gridHeight
public float[][] backgrounds
gridWidth
and
gridHeight
, and must be non-null with non-null interior arrays, but can otherwise be assigned 2D float
arrays from other sources (that use floats to represent colors, not just any number).public com.badlogic.gdx.graphics.Color defaultForeground
public com.badlogic.gdx.graphics.Color defaultBackground
public float defaultPackedForeground
defaultForeground
as a float, for easier usage with the methods that use floats for colors.
Defaults to white.public float defaultPackedBackground
defaultForeground
as a float, for easier usage with the methods that use floats for colors.
Defaults to white.public java.util.ArrayList<SparseTextMap> layers
protected com.badlogic.gdx.utils.IntIntMap mapping
public TextCellFactory font
TextCellFactory.initBySize()
, if this is changed after construction.public int animationCount
hasActiveAnimations()
instead of adjusting this manuallyhasActiveAnimations()
to track animations instead.
The approach of tracking animations via a counter was prone to error when multiple effects might remove a Glyph
or adjust the animationCount in one direction but not the other. This could result in never-ending phases of a
game where input wasn't handled because animationCount was greater than 0, but whatever effect was supposed to
reduce animationCount would never happen.public java.util.ArrayList<TextCellFactory.Glyph> glyphs
public squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> scc
DefaultResources.getSCC()
.protected SparseLayers()
public SparseLayers(int gridWidth, int gridHeight)
public SparseLayers(int gridWidth, int gridHeight, float cellWidth, float cellHeight)
public SparseLayers(int gridWidth, int gridHeight, float cellWidth, float cellHeight, TextCellFactory font)
public SparseLayers(int gridWidth, int gridHeight, float cellWidth, float cellHeight, TextCellFactory font, float xOffset, float yOffset)
public int getLayerCount()
public SparseTextMap getLayer(int layer)
layer
- the int that is associated with a layer, usually the int used to add to that layer.public void setLayer(int layerNumber, SparseTextMap contents)
layerNumber
- must be 0 or greatercontents
- a SparseTextMap, possibly obtained with getLayer(int)
public int findLayer(SparseTextMap layerMap)
layerMap
- a SparseTextMap that was likely returned by addLayer()
public SparseTextMap addLayer()
findLayer(SparseTextMap)
on the returned SparseTextMap to get its association number.public SparseTextMap addLayer(int association)
getLayerCount()
, which will maintain the order and layer numbers in a sane way, and this is the behavior
of the addLayer overload that does not take a parameter.association
- the number to associate the layer with; should usually be between 0 and getLayerCount()
inclusivepublic void put(int x, int y, char c)
c
at (x, y)
with the default foreground. Does not change the background.put
in interface IPackedColorPanel
x
- the x position to place the char aty
- the y position to place the char atc
- the char to place, using the default foreground colorpublic void put(int x, int y, ICellVisible cell)
cell.getPackedColor()
is 0f, then this does not change the foreground contents either. Does not filter the given colors.x
- the x position to place the char aty
- the y position to place the char atcell
- an ICellVisible, which is often implemented outside of SquidLib; this uses its char and color.public void put(int xOffset, int yOffset, java.lang.String string, com.badlogic.gdx.graphics.Color foreground)
Does not word wrap. Characters that are not renderable (due to being at negative offsets or offsets greater than the grid size) will not be shown but will not cause any malfunctions.
put
in interface IPackedColorPanel
xOffset
- the x coordinate of the first characteryOffset
- the y coordinate of the first characterstring
- the characters to be displayedforeground
- the color to use for the textpublic void put(int xOffset, int yOffset, squidpony.panel.IColoredString<? extends com.badlogic.gdx.graphics.Color> cs)
cs
provides. Does not change the
background colors. Does filter the colors from cs if the color center this
uses is set up to filter colors.
Does not word wrap. Characters that are not renderable (due to being at negative offsets or offsets greater than the grid size) will not be shown but will not cause any malfunctions.
put
in interface IPackedColorPanel
xOffset
- the x coordinate of the first characteryOffset
- the y coordinate of the first charactercs
- an IColoredString
with potentially multiple colorspublic void put(int x, int y, char c, com.badlogic.gdx.graphics.Color color)
c
at (x, y)
with some color
.
Does not change the background colors.put
in interface IPackedColorPanel
x
- the x position to place the char aty
- the y position to place the char atc
- the char to placecolor
- the color to use for c; if null or fully transparent, nothing will change in the foregroundpublic void put(com.badlogic.gdx.graphics.Color[][] colors)
colors
- the background colors for the given charspublic void put(float[][] colors)
colors
- the background colors to use for this SparseLayerspublic void putChars(char[][] chars)
chars
- a 2D char array to place without affecting background colors; these chars will use the default foreground colorpublic void putChars(char[][] chars, float[][] foregrounds)
chars
- a 2D char array to place without affecting background colorsforegrounds
- a 2D float array of encoded colors as produced by Color.toFloatBits()
; applies to char foregroundspublic void putChars(char[][] chars, com.badlogic.gdx.graphics.Color[][] foregrounds)
chars
- a 2D char array to place without affecting background colorsforegrounds
- a 2D array of libGDX colors (any may also be an SColor or other subclass); applies to char foregroundspublic void put(char[][] chars, com.badlogic.gdx.graphics.Color[][] colors)
put
in interface IPackedColorPanel
chars
- Can be null
, indicating that only colors must be put.colors
- the background colors for the given charspublic void put(char[][] chars, float[][] colors)
chars
- Can be null
, indicating that only colors must be put.colors
- the background colors for the given charspublic void put(char[][] chars, com.badlogic.gdx.graphics.Color[][] fgColors, com.badlogic.gdx.graphics.Color[][] bgColors)
chars
- Can be null
, indicating that only colors must be put.fgColors
- the foreground Colors for the given charsbgColors
- the background Colors for the given charspublic void put(char[][] chars, float[][] fgColors, float[][] bgColors)
chars
- Can be null
, indicating that only colors must be put.fgColors
- the foreground colors for the given chars, as packed floatsbgColors
- the background colors for the given chars, as packed floatspublic int gridWidth()
gridWidth
in interface IPackedColorPanel
public int gridHeight()
gridHeight
in interface IPackedColorPanel
public int getGridWidth()
gridWidth()
; here for compatibility with SquidPanel.public int getGridHeight()
gridHeight()
; here for compatibility with SquidPanel.public int cellWidth()
cellWidth
in interface IPackedColorPanel
public int cellHeight()
cellHeight
in interface IPackedColorPanel
public SparseLayers setTextSize(float wide, float high)
wide
- width in approximate pixelshigh
- height in approximate pixelspublic void setDefaultForeground(com.badlogic.gdx.graphics.Color color)
setDefaultForeground
in interface IPackedColorPanel
color
- a libGDX Color object or an extension of Color, such as SColorpublic com.badlogic.gdx.graphics.Color getDefaultForegroundColor()
getDefaultForegroundColor
in interface IPackedColorPanel
setDefaultForeground(Color)
), or the last color set with
setDefaultForeground(Color)
. This Color can be null which
will usually not be rendered unless a different color is specified.public void setDefaultBackground(com.badlogic.gdx.graphics.Color color)
color
- a libGDX Color object or an extension of Color, such as SColorpublic com.badlogic.gdx.graphics.Color getDefaultBackgroundColor()
setDefaultBackground(Color)
), or the last color set
with setDefaultBackground(Color)
. This can be null,
which will usually not be rendered unless a different color
is specified.protected void setColorCenter(squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> icc)
IColorCenter
.
Note that the IColorCenter is not used to filter floats that encode colors, so passing the result of
Color.toFloatBits()
can be used to bypass the filtering if you want a color to be used exactly.icc
- an IColorCenter that can cache and possibly filter Color
objectspublic squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> getColorCenter()
SquidColorCenter
.
Note that the IColorCenter is not used to filter floats that encode colors, so passing the result of
Color.toFloatBits()
can be used to bypass the filtering if you want a color to be used exactly.public void put(int x, int y, char c, com.badlogic.gdx.graphics.Color foreground, com.badlogic.gdx.graphics.Color background)
setColorCenter(IColorCenter)
.x
- the x position to place the char aty
- the y position to place the char atc
- the char to placeforeground
- the color to use for c; if null or fully transparent, nothing will change in the foregroundbackground
- the color to use for the cell; if null or fully transparent, nothing will change in the backgroundpublic void put(int x, int y, ICellVisible cell, float background)
Color.toFloatBits()
. If cell.getPackedColor()
is 0f, then this does not
change the foreground contents. If background is 0f, this does not change the background. Does not filter the
given colors.x
- the x position to place the char aty
- the y position to place the char atcell
- an ICellVisible, which is often implemented outside of SquidLib; this uses its char and color.background
- the color to use for the cell; if null or fully transparent, nothing will change in the backgroundpublic void put(int x, int y, char c, float foreground, float background)
Color.toFloatBits()
. If foreground is 0f, then this does not
change the foreground contents. If background is 0f, this does not change the background. Does not filter the
given colors.x
- the x position to place the char aty
- the y position to place the char atc
- the char to placeforeground
- the color to use for c; if 0f, nothing will change in the foregroundbackground
- the color to use for the cell; if null or fully transparent, nothing will change in the backgroundpublic void put(int x, int y, char c, float foreground)
Color.toFloatBits()
). If foreground is 0f, then this does nothing. Does not filter the given color.put
in interface IPackedColorPanel
x
- the x position to place the char aty
- the y position to place the char atc
- the char to placeforeground
- the color to use for c; if 0f, this call does nothingpublic void put(int x, int y, char c, com.badlogic.gdx.graphics.Color foreground, com.badlogic.gdx.graphics.Color background, int layer)
setColorCenter(IColorCenter)
. The layer can be greater than the number of layers currently present,
which will add a layer to be rendered over the existing layers, but the number that refers to that layer will not
change. It is recommended that to add a layer, you only add at the value equal to getLayerCount()
, which
will maintain the order and layer numbers in a sane way.x
- the x position to place the char aty
- the y position to place the char atc
- the char to placeforeground
- the color to use for c; if null or fully transparent, nothing will change in the foregroundbackground
- the color to use for the cell; if null or fully transparent, nothing will change in the backgroundlayer
- the layer to place the colorful char into; should usually be between 0 and getLayerCount()
inclusivepublic void put(int x, int y, char c, float foreground, float background, int layer)
Color.toFloatBits()
. If foreground is 0f, then this does not
change the foreground contents. If background is 0f, this does not change the
background. Does not filter the given colors. The layer can be greater than the number of layers currently
present, which will add a layer to be rendered over the existing layers, but the number that refers to that layer
will not change. It is recommended that to add a layer, you only add at the value equal to
getLayerCount()
, which will maintain the order and layer numbers in a sane way.x
- the x position to place the char aty
- the y position to place the char atc
- the char to placeforeground
- the color to use for c; if 0f, nothing will change in the foregroundbackground
- the color to use for the cell; if null or fully transparent, nothing will change in the backgroundlayer
- the layer to place the colorful char into; should usually be between 0 and getLayerCount()
inclusivepublic void put(int x, int y, java.lang.String text, com.badlogic.gdx.graphics.Color foreground, com.badlogic.gdx.graphics.Color background)
setColorCenter(IColorCenter)
.x
- the x position to place the String aty
- the y position to place the String attext
- the String to placeforeground
- the color to use for text; if null or fully transparent, nothing will change in the foregroundbackground
- the color to use for the cells; if null or fully transparent, nothing will change in the backgroundpublic void put(int x, int y, java.lang.String text, float foreground, float background)
Color.toFloatBits()
. If foreground is 0f, then this does not change the foreground
contents. If background is 0f, this does not change the background. Does not filter the given colors.x
- the x position to place the String aty
- the y position to place the String attext
- the String to placeforeground
- the color to use for text; if 0f, nothing will change in the foregroundbackground
- the color to use for the cells; if null or fully transparent, nothing will change in the backgroundpublic void put(int x, int y, java.lang.String text, com.badlogic.gdx.graphics.Color foreground, com.badlogic.gdx.graphics.Color background, int layer)
setColorCenter(IColorCenter)
. The layer
can be greater than the number of layers currently present, which will add a layer to be rendered over the
existing layers, but the number that refers to that layer will not change. It is recommended that to add a layer,
you only add at the value equal to getLayerCount()
, which will maintain the order and layer numbers in a
sane way.x
- the x position to place the String aty
- the y position to place the String attext
- the String to placeforeground
- the color to use for text; if null or fully transparent, nothing will change in the foregroundbackground
- the color to use for the cells; if null or fully transparent, nothing will change in the backgroundlayer
- the layer to place the colorful char into; should usually be between 0 and getLayerCount()
inclusivepublic void put(int x, int y, java.lang.String text, float foreground, float background, int layer)
Color.toFloatBits()
. If foreground is 0f, then this does not change the
foreground contents. If background is 0f, this does not change the background. Does not filter the given colors.
The layer can be greater than the number of layers currently present, which will add a layer to be rendered over
the existing layers, but the number that refers to that layer will not change. It is recommended that to add a
layer, you only add at the value equal to getLayerCount()
, which will maintain the order and layer
numbers in a sane way.x
- the x position to place the String aty
- the y position to place the String attext
- the String to placeforeground
- the color to use for text; if 0f, nothing will change in the foregroundbackground
- the color to use for the cells; if null or fully transparent, nothing will change in the backgroundlayer
- the layer to place the colorful char into; should usually be between 0 and getLayerCount()
inclusivepublic void put(int x, int y, com.badlogic.gdx.graphics.Color color)
put
in interface IPackedColorPanel
x
- where to change the background color, x-coordinatey
- where to change the background color, y-coordinatecolor
- the Color to change to; if null will be considered fully transparentpublic void put(int x, int y, float color)
put
in interface IPackedColorPanel
x
- where to change the background color, x-coordinatey
- where to change the background color, y-coordinatecolor
- the color, as an encoded float, to change to; may be transparent, and considers 0f a valid colorpublic void putWithLight(int x, int y, com.badlogic.gdx.graphics.Color background, com.badlogic.gdx.graphics.Color lightColor, float lightAmount)
x
- the x position, in cellsy
- the y position, in cellsbackground
- the "base" color to use for the background, which will be combined with lightColor, as a libGDX ColorlightColor
- the color to mix with the background, as a libGDX ColorlightAmount
- a float that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background morepublic void putWithLight(int x, int y, com.badlogic.gdx.graphics.Color background, com.badlogic.gdx.graphics.Color lightColor, double lightAmount)
x
- the x position, in cellsy
- the y position, in cellsbackground
- the "base" color to use for the background, which will be combined with lightColor, as a libGDX ColorlightColor
- the color to mix with the background, as a libGDX ColorlightAmount
- a double that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background morepublic void putWithLight(int x, int y, char c, com.badlogic.gdx.graphics.Color foreground, com.badlogic.gdx.graphics.Color background, com.badlogic.gdx.graphics.Color lightColor, float lightAmount)
x
- the x position, in cellsy
- the y position, in cellsc
- the char to put in the foregroundforeground
- the color to use for the foreground, as a libGDX Color; if null, this won't place a foreground charbackground
- the "base" color to use for the background, which will be combined with lightColor, as a libGDX ColorlightColor
- the color to mix with the background, as a libGDX ColorlightAmount
- a float that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background morepublic void putWithLight(int x, int y, char c, com.badlogic.gdx.graphics.Color foreground, com.badlogic.gdx.graphics.Color background, com.badlogic.gdx.graphics.Color lightColor, double lightAmount)
x
- the x position, in cellsy
- the y position, in cellsc
- the char to put in the foregroundforeground
- the color to use for the foreground, as a libGDX Color; if null, this won't place a foreground charbackground
- the "base" color to use for the background, which will be combined with lightColor, as a libGDX ColorlightColor
- the color to mix with the background, as a libGDX ColorlightAmount
- a double that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background morepublic void putWithConsistentLight(int x, int y, float background, float lightColor, float lightAmount)
putWithLight(int, int, float, float, float, Noise.Noise3D)
, which would light "splotches" of map with
brighter or darker color. Instead, if lightAmount is obtained via SquidLib's FOV
class, then all cells
at a short distance from an FOV center will be lit brightly and cells far away will flicker in and out of view.x
- the x position, in cellsy
- the y position, in cellsbackground
- the "base" color to use for the background, which will be combined with lightColor, as a packed float colorlightColor
- the color to mix with the background, as a packed float colorlightAmount
- a float that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background morepublic void putWithConsistentLight(int x, int y, float background, float lightColor, float lightAmount, float flickerSpeed)
putWithLight(int, int, float, float, float, Noise.Noise3D)
, which would light "splotches" of map with
brighter or darker color. Instead, if lightAmount is obtained via SquidLib's FOV
class, then all cells
at a short distance from an FOV center will be lit brightly and cells far away will flicker in and out of view.x
- the x position, in cellsy
- the y position, in cellsbackground
- the "base" color to use for the background, which will be combined with lightColor, as a packed float colorlightColor
- the color to mix with the background, as a packed float colorlightAmount
- a float that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background moreflickerSpeed
- a small float multiplier applied to the time in milliseconds; often between 0.0005f and 0.005fpublic float calculateConsistentLightModifier()
calculateConsistentLightAmount(float, float)
; this only needs to
be called at most once per frame. It uses a flickerSpeed of 0.0015f, if you want to compare it to
calculateConsistentLightModifier(float)
.calculateConsistentLightAmount(float, float)
public float calculateConsistentLightModifier(float flickerSpeed)
calculateConsistentLightAmount(float, float)
; this only needs to
be called at most once per frame. It uses the given flickerSpeed; a common example value is 0.0015f.calculateConsistentLightAmount(float, float)
public float calculateConsistentLightAmount(float lightAmount, float modifier)
putWithConsistentLight(int, int, char, float, float, float, double, float)
without recalculating the modifier many times per frame. You should typically calculate the modifier once per
frame using calculateConsistentLightModifier()
. This method should usually be called once per cell that
needs consistent lighting that flickers the same in all directions.lightAmount
- typically from FOV or some other way of generating a float with lower values further from a position (such as a light)modifier
- calculated previously by calculateConsistentLightModifier()
, which should be done per-frameputWithConsistentLight(int, int, char, float, float, float, double, float)
public void putWithConsistentLight(int x, int y, com.badlogic.gdx.graphics.Color background, com.badlogic.gdx.graphics.Color lightColor, float lightAmount)
putWithLight(int, int, float, float, float, Noise.Noise3D)
, which would light "splotches" of map with
brighter or darker color. Instead, if lightAmount is obtained via SquidLib's FOV
class, then all cells
at a short distance from an FOV center will be lit brightly and cells far away will flicker in and out of view.x
- the x position, in cellsy
- the y position, in cellsbackground
- the "base" color to use for the background, which will be combined with lightColor, as a libGDX ColorlightColor
- the color to mix with the background, as a libGDX ColorlightAmount
- a float that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background morepublic void putWithConsistentLight(int x, int y, com.badlogic.gdx.graphics.Color background, com.badlogic.gdx.graphics.Color lightColor, float lightAmount, float flickerSpeed)
putWithLight(int, int, float, float, float, Noise.Noise3D)
, which would light "splotches" of map with
brighter or darker color. Instead, if lightAmount is obtained via SquidLib's FOV
class, then all cells
at a short distance from an FOV center will be lit brightly and cells far away will flicker in and out of view.x
- the x position, in cellsy
- the y position, in cellsbackground
- the "base" color to use for the background, which will be combined with lightColor, as a libGDX ColorlightColor
- the color to mix with the background, as a libGDX ColorlightAmount
- a float that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background moreflickerSpeed
- a small float multiplier applied to the time in milliseconds; often between 0.0005f and 0.005fpublic void putWithConsistentLight(int x, int y, char c, float foreground, float background, float lightColor, float lightAmount)
putWithLight(int, int, float, float, float, Noise.Noise3D)
, which would light "splotches" of map with
brighter or darker color. Instead, if lightAmount is obtained via SquidLib's FOV
class, then all cells
at a short distance from an FOV center will be lit brightly and cells far away will flicker in and out of view.x
- the x position, in cellsy
- the y position, in cellsc
- the char to draw; may be '\0'
to draw a solid blockbackground
- the "base" color to use for the background, which will be combined with lightColor, as a packed float colorlightColor
- the color to mix with the background, as a packed float colorlightAmount
- a float that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background morepublic void putWithConsistentLight(int x, int y, char c, float foreground, float background, float lightColor, double lightAmount)
putWithLight(int, int, float, float, float, Noise.Noise3D)
, which would light "splotches" of map with
brighter or darker color. Instead, if lightAmount is obtained via SquidLib's FOV
class, then all cells
at a short distance from an FOV center will be lit brightly and cells far away will flicker in and out of view.x
- the x position, in cellsy
- the y position, in cellsc
- the char to draw; may be '\0'
to draw a solid blockbackground
- the "base" color to use for the background, which will be combined with lightColor, as a packed float colorlightColor
- the color to mix with the background, as a packed float colorlightAmount
- a double that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background morepublic void putWithConsistentLight(int x, int y, char c, float foreground, float background, float lightColor, double lightAmount, float flickerSpeed)
putWithLight(int, int, float, float, float, Noise.Noise3D)
, which would light "splotches" of map with
brighter or darker color. Instead, if lightAmount is obtained via SquidLib's FOV
class, then all cells
at a short distance from an FOV center will be lit brightly and cells far away will flicker in and out of view.x
- the x position, in cellsy
- the y position, in cellsc
- the char to draw; may be '\0'
to draw a solid blockforeground
- the color to use for the foreground, as a packed float; if 0f, this won't place a foreground charbackground
- the "base" color to use for the background, which will be combined with lightColor, as a packed float colorlightColor
- the color to mix with the background, as a packed float colorlightAmount
- a float that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background moreflickerSpeed
- a small float multiplier applied to the time in milliseconds; often between 0.0005f and 0.005fpublic void putWithReverseConsistentLight(int x, int y, char c, float foreground, float background, float lightColor, float lightAmount)
putWithLight(int, int, float, float, float, Noise.Noise3D)
, which would
light "splotches" of map with brighter or darker color. Instead, if lightAmount is obtained via SquidLib's
FOV
class, then all cells at a short distance from an FOV center will be lit brightly and cells far away
will flicker in and out of view.x
- the x position, in cellsy
- the y position, in cellsc
- the char to draw; may be '\0'
to draw a solid blockforeground
- the "base" color to use for the foreground, which will be combined with lightColor, as a packed float colorbackground
- the "base" color to use for the background, which will used without modification, as a packed float colorlightColor
- the color to mix with the foreground, as a packed float colorlightAmount
- a float that determines how much lightColor should affect foreground by; not strictly limited
to between 0 and 1, and negative values can be given to favor foreground morepublic void putWithReverseConsistentLight(int x, int y, char c, float foreground, float background, float lightColor, float lightAmount, float flickerSpeed)
putWithLight(int, int, float, float, float, Noise.Noise3D)
, which would
light "splotches" of map with brighter or darker color. Instead, if lightAmount is obtained via SquidLib's
FOV
class, then all cells at a short distance from an FOV center will be lit brightly and cells far away
will flicker in and out of view.x
- the x position, in cellsy
- the y position, in cellsc
- the char to draw; may be '\0'
to draw a solid blockforeground
- the "base" color to use for the foreground, which will be combined with lightColor, as a packed float colorbackground
- the "base" color to use for the background, which will used without modification, as a packed float colorlightColor
- the color to mix with the foreground, as a packed float colorlightAmount
- a float that determines how much lightColor should affect foreground by; not strictly limited
to between 0 and 1, and negative values can be given to favor foreground moreflickerSpeed
- a small float multiplier applied to the time in milliseconds; often between 0.0005f and 0.005fpublic void putWithConsistentLight(int x, int y, char c, com.badlogic.gdx.graphics.Color foreground, com.badlogic.gdx.graphics.Color background, com.badlogic.gdx.graphics.Color lightColor, float lightAmount)
putWithLight(int, int, float, float, float, Noise.Noise3D)
, which would light "splotches" of map with
brighter or darker color. Instead, if lightAmount is obtained via SquidLib's FOV
class, then all cells
at a short distance from an FOV center will be lit brightly and cells far away will flicker in and out of view.x
- the x position, in cellsy
- the y position, in cellsc
- the char to draw; may be '\0'
to draw a solid blockforeground
- the "base" color to use for the foreground, which will be combined with lightColor, as a libGDX Colorbackground
- the "base" color to use for the background, which will used without modificationlightColor
- the color to mix with the background, as a libGDX ColorlightAmount
- a float that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background morepublic void putWithConsistentLight(int x, int y, char c, com.badlogic.gdx.graphics.Color foreground, com.badlogic.gdx.graphics.Color background, com.badlogic.gdx.graphics.Color lightColor, float lightAmount, float flickerSpeed)
putWithLight(int, int, float, float, float, Noise.Noise3D)
, which would light "splotches" of map with
brighter or darker color. Instead, if lightAmount is obtained via SquidLib's FOV
class, then all cells
at a short distance from an FOV center will be lit brightly and cells far away will flicker in and out of view.x
- the x position, in cellsy
- the y position, in cellsc
- the char to draw; may be '\0'
to draw a solid blockforeground
- the "base" color to use for the foreground, which will used without modificationbackground
- the "base" color to use for the background, which will be combined with lightColor, as a libGDX ColorlightColor
- the color to mix with the background, as a libGDX ColorlightAmount
- a float that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background moreflickerSpeed
- a small float multiplier applied to the time in milliseconds; often between 0.0005f and 0.005fpublic void putWithReverseConsistentLight(int x, int y, char c, com.badlogic.gdx.graphics.Color foreground, com.badlogic.gdx.graphics.Color background, com.badlogic.gdx.graphics.Color lightColor, float lightAmount)
putWithLight(int, int, float, float, float, Noise.Noise3D)
, which would light "splotches" of map with
brighter or darker color. Instead, if lightAmount is obtained via SquidLib's FOV
class, then all cells
at a short distance from an FOV center will be lit brightly and cells far away will flicker in and out of view.
putWithReverseConsistentLight(int, int, char, Color, Color, Color, float, float)
with 0.0015f as the last parameter.x
- the x position, in cellsy
- the y position, in cellsc
- the char to draw; may be '\0'
to draw a solid blockforeground
- the "base" color to use for the foreground, which will be combined with lightColor, as a libGDX Colorbackground
- the "base" color to use for the background, which will used without modificationlightColor
- the color to mix with the foreground, as a libGDX ColorlightAmount
- a float that determines how much lightColor should affect foreground by; not strictly limited
to between 0 and 1, and negative values can be given to favor foreground morepublic void putWithReverseConsistentLight(int x, int y, char c, com.badlogic.gdx.graphics.Color foreground, com.badlogic.gdx.graphics.Color background, com.badlogic.gdx.graphics.Color lightColor, float lightAmount, float flickerSpeed)
putWithLight(int, int, float, float, float, Noise.Noise3D)
, which would light "splotches" of map with
brighter or darker color. Instead, if lightAmount is obtained via SquidLib's FOV
class, then all cells
at a short distance from an FOV center will be lit brightly and cells far away will flicker in and out of view.x
- the x position, in cellsy
- the y position, in cellsc
- the char to draw; may be '\0'
to draw a solid blockforeground
- the "base" color to use for the foreground, which will be combined with lightColor, as a libGDX Colorbackground
- the "base" color to use for the background, which will used without modificationlightColor
- the color to mix with the foreground, as a libGDX ColorlightAmount
- a float that determines how much lightColor should affect foreground by; not strictly limited
to between 0 and 1, and negative values can be given to favor foreground moreflickerSpeed
- a small float multiplier applied to the time in milliseconds; often between 0.0005f and 0.005fpublic void putWithReverseConsistentLight(int x, int y, char c, com.badlogic.gdx.graphics.Color foreground, com.badlogic.gdx.graphics.Color background, com.badlogic.gdx.graphics.Color lightColor, double lightAmount, float flickerSpeed)
putWithLight(int, int, float, float, float, Noise.Noise3D)
, which would light "splotches" of map with
brighter or darker color. Instead, if lightAmount is obtained via SquidLib's FOV
class, then all cells
at a short distance from an FOV center will be lit brightly and cells far away will flicker in and out of view.x
- the x position, in cellsy
- the y position, in cellsc
- the char to draw; may be '\0'
to draw a solid blockforeground
- the "base" color to use for the foreground, which will be combined with lightColor, as a libGDX Colorbackground
- the "base" color to use for the background, which will used without modificationlightColor
- the color to mix with the foreground, as a libGDX ColorlightAmount
- a double that determines how much lightColor should affect foreground by; not strictly limited
to between 0 and 1, and negative values can be given to favor foreground moreflickerSpeed
- a small float multiplier applied to the time in milliseconds; often between 0.0005f and 0.005fpublic void putWithLight(int x, int y, float background, float lightColor, float lightAmount)
x
- the x position, in cellsy
- the y position, in cellsbackground
- the "base" color to use for the background, which will be combined with lightColor, as a packed floatlightColor
- the color to mix with the background, as a packed floatlightAmount
- a float that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background morepublic void putWithLight(int x, int y, float background, float lightColor, double lightAmount)
x
- the x position, in cellsy
- the y position, in cellsbackground
- the "base" color to use for the background, which will be combined with lightColor, as a packed floatlightColor
- the color to mix with the background, as a packed floatlightAmount
- a double that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background morepublic void putWithLight(int x, int y, char c, float foreground, float background, float lightColor, float lightAmount)
x
- the x position, in cellsy
- the y position, in cellsc
- the char to put in the foregroundforeground
- the color to use for the foreground, as a packed float; if 0f, this won't place a foreground charbackground
- the "base" color to use for the background, which will be combined with lightColor, as a packed floatlightColor
- the color to mix with the background, as a packed floatlightAmount
- a float that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background morepublic void putWithLight(int x, int y, char c, float foreground, float background, float lightColor, double lightAmount)
x
- the x position, in cellsy
- the y position, in cellsc
- the char to put in the foregroundforeground
- the color to use for the foreground, as a packed float; if 0f, this won't place a foreground charbackground
- the "base" color to use for the background, which will be combined with lightColor, as a packed floatlightColor
- the color to mix with the background, as a packed floatlightAmount
- a double that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background morepublic void putWithReverseLight(int x, int y, char c, float foreground, float background, float lightColor, float lightAmount)
x
- the x position, in cellsy
- the y position, in cellsc
- the char to put in the foregroundforeground
- the color to use for the foreground, as a packed float; if 0f, this won't place a foreground charbackground
- the "base" color to use for the background, which will be combined with lightColor, as a packed floatlightColor
- the color to mix with the background, as a packed floatlightAmount
- a float that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background morepublic void putWithReverseLight(int x, int y, char c, float foreground, float background, float lightColor, double lightAmount)
x
- the x position, in cellsy
- the y position, in cellsc
- the char to put in the foregroundforeground
- the color to use for the foreground, as a packed float; if 0f, this won't place a foreground charbackground
- the "base" color to use for the background, which will be combined with lightColor, as a packed floatlightColor
- the color to mix with the background, as a packed floatlightAmount
- a double that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background morepublic void putWithLight(int x, int y, com.badlogic.gdx.graphics.Color background, com.badlogic.gdx.graphics.Color lightColor, float lightAmount, squidpony.squidmath.Noise.Noise3D flicker)
Noise.Noise3D
object, without putting a char on the screen;
as a whole this affects one x,y position and will change what it puts as the time (in milliseconds) changes. If
flicker
is null, this will default to using WhirlingNoise
. You can make the lighting dimmer by
using a darker color for lightColor
or by giving a lower value for lightAmount
.x
- the x position, in cellsy
- the y position, in cellsbackground
- the "base" color to use for the background, which will be combined with lightColor, as a libGDX ColorlightColor
- the color to mix with the background, as a libGDX ColorlightAmount
- a float that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background moreflicker
- a Noise.Noise3D instance, such as WhirlingNoise.instance
; may be null to use WhirlingNoisepublic void putWithLight(int x, int y, char c, com.badlogic.gdx.graphics.Color foreground, com.badlogic.gdx.graphics.Color background, com.badlogic.gdx.graphics.Color lightColor, float lightAmount, squidpony.squidmath.Noise.Noise3D flicker)
Noise.Noise3D
object, while also putting a char on the screen;
as a whole this affects one x,y position and will change what it puts as the time (in milliseconds) changes. If
flicker
is null, this will default to using WhirlingNoise
. You can make the lighting dimmer by
using a darker color for lightColor
or by giving a lower value for lightAmount
.x
- the x position, in cellsy
- the y position, in cellsc
- the char to put in the foregroundforeground
- the color to use for the foreground, as a libGDX Color; if null, this won't place a foreground charbackground
- the "base" color to use for the background, which will be combined with lightColor, as a libGDX ColorlightColor
- the color to mix with the background, as a libGDX ColorlightAmount
- a float that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background moreflicker
- a Noise.Noise3D instance, such as WhirlingNoise.instance
; may be null to use WhirlingNoisepublic void putWithLight(int x, int y, float background, float lightColor, float lightAmount, squidpony.squidmath.Noise.Noise3D flicker)
Noise.Noise3D
object, without putting a char on the screen;
as a whole this affects one x,y position and will change what it puts as the time (in milliseconds) changes. If
flicker
is null, this will default to using WhirlingNoise
. You can make the lighting dimmer by
using a darker color for lightColor
or by giving a lower value for lightAmount
.x
- the x position, in cellsy
- the y position, in cellsbackground
- the "base" color to use for the background, which will be combined with lightColor, as a packed float colorlightColor
- the color to mix with the background, as a packed float colorlightAmount
- a float that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background moreflicker
- a Noise.Noise3D instance, such as WhirlingNoise.instance
; may be null to use WhirlingNoisepublic void putWithLight(int x, int y, char c, float foreground, float background, float lightColor, float lightAmount, squidpony.squidmath.Noise.Noise3D flicker)
Noise.Noise3D
object, while also putting a char on the screen;
as a whole this affects one x,y position and will change what it puts as the time (in milliseconds) changes. If
flicker
is null, this will default to using WhirlingNoise
. You can make the lighting dimmer by
using a darker color for lightColor
or by giving a lower value for lightAmount
.x
- the x position, in cellsy
- the y position, in cellsc
- the char to put in the foregroundforeground
- the color to use for the foreground, as a packed float; if 0f, this won't place a foreground charbackground
- the "base" color to use for the background, which will be combined with lightColor, as a packed float colorlightColor
- the color to mix with the background, as a packed float colorlightAmount
- a float that determines how much lightColor should affect background by; not strictly limited
to between 0 and 1, and negative values can be given to favor background moreflicker
- a Noise.Noise3D instance, such as WhirlingNoise.instance
; may be null to use WhirlingNoisepublic void putBorders(float color, java.lang.String caption)
public void putBordersCaptioned(float color, squidpony.panel.IColoredString<com.badlogic.gdx.graphics.Color> caption)
color
- the color to draw the borders with; does not affect caption's color(s)caption
- an IColoredStringpublic void clear(int x, int y)
clear
in interface IPackedColorPanel
x
- the x-coordinate of the position to remove all chars fromy
- the y-coordinate of the position to remove all chars frompublic void clear(int x, int y, int layer)
x
- the x-coordinate of the position to remove all chars fromy
- the y-coordinate of the position to remove all chars fromlayer
- the layer to remove frompublic void clear()
clear
in class com.badlogic.gdx.scenes.scene2d.Actor
public void clear(int layer)
public void fillBackground(com.badlogic.gdx.graphics.Color color)
color
- the color to use for all of the background, as a libGDX Color or some subclass like SColorpublic void fillBackground(float color)
color
- the color to use for all of the background, as a packed floatpublic void fillArea(com.badlogic.gdx.graphics.Color color, int x, int y, int width, int height)
color
- a libGDX Color to fill the area with; may be null to make the background transparentx
- left edge's x coordinate, in cellsy
- top edge's y coordinate, in cellswidth
- the width of the area to change the color onheight
- the height of the area to change the color onpublic void fillArea(float color, int x, int y, int width, int height)
color
- a color as a packed float to fill the area with; may be 0f to make the background transparentx
- left edge's x coordinate, in cellsy
- top edge's y coordinate, in cellswidth
- the width of the area to change the color onheight
- the height of the area to change the color onpublic boolean hasActiveAnimations()
hasActiveAnimations
in interface IPackedColorPanel
public float[][] getBackgrounds()
public void setBackgrounds(float[][] backgrounds)
backgrounds
- a non-null 2D float array of colors; must have width == gridWidth and height == gridHeightpublic TextCellFactory getFont()
public void setFont(TextCellFactory font)
font
- a non-null TextCellFactory; if uninitialized, this will initialize it using cellWidth and cellHeight.public squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> getScc()
public void setScc(squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> scc)
scc
- a non-null IColorCenter of Color that this will use to cache and modify Colors given to itpublic float worldX(int gridX)
gridX
- x on the gridpublic float worldY(int gridY)
gridY
- y on the gridpublic int gridX(float worldX)
worldX
- x in the worldpublic int gridY(float worldY)
worldY
- y in the worldpublic void blend(int x, int y, float color, float mixBy)
blend
in interface IPackedColorPanel
x
- the x component of the position in this panel to draw the starting color fromy
- the y component of the position in this panel to draw the starting color fromcolor
- the new color to mix with the starting color; a packed float, as made by Color.toFloatBits()
mixBy
- the amount by which the new color will affect the old one, between 0 (no effect) and 1 (overwrite)public TextCellFactory.Glyph glyph(char shown, com.badlogic.gdx.graphics.Color color, int x, int y)
shown
- the char to use in the Glyphcolor
- the color to use for the Glyph, which can be filteredx
- the x position, in grid cellsy
- the y position, in grid cellspublic TextCellFactory.Glyph glyph(char shown, float color, int x, int y)
shown
- the char to use in the Glyphcolor
- the color to use for the Glyph as an encoded floatx
- the x position, in grid cellsy
- the y position, in grid cellspublic TextCellFactory.Glyph glyphFromGrid(int x, int y)
x
- the x position, in grid cellsy
- the y position, in grid cellspublic TextCellFactory.Glyph glyphFromGrid(int x, int y, int layer)
x
- the x position, in grid cellsy
- the y position, in grid cellslayer
- the layer to take a colorful char frompublic void recallToGrid(TextCellFactory.Glyph glyph)
glyph
- the Glyph to remove and fit back into the gridpublic void recallToGrid(TextCellFactory.Glyph glyph, int layer)
glyph
- the Glyph to remove and fit back into the gridpublic void removeGlyph(TextCellFactory.Glyph glyph)
glyph
- a Glyph that should be removed from the glyphs
List this holdspublic void bump(TextCellFactory.Glyph glyph, squidpony.squidgrid.Direction direction, float duration)
glyph
- A TextCellFactory.Glyph
, probably produced by
glyph(char, float, int, int)
or glyphFromGrid(int, int)
direction
- the direction for the glyph to bump towardsduration
- a float, measured in seconds, for how long the animation should last; commonly 0.12fpublic void bump(float delay, TextCellFactory.Glyph glyph, squidpony.squidgrid.Direction direction, float duration, java.lang.Runnable postRunnable)
delay
- how long to wait in seconds before starting the effectglyph
- A TextCellFactory.Glyph
, which should be produced by a SparseLayers method like
glyph(char, float, int, int)
or glyphFromGrid(int, int)
direction
- the direction for the glyph to bump towardsduration
- a float, measured in seconds, for how long the animation should last; commonly 0.12fpostRunnable
- a Runnable to execute after the bump completes; may be null to do nothing.public void slide(TextCellFactory.Glyph glyph, int startX, int startY, int newX, int newY, float duration, java.lang.Runnable postRunnable)
glyph
from (xstartX,startY)
to (newx, newy)
.
Takes a number of seconds equal to duration to complete. This also allows
a Runnable to be given as postRunnable
to be run after the
slide completes, or null to not run anything after the slide.glyph
- A TextCellFactory.Glyph
, probably produced by
glyph(char, float, int, int)
or glyphFromGrid(int, int)
startX
- Where to start the slide, horizontally.startY
- Where to start the slide, vertically.newX
- Where to end the slide, horizontally.newY
- Where to end the slide, vertically.duration
- The animation's duration.postRunnable
- a Runnable to execute after the slide completes; may be null to do nothing.public void slide(float delay, TextCellFactory.Glyph glyph, int startX, int startY, int newX, int newY, float duration, java.lang.Runnable postRunnable)
glyph
from (xstartX,startY)
to (newx, newy)
after waiting delay
seconds.
Takes a number of seconds equal to duration to complete (starting after the delay). This also allows
a Runnable to be given as postRunnable
to be run after the
slide completes, or null to not run anything after the slide.delay
- how long to wait in seconds before starting the effectglyph
- A TextCellFactory.Glyph
, probably produced by
glyph(char, float, int, int)
or glyphFromGrid(int, int)
startX
- Where to start the slide, horizontally.startY
- Where to start the slide, vertically.newX
- Where to end the slide, horizontally.newY
- Where to end the slide, vertically.duration
- The animation's duration.postRunnable
- a Runnable to execute after the slide completes; may be null to do nothing.public void wiggle(TextCellFactory.Glyph glyph, float duration)
glyph
- A TextCellFactory.Glyph
, probably produced by
glyph(char, float, int, int)
or glyphFromGrid(int, int)
duration
- in seconds, as a floatpublic void wiggle(float delay, TextCellFactory.Glyph glyph, float duration, java.lang.Runnable postRunnable)
delay
- how long to wait in seconds before starting the effectglyph
- A TextCellFactory.Glyph
, probably produced by
glyph(char, float, int, int)
or glyphFromGrid(int, int)
duration
- in seconds, as a floatpostRunnable
- a Runnable to execute after the wiggle completes; may be null to do nothing.public void tint(int x, int y, com.badlogic.gdx.graphics.Color color, float duration)
Stage.act()
before you call Stage.draw()
, but after
any changes to the contents of this SparseLayers. If you change the contents, then draw, and then act, that will
draw the contents without the tint this applies, then apply the tint when you call act(), then quickly overwrite
the tint in the next frame. That visually appears as nothing happening other than a delay.x
- the x-coordinate of the cell to tinty
- the y-coordinate of the cell to tintcolor
- what to transition the cell's color towards, and then transition back from, as a Color objectduration
- how long the total "round-trip" transition should take in secondspublic void tint(int x, int y, float encodedColor, float duration)
Stage.act()
before you call Stage.draw()
, but after
any changes to the contents of this SparseLayers. If you change the contents, then draw, and then act, that will
draw the contents without the tint this applies, then apply the tint when you call act(), then quickly overwrite
the tint in the next frame. That visually appears as nothing happening other than a delay.x
- the x-coordinate of the cell to tinty
- the y-coordinate of the cell to tintencodedColor
- what to transition the cell's color towards, and then transition back from, as a packed floatduration
- how long the total "round-trip" transition should take in secondspublic void tint(float delay, int x, int y, float encodedColor, float duration, java.lang.Runnable postRunnable)
delay
(in seconds)
before performing it, then after the tint is complete it returns the cell to its original color, taking duration
seconds. Additionally, enqueue postRunnable
for running after the created action ends.
Stage.act()
before you call Stage.draw()
, but after
any changes to the contents of this SparseLayers. If you change the contents, then draw, and then act, that will
draw the contents without the tint this applies, then apply the tint when you call act(), then quickly overwrite
the tint in the next frame. That visually appears as nothing happening other than a delay.delay
- how long to wait in seconds before starting the effectx
- the x-coordinate of the cell to tinty
- the y-coordinate of the cell to tintencodedColor
- what to transition the cell's color towards, and then transition back from, as a packed floatduration
- how long the total "round-trip" transition should take in secondspostRunnable
- a Runnable to execute after the tint completes; may be null to do nothing.public void tint(int x, int y, int layer, com.badlogic.gdx.graphics.Color color, float duration)
SquidPanel.tint(float, int, int, Color, float, Runnable)
method has been reworked to use the same
technique this class uses for rendering text, and the two classes should have similar appearance (if not the
same) when rendering the same text. SparseLayers tends to be faster, especially when not all of the map is shown.
Stage.act()
before you call Stage.draw()
, but after
any changes to the contents of this SparseLayers. If you change the contents, then draw, and then act, that will
draw the contents without the tint this applies, then apply the tint when you call act(), then quickly overwrite
the tint in the next frame. That visually appears as nothing happening other than a delay.x
- the x-coordinate of the cell to tinty
- the y-coordinate of the cell to tintlayer
- which layer to affect; if you haven't specified a layer when placing text, then this should be 0color
- what to transition the cell's color towards, and then transition back from, as a Color objectduration
- how long the total "round-trip" transition should take in secondspublic void tint(int x, int y, int layer, float encodedColor, float duration)
SquidPanel.tint(float, int, int, Color, float, Runnable)
method has been reworked to use the same
technique this class uses for rendering text, and the two classes should have similar appearance (if not the
same) when rendering the same text. SparseLayers tends to be faster, especially when not all of the map is shown.
Stage.act()
before you call Stage.draw()
, but after
any changes to the contents of this SparseLayers. If you change the contents, then draw, and then act, that will
draw the contents without the tint this applies, then apply the tint when you call act(), then quickly overwrite
the tint in the next frame. That visually appears as nothing happening other than a delay.x
- the x-coordinate of the cell to tinty
- the y-coordinate of the cell to tintlayer
- which layer to affect; if you haven't specified a layer when placing text, then this should be 0encodedColor
- what to transition the cell's color towards, and then transition back from, as a packed floatduration
- how long the total "round-trip" transition should take in secondspublic void tint(float delay, int x, int y, int layer, float encodedColor, float duration, java.lang.Runnable postRunnable)
delay
(in seconds) before performing it, then after the tint is complete it returns the cell to its
original color, taking duration seconds. Additionally, enqueue postRunnable
for running after the created
action ends.
SquidPanel.tint(float, int, int, Color, float, Runnable)
method has been reworked to use the same
technique this class uses for rendering text, and the two classes should have similar appearance (if not the
same) when rendering the same text. SparseLayers tends to be faster, especially when not all of the map is shown.
Stage.act()
before you call Stage.draw()
, but after
any changes to the contents of this SparseLayers. If you change the contents, then draw, and then act, that will
draw the contents without the tint this applies, then apply the tint when you call act(), then quickly overwrite
the tint in the next frame. That visually appears as nothing happening other than a delay.delay
- how long to wait in seconds before starting the effectx
- the x-coordinate of the cell to tinty
- the y-coordinate of the cell to tintlayer
- which layer to affect; if you haven't specified a layer when placing text, then this should be 0encodedColor
- what to transition the cell's color towards, and then transition back from, as a packed floatduration
- how long the total "round-trip" transition should take in secondspostRunnable
- a Runnable to execute after the tint completes; may be null to do nothing.public void tint(TextCellFactory.Glyph glyph, float encodedColor, float duration)
glyphs
list this holds) so it becomes the
given encodedColor, then after the tint is complete it returns the cell to its original color, taking duration
seconds. This resets the glyph to its pre-tint color before it ends.glyph
- the TextCellFactory.Glyph
to tintencodedColor
- what to transition the cell's color towards, and then transition back from, as a packed floatduration
- how long the total "round-trip" transition should take in secondspublic void tint(float delay, TextCellFactory.Glyph glyph, float encodedColor, float duration, java.lang.Runnable postRunnable)
glyphs
list this holds) so it becomes the
given encodedColor, waiting for delay
(in seconds) before performing it, then after the tint is complete
it returns the cell to its original color, taking duration seconds. Additionally, enqueue postRunnable
for running after the created action ends. This resets the glyph to its pre-tint color before it runs any
postRunnable
.delay
- how long to wait in seconds before starting the effectglyph
- the TextCellFactory.Glyph
to tintencodedColor
- what to transition the cell's color towards, and then transition back from, as a packed floatduration
- how long the total "round-trip" transition should take in secondspostRunnable
- a Runnable to execute after the tint completes; may be null to do nothing.public void summon(int startX, int startY, int endX, int endY, char shown, float startColor, float endColor, float duration)
SquidPanel.summon(float, int, int, int, int, char, Color, Color, boolean, float, float, float)
,
this does not rotate the Glyph it produces.startX
- the starting x position in cellsstartY
- the starting y position in cellsendX
- the ending x position in cellsendY
- the ending y position in cellsshown
- the char to show (the same char throughout the effect)startColor
- the starting ColorendColor
- the Color to transition toduration
- the duration in seconds for the effectpublic void summon(float delay, int startX, int startY, int endX, int endY, char shown, float startColor, float endColor, float duration, java.lang.Runnable postRunnable)
SquidPanel.summon(float, int, int, int, int, char, Color, Color, boolean, float, float, float)
,
this does not rotate the Glyph it produces.delay
- how long to wait in seconds before starting the effectstartX
- the starting x position in cellsstartY
- the starting y position in cellsendX
- the ending x position in cellsendY
- the ending y position in cellsshown
- the char to show (the same char throughout the effect)startColor
- the starting ColorendColor
- the Color to transition toduration
- the duration in seconds for the effectpostRunnable
- a Runnable to execute after the summon completes; may be null to do nothing.public void summon(float startX, float startY, float endX, float endY, char shown, float startColor, float endColor, float duration)
SquidPanel.summon(float, int, int, int, int, char, Color, Color, boolean, float, float, float)
,
this does not rotate the Glyph it produces.startX
- the starting x position in world coordinatesstartY
- the starting y position in world coordinatesendX
- the ending x position in world coordinatesendY
- the ending y position in world coordinatesshown
- the char to show (the same char throughout the effect)startColor
- the starting ColorendColor
- the Color to transition toduration
- the duration in seconds for the effectpublic void summon(float delay, float startX, float startY, float endX, float endY, char shown, float startColor, float endColor, float duration, java.lang.Runnable postRunnable)
SquidPanel.summon(float, int, int, int, int, char, Color, Color, boolean, float, float, float)
,
this does not rotate the Glyph it produces.delay
- how long to wait in seconds before starting the effectstartX
- the starting x position in world coordinatesstartY
- the starting y position in world coordinatesendX
- the ending x position in world coordinatesendY
- the ending y position in world coordinatesshown
- the char to show (the same char throughout the effect)startColor
- the starting ColorendColor
- the Color to transition toduration
- the duration in seconds for the effectpostRunnable
- a Runnable to execute after the summon completes; may be null to do nothing.public void burst(int x, int y, int distance, squidpony.squidgrid.Radius measurement, char shown, float startColor, float endColor, float duration)
summon(int, int, int, int, char, float, float, float)
repeatedly with
different parameters. As with summon(), this creates temporary Glyphs that change color and position.
The distance is how many cells away to move the created Actors away from (x,y). The measurement determines
whether this produces Glyphs in 4 (cardinal) directions for DIAMOND or OCTAHEDRON, or 8 (cardinal and diagonal)
directions for any other enum value for Radius; CIRCLE and SPHERE will position the 8 glyphs in a circle, while
SQUARE and CUBE will position their 8 glyphs in a square.
SquidPanel.burst(float, int, int, int, boolean, char, Color, Color, boolean, float, float)
, this
does not rotate the individual Glyphs it produces.x
- the starting, center, x-position in cells to create all Actors aty
- the starting, center, y-position in cells to create all Actors atdistance
- how far away, in cells, to move each actor from the center (Chebyshev distance, forming a square)measurement
- a Radius enum that determines if 4 (DIAMOND, OCTAHEDRON) or 8 (anything else) Glyphs are
created, and the shape they will takeshown
- the char to use for Glyphs; should definitely be visiblestartColor
- the encoded color to start the effect withendColor
- the encoded color to end the effect onduration
- how long, in seconds, the effect should lastpublic void burst(float delay, int x, int y, int distance, squidpony.squidgrid.Radius measurement, char shown, float startColor, float endColor, float duration, java.lang.Runnable postRunnable)
summon(float, int, int, int, int, char, float, float, float, Runnable)
repeatedly with
different parameters. As with summon(), this creates temporary Glyphs that change color and position.
The distance is how many cells away to move the created Actors away from (x,y). The measurement determines
whether this produces Glyphs in 4 (cardinal) directions for DIAMOND or OCTAHEDRON, or 8 (cardinal and diagonal)
directions for any other enum value for Radius; CIRCLE and SPHERE will position the 8 glyphs in a circle, while
SQUARE and CUBE will position their 8 glyphs in a square. This takes a delay in seconds that can be used to make
the effect wait to start for some amount of time, and a Runnable that will be run once after the burst's full
duration completes (not once per summoned Glyph).
SquidPanel.burst(float, int, int, int, boolean, char, Color, Color, boolean, float, float)
, this
does not rotate the individual Glyphs it produces.delay
- how long to wait in seconds before starting the effectx
- the starting, center, x-position in cells to create all Actors aty
- the starting, center, y-position in cells to create all Actors atdistance
- how far away, in cells, to move each actor from the center (Chebyshev distance, forming a square)measurement
- a Radius enum that determines if 4 (DIAMOND, OCTAHEDRON) or 8 (anything else) Glyphs are
created, and the shape they will takeshown
- the char to use for Glyphs; should definitely be visiblestartColor
- the encoded color to start the effect withendColor
- the encoded color to end the effect onduration
- how long, in seconds, the effect should lastpostRunnable
- a Runnable to execute after the burst completes; may be null to do nothing,
and will only be run once for the whole burst effect.public void burst(int x, int y, int distance, squidpony.squidgrid.Radius measurement, java.lang.CharSequence choices, float startColor, float endColor, float duration)
summon(int, int, int, int, char, float, float, float)
repeatedly with
different parameters. As with summon(), this creates temporary Glyphs that change color and position.
The distance is how many cells away to move the created Actors away from (x,y). The measurement determines
whether this produces Glyphs in 4 (cardinal) directions for DIAMOND or OCTAHEDRON, or 8 (cardinal and diagonal)
directions for any other enum value for Radius; CIRCLE and SPHERE will position the 8 glyphs in a circle, while
SQUARE and CUBE will position their 8 glyphs in a square.
SquidPanel.burst(float, int, int, int, boolean, char, Color, Color, boolean, float, float)
, this
does not rotate the individual Glyphs it produces.x
- the starting, center, x-position in cells to create all Actors aty
- the starting, center, y-position in cells to create all Actors atdistance
- how far away, in cells, to move each actor from the center (Chebyshev distance, forming a square)measurement
- a Radius enum that determines if 4 (DIAMOND, OCTAHEDRON) or 8 (anything else) Glyphs are
created, and the shape they will takechoices
- a String or other CharSequence containing the chars this can randomly choosestartColor
- the encoded color to start the effect withendColor
- the encoded color to end the effect onduration
- how long, in seconds, the effect should lastpublic void burst(float delay, int x, int y, int distance, squidpony.squidgrid.Radius measurement, java.lang.CharSequence choices, float startColor, float endColor, float duration, java.lang.Runnable postRunnable)
summon(int, int, int, int, char, float, float, float)
repeatedly with
different parameters. As with summon(), this creates temporary Glyphs that change color and position.
The distance is how many cells away to move the created Actors away from (x,y). The measurement determines
whether this produces Glyphs in 4 (cardinal) directions for DIAMOND or OCTAHEDRON, or 8 (cardinal and diagonal)
directions for any other enum value for Radius; CIRCLE and SPHERE will position the 8 glyphs in a circle, while
SQUARE and CUBE will position their 8 glyphs in a square. This takes a delay in seconds that can be used to make
the effect wait to start for some amount of time, and a Runnable that will be run once after the burst's full
duration completes (not once per summoned Glyph).
SquidPanel.burst(float, int, int, int, boolean, char, Color, Color, boolean, float, float)
, this
does not rotate the individual Glyphs it produces.delay
- how long to wait in seconds before starting the effectx
- the starting, center, x-position in cells to create all Actors aty
- the starting, center, y-position in cells to create all Actors atdistance
- how far away, in cells, to move each actor from the center (Chebyshev distance, forming a square)measurement
- a Radius enum that determines if 4 (DIAMOND, OCTAHEDRON) or 8 (anything else) Glyphs are
created, and the shape they will takechoices
- a String or other CharSequence containing the chars this can randomly choosestartColor
- the encoded color to start the effect withendColor
- the encoded color to end the effect onduration
- how long, in seconds, the effect should lastpostRunnable
- a Runnable to execute after the burst completes; may be null to do nothing,
and will only be run once for the whole burst effect.public void recolor(int x, int y, com.badlogic.gdx.graphics.Color color, float duration)
Stage.act()
before you call Stage.draw()
, but after
any changes to the contents of this SparseLayers. If you change the contents, then draw, and then act, that will
draw the contents without the recolor this applies, then apply the recolor when you call act(), then quickly
overwrite the recolor in the next frame. That visually appears as nothing happening other than a delay.x
- the x-coordinate of the cell to recolory
- the y-coordinate of the cell to recolorcolor
- what to gradually change the cell's color to, as a Color objectduration
- how long the total transition should take in secondspublic void recolor(int x, int y, float encodedColor, float duration)
Stage.act()
before you call Stage.draw()
, but after
any changes to the contents of this SparseLayers. If you change the contents, then draw, and then act, that will
draw the contents without the recolor this applies, then apply the recolor when you call act(), then quickly
overwrite the recolor in the next frame. That visually appears as nothing happening other than a delay.x
- the x-coordinate of the cell to recolory
- the y-coordinate of the cell to recolorencodedColor
- what to gradually change the cell's color to, as a packed floatduration
- how long the total transition should take in secondspublic void recolor(float delay, int x, int y, float encodedColor, float duration)
delay
(in
seconds) before performing it, taking duration seconds. The background will keep the changed color after
the effect, unless drawn over.
Stage.act()
before you call Stage.draw()
, but after
any changes to the contents of this SparseLayers. If you change the contents, then draw, and then act, that will
draw the contents without the recolor this applies, then apply the recolor when you call act(), then quickly
overwrite the recolor in the next frame. That visually appears as nothing happening other than a delay.delay
- how long to wait in seconds before starting the effectx
- the x-coordinate of the cell to recolory
- the y-coordinate of the cell to recolorencodedColor
- what to gradually change the cell's color to, as a packed floatduration
- how long the total transition should take in secondspublic void recolor(float delay, int x, int y, float encodedColor, float duration, java.lang.Runnable postRunnable)
delay
(in
seconds) before performing it, taking duration seconds. The background will keep the changed color after the
effect, unless drawn over. Additionally, enqueue postRunnable
for running after the created action ends.
Stage.act()
before you call Stage.draw()
, but after
any changes to the contents of this SparseLayers. If you change the contents, then draw, and then act, that will
draw the contents without the recolor this applies, then apply the recolor when you call act(), then quickly
overwrite the recolor in the next frame. That visually appears as nothing happening other than a delay.delay
- how long to wait in seconds before starting the effectx
- the x-coordinate of the cell to recolory
- the y-coordinate of the cell to recolorencodedColor
- what to gradually change the cell's color to, as a packed floatduration
- how long the total transition should take in secondspostRunnable
- a Runnable to execute after the recolor completes; may be null to do nothing.public void recolor(int x, int y, int layer, com.badlogic.gdx.graphics.Color color, float duration)
Stage.act()
before you call Stage.draw()
, but after
any changes to the contents of this SparseLayers. If you change the contents, then draw, and then act, that will
draw the contents without the recolor this applies, then apply the recolor when you call act(), then quickly
overwrite the recolor in the next frame. That visually appears as nothing happening other than a delay.x
- the x-coordinate of the cell to recolory
- the y-coordinate of the cell to recolorlayer
- which layer to affect; if you haven't specified a layer when placing text, then this should be 0color
- what to gradually change the cell's color to, as a Color objectduration
- how long the total transition should take in secondspublic void recolor(int x, int y, int layer, float encodedColor, float duration)
Stage.act()
before you call Stage.draw()
, but after
any changes to the contents of this SparseLayers. If you change the contents, then draw, and then act, that will
draw the contents without the recolor this applies, then apply the recolor when you call act(), then quickly
overwrite the recolor in the next frame. That visually appears as nothing happening other than a delay.x
- the x-coordinate of the cell to recolory
- the y-coordinate of the cell to recolorlayer
- which layer to affect; if you haven't specified a layer when placing text, then this should be 0encodedColor
- what to gradually change the cell's color to, as a packed floatduration
- how long the total transition should take in secondspublic void recolor(float delay, int x, int y, int layer, float encodedColor, float duration)
delay
(in seconds) before performing it, taking duration seconds. The foreground color will keep the
changed color after the effect, unless drawn over.
Stage.act()
before you call Stage.draw()
, but after
any changes to the contents of this SparseLayers. If you change the contents, then draw, and then act, that will
draw the contents without the recolor this applies, then apply the recolor when you call act(), then quickly
overwrite the recolor in the next frame. That visually appears as nothing happening other than a delay.delay
- how long to wait in seconds before starting the effectx
- the x-coordinate of the cell to recolory
- the y-coordinate of the cell to recolorlayer
- which layer to affect; if you haven't specified a layer when placing text, then this should be 0encodedColor
- what to gradually change the cell's color to, as a packed floatduration
- how long the total transition should take in secondspublic void recolor(float delay, int x, int y, int layer, float encodedColor, float duration, java.lang.Runnable postRunnable)
delay
(in seconds) before performing it, taking duration seconds. The foreground color will keep the
changed color after the effect, unless drawn over. Additionally, enqueue postRunnable
for running after
the created action ends.
Stage.act()
before you call Stage.draw()
, but after
any changes to the contents of this SparseLayers. If you change the contents, then draw, and then act, that will
draw the contents without the recolor this applies, then apply the recolor when you call act(), then quickly
overwrite the recolor in the next frame. That visually appears as nothing happening other than a delay.delay
- how long to wait in seconds before starting the effectx
- the x-coordinate of the cell to recolory
- the y-coordinate of the cell to recolorlayer
- which layer to affect; if you haven't specified a layer when placing text, then this should be 0encodedColor
- what to gradually change the cell's color to, as a packed floatduration
- how long the total transition should take in secondspostRunnable
- a Runnable to execute after the recolor completes; may be null to do nothing.public char[][] frontChars()
' '
(the space char) at that spot.
This is the same as frontChars(char[][])
, except this method allocates a new 2D array on every call.' '
if no char was visiblepublic char[][] frontChars(char[][] buffer)
buffer
.
This means the highest layers will take precedence over lower layers, the background colors are ignored, and if
no char or Glyph was present at a square, then the buffer will contain ' '
(the space char) at that spot.buffer
- a non-null 2D char array; will be erased, filled with ' '
, and then given the chars from the front of this.buffer
, after modificationspublic void draw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)
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 com.badlogic.gdx.scenes.scene2d.Actor
batch
- a Batch such as a FilterBatch
that must be between a begin() and end() call; usually done by StageparentAlpha
- currently ignoredCopyright © Eben Howard 2012–2022. All rights reserved.