public class SquidLayers
extends com.badlogic.gdx.scenes.scene2d.Group
Modifier and Type | Field and Description |
---|---|
protected float |
animationDuration |
protected SquidPanel |
backgroundPanel |
protected int |
cellHeight |
protected int |
cellWidth |
static char |
EMPTY_CELL |
protected java.util.ArrayList<SquidPanel> |
extraPanels |
protected SquidPanel |
foregroundPanel |
protected int |
height |
int[][] |
lightnesses |
protected TextCellFactory |
textFactory |
protected int |
width |
Constructor and Description |
---|
SquidLayers()
Create a new SquidLayers widget with a default stretchable font, 40 cells wide and 40 cells high,
and 12x12 pixels for each cell.
|
SquidLayers(int gridWidth,
int gridHeight)
Create a new SquidLayers widget with a default stretchable font, the given number of cells for gridWidth
and gridHeight, and 12x12 pixels for each cell.
|
SquidLayers(int gridWidth,
int gridHeight,
int cellWidth,
int cellHeight)
Create a new SquidLayers widget with a default stretchable font (it will adapt to the cellWidth and cellHeight
you give it), the given number of cells for gridWidth and gridHeight, and the size in pixels for each cell
given by cellWidth and cellHeight.
|
SquidLayers(int gridWidth,
int gridHeight,
int cellWidth,
int cellHeight,
com.badlogic.gdx.graphics.g2d.BitmapFont bitmapFont)
Create a new SquidLayers widget with the given path to a BitmapFont file, the given number of cells for gridWidth
and gridHeight, and the size in pixels for each cell given by cellWidth and cellHeight.
|
SquidLayers(int gridWidth,
int gridHeight,
int cellWidth,
int cellHeight,
com.badlogic.gdx.graphics.g2d.BitmapFont bitmapFont,
SquidColorCenter bgColorCenter,
SquidColorCenter fgColorCenter)
Create a new SquidLayers widget with the given BitmapFont (already constructed), the given number of cells for
gridWidth and gridHeight, and the size in pixels for each cell given by cellWidth and cellHeight.
|
SquidLayers(int gridWidth,
int gridHeight,
int cellWidth,
int cellHeight,
SquidColorCenter bgColorCenter,
SquidColorCenter fgColorCenter)
Create a new SquidLayers widget with a default stretchable font (it will adapt to the cellWidth and cellHeight
you give it), the given number of cells for gridWidth and gridHeight, the size in pixels for each cell
given by cellWidth and cellHeight, and the given SquidColorCenter instances to affect colors.
|
SquidLayers(int gridWidth,
int gridHeight,
int cellWidth,
int cellHeight,
java.lang.String fontpath)
Create a new SquidLayers widget with the given path to a BitmapFont file, the given number of cells for gridWidth
and gridHeight, and the size in pixels for each cell given by cellWidth and cellHeight.
|
SquidLayers(int gridWidth,
int gridHeight,
int cellWidth,
int cellHeight,
java.lang.String fontpath,
SquidColorCenter bgColorCenter,
SquidColorCenter fgColorCenter)
Create a new SquidLayers widget with the given path to a BitmapFont file, the given number of cells for gridWidth
and gridHeight, and the size in pixels for each cell given by cellWidth and cellHeight.
|
SquidLayers(int gridWidth,
int gridHeight,
int cellWidth,
int cellHeight,
TextCellFactory tcf)
Create a new SquidLayers widget with the given path pre-constructed TextCellFactory, the given number of cells
for gridWidth and gridHeight, and the size in pixels for each cell given by cellWidth and cellHeight.
|
SquidLayers(int gridWidth,
int gridHeight,
int cellWidth,
int cellHeight,
TextCellFactory tcf,
SquidColorCenter bgColorCenter,
SquidColorCenter fgColorCenter)
Create a new SquidLayers widget with the given TextCellFactory, the given number of cells for gridWidth
and gridHeight, the size in pixels for each cell given by cellWidth and cellHeight, and the given
SquidColorCenters for background and foreground.
|
SquidLayers(int gridWidth,
int gridHeight,
int cellWidth,
int cellHeight,
TextCellFactory tcf,
SquidColorCenter bgColorCenter,
SquidColorCenter fgColorCenter,
char[][] actualMap)
Create a new SquidLayers widget with the given TextCellFactory, the given number of cells for gridWidth
and gridHeight, the size in pixels for each cell given by cellWidth and cellHeight, the given
SquidColorCenters for background and foreground, and the given 2D char array for an area map that may be
sized differently than gridWidth by gridHeight (it is usually larger than gridWidth by gridHeight, which
allows camera scrolling across the map).
|
Modifier and Type | Method and Description |
---|---|
SquidLayers |
addExtraLayer()
Add an extra layer on top of the foreground layer.
|
AnimatedEntity |
animateActor(int x,
int y,
char c,
java.util.Collection<com.badlogic.gdx.graphics.Color> colors,
boolean doubleWidth) |
AnimatedEntity |
animateActor(int x,
int y,
char c,
java.util.Collection<com.badlogic.gdx.graphics.Color> colors,
float loopTime,
boolean doubleWidth) |
AnimatedEntity |
animateActor(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color color) |
AnimatedEntity |
animateActor(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color color,
boolean doubleWidth) |
AnimatedEntity |
animateActor(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color color,
int layer) |
AnimatedEntity |
animateActor(int x,
int y,
java.lang.String s,
com.badlogic.gdx.graphics.Color color) |
AnimatedEntity |
animateActor(int x,
int y,
java.lang.String s,
com.badlogic.gdx.graphics.Color color,
boolean doubleWidth) |
AnimatedEntity |
animateActor(int x,
int y,
java.lang.String s,
com.badlogic.gdx.graphics.Color color,
int layer) |
AnimatedEntity |
animateActor(int x,
int y,
java.lang.String s,
com.badlogic.gdx.graphics.Color color,
int layer,
boolean doubleWidth) |
AnimatedEntity |
animateActor(int x,
int y,
com.badlogic.gdx.graphics.g2d.TextureRegion tr) |
AnimatedEntity |
animateActor(int x,
int y,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
boolean doubleWidth) |
AnimatedEntity |
animateActor(int x,
int y,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
boolean doubleWidth,
boolean stretch) |
AnimatedEntity |
animateActor(int x,
int y,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
com.badlogic.gdx.graphics.Color color) |
AnimatedEntity |
animateActor(int x,
int y,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
com.badlogic.gdx.graphics.Color color,
boolean doubleWidth) |
AnimatedEntity |
animateActor(int x,
int y,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
com.badlogic.gdx.graphics.Color color,
boolean doubleWidth,
boolean stretch) |
AnimatedEntity |
animateActor(int x,
int y,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
com.badlogic.gdx.graphics.Color color,
int layer) |
AnimatedEntity |
animateActor(int x,
int y,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
com.badlogic.gdx.graphics.Color color,
int layer,
boolean doubleWidth,
boolean stretch) |
SquidLayers |
autoLight()
Alters the lightnesses that affect the background colors, accepting a parameter for
animation frame if rippling water and waving grass using
UnifiedNoise are desired. |
SquidLayers |
autoLight(double frame)
Alters the lightnesses that affect the background colors, accepting a parameter for
animation frame if rippling water and waving grass using
UnifiedNoise are desired. |
SquidLayers |
autoLight(double frame,
char deepLiquid,
char shallowLiquid)
Alters the lightnesses that affect the background colors, accepting a parameter for
animation frame if rippling water and waving grass using
UnifiedNoise are desired. |
SquidLayers |
bump(AnimatedEntity ae,
squidpony.squidgrid.Direction dir) |
SquidLayers |
bump(AnimatedEntity ae,
int layer,
squidpony.squidgrid.Direction dir,
float duration) |
SquidLayers |
bump(int x,
int y,
squidpony.squidgrid.Direction dir) |
SquidLayers |
bump(int x,
int y,
int layer,
squidpony.squidgrid.Direction dir,
float duration) |
SquidLayers |
clear(int x,
int y)
Clear one cell at position x, y of its foreground contents.
|
AnimatedEntity |
directionMarker(int x,
int y,
java.util.Collection<com.badlogic.gdx.graphics.Color> colors,
float loopTime,
int layer,
boolean doubleWidth) |
AnimatedEntity |
directionMarker(int x,
int y,
com.badlogic.gdx.graphics.Color color,
int layer,
boolean doubleWidth) |
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
float parentAlpha) |
void |
drawActor(com.badlogic.gdx.graphics.g2d.Batch batch,
float parentAlpha,
AnimatedEntity ae) |
void |
drawActor(com.badlogic.gdx.graphics.g2d.Batch batch,
float parentAlpha,
AnimatedEntity ae,
int layer) |
SquidLayers |
erase()
Erase everything visible in all cells or all layers.
|
SquidLayers |
eraseLayer(int layer) |
squidpony.squidmath.OrderedSet<AnimatedEntity> |
getAnimatedEntities() |
squidpony.squidmath.OrderedSet<AnimatedEntity> |
getAnimatedEntities(int layer) |
AnimatedEntity |
getAnimatedEntityByCell(int x,
int y) |
AnimatedEntity |
getAnimatedEntityByCell(int x,
int y,
int layer) |
float |
getAnimationDuration() |
SquidPanel |
getBackgroundLayer() |
int |
getCellHeight()
Height of one cell in pixels.
|
int |
getCellWidth()
Width of one cell in pixels.
|
SquidPanel |
getForegroundLayer() |
int |
getGridHeight()
Height of the shown area of the map in grid cells.
|
int |
getGridOffsetX() |
int |
getGridOffsetY() |
int |
getGridWidth()
Width of the shown area of the map in grid cells.
|
float |
getHeight()
The pixel height of the entire map as displayed.
|
SquidPanel |
getLayer(int layer)
Gets a SquidPanel from this SquidLayers and returns a direct reference.
|
com.badlogic.gdx.graphics.Color |
getLightingColor() |
int[][] |
getLightnesses()
Get the lightness modifiers used for background cells as an int[][], with elements between 0 and 511, 256 as the
unmodified lightness level, lower numbers meaning darker, and higher meaning lighter.
|
TextCellFactory |
getTextFactory() |
int |
getTotalHeight() |
int |
getTotalWidth() |
float |
getWidth()
The pixel width of the entire map as displayed.
|
boolean |
hasActiveAnimations() |
boolean |
hasValue(int x,
int y)
Very basic check to see if something was rendered at the x,y cell requested; this only checks the
foreground.
|
SquidLayers |
highlight(int x,
int y,
int lightness)
Change the lightness for the background of the cell at x, y (0 is no change, 100 is
very bright, -100 is very dark, anything past -150 or 150 will make the background almost fully black or white).
|
SquidLayers |
highlight(int x,
int y,
int[][] lightness)
Change the lightness for the background of the cell at x, y (0 is no change, 100 is
very bright, -100 is very dark, anything past -150 or 150 will make the background almost fully black or white).
|
SquidLayers |
put(int x,
int y,
char c)
Place a char c into the foreground at position x, y, with the default color.
|
SquidLayers |
put(int x,
int y,
char[][] c) |
SquidLayers |
put(int x,
int y,
char[][] c,
com.badlogic.gdx.graphics.Color[][] foreground,
com.badlogic.gdx.graphics.Color[][] background) |
SquidLayers |
put(int x,
int y,
char[][] c,
com.badlogic.gdx.graphics.Color[][] foregrounds,
com.badlogic.gdx.graphics.Color[][] backgrounds,
int[][] backgroundLightness)
Place a 2@ char array c into the foreground, with foreground colors specified by a 2D Color array, background
colors with another 2D Color array, and lightness variations for the background in a 2D int array (255 will make
the background equal the background panel's
SquidPanel.getLightingColor() , -255 will use the background
as-is, and values in between will be linearly interpolated between those two extremes). |
SquidLayers |
put(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color foreground)
Place a char c into the foreground, with a foreground color as a libGDX Color (or SColor).
|
SquidLayers |
put(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color foreground,
com.badlogic.gdx.graphics.Color background)
Place a char c into the foreground, with a specified foreground color and background color.
|
SquidLayers |
put(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color foreground,
com.badlogic.gdx.graphics.Color background,
int backgroundLightness)
Place a char c into the foreground, with a foreground and background libGDX Color and a lightness variation for
the background (255 will make the background equal the background panel's
SquidPanel.getLightingColor() , -255 will use the background as-is, and values in between will be
linearly interpolated between those two extremes). |
SquidLayers |
put(int x,
int y,
char c,
com.badlogic.gdx.graphics.Color foreground,
com.badlogic.gdx.graphics.Color background,
int mixAmount,
com.badlogic.gdx.graphics.Color mixBackground)
Place a char c into the foreground, with a foreground and background libGDX Color and a lightness variation for
the background (255 will make the background equal the background panel's
SquidPanel.getLightingColor() , -255 will use the background as-is, and values in between will be
linearly interpolated between those two extremes). |
SquidLayers |
put(int x,
int y,
char c,
float encodedForeground)
Place a char c into the foreground, with a foreground color as a packed float.
|
SquidLayers |
put(int x,
int y,
char c,
float encodedForeground,
float encodedBackground,
float backgroundLightness,
float mixBackground)
Place a char c into the foreground, with a foreground, background, and mix color (which affects the background)
each encoded as a packed float and a lightness variation for the background (using the style that SquidPanel
does, with the "lightness" a float between 0.0f and 1.0f inclusive, encodedBackground used on its own for 0
lightness, mixBackground used on its own for 1 lightness, and values in between mixing the two).
|
SquidLayers |
put(int x,
int y,
char c,
float encodedForeground,
float encodedBackground,
int backgroundLightness)
Place a char c into the foreground, with a foreground and background color each encoded as a packed float and a
lightness variation for the background (255 will make the background equal the background panel's
SquidPanel.getLightingColor() , -255 will use encodedBackground as-is, and values in between will be
linearly interpolated between those two extremes). |
SquidLayers |
put(int x,
int y,
char c,
float encodedForeground,
float encodedBackground,
int backgroundLightness,
float mixBackground)
Place a char c into the foreground, with a foreground, background, and mix color (which affects the background)
each encoded as a packed float and a lightness variation for the background (255 will make the background equal
mixColor, -255 will use encodedBackground as-is, and values in between will be linearly interpolated between
those two extremes).
|
SquidLayers |
putBoxedString(int x,
int y,
java.lang.String s)
A utility method that draws a 1-cell-wide black box around the text you request (as s) and replaces the contents
of anything that was below or adjacent to the string's new position.
|
SquidLayers |
putInto(int layer,
int x,
int y,
char c)
Place a char c into the specified layer, using the specified layer's default foreground color.
|
SquidLayers |
putInto(int layer,
int x,
int y,
char[][] c)
Place a 2D char array c into the specified layer, using the specified layer's default foreground color.
|
SquidLayers |
putInto(int layer,
int x,
int y,
char[][] c,
com.badlogic.gdx.graphics.Color[][] colors)
Place a 2D char array c into the specified layer, using the matching Color from the given 2D Color array.
|
SquidLayers |
putInto(int layer,
int x,
int y,
char c,
com.badlogic.gdx.graphics.Color color)
Place a char c into the specified layer with the specified Color.
|
SquidLayers |
putString(int x,
int y,
java.lang.String s)
Put a string at the given x, y position, using the default foreground color.
|
SquidLayers |
putString(int x,
int y,
java.lang.String s,
com.badlogic.gdx.graphics.Color foreground)
Put a string at the given x, y position, with the given foreground Color.
|
SquidLayers |
putString(int x,
int y,
java.lang.String s,
com.badlogic.gdx.graphics.Color foreground,
com.badlogic.gdx.graphics.Color background)
Put a string at the given x, y position, with the given foreground and background Colors.
|
void |
removeAnimatedEntity(AnimatedEntity ae) |
void |
removeAnimatedEntity(AnimatedEntity ae,
int layer) |
void |
removeAnimatedEntityByCell(int x,
int y) |
void |
removeAnimatedEntityByCell(int x,
int y,
int layer) |
void |
setAnimationDuration(float animationDuration) |
void |
setBackgroundLayer(SquidPanel panel)
Sets the background panel to match the given SquidPanel (it can also be a subclass of SquidPanel, a likely use).
|
void |
setBGColorCenter(squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> scc)
Sets the IColorCenter used by the background layer.
|
void |
setExtraPanel(SquidPanel panel,
int index)
Sets an extra panel to match the given SquidPanel (it can also be a subclass of SquidPanel, a likely use).
|
void |
setFGColorCenter(squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> scc)
Sets the IColorCenter used by the foreground layer.
|
void |
setForegroundLayer(SquidPanel panel)
Sets the foreground panel to match the given SquidPanel (it can also be a subclass of SquidPanel, a likely use).
|
void |
setGridOffsetX(int offset) |
void |
setGridOffsetY(int offset) |
void |
setLightingColor(com.badlogic.gdx.graphics.Color lightingColor) |
void |
setLightnesses(int[][] lightnesses)
Sets the lightness modifiers used for background cells with the int[][] passed as lightnesses.
|
void |
setOffsets(float x,
float y) |
void |
setPosition(float x,
float y)
Sets the position of the actor's bottom left corner.
|
SquidLayers |
setTextSize(float wide,
float high)
Sets the size of the text in all layers (but not the size of the cells) to the given width and height in pixels
(which may be stretched by viewports later on, if your program uses them).
|
SquidLayers |
setTextSize(int layer,
float wide,
float high)
Sets the size of the text in the given layer (but not the size of the cells) to the given width and height in
pixels (which may be stretched by viewports later on, if your program uses them).
|
SquidLayers |
slide(AnimatedEntity ae,
int endX,
int endY) |
SquidLayers |
slide(AnimatedEntity ae,
int endX,
int endY,
int layer,
float duration) |
SquidLayers |
slide(int x,
int y,
int endX,
int endY) |
SquidLayers |
slide(int x,
int y,
int endX,
int endY,
int layer,
float duration) |
SquidLayers |
tint(AnimatedEntity ae,
com.badlogic.gdx.graphics.Color color) |
SquidLayers |
tint(AnimatedEntity ae,
com.badlogic.gdx.graphics.Color color,
int layer,
float duration) |
SquidLayers |
tint(int x,
int y,
com.badlogic.gdx.graphics.Color color) |
SquidLayers |
tint(int x,
int y,
com.badlogic.gdx.graphics.Color color,
int layer,
float duration) |
SquidLayers |
wiggle(AnimatedEntity ae) |
SquidLayers |
wiggle(AnimatedEntity ae,
int layer,
float duration) |
SquidLayers |
wiggle(int x,
int y) |
SquidLayers |
wiggle(int x,
int y,
int layer,
float duration) |
act, addActor, addActorAfter, addActorAt, addActorBefore, applyTransform, applyTransform, childrenChanged, clear, clear, clearChildren, clearChildren, computeTransform, debugAll, drawChildren, drawDebug, drawDebugChildren, findActor, getChild, getChildren, getCullingArea, hasChildren, hit, isTransform, localToDescendantCoordinates, removeActor, removeActor, removeActorAt, resetTransform, resetTransform, setCullingArea, setDebug, setStage, setTransform, swapActor, swapActor, toString
addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebugBounds, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getX, getX, getY, getY, getZIndex, hasActions, hasKeyboardFocus, hasParent, hasScrollFocus, 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, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, sizeChanged, stageToLocalCoordinates, toBack, toFront
protected int width
protected int height
protected int cellWidth
protected int cellHeight
public int[][] lightnesses
protected SquidPanel backgroundPanel
protected SquidPanel foregroundPanel
protected java.util.ArrayList<SquidPanel> extraPanels
protected TextCellFactory textFactory
protected float animationDuration
public static final char EMPTY_CELL
public SquidLayers()
public SquidLayers(int gridWidth, int gridHeight)
gridWidth
- in grid cellsgridHeight
- in grid cellspublic SquidLayers(int gridWidth, int gridHeight, int cellWidth, int cellHeight)
gridWidth
- in grid cellsgridHeight
- in grid cellscellWidth
- in pixelscellHeight
- in pixelspublic SquidLayers(int gridWidth, int gridHeight, int cellWidth, int cellHeight, java.lang.String fontpath)
gridWidth
- in grid cellsgridHeight
- in grid cellscellWidth
- in pixelscellHeight
- in pixelsfontpath
- A path to a BitmapFont in the assets folderpublic SquidLayers(int gridWidth, int gridHeight, int cellWidth, int cellHeight, com.badlogic.gdx.graphics.g2d.BitmapFont bitmapFont)
gridWidth
- in grid cellsgridHeight
- in grid cellscellWidth
- in pixelscellHeight
- in pixelsbitmapFont
- A BitmapFont that you already constructedpublic SquidLayers(int gridWidth, int gridHeight, int cellWidth, int cellHeight, TextCellFactory tcf)
DefaultResources
, which will be configured by
this constructor for sizing when passed here.gridWidth
- in grid cellsgridHeight
- in grid cellscellWidth
- in pixelscellHeight
- in pixelstcf
- A TextCellFactory that you already constructedpublic SquidLayers(int gridWidth, int gridHeight, int cellWidth, int cellHeight, SquidColorCenter bgColorCenter, SquidColorCenter fgColorCenter)
gridWidth
- in grid cellsgridHeight
- in grid cellscellWidth
- in pixelscellHeight
- in pixelsbgColorCenter
- a SquidColorCenter (possibly with a filter) to use for the backgroundfgColorCenter
- a SquidColorCenter (possibly with a filter) to use for the foregroundpublic SquidLayers(int gridWidth, int gridHeight, int cellWidth, int cellHeight, java.lang.String fontpath, SquidColorCenter bgColorCenter, SquidColorCenter fgColorCenter)
gridWidth
- in grid cellsgridHeight
- in grid cellscellWidth
- in pixelscellHeight
- in pixelsfontpath
- A path to a BitmapFont that can be on the classpath (in SquidLib) or in the assets folder.bgColorCenter
- a SquidColorCenter (possibly with a filter) to use for the backgroundfgColorCenter
- a SquidColorCenter (possibly with a filter) to use for the foregroundpublic SquidLayers(int gridWidth, int gridHeight, int cellWidth, int cellHeight, com.badlogic.gdx.graphics.g2d.BitmapFont bitmapFont, SquidColorCenter bgColorCenter, SquidColorCenter fgColorCenter)
gridWidth
- in grid cellsgridHeight
- in grid cellscellWidth
- in pixelscellHeight
- in pixelsbitmapFont
- A BitmapFont that you already constructedbgColorCenter
- a SquidColorCenter (possibly with a filter) to use for the backgroundfgColorCenter
- a SquidColorCenter (possibly with a filter) to use for the foregroundpublic SquidLayers(int gridWidth, int gridHeight, int cellWidth, int cellHeight, TextCellFactory tcf, SquidColorCenter bgColorCenter, SquidColorCenter fgColorCenter)
DefaultResources
, which will be configured by this constructor for sizing when passed here.gridWidth
- in grid cellsgridHeight
- in grid cellscellWidth
- in pixelscellHeight
- in pixelstcf
- A TextCellFactory that will be (re-)initialized here with the given cellHeight and cellWidth.bgColorCenter
- a SquidColorCenter (possibly with a filter) to use for the backgroundfgColorCenter
- a SquidColorCenter (possibly with a filter) to use for the foregroundpublic SquidLayers(int gridWidth, int gridHeight, int cellWidth, int cellHeight, TextCellFactory tcf, SquidColorCenter bgColorCenter, SquidColorCenter fgColorCenter, char[][] actualMap)
DefaultResources
, which will be configured by this constructor for
sizing when passed here.gridWidth
- in grid cellsgridHeight
- in grid cellscellWidth
- in pixelscellHeight
- in pixelstcf
- A TextCellFactory that will be (re-)initialized here with the given cellHeight and cellWidth.bgColorCenter
- a SquidColorCenter (possibly with a filter) to use for the backgroundfgColorCenter
- a SquidColorCenter (possibly with a filter) to use for the foregroundactualMap
- will often be a different size than gridWidth by gridHeight, which enables camera scrollingpublic float getWidth()
getWidth
in class com.badlogic.gdx.scenes.scene2d.Actor
public float getHeight()
getHeight
in class com.badlogic.gdx.scenes.scene2d.Actor
public int getGridWidth()
public int getGridHeight()
public int getCellWidth()
public int getCellHeight()
public float getAnimationDuration()
public void setAnimationDuration(float animationDuration)
public TextCellFactory getTextFactory()
public int[][] getLightnesses()
public SquidLayers autoLight()
UnifiedNoise
are desired. It may make sense to
pass some fraction of the current time, as given by System.currentTimeMillis()
, instead of a frame.
Does not allocate a new 2D int array like MapUtility.generateLightnessModifiers(char[][])
or its
equivalent in DungeonUtility, and directly mutates the lightness data. You can use the lightnesses
field
to access the 2D array directly, where you can make further modifications to the lighting.public SquidLayers autoLight(double frame)
UnifiedNoise
are desired. It may make sense to
pass some fraction of the current time, as given by System.currentTimeMillis()
, instead of a frame.
Does not allocate a new 2D int array like MapUtility.generateLightnessModifiers(char[][])
or its
equivalent in DungeonUtility, and directly mutates the lightness data. You can use the lightnesses
field
to access the 2D array directly, where you can make further modifications to the lighting.frame
- a counter that typically should increase by between 10.0 and 20.0 each second; higher numbers make
water and grass move more, and 0.013 multiplied by the current time in milliseconds works well
as long as only the smaller digits of the time are used; this can be accomplished with
(System.currentTimeMillis() & 0xFFFFFF) * 0.013
.public SquidLayers autoLight(double frame, char deepLiquid, char shallowLiquid)
UnifiedNoise
are desired. It may make sense to
pass some fraction of the current time, as given by System.currentTimeMillis()
, instead of a frame.
Also allows additional chars to be treated like deep and shallow water regarding the ripple animation.
Does not allocate a new 2D int array like MapUtility.generateLightnessModifiers(char[][])
or its
equivalent in DungeonUtility, and directly mutates the lightness data. You can use the lightnesses
field
to access the 2D array directly, where you can make further modifications to the lighting.
MapUtility.fillLightnessModifiers(int[][], char[][], double, char, char)
.frame
- a counter that typically should increase by between 10.0 and 20.0 each second; higher numbers make
water and grass move more, and 0.013 multiplied by the current time in milliseconds works well
as long as only the smaller digits of the time are used; this can be accomplished with
(System.currentTimeMillis() & 0xFFFFFF) * 0.013
.deepLiquid
- a char that will be treated like deep water when animating ripplesshallowLiquid
- a char that will be treated like shallow water when animating ripplespublic void setLightnesses(int[][] lightnesses)
lightnesses
- 2D array, width and height should match this class' gridWidth and gridHeight. elements must
be between 0 and 511.public SquidLayers addExtraLayer()
public SquidLayers setTextSize(int layer, float wide, float high)
layer
- the layer to affect; 0 is background, 1 is unused, 2 is foreground, 3 and higher are extra panelswide
- the width of a glyph in pixelshigh
- the height of a glyph in pixelspublic SquidLayers setTextSize(float wide, float high)
wide
- the width of a glyph in pixelshigh
- the height of a glyph in pixelspublic SquidLayers put(int x, int y, char c)
x
- in grid cells.y
- in grid cells.c
- a character to be drawn in the foregroundpublic SquidLayers put(int x, int y, char c, com.badlogic.gdx.graphics.Color foreground)
x
- in grid cells.y
- in grid cells.c
- a character to be drawn in the foregroundforeground
- Color for the char being drawnpublic SquidLayers put(int x, int y, char c, float encodedForeground)
x
- in grid cells.y
- in grid cells.c
- a character to be drawn in the foregroundencodedForeground
- float encoding the color for the char being drawnpublic SquidLayers put(int x, int y, char c, com.badlogic.gdx.graphics.Color foreground, com.badlogic.gdx.graphics.Color background)
x
- in grid cells.y
- in grid cells.c
- a character to be drawn in the foregroundforeground
- Color for the char being drawnbackground
- Color for the backgroundpublic SquidLayers put(int x, int y, char c, com.badlogic.gdx.graphics.Color foreground, com.badlogic.gdx.graphics.Color background, int backgroundLightness)
SquidPanel.getLightingColor()
, -255 will use the background as-is, and values in between will be
linearly interpolated between those two extremes).x
- in grid cells.y
- in grid cells.c
- a character to be drawn in the foregroundforeground
- Color for the char being drawnbackground
- Color for the backgroundbackgroundLightness
- int between -255 and 255 , lower numbers are changed less, higher changed closer to the lighting colorpublic SquidLayers put(int x, int y, char c, com.badlogic.gdx.graphics.Color foreground, com.badlogic.gdx.graphics.Color background, int mixAmount, com.badlogic.gdx.graphics.Color mixBackground)
SquidPanel.getLightingColor()
, -255 will use the background as-is, and values in between will be
linearly interpolated between those two extremes).x
- in grid cells.y
- in grid cells.c
- a character to be drawn in the foregroundforeground
- Color for the char being drawnbackground
- Color for the backgroundmixAmount
- int between -255 and 255 , lower numbers are changed less, higher changed closer to mixBackgroundmixBackground
- Color to mix with the background, dependent on mixAmountpublic SquidLayers put(int x, int y, char c, float encodedForeground, float encodedBackground, int backgroundLightness)
SquidPanel.getLightingColor()
, -255 will use encodedBackground as-is, and values in between will be
linearly interpolated between those two extremes).x
- in grid cells.y
- in grid cells.c
- a character to be drawn in the foregroundencodedForeground
- float encoding the color for the char being drawnencodedBackground
- float encoding the color for the backgroundbackgroundLightness
- int between -255 and 255 , lower numbers are darker, higher lighter.public SquidLayers put(int x, int y, char c, float encodedForeground, float encodedBackground, int backgroundLightness, float mixBackground)
x
- in grid cells.y
- in grid cells.c
- a character to be drawn in the foregroundencodedForeground
- float encoding the color for the char being drawnencodedBackground
- float encoding the color for the backgroundbackgroundLightness
- int between -255 and 255 , lower numbers are darker, higher lighter.mixBackground
- float encoding a color to mix with the background instead of the normal lighting colorpublic SquidLayers put(int x, int y, char c, float encodedForeground, float encodedBackground, float backgroundLightness, float mixBackground)
x
- in grid cells.y
- in grid cells.c
- a character to be drawn in the foregroundencodedForeground
- float encoding the color for the char being drawnencodedBackground
- float encoding the color for the backgroundbackgroundLightness
- float between 0.0f and 1.0f (both inclusive); higher means closer to mixBackgroundmixBackground
- float encoding a color to mix with the background instead of the normal lighting colorpublic SquidLayers put(int x, int y, char[][] c)
public SquidLayers put(int x, int y, char[][] c, com.badlogic.gdx.graphics.Color[][] foreground, com.badlogic.gdx.graphics.Color[][] background)
public SquidLayers put(int x, int y, char[][] c, com.badlogic.gdx.graphics.Color[][] foregrounds, com.badlogic.gdx.graphics.Color[][] backgrounds, int[][] backgroundLightness)
SquidPanel.getLightingColor()
, -255 will use the background
as-is, and values in between will be linearly interpolated between those two extremes).x
- in grid cells.y
- in grid cells.c
- char[][] to be drawn in the foreground starting from x, yforegrounds
- Color[][] of colors for the char being drawnbackgrounds
- Color[][] of colors for the backgroundbackgroundLightness
- int[][] with elements between -255 and 255 , lower darker, higher lighter.public SquidLayers putInto(int layer, int x, int y, char c)
layer
- 0 or 1 for background, 2 for foreground, 3 or higher for extra layers added on.x
- in grid cells.y
- in grid cells.c
- char to be drawn in the foreground at x, ypublic SquidLayers putInto(int layer, int x, int y, char c, com.badlogic.gdx.graphics.Color color)
layer
- the layer to draw intox
- in grid cells.y
- in grid cells.c
- a character to be drawn in the specified layercolor
- Color for the char being drawnpublic SquidLayers putInto(int layer, int x, int y, char[][] c)
layer
- 0 or 1 for background, 2 for foreground, 3 or higher for extra layers added on.x
- in grid cells.y
- in grid cells.c
- char[][] to be drawn in the foreground starting from x, ypublic SquidLayers putInto(int layer, int x, int y, char[][] c, com.badlogic.gdx.graphics.Color[][] colors)
layer
- 0 or 1 for background, 2 for foreground, 3 or higher for extra layers added on.x
- in grid cells.y
- in grid cells.c
- char[][] to be drawn in the foreground starting from x, ycolors
- Color[][] that should have the same width and height as cpublic SquidLayers putString(int x, int y, java.lang.String s)
x
- in grid cells.y
- in grid cells.s
- the string to printpublic SquidLayers putString(int x, int y, java.lang.String s, com.badlogic.gdx.graphics.Color foreground)
x
- in grid cells.y
- in grid cells.s
- the string to printforeground
- the Color to usepublic SquidLayers putString(int x, int y, java.lang.String s, com.badlogic.gdx.graphics.Color foreground, com.badlogic.gdx.graphics.Color background)
x
- in grid cells.y
- in grid cells.s
- the string to printforeground
- the Color of the string's charsbackground
- the Color of the background of the stringpublic SquidLayers putBoxedString(int x, int y, java.lang.String s)
x
- in grid cells.y
- in grid cells.s
- the string to print inside the boxpublic SquidLayers highlight(int x, int y, int lightness)
x
- in grid cells.y
- in grid cells.lightness
- int between -255 and 255 , lower numbers are darker, higher lighter.public SquidLayers highlight(int x, int y, int[][] lightness)
x
- in grid cells.y
- in grid cells.lightness
- int[][] with elements between -255 and 255 , lower numbers are darker, higher lighter.public boolean hasValue(int x, int y)
' '
at the given position or has not
been assigned a value at that position, then this returns false, otherwise it returns true.x
- in grid cells.y
- in grid cells.public SquidLayers clear(int x, int y)
You may be looking for the erase() method, which erases all panels and all cells.
x
- in grid cellsy
- in grid cellspublic SquidLayers eraseLayer(int layer)
public SquidLayers erase()
public SquidLayers bump(int x, int y, int layer, squidpony.squidgrid.Direction dir, float duration)
public SquidLayers bump(AnimatedEntity ae, int layer, squidpony.squidgrid.Direction dir, float duration)
public SquidLayers bump(int x, int y, squidpony.squidgrid.Direction dir)
public SquidLayers bump(AnimatedEntity ae, squidpony.squidgrid.Direction dir)
public SquidLayers slide(AnimatedEntity ae, int endX, int endY, int layer, float duration)
public SquidLayers slide(int x, int y, int endX, int endY, int layer, float duration)
public SquidLayers slide(int x, int y, int endX, int endY)
public SquidLayers slide(AnimatedEntity ae, int endX, int endY)
public SquidLayers wiggle(int x, int y, int layer, float duration)
public SquidLayers wiggle(AnimatedEntity ae, int layer, float duration)
public SquidLayers wiggle(int x, int y)
public SquidLayers wiggle(AnimatedEntity ae)
public SquidLayers tint(int x, int y, com.badlogic.gdx.graphics.Color color, int layer, float duration)
public SquidLayers tint(AnimatedEntity ae, com.badlogic.gdx.graphics.Color color, int layer, float duration)
public SquidLayers tint(int x, int y, com.badlogic.gdx.graphics.Color color)
public SquidLayers tint(AnimatedEntity ae, com.badlogic.gdx.graphics.Color color)
public boolean hasActiveAnimations()
public AnimatedEntity directionMarker(int x, int y, com.badlogic.gdx.graphics.Color color, int layer, boolean doubleWidth)
public AnimatedEntity directionMarker(int x, int y, java.util.Collection<com.badlogic.gdx.graphics.Color> colors, float loopTime, int layer, boolean doubleWidth)
public AnimatedEntity animateActor(int x, int y, char c, com.badlogic.gdx.graphics.Color color, int layer)
public AnimatedEntity animateActor(int x, int y, char c, com.badlogic.gdx.graphics.Color color)
public AnimatedEntity animateActor(int x, int y, char c, com.badlogic.gdx.graphics.Color color, boolean doubleWidth)
public AnimatedEntity animateActor(int x, int y, char c, java.util.Collection<com.badlogic.gdx.graphics.Color> colors, boolean doubleWidth)
public AnimatedEntity animateActor(int x, int y, char c, java.util.Collection<com.badlogic.gdx.graphics.Color> colors, float loopTime, boolean doubleWidth)
public AnimatedEntity animateActor(int x, int y, java.lang.String s, com.badlogic.gdx.graphics.Color color, int layer)
public AnimatedEntity animateActor(int x, int y, java.lang.String s, com.badlogic.gdx.graphics.Color color, int layer, boolean doubleWidth)
public AnimatedEntity animateActor(int x, int y, com.badlogic.gdx.graphics.g2d.TextureRegion tr, com.badlogic.gdx.graphics.Color color, int layer)
public AnimatedEntity animateActor(int x, int y, com.badlogic.gdx.graphics.g2d.TextureRegion tr, com.badlogic.gdx.graphics.Color color, int layer, boolean doubleWidth, boolean stretch)
public AnimatedEntity animateActor(int x, int y, java.lang.String s, com.badlogic.gdx.graphics.Color color)
public AnimatedEntity animateActor(int x, int y, java.lang.String s, com.badlogic.gdx.graphics.Color color, boolean doubleWidth)
public AnimatedEntity animateActor(int x, int y, com.badlogic.gdx.graphics.g2d.TextureRegion tr, com.badlogic.gdx.graphics.Color color)
public AnimatedEntity animateActor(int x, int y, com.badlogic.gdx.graphics.g2d.TextureRegion tr, com.badlogic.gdx.graphics.Color color, boolean doubleWidth)
public AnimatedEntity animateActor(int x, int y, com.badlogic.gdx.graphics.g2d.TextureRegion tr, com.badlogic.gdx.graphics.Color color, boolean doubleWidth, boolean stretch)
public AnimatedEntity animateActor(int x, int y, com.badlogic.gdx.graphics.g2d.TextureRegion tr)
public AnimatedEntity animateActor(int x, int y, com.badlogic.gdx.graphics.g2d.TextureRegion tr, boolean doubleWidth)
public AnimatedEntity animateActor(int x, int y, com.badlogic.gdx.graphics.g2d.TextureRegion tr, boolean doubleWidth, boolean stretch)
public squidpony.squidmath.OrderedSet<AnimatedEntity> getAnimatedEntities(int layer)
public squidpony.squidmath.OrderedSet<AnimatedEntity> getAnimatedEntities()
public AnimatedEntity getAnimatedEntityByCell(int x, int y, int layer)
public void removeAnimatedEntity(AnimatedEntity ae, int layer)
public void removeAnimatedEntity(AnimatedEntity ae)
public AnimatedEntity getAnimatedEntityByCell(int x, int y)
public void removeAnimatedEntityByCell(int x, int y, int layer)
public void removeAnimatedEntityByCell(int x, int y)
public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)
draw
in class com.badlogic.gdx.scenes.scene2d.Group
public void drawActor(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha, AnimatedEntity ae, int layer)
public void drawActor(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha, AnimatedEntity ae)
public void setLightingColor(com.badlogic.gdx.graphics.Color lightingColor)
public com.badlogic.gdx.graphics.Color getLightingColor()
public void setPosition(float x, float y)
setPosition
in class com.badlogic.gdx.scenes.scene2d.Actor
x
- y
- public SquidPanel getLayer(int layer)
addExtraLayer()
.
If the layer is not found, this returns the foreground SquidPanel.layer
- 0 for background, 1 or 2 for foreground, 3 for any extra layers; defaults to foregroundpublic SquidPanel getForegroundLayer()
public void setForegroundLayer(SquidPanel panel)
SquidPanel.getTotalWidth()
and
SquidPanel.getTotalHeight()
of panel should almost always match this object's getTotalWidth()
and getTotalHeight()
, though there are good reasons why the cell sizes or text sizes might not match.
This method is probably most useful when you want a system of ImageSquidPanel
layers; as long as you have
the reference to an ImageSquidPanel outside this class, you can call its additional methods there and have it
affect panel
here.panel
- a SquidPanel, ImageSquidPanel, or other subclass of SquidPanel that should have identical sizepublic SquidPanel getBackgroundLayer()
public void setBackgroundLayer(SquidPanel panel)
SquidPanel.getTotalWidth()
and
SquidPanel.getTotalHeight()
of panel should almost always match this object's getTotalWidth()
and getTotalHeight()
, though there are good reasons why the cell sizes or text sizes might not match.
This method is probably most useful when you want a system of ImageSquidPanel
layers; as long as you have
the reference to an ImageSquidPanel outside this class, you can call its additional methods there and have it
affect panel
here.panel
- a SquidPanel, ImageSquidPanel, or other subclass of SquidPanel that should have identical sizepublic void setExtraPanel(SquidPanel panel, int index)
addExtraLayer()
; if index is invalid because it is negative, this does nothing. If index is higher
than the highest index for a layer, this will simply add panel
to the extra panels, possibly at an
earlier index (it will use the next available index, which could easily be 0 or 1). If index is valid, this sets
the extra panel at that index to panel
, without changes.
This does not do any validation of size, but the SquidPanel.getTotalWidth()
and
SquidPanel.getTotalHeight()
of panel should almost always match this object's getTotalWidth()
and getTotalHeight()
, though there are good reasons why the cell sizes or text sizes might not match.
This method is probably most useful when you want a system of ImageSquidPanel
layers; as long as you have
the reference to an ImageSquidPanel outside this class, you can call its additional methods there and have it
affect panel
here.panel
- a SquidPanel, ImageSquidPanel, or other subclass of SquidPanel that should have identical sizeindex
- the 0-based index into the extra panels list to try to assign panel to, or to append panel topublic void setFGColorCenter(squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> scc)
scc
- an IColorCenterpublic void setBGColorCenter(squidpony.IColorCenter<com.badlogic.gdx.graphics.Color> scc)
scc
- an IColorCenterpublic void setOffsets(float x, float y)
public int getGridOffsetX()
public int getGridOffsetY()
public void setGridOffsetX(int offset)
public void setGridOffsetY(int offset)
public int getTotalWidth()
public int getTotalHeight()
Copyright © Eben Howard 2012–2022. All rights reserved.