Class SquidPanel

java.lang.Object
com.badlogic.gdx.scenes.scene2d.Actor
com.badlogic.gdx.scenes.scene2d.Group
squidpony.squidgrid.gui.gdx.SquidPanel
All Implemented Interfaces:
com.badlogic.gdx.scenes.scene2d.utils.Cullable, IPackedColorPanel
Direct Known Subclasses:
ImageSquidPanel

public class SquidPanel
extends com.badlogic.gdx.scenes.scene2d.Group
implements IPackedColorPanel
Displays text and images in a grid pattern. Supports basic animations. Grid width and height settings are in terms of number of cells. Cell width and height are in terms of number of pixels. When text is placed, the background color is set separately from the foreground character. When moved, only the foreground character is moved.
Author:
Eben Howard - http://squidpony.com - howard@squidpony.com
  • Field Summary

    Fields 
    Modifier and Type Field Description
    OrderedSet<AnimatedEntity> animatedEntities  
    protected int animationCount  
    OrderedSet<com.badlogic.gdx.scenes.scene2d.Actor> autoActors  
    protected int cellHeight  
    protected int cellWidth  
    float[][] colors
    The 2D array of floats representing colors in a way that libGDX can efficiently use, ABGR-packed.
    char[][] contents
    The 2D array of chars that this will render, using x,y indexing.
    float DEFAULT_ANIMATION_DURATION  
    protected com.badlogic.gdx.graphics.Color defaultForeground  
    protected int gridHeight  
    protected int gridOffsetX  
    protected int gridOffsetY  
    protected int gridWidth  
    protected com.badlogic.gdx.graphics.Color lightingColor  
    protected float lightingFloat  
    boolean onlyRenderEven
    For thin-wall maps, where only cells where x and y are both even numbers have backgrounds displayed.
    protected IColorCenter<com.badlogic.gdx.graphics.Color> scc  
    protected TextCellFactory textFactory  
    protected com.badlogic.gdx.graphics.Color tmpColor  
    protected float xOffset  
    protected float yOffset  
  • Constructor Summary

    Constructors 
    Constructor Description
    SquidPanel​(int gridWidth, int gridHeight)
    Creates a bare-bones panel with all default values for text rendering.
    SquidPanel​(int gridWidth, int gridHeight, int cellWidth, int cellHeight)
    Creates a panel with the given grid and cell size.
    SquidPanel​(int gridWidth, int gridHeight, TextCellFactory factory)
    Builds a panel with the given grid size and all other parameters determined by the factory.
    SquidPanel​(int gridWidth, int gridHeight, TextCellFactory factory, IColorCenter<com.badlogic.gdx.graphics.Color> center)
    Builds a panel with the given grid size and all other parameters determined by the factory.
    SquidPanel​(int gridWidth, int gridHeight, TextCellFactory factory, IColorCenter<com.badlogic.gdx.graphics.Color> center, float xOffset, float yOffset)
    Builds a panel with the given grid size and all other parameters determined by the factory.
    SquidPanel​(int gridWidth, int gridHeight, TextCellFactory factory, IColorCenter<com.badlogic.gdx.graphics.Color> center, float xOffset, float yOffset, char[][] actualMap)
    Builds a panel with the given grid size and all other parameters determined by the factory.
  • Method Summary

    Modifier and Type Method Description
    float adjustX​(float x, boolean doubleWidth)  
    float adjustY​(float y)  
    AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, boolean stretch, com.badlogic.gdx.graphics.g2d.TextureRegion texture)
    Create an AnimatedEntity at position x, y, using a TextureRegion with no color modifications, which, if and only if stretch is true, will be stretched to fit one cell, or two cells if doubleWidth is true.
    AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, boolean stretch, com.badlogic.gdx.graphics.g2d.TextureRegion texture, com.badlogic.gdx.graphics.Color color)
    Create an AnimatedEntity at position x, y, using a TextureRegion with the given color, which, if and only if stretch is true, will be stretched to fit one cell, or two cells if doubleWidth is true.
    AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, char c, com.badlogic.gdx.graphics.Color color)
    Create an AnimatedEntity at position x, y, using the char c in the given color.
    AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, com.badlogic.gdx.graphics.g2d.TextureRegion texture)
    Create an AnimatedEntity at position x, y, using a TextureRegion with no color modifications, which will be stretched to fit one cell, or two cells if doubleWidth is true.
    AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, com.badlogic.gdx.graphics.g2d.TextureRegion texture, com.badlogic.gdx.graphics.Color color)
    Create an AnimatedEntity at position x, y, using a TextureRegion with the given color, which will be stretched to fit one cell, or two cells if doubleWidth is true.
    AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, com.badlogic.gdx.graphics.g2d.TextureRegion texture, Collection<com.badlogic.gdx.graphics.Color> colors)
    Create an AnimatedEntity at position x, y, using a TextureRegion with the given color, which will be stretched to fit one cell, or two cells if doubleWidth is true.
    AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, com.badlogic.gdx.graphics.g2d.TextureRegion texture, Collection<com.badlogic.gdx.graphics.Color> colors, float loopTime)
    Create an AnimatedEntity at position x, y, using a TextureRegion with the given color, which will be stretched to fit one cell, or two cells if doubleWidth is true.
    AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, String s, com.badlogic.gdx.graphics.Color color)
    Create an AnimatedEntity at position x, y, using the String s in the given color.
    AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, String s, Collection<com.badlogic.gdx.graphics.Color> colors)
    Create an AnimatedEntity at position x, y, using the String s in the given color.
    AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, String s, Collection<com.badlogic.gdx.graphics.Color> colors, float loopTime)
    Create an AnimatedEntity at position x, y, using the String s in the given color.
    AnimatedEntity animateActor​(int x, int y, char c, com.badlogic.gdx.graphics.Color color)
    Create an AnimatedEntity at position x, y, using the char c in the given color.
    AnimatedEntity animateActor​(int x, int y, com.badlogic.gdx.graphics.g2d.TextureRegion texture)
    Create an AnimatedEntity at position x, y, using a TextureRegion with no color modifications, which will be stretched to fit one cell.
    AnimatedEntity animateActor​(int x, int y, com.badlogic.gdx.graphics.g2d.TextureRegion texture, com.badlogic.gdx.graphics.Color color)
    Create an AnimatedEntity at position x, y, using a TextureRegion with the given color, which will be stretched to fit one cell.
    AnimatedEntity animateActor​(int x, int y, String s, com.badlogic.gdx.graphics.Color color)
    Create an AnimatedEntity at position x, y, using the String s in the given color.
    void blend​(int x, int y, float color, float mixBy)
    Using the existing 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​(int x, int y, Direction direction)
    Starts a bumping animation in the direction provided.
    void bump​(int x, int y, Direction direction, float duration)
    Start a bumping animation in the given direction that will last duration seconds.
    void bump​(AnimatedEntity ae, Direction direction, float duration)
    Start a bumping animation in the given direction that will last duration seconds.
    void bump​(Coord location, Direction direction)
    Starts a bumping animation in the direction provided.
    void burst​(float delay, int x, int y, int distance, boolean eightWay, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, boolean doubleWidth, float rotationStrength, float duration)
    Convenience method to produce an explosion, splash, or burst effect.
    void burst​(int x, int y, boolean eightWay, char glyph, com.badlogic.gdx.graphics.Color startColor, float duration)
    Convenience method to produce an explosion, splash, or burst effect.
    void burst​(int x, int y, boolean eightWay, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, boolean doubleWidth, float rotationStrength, float duration)
    Convenience method to produce an explosion, splash, or burst effect.
    void burst​(int x, int y, boolean eightWay, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, float duration)
    Convenience method to produce an explosion, splash, or burst effect.
    void burst​(int x, int y, boolean eightWay, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, float rotationStrength, float duration)
    Convenience method to produce an explosion, splash, or burst effect.
    void burst​(int x, int y, int distance, boolean eightWay, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, boolean doubleWidth, float rotationStrength, float duration)
    Convenience method to produce an explosion, splash, or burst effect.
    void burst​(int x, int y, int distance, boolean eightWay, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, float rotationStrength, float duration)
    Convenience method to produce an explosion, splash, or burst effect.
    int cellHeight()  
    TextCellFactory.Glyph cellToActor​(int x, int y)
    Created an Actor from the contents of the given x,y position on the grid.
    TextCellFactory.Glyph cellToActor​(int x, int y, boolean doubleWidth)
    Created an Actor from the contents of the given x,y position on the grid; deleting the grid's String content at this cell.
    int cellWidth()  
    protected float clampDuration​(float duration)  
    void clear​(int x, int y)
    Removes the contents of this cell, leaving a transparent space.
    protected TextCellFactory.Glyph createActor​(int x, int y, char name, float encodedColor, boolean doubleWidth)  
    protected TextCellFactory.Glyph createActor​(int x, int y, char name, com.badlogic.gdx.graphics.Color color, boolean doubleWidth)  
    AnimatedEntity directionMarker​(int x, int y, boolean doubleWidth, com.badlogic.gdx.graphics.Color color)  
    AnimatedEntity directionMarker​(int x, int y, boolean doubleWidth, Collection<com.badlogic.gdx.graphics.Color> colors, float loopTime)
    Create an AnimatedEntity at position x, y, using '^' as its contents, but as an image so it can be rotated.
    void draw​(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)
    Draws this SquidPanel and any autoActors it has, and calls Actor.act(float) for each AnimatedEntity this contains in animatedEntities or autoActors.
    void drawActor​(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha, com.badlogic.gdx.scenes.scene2d.Actor ac)
    Draws one AnimatedEntity, specifically the Actor it contains.
    void drawActor​(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha, AnimatedEntity ae)
    Draws one AnimatedEntity, specifically the Actor it contains.
    void erase()
    Erases the entire panel, leaving only a transparent space.
    void fade​(int x, int y, com.badlogic.gdx.graphics.Color color, float duration)
    Fade the cell at (x,y) to color.
    void fixPosition​(AnimatedEntity ae)  
    void fixPositions()  
    OrderedSet<AnimatedEntity> getAnimatedEntities()  
    AnimatedEntity getAnimatedEntityByCell​(int x, int y)  
    char getAt​(int x, int y)  
    com.badlogic.gdx.graphics.Color getColorAt​(int x, int y)  
    IColorCenter<com.badlogic.gdx.graphics.Color> getColorCenter()  
    com.badlogic.gdx.graphics.Color getDefaultForegroundColor()  
    int getGridHeight()
    The number of cells along the y-axis that will be rendered of this panel
    int getGridOffsetX()
    The X offset that the whole panel's internals will be rendered at.
    int getGridOffsetY()
    The Y offset that the whole panel's internals will be rendered at.
    int getGridWidth()
    The number of cells along the x-axis that will be rendered of this panel.
    com.badlogic.gdx.graphics.Color getLightingColor()  
    boolean getOnlyRenderEven()
    Gets the status of a boolean flag used for rendering thin maps; it will almost always be false unless it was set to true with setOnlyRenderEven(boolean).
    StringBuilder getSnapshot()
    Gets a "snapshot" of the data represented by this SquidPanel; stores the dimensions, the char data, and the color data in a way that can be set back to a SquidPanel using setFromSnapshot(String, int, int, int, int) or its overload that takes a StringBuilder.
    StringBuilder getSnapshot​(int startX, int startY, int width, int height)
    Gets a "snapshot" of the data represented by this SquidPanel; stores the dimensions, the char data, and the color data in a way that can be set back to a SquidPanel using setFromSnapshot(String, int, int, int, int) or its overload that takes a StringBuilder.
    TextCellFactory getTextCellFactory()  
    int getTotalHeight()
    Gets the total number of cells along the y-axis that this stores; this is usually equivalent to getGridHeight(), but not if the constructor SquidPanel(int, int, TextCellFactory, IColorCenter, float, float, char[][]) was used to set a larger-than-normal map.
    int getTotalWidth()
    Gets the total number of cells along the x-axis that this stores; this is usually equivalent to getGridWidth(), but not if the constructor SquidPanel(int, int, TextCellFactory, IColorCenter, float, float, char[][]) was used to set a larger-than-normal map.
    float getxOffset()  
    float getyOffset()  
    int gridHeight()  
    int gridWidth()  
    boolean hasActiveAnimations()  
    void put​(char[][] chars)
    Places the given characters into the grid starting at 0,0.
    void put​(char[][] chars, com.badlogic.gdx.graphics.Color[][] foregrounds)  
    void put​(int x, int y, char c)
    Puts the character c at (x, y).
    void put​(int xOffset, int yOffset, char[][] chars)  
    void put​(int xOffset, int yOffset, char[][] chars, com.badlogic.gdx.graphics.Color foreground)  
    void put​(int xOffset, int yOffset, char[][] chars, com.badlogic.gdx.graphics.Color[][] foregrounds)  
    void put​(int xOffset, int yOffset, char[][] chars, com.badlogic.gdx.graphics.Color foreground, float colorMultiplier)  
    void put​(int x, int y, char c, float encodedColor)
    Takes a unicode char for input.
    void put​(int x, int y, char c, float encodedColor, float colorMultiplier)
    Takes a unicode char for input and a color multiplier that determines how much of lightingColor will affect the given encodedColor.
    void put​(int x, int y, char c, float encodedColor, float colorMultiplier, float mixColor)
    Intended for colored lighting; takes a unicode char for input and a color multiplier that determines how much of mixColor will affect encodedColor.
    void put​(int x, int y, char c, com.badlogic.gdx.graphics.Color color)
    Takes a unicode char for input.
    void put​(int x, int y, char c, com.badlogic.gdx.graphics.Color color, float colorMultiplier)
    Puts the given character at position x, y, with its color determined by the given color interpolated with this SquidPanel's lightingColor (default is white light) by the amount specified by colorMultiplier (0.0 causes no change to the given color, 1.0 uses the lightingColor only, and anything between 0 and 1 will produce some tint to color, and probably cache the produced color in the IColorCenter this uses).
    void put​(int x, int y, char c, com.badlogic.gdx.graphics.Color color, float mixAmount, com.badlogic.gdx.graphics.Color mix)
    Puts the given character at position x, y, with its color determined by the given color interpolated with the given mix color by the amount specified by mixAmount (0.0 causes no change to the given color, 1.0 uses mix only, and anything between 0 and 1 will produce some tint to color, and probably cache the produced color in the IColorCenter this uses).
    void put​(int x, int y, float encodedColor)
    Places a full cell of color at the given x,y position; this may be used as a background or foreground, depending on the implementation.
    void put​(int x, int y, float encodedColor, float colorMultiplier)  
    void put​(int x, int y, float encodedColor, float colorMultiplier, float mixColor)  
    void put​(int x, int y, int code)
    Takes a unicode codepoint for input.
    void put​(int x, int y, int c, com.badlogic.gdx.graphics.Color color)  
    void put​(int x, int y, com.badlogic.gdx.graphics.Color color)
    Puts color at (x, y) (in the cell's entirety, i.e.
    void put​(int xOffset, int yOffset, com.badlogic.gdx.graphics.Color[][] foregrounds)  
    void put​(int x, int y, com.badlogic.gdx.graphics.Color color, float colorMultiplier)  
    void put​(int x, int y, com.badlogic.gdx.graphics.Color color, float mixAmount, com.badlogic.gdx.graphics.Color mix)  
    void put​(int xOffset, int yOffset, String string)
    Puts the given string horizontally with the first character at the given offset.
    void put​(int xOffset, int yOffset, String string, boolean vertical)
    Puts the given string horizontally or optionally vertically, with the first character at the given offset.
    void put​(int xOffset, int yOffset, String string, float encodedColor)  
    void put​(int xOffset, int yOffset, String string, float encodedColor, float colorMultiplier)  
    void put​(int xOffset, int yOffset, String string, com.badlogic.gdx.graphics.Color foreground)
    Puts the given string horizontally with the first character at the given offset.
    void put​(int xOffset, int yOffset, String string, com.badlogic.gdx.graphics.Color foreground, boolean vertical)
    Puts the given string horizontally or optionally vertically, with the first character at the given offset.
    void put​(int xOffset, int yOffset, String string, com.badlogic.gdx.graphics.Color foreground, float colorMultiplier)  
    void put​(int xOffset, int yOffset, String string, com.badlogic.gdx.graphics.Color foreground, Direction direction)
    Puts the given string in the chosen direction, with the first character shown (not necessarily the first in the string) at the given offset.
    void put​(int xOffset, int yOffset, 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 putBorders()
    Changes the chars at the edge of the SquidPanel to be a border drawn with box drawing characters in white.
    void putBorders​(float encodedColor)
    Changes the chars at the edge of the SquidPanel to be a border drawn with box drawing characters in the given color as a packed float.
    void putBorders​(float encodedColor, String caption)
    Changes the chars at the edge of the SquidPanel to be a border drawn with box drawing characters in the given color as a packed float.
    void putBorders​(com.badlogic.gdx.graphics.Color color)
    Changes the chars at the edge of the SquidPanel to be a border drawn with box drawing characters in the given Color, which will be run through any IColorCenter this has for filtering.
    void putBorders​(com.badlogic.gdx.graphics.Color color, String caption)
    Changes the chars at the edge of the SquidPanel to be a border drawn with box drawing characters in the given Color, which will be run through any IColorCenter this has for filtering.
    void putBordersCaptioned​(float encodedColor, IColoredString<com.badlogic.gdx.graphics.Color> caption)
    Changes the chars at the edge of the SquidPanel to be a border drawn with box drawing characters in the given color as a packed float.
    void putBordersCaptioned​(com.badlogic.gdx.graphics.Color color, IColoredString<com.badlogic.gdx.graphics.Color> caption)
    Changes the chars at the edge of the SquidPanel to be a border drawn with box drawing characters in the given libGDX Color.
    void recallActor​(com.badlogic.gdx.scenes.scene2d.Actor a, boolean restoreSym)  
    void recallActor​(com.badlogic.gdx.scenes.scene2d.Actor a, boolean restoreSym, int nextX, int nextY)  
    void recallActor​(AnimatedEntity ae)  
    void recallActor​(AnimatedEntity ae, int nextX, int nextY)  
    void recallActor​(TextCellFactory.Glyph a, boolean restoreSym, int nextX, int nextY)  
    void removeAnimatedEntity​(AnimatedEntity ae)  
    void setColorCenter​(IColorCenter<com.badlogic.gdx.graphics.Color> scc)
    Use this method if you use your own IColorCenter and want this panel not to allocate its own colors (or fill DefaultResources.getSCC() but instead to the provided center.
    void setDefaultForeground​(com.badlogic.gdx.graphics.Color defaultForeground)
    Sets the default foreground color.
    SquidPanel setFromSnapshot​(String snapshot)
    Given a "snapshot" from getSnapshot(int, int, int, int), this assigns the chars and colors in this SquidPanel from 0,0 (inclusive) up to the dimensions stored in the snapshot to match the snapshot's data.
    SquidPanel setFromSnapshot​(StringBuilder snapshot)
    Given a "snapshot" from getSnapshot(int, int, int, int), this assigns the chars and colors in this SquidPanel from 0,0 (inclusive) up to the dimensions stored in the snapshot to match the snapshot's data.
    SquidPanel setFromSnapshot​(StringBuilder snapshot, int putX, int putY)
    Given a "snapshot" from getSnapshot(int, int, int, int), this assigns the chars and colors in this SquidPanel from the position given by putX,putY (inclusive) up to the dimensions stored in the snapshot (considering putX and putY as offsets) so they have the values stored in the snapshot.
    SquidPanel setFromSnapshot​(StringBuilder snapshot, int putX, int putY, int limitWidth, int limitHeight)
    Given a "snapshot" from getSnapshot(int, int, int, int), this assigns the chars and colors in this SquidPanel from the position given by putX,putY (inclusive) to putX+limitWidth,putY+limitHeight (exclusive) so they have the values stored in the snapshot.
    SquidPanel setFromSnapshot​(String snapshot, int putX, int putY)
    Given a "snapshot" from getSnapshot(int, int, int, int), this assigns the chars and colors in this SquidPanel from the position given by putX,putY (inclusive) up to the dimensions stored in the snapshot (considering putX and putY as offsets) so they have the values stored in the snapshot.
    SquidPanel setFromSnapshot​(String snapshot, int putX, int putY, int limitWidth, int limitHeight)
    Given a "snapshot" from getSnapshot(int, int, int, int), this assigns the chars and colors in this SquidPanel from the position given by putX,putY (inclusive) to putX+limitWidth,putY+limitHeight (exclusive) so they have the values stored in the snapshot.
    void setGridHeight​(int gridHeight)
    Sets the number of cells along the y-axis that will be rendered of this panel to gridHeight.
    void setGridOffsetX​(int gridOffsetX)
    Sets the X offset that the whole panel's internals will be rendered at.
    void setGridOffsetY​(int gridOffsetY)
    Sets the Y offset that the whole panel's internals will be rendered at.
    void setGridWidth​(int gridWidth)
    Sets the number of cells along the x-axis that will be rendered of this panel to gridWidth.
    void setLightingColor​(com.badlogic.gdx.graphics.Color lightingColor)  
    void setOffsets​(float x, float y)  
    void setOffsetX​(float xOffset)  
    void setOffsetY​(float yOffset)  
    void setOnlyRenderEven​(boolean onlyRenderEven)
    Sets the status of a boolean flag used for rendering thin maps; it should almost always be the default, which is false, unless you are using a thin-wall map, and then this should be true only if this SquidPanel is used for the background layer.
    void setPosition​(float x, float y)
    Sets the position of the actor's bottom left corner.
    SquidPanel setTextSize​(float wide, float high)
    Sets the size of the text in this SquidPanel (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).
    void slide​(int x, int y, int newX, int newY, float duration)
    Start a movement animation for the object at the grid location x, y and moves it to newX, newY over a number of seconds given by duration (often 0.12f or somewhere around there).
    void slide​(int x, int y, String name, com.badlogic.gdx.graphics.Color color, int newX, int newY, float duration)
    Slides name from (x,y) to (newx, newy).
    void slide​(int x, int y, String name, com.badlogic.gdx.graphics.Color color, int newX, int newY, float duration, Runnable postRunnable)
    Slides name from (x,y) to (newx, newy).
    void slide​(AnimatedEntity ae, int newX, int newY, float duration)
    Start a movement animation for the object at the grid location x, y and moves it to newX, newY over a number of seconds given by duration (often 0.12f or somewhere around there).
    void slide​(Coord start, Direction direction)
    Starts a movement animation for the object at the given grid location at the default speed for one grid square in the direction provided.
    void slide​(Coord start, Coord end)
    Starts a movement animation for the object at the given grid location at the default speed.
    void slide​(Coord start, Coord end, float duration)
    Starts a sliding movement animation for the object at the given location at the provided speed.
    void summon​(float delay, int startX, int startY, int endX, int endY, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, boolean doubleWidth, float startRotation, float endRotation, float duration)
    Create a new Actor at (startX, startY) that looks like glyph but can rotate, and immediately starts changing color from startColor to endColor, changing position so it ends on the cell (endX, endY), and changing rotation from startRotation to endRotation, taking duration seconds to complete before removing the Actor.
    void summon​(int x, int y, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, float startRotation, float endRotation, float duration)
    Create a new Actor at (x, y) that looks like glyph but can rotate, and immediately starts changing color from startColor to endColor and changing rotation from startRotation to endRotation, taking duration seconds to complete before removing the Actor.
    void summon​(int startX, int startY, int endX, int endY, char glyph, com.badlogic.gdx.graphics.Color color, float startRotation, float endRotation, float duration)
    Create a new Actor at (startX, startY) that looks like glyph but can rotate, sets its color, and immediately starts changing position so it ends on the cell (endX, endY) and changing rotation from startRotation to endRotation, taking duration seconds to complete before removing the Actor.
    void summon​(int startX, int startY, int endX, int endY, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, boolean doubleWidth, float startRotation, float endRotation, float duration)
    Create a new Actor at (startX, startY) that looks like glyph but can rotate, and immediately starts changing color from startColor to endColor, changing position so it ends on the cell (endX, endY), and changing rotation from startRotation to endRotation, taking duration seconds to complete before removing the Actor.
    void summon​(int startX, int startY, int endX, int endY, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, float rotation, float duration)
    Create a new Actor at (startX, startY) that looks like glyph but has the given rotation, and immediately starts changing color from startColor to endColor, and changing position so it ends on the cell (endX, endY), taking duration seconds to complete before removing the Actor.
    void summon​(int startX, int startY, int endX, int endY, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, float startRotation, float endRotation, float duration)
    Create a new Actor at (startX, startY) that looks like glyph but can rotate, and immediately starts changing color from startColor to endColor, changing position so it ends on the cell (endX, endY), and changing rotation from startRotation to endRotation, taking duration seconds to complete before removing the Actor.
    void tint​(float delay, int x, int y, com.badlogic.gdx.graphics.Color color, float duration)
    Like tint(int, int, Color, float), but waits for delay (in seconds) before performing it.
    void tint​(float delay, int x, int y, com.badlogic.gdx.graphics.Color color, float duration, Runnable postRunnable)
    Like tint(int, int, Color, float), but waits for delay (in seconds) before performing it.
    void tint​(int x, int y, com.badlogic.gdx.graphics.Color color, float duration)
    Starts a tint animation for the object at (x,y) for the given duration (in seconds).
    void tint​(AnimatedEntity ae, com.badlogic.gdx.graphics.Color color, float duration)
    Starts a tint animation for ae for the given duration in seconds.
    void wiggle​(int x, int y, float duration)
    Starts an wiggling animation for the object at the given location for the given duration in seconds.
    void wiggle​(AnimatedEntity ae, float duration)
    Starts an wiggling animation for the object at the given location for the given duration in seconds.
    float worldX​(int gridX, boolean doubleWidth)
    Used internally to go between grid positions and world positions.
    float worldY​(int gridY)
    Used internally to go between grid positions and world positions.

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

    act, addActor, addActorAfter, addActorAt, addActorBefore, applyTransform, applyTransform, childrenChanged, clear, 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

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

    addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, 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, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, sizeChanged, stageToLocalCoordinates, toBack, toFront

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • SquidPanel

      public SquidPanel​(int gridWidth, int gridHeight)
      Creates a bare-bones panel with all default values for text rendering.
      This uses a default font that is not supplied in the JAR library of SquidLib; you need two files to use it if it does not render correctly:
      • https://github.com/SquidPony/SquidLib/blob/master/assets/Zodiac-Square-12x12.fnt
      • https://github.com/SquidPony/SquidLib/blob/master/assets/Zodiac-Square-12x12.png
      Parameters:
      gridWidth - the number of cells horizontally
      gridHeight - the number of cells vertically
    • SquidPanel

      public SquidPanel​(int gridWidth, int gridHeight, int cellWidth, int cellHeight)
      Creates a panel with the given grid and cell size. Uses a default square font.
      This uses a default font that is not supplied in the JAR library of SquidLib; you need two files to use it if it does not render correctly:
      • https://github.com/SquidPony/SquidLib/blob/master/assets/Zodiac-Square-12x12.fnt
      • https://github.com/SquidPony/SquidLib/blob/master/assets/Zodiac-Square-12x12.png
      Parameters:
      gridWidth - the number of cells horizontally
      gridHeight - the number of cells vertically
      cellWidth - the number of horizontal pixels in each cell
      cellHeight - the number of vertical pixels in each cell
    • SquidPanel

      public SquidPanel​(int gridWidth, int gridHeight, TextCellFactory factory)
      Builds a panel with the given grid size and all other parameters determined by the factory. Even if sprite images are being used, a TextCellFactory is still needed to perform sizing and other utility functions. If the TextCellFactory has not yet been initialized, then it will be sized at 12x12 px per cell. If it is null then a default one will be created and initialized.
      Parameters:
      gridWidth - the number of cells horizontally
      gridHeight - the number of cells vertically
      factory - the factory to use for cell rendering
    • SquidPanel

      public SquidPanel​(int gridWidth, int gridHeight, TextCellFactory factory, IColorCenter<com.badlogic.gdx.graphics.Color> center)
      Builds a panel with the given grid size and all other parameters determined by the factory. Even if sprite images are being used, a TextCellFactory is still needed to perform sizing and other utility functions. If the TextCellFactory has not yet been initialized, then it will be sized at 12x12 px per cell. If it is null then a default one will be created and initialized.
      Parameters:
      gridWidth - the number of cells horizontally
      gridHeight - the number of cells vertically
      factory - the factory to use for cell rendering
      center - the color center to use. Can be null, which will use a default
    • SquidPanel

      public SquidPanel​(int gridWidth, int gridHeight, TextCellFactory factory, IColorCenter<com.badlogic.gdx.graphics.Color> center, float xOffset, float yOffset)
      Builds a panel with the given grid size and all other parameters determined by the factory. Even if sprite images are being used, a TextCellFactory is still needed to perform sizing and other utility functions.
      If the TextCellFactory has not yet been initialized, then it will be sized at 12x12 px per cell. If it is null then a default one will be created and initialized. The xOffset and yOffset arguments are measured in pixels or whatever sub-cell unit of measure your game uses (world coordinates, in libGDX parlance), and change where the SquidPanel starts drawing by simply adding to the initial x and y coordinates. 0 and 0 are usually fine.
      Parameters:
      gridWidth - the number of cells horizontally
      gridHeight - the number of cells vertically
      factory - the factory to use for cell rendering
      center - the color center to use. Can be null, which will use a default
      xOffset - the x offset to start rendering at, in pixels (or some other sub-cell measurement your game uses)
      yOffset - the y offset to start rendering at, in pixels (or some other sub-cell measurement your game uses)
    • SquidPanel

      public SquidPanel​(int gridWidth, int gridHeight, TextCellFactory factory, IColorCenter<com.badlogic.gdx.graphics.Color> center, float xOffset, float yOffset, char[][] actualMap)
      Builds a panel with the given grid size and all other parameters determined by the factory. Even if sprite images are being used, a TextCellFactory is still needed to perform sizing and other utility functions. Importantly, this constructor takes a 2D char array argument that can be sized differently than the displayed area. The displayed area is gridWidth by gridHeight in cells, but the actualMap argument can be much larger, and only a portion will be displayed at a time. This requires some special work with the Camera and Viewports to get working correctly; in the squidlib module's examples, EverythingDemo may be a good place to see how this can be done. You can pass null for actualMap, which will simply create a char array to use internally that is exactly gridWidth by gridHeight, in cells.
      If the TextCellFactory has not yet been initialized, then it will be sized at 12x12 px per cell. If it is null then a default one will be created and initialized. The xOffset and yOffset arguments are measured in pixels or whatever sub-cell unit of measure your game uses (world coordinates, in libGDX parlance), and change where the SquidPanel starts drawing by simply adding to the initial x and y coordinates. 0 and 0 are usually fine.
      Parameters:
      gridWidth - the number of cells horizontally
      gridHeight - the number of cells vertically
      factory - the factory to use for cell rendering
      center - the color center to use. Can be null, which will use a default
      xOffset - the x offset to start rendering at, in pixels (or some other sub-cell measurement your game uses)
      yOffset - the y offset to start rendering at, in pixels (or some other sub-cell measurement your game uses)
      actualMap - will often be a different size than gridWidth by gridHeight, which enables camera scrolling
  • Method Details

    • put

      public void put​(char[][] chars)
      Places the given characters into the grid starting at 0,0.
      Parameters:
      chars -
    • put

      public void put​(char[][] chars, com.badlogic.gdx.graphics.Color[][] foregrounds)
      Specified by:
      put in interface IPackedColorPanel
      Parameters:
      chars - Can be null, indicating that only colors must be put.
    • put

      public void put​(int xOffset, int yOffset, char[][] chars)
    • put

      public void put​(int xOffset, int yOffset, char[][] chars, com.badlogic.gdx.graphics.Color[][] foregrounds)
    • put

      public void put​(int xOffset, int yOffset, com.badlogic.gdx.graphics.Color[][] foregrounds)
    • put

      public void put​(int xOffset, int yOffset, char[][] chars, com.badlogic.gdx.graphics.Color foreground)
    • put

      public void put​(int xOffset, int yOffset, String string)
      Puts the given string horizontally with the first character at the given offset. 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. Will use the default color for this component to draw the characters.
      Parameters:
      xOffset - the x coordinate of the first character
      yOffset - the y coordinate of the first character
      string - the characters to be displayed
    • put

      public void put​(int xOffset, int yOffset, IColoredString<? extends com.badlogic.gdx.graphics.Color> cs)
      Description copied from interface: IPackedColorPanel
      Puts the given string horizontally with the first character at the given offset, using the colors that cs provides. 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.
      Specified by:
      put in interface IPackedColorPanel
      Parameters:
      xOffset - the x coordinate of the first character
      yOffset - the y coordinate of the first character
      cs - The string to display, with its colors.
    • put

      public void put​(int xOffset, int yOffset, String string, com.badlogic.gdx.graphics.Color foreground)
      Description copied from interface: IPackedColorPanel
      Puts the given string horizontally with the first character at the given offset. 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.
      Specified by:
      put in interface IPackedColorPanel
      Parameters:
      xOffset - the x coordinate of the first character
      yOffset - the y coordinate of the first character
      string - the characters to be displayed
      foreground - the color to draw the characters
    • put

      public void put​(int xOffset, int yOffset, String string, float encodedColor)
    • put

      public void put​(int xOffset, int yOffset, String string, com.badlogic.gdx.graphics.Color foreground, float colorMultiplier)
    • put

      public void put​(int xOffset, int yOffset, String string, float encodedColor, float colorMultiplier)
    • put

      public void put​(int xOffset, int yOffset, char[][] chars, com.badlogic.gdx.graphics.Color foreground, float colorMultiplier)
    • put

      public void put​(int xOffset, int yOffset, String string, boolean vertical)
      Puts the given string horizontally or optionally vertically, with the first character at the given offset. 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. Will use the default color for this component to draw the characters.
      Parameters:
      xOffset - the x coordinate of the first character
      yOffset - the y coordinate of the first character
      string - the characters to be displayed
      vertical - true if the text should be written vertically, from top to bottom
    • put

      public void put​(int xOffset, int yOffset, String string, com.badlogic.gdx.graphics.Color foreground, boolean vertical)
      Puts the given string horizontally or optionally vertically, with the first character at the given offset. 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.
      Parameters:
      xOffset - the x coordinate of the first character
      yOffset - the y coordinate of the first character
      string - the characters to be displayed
      foreground - the color to draw the characters
      vertical - true if the text should be written vertically, from top to bottom
    • put

      public void put​(int xOffset, int yOffset, String string, com.badlogic.gdx.graphics.Color foreground, Direction direction)
      Puts the given string in the chosen direction, with the first character shown (not necessarily the first in the string) at the given offset. If you use Direction.LEFT, then this effectively reverses the String and prints it with the last character of the String at the minimum-x position, which is the same position that the first character would be if you printed normally or if you gave this RIGHT (x is xOffset, y is yOffset). Giving UP acts similarly to LEFT, but has the last character at the minimum-y position and has the first character below it. The diagonals act as you would expect, combining the behavior of one of UP or DOWN with one of LEFT or RIGHT.
      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.
      Parameters:
      xOffset - the x coordinate of the first character
      yOffset - the y coordinate of the first character
      string - the characters to be displayed
      foreground - the color to draw the characters
      direction - the direction the text should be written in, such as Direction.RIGHT for normal layout
    • putBorders

      public void putBorders()
      Changes the chars at the edge of the SquidPanel to be a border drawn with box drawing characters in white.
    • putBorders

      public void putBorders​(com.badlogic.gdx.graphics.Color color, String caption)
      Changes the chars at the edge of the SquidPanel to be a border drawn with box drawing characters in the given Color, which will be run through any IColorCenter this has for filtering. If caption is non-null, then this puts that String starting at x=1, y=0.
      Parameters:
      color - a libGDX Color to use for the borders
      caption - an optional caption that will be drawn at (1, 0). May be null.
      See Also:
      Another method that takes an IColoredString caption
    • putBorders

      public void putBorders​(com.badlogic.gdx.graphics.Color color)
      Changes the chars at the edge of the SquidPanel to be a border drawn with box drawing characters in the given Color, which will be run through any IColorCenter this has for filtering.
      Parameters:
      color - a libGDX Color to use for the borders
    • putBorders

      public void putBorders​(float encodedColor)
      Changes the chars at the edge of the SquidPanel to be a border drawn with box drawing characters in the given color as a packed float.
      Parameters:
      encodedColor - a packed float color to use for the borders, as from Color.toFloatBits()
    • putBorders

      public void putBorders​(float encodedColor, String caption)
      Changes the chars at the edge of the SquidPanel to be a border drawn with box drawing characters in the given color as a packed float. If caption is non-null, then this puts that String starting at x=1, y=0.
      Parameters:
      encodedColor - a packed float color to use for the borders, as from Color.toFloatBits()
      caption - an optional caption that will be drawn at (1, 0). May be null to have no caption.
      See Also:
      Another method that takes an IColoredString caption
    • putBordersCaptioned

      public void putBordersCaptioned​(com.badlogic.gdx.graphics.Color color, IColoredString<com.badlogic.gdx.graphics.Color> caption)
      Changes the chars at the edge of the SquidPanel to be a border drawn with box drawing characters in the given libGDX Color. If caption is non-null, then this puts that IColoredString starting at x=1, y=0.
      Parameters:
      color - a libGDX Color to use for the borders
      caption - an optional caption as an IColoredString that will be drawn at (1, 0). May be null to have no caption. Will be colored independently from the border lines.
    • putBordersCaptioned

      public void putBordersCaptioned​(float encodedColor, IColoredString<com.badlogic.gdx.graphics.Color> caption)
      Changes the chars at the edge of the SquidPanel to be a border drawn with box drawing characters in the given color as a packed float. If caption is non-null, then this puts that IColoredString starting at x=1, y=0.
      Parameters:
      encodedColor - a packed float color to use for the borders, as from Color.toFloatBits()
      caption - an optional caption as an IColoredString that will be drawn at (1, 0). May be null to have no caption. Will be colored independently from the border lines.
    • erase

      public void erase()
      Erases the entire panel, leaving only a transparent space.
    • clear

      public void clear​(int x, int y)
      Description copied from interface: IPackedColorPanel
      Removes the contents of this cell, leaving a transparent space.
      Specified by:
      clear in interface IPackedColorPanel
    • put

      public void put​(int x, int y, com.badlogic.gdx.graphics.Color color)
      Description copied from interface: IPackedColorPanel
      Puts color at (x, y) (in the cell's entirety, i.e. in the background).
      Specified by:
      put in interface IPackedColorPanel
    • put

      public void put​(int x, int y, float encodedColor)
      Description copied from interface: IPackedColorPanel
      Places a full cell of color at the given x,y position; this may be used as a background or foreground, depending on the implementation. The color is given as a packed float, the kind produced by Color.toFloatBits(). If the implementation performs color filtering on Color objects, it generally won't on packed float colors.
      Specified by:
      put in interface IPackedColorPanel
      Parameters:
      x - x position of the cell
      y - y position of the cell
      encodedColor - color for the full cell as a packed float, as made by Color.toFloatBits()
    • put

      public void put​(int x, int y, float encodedColor, float colorMultiplier)
    • put

      public void put​(int x, int y, float encodedColor, float colorMultiplier, float mixColor)
    • blend

      public void blend​(int x, int y, float color, float mixBy)
      Description copied from interface: IPackedColorPanel
      Using the existing 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).
      Specified by:
      blend in interface IPackedColorPanel
      Parameters:
      x - the x component of the position in this panel to draw the starting color from
      y - the y component of the position in this panel to draw the starting color from
      color - 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)
    • put

      public void put​(int x, int y, com.badlogic.gdx.graphics.Color color, float colorMultiplier)
    • put

      public void put​(int x, int y, com.badlogic.gdx.graphics.Color color, float mixAmount, com.badlogic.gdx.graphics.Color mix)
    • put

      public void put​(int x, int y, char c)
      Description copied from interface: IPackedColorPanel
      Puts the character c at (x, y).
      Specified by:
      put in interface IPackedColorPanel
    • put

      public void put​(int x, int y, int code)
      Takes a unicode codepoint for input.
      Parameters:
      x -
      y -
      code -
    • put

      public void put​(int x, int y, int c, com.badlogic.gdx.graphics.Color color)
    • put

      public void put​(int x, int y, char c, com.badlogic.gdx.graphics.Color color)
      Takes a unicode char for input.
      Specified by:
      put in interface IPackedColorPanel
      Parameters:
      x -
      y -
      c -
      color -
    • put

      public void put​(int x, int y, char c, float encodedColor)
      Takes a unicode char for input.
      Specified by:
      put in interface IPackedColorPanel
      Parameters:
      x -
      y -
      c -
      encodedColor - a float color as produced by SColor.floatGet(float, float, float, float)
    • put

      public void put​(int x, int y, char c, float encodedColor, float colorMultiplier)
      Takes a unicode char for input and a color multiplier that determines how much of lightingColor will affect the given encodedColor. The encodedColor is a float that might be produced by Color.toFloatBits() or by mixing multiple such floats with SColor.lerpFloatColors(float, float, float).
      Parameters:
      x -
      y -
      c -
      encodedColor - a float color as produced by SColor.floatGet(float, float, float, float)
      colorMultiplier - how much of lightingColor to use in place of encodedColor, from 0.0 to 1.0
    • put

      public void put​(int x, int y, char c, float encodedColor, float colorMultiplier, float mixColor)
      Intended for colored lighting; takes a unicode char for input and a color multiplier that determines how much of mixColor will affect encodedColor. Both encodedColor and mixColor are floats that might be produced by Color.toFloatBits() or by mixing multiple such floats with SColor.lerpFloatColors(float, float, float); colorMultiplier is a normal float between 0.0f and 1.0f .
      Parameters:
      x -
      y -
      c -
      encodedColor - a float color as produced by SColor.floatGet(float, float, float, float)
      colorMultiplier - how much of mixColor to use in place of encodedColor, from 0.0 to 1.0
      mixColor - a color to mix with encodedColor, typically as part of colored lighting
    • put

      public void put​(int x, int y, char c, com.badlogic.gdx.graphics.Color color, float colorMultiplier)
      Puts the given character at position x, y, with its color determined by the given color interpolated with this SquidPanel's lightingColor (default is white light) by the amount specified by colorMultiplier (0.0 causes no change to the given color, 1.0 uses the lightingColor only, and anything between 0 and 1 will produce some tint to color, and probably cache the produced color in the IColorCenter this uses).
    • put

      public void put​(int x, int y, char c, com.badlogic.gdx.graphics.Color color, float mixAmount, com.badlogic.gdx.graphics.Color mix)
      Puts the given character at position x, y, with its color determined by the given color interpolated with the given mix color by the amount specified by mixAmount (0.0 causes no change to the given color, 1.0 uses mix only, and anything between 0 and 1 will produce some tint to color, and probably cache the produced color in the IColorCenter this uses).
      Note, unlike put(int, int, char, float, float, float), this will use the IColorCenter to produce the finished color, which may be slightly slower if you don't need any of IColorCenter's features, and will use more memory if many colors are cached, but has the advantage of being able to adjust colors with filters.
    • cellWidth

      public int cellWidth()
      Specified by:
      cellWidth in interface IPackedColorPanel
      Returns:
      The width of a cell, in number of pixels.
    • cellHeight

      public int cellHeight()
      Specified by:
      cellHeight in interface IPackedColorPanel
      Returns:
      The height of a cell, in number of pixels.
    • gridHeight

      public int gridHeight()
      Specified by:
      gridHeight in interface IPackedColorPanel
      Returns:
      The number of cells that this panel spans, vertically.
    • gridWidth

      public int gridWidth()
      Specified by:
      gridWidth in interface IPackedColorPanel
      Returns:
      The number of cells that this panel spans, horizontally.
    • getTextCellFactory

      Returns:
      The TextCellFactory backing this.
    • setTextSize

      public SquidPanel setTextSize​(float wide, float high)
      Sets the size of the text in this SquidPanel (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).
      Parameters:
      wide - the width of a glyph in pixels
      high - the height of a glyph in pixels
      Returns:
      this for chaining
    • draw

      public void draw​(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)
      Draws this SquidPanel and any autoActors it has, and calls Actor.act(float) for each AnimatedEntity this contains in animatedEntities or autoActors.
      This will set the shader of 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.
      Overrides:
      draw in class com.badlogic.gdx.scenes.scene2d.Group
      Parameters:
      batch - a Batch such as a FilterBatch that must be between a begin() and end() call; usually done by Stage
      parentAlpha - only used when drawing children of this SquidPanel
    • drawActor

      public void drawActor​(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha, AnimatedEntity ae)
      Draws one AnimatedEntity, specifically the Actor it contains. Batch must be between start() and end()
      Parameters:
      batch - Must have start() called already but not stop() yet during this frame.
      parentAlpha - This can be assumed to be 1.0f if you don't know it
      ae - The AnimatedEntity to draw; the position to draw ae is stored inside it.
    • drawActor

      public void drawActor​(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha, com.badlogic.gdx.scenes.scene2d.Actor ac)
      Draws one AnimatedEntity, specifically the Actor it contains. Batch must be between start() and end()
      Parameters:
      batch - Must have start() called already but not stop() yet during this frame.
      parentAlpha - This can be assumed to be 1.0f if you don't know it
      ac - The Actor to draw; the position to draw ac is modified and reset based on some fields of this object
    • setDefaultForeground

      public void setDefaultForeground​(com.badlogic.gdx.graphics.Color defaultForeground)
      Description copied from interface: IPackedColorPanel
      Sets the default foreground color.
      Specified by:
      setDefaultForeground in interface IPackedColorPanel
    • getDefaultForegroundColor

      public com.badlogic.gdx.graphics.Color getDefaultForegroundColor()
      Specified by:
      getDefaultForegroundColor in interface IPackedColorPanel
      Returns:
      The default foreground color (if none was set with IPackedColorPanel.setDefaultForeground(Color)), or the last color set with IPackedColorPanel.setDefaultForeground(Color). Cannot be null.
    • getAnimatedEntityByCell

      public AnimatedEntity getAnimatedEntityByCell​(int x, int y)
    • animateActor

      public AnimatedEntity animateActor​(int x, int y, char c, com.badlogic.gdx.graphics.Color color)
      Create an AnimatedEntity at position x, y, using the char c in the given color.
      Parameters:
      x -
      y -
      c -
      color -
      Returns:
    • animateActor

      public AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, char c, com.badlogic.gdx.graphics.Color color)
      Create an AnimatedEntity at position x, y, using the char c in the given color. If doubleWidth is true, treats the char c as the left char to be placed in a grid of 2-char cells.
      Parameters:
      x -
      y -
      doubleWidth -
      c -
      color -
      Returns:
    • animateActor

      public AnimatedEntity animateActor​(int x, int y, String s, com.badlogic.gdx.graphics.Color color)
      Create an AnimatedEntity at position x, y, using the String s in the given color.
      Parameters:
      x -
      y -
      s -
      color -
      Returns:
    • animateActor

      public AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, String s, com.badlogic.gdx.graphics.Color color)
      Create an AnimatedEntity at position x, y, using the String s in the given color. If doubleWidth is true, treats the String s as starting in the left cell of a pair to be placed in a grid of 2-char cells.
      Parameters:
      x -
      y -
      doubleWidth -
      s -
      color -
      Returns:
    • animateActor

      public AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, String s, Collection<com.badlogic.gdx.graphics.Color> colors)
      Create an AnimatedEntity at position x, y, using the String s in the given color. If doubleWidth is true, treats the String s as starting in the left cell of a pair to be placed in a grid of 2-char cells.
      Parameters:
      x -
      y -
      doubleWidth -
      s -
      colors -
      Returns:
    • animateActor

      public AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, String s, Collection<com.badlogic.gdx.graphics.Color> colors, float loopTime)
      Create an AnimatedEntity at position x, y, using the String s in the given color. If doubleWidth is true, treats the String s as starting in the left cell of a pair to be placed in a grid of 2-char cells.
      Parameters:
      x -
      y -
      doubleWidth -
      s -
      colors -
      loopTime -
      Returns:
    • directionMarker

      public AnimatedEntity directionMarker​(int x, int y, boolean doubleWidth, Collection<com.badlogic.gdx.graphics.Color> colors, float loopTime)
      Create an AnimatedEntity at position x, y, using '^' as its contents, but as an image so it can be rotated. Uses the given colors in a looping pattern, that doesn't count as an animation. If doubleWidth is true, treats the '^' as starting in the middle of a 2-char cell.
      Parameters:
      x -
      y -
      doubleWidth -
      colors -
      loopTime -
      Returns:
    • directionMarker

      public AnimatedEntity directionMarker​(int x, int y, boolean doubleWidth, com.badlogic.gdx.graphics.Color color)
    • animateActor

      public AnimatedEntity animateActor​(int x, int y, com.badlogic.gdx.graphics.g2d.TextureRegion texture)
      Create an AnimatedEntity at position x, y, using a TextureRegion with no color modifications, which will be stretched to fit one cell.
      Parameters:
      x -
      y -
      texture -
      Returns:
    • animateActor

      public AnimatedEntity animateActor​(int x, int y, com.badlogic.gdx.graphics.g2d.TextureRegion texture, com.badlogic.gdx.graphics.Color color)
      Create an AnimatedEntity at position x, y, using a TextureRegion with the given color, which will be stretched to fit one cell.
      Parameters:
      x -
      y -
      texture -
      color -
      Returns:
    • animateActor

      public AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, com.badlogic.gdx.graphics.g2d.TextureRegion texture)
      Create an AnimatedEntity at position x, y, using a TextureRegion with no color modifications, which will be stretched to fit one cell, or two cells if doubleWidth is true.
      Parameters:
      x -
      y -
      doubleWidth -
      texture -
      Returns:
    • animateActor

      public AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, com.badlogic.gdx.graphics.g2d.TextureRegion texture, com.badlogic.gdx.graphics.Color color)
      Create an AnimatedEntity at position x, y, using a TextureRegion with the given color, which will be stretched to fit one cell, or two cells if doubleWidth is true.
      Parameters:
      x -
      y -
      doubleWidth -
      texture -
      color -
      Returns:
    • animateActor

      public AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, com.badlogic.gdx.graphics.g2d.TextureRegion texture, Collection<com.badlogic.gdx.graphics.Color> colors)
      Create an AnimatedEntity at position x, y, using a TextureRegion with the given color, which will be stretched to fit one cell, or two cells if doubleWidth is true.
      Parameters:
      x -
      y -
      doubleWidth -
      texture -
      colors -
      Returns:
    • animateActor

      public AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, com.badlogic.gdx.graphics.g2d.TextureRegion texture, Collection<com.badlogic.gdx.graphics.Color> colors, float loopTime)
      Create an AnimatedEntity at position x, y, using a TextureRegion with the given color, which will be stretched to fit one cell, or two cells if doubleWidth is true.
      Parameters:
      x -
      y -
      doubleWidth -
      texture -
      colors -
      Returns:
    • animateActor

      public AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, boolean stretch, com.badlogic.gdx.graphics.g2d.TextureRegion texture)
      Create an AnimatedEntity at position x, y, using a TextureRegion with no color modifications, which, if and only if stretch is true, will be stretched to fit one cell, or two cells if doubleWidth is true. If stretch is false, this will preserve the existing size of texture.
      Parameters:
      x -
      y -
      doubleWidth -
      stretch -
      texture -
      Returns:
    • animateActor

      public AnimatedEntity animateActor​(int x, int y, boolean doubleWidth, boolean stretch, com.badlogic.gdx.graphics.g2d.TextureRegion texture, com.badlogic.gdx.graphics.Color color)
      Create an AnimatedEntity at position x, y, using a TextureRegion with the given color, which, if and only if stretch is true, will be stretched to fit one cell, or two cells if doubleWidth is true. If stretch is false, this will preserve the existing size of texture.
      Parameters:
      x -
      y -
      doubleWidth -
      stretch -
      texture -
      color -
      Returns:
    • cellToActor

      public TextCellFactory.Glyph cellToActor​(int x, int y)
      Created an Actor from the contents of the given x,y position on the grid.
      Parameters:
      x -
      y -
      Returns:
    • cellToActor

      public TextCellFactory.Glyph cellToActor​(int x, int y, boolean doubleWidth)
      Created an Actor from the contents of the given x,y position on the grid; deleting the grid's String content at this cell.
      Parameters:
      x -
      y -
      doubleWidth -
      Returns:
      A fresh Actor, that has just been added to this.
    • worldX

      public float worldX​(int gridX, boolean doubleWidth)
      Used internally to go between grid positions and world positions.
      Parameters:
      gridX - x on the grid
      Returns:
      x in the world
    • worldY

      public float worldY​(int gridY)
      Used internally to go between grid positions and world positions.
      Parameters:
      gridY - y on the grid
      Returns:
      y in the world
    • createActor

      protected TextCellFactory.Glyph createActor​(int x, int y, char name, com.badlogic.gdx.graphics.Color color, boolean doubleWidth)
    • createActor

      protected TextCellFactory.Glyph createActor​(int x, int y, char name, float encodedColor, boolean doubleWidth)
    • adjustX

      public float adjustX​(float x, boolean doubleWidth)
    • adjustY

      public float adjustY​(float y)
    • recallActor

      public void recallActor​(com.badlogic.gdx.scenes.scene2d.Actor a, boolean restoreSym)
    • recallActor

      public void recallActor​(com.badlogic.gdx.scenes.scene2d.Actor a, boolean restoreSym, int nextX, int nextY)
    • recallActor

      public void recallActor​(TextCellFactory.Glyph a, boolean restoreSym, int nextX, int nextY)
    • recallActor

      public void recallActor​(AnimatedEntity ae)
    • recallActor

      public void recallActor​(AnimatedEntity ae, int nextX, int nextY)
    • fixPosition

      public void fixPosition​(AnimatedEntity ae)
    • fixPositions

      public void fixPositions()
    • bump

      public void bump​(AnimatedEntity ae, Direction direction, float duration)
      Start a bumping animation in the given direction that will last duration seconds.
      Parameters:
      ae - an AnimatedEntity returned by animateActor()
      direction -
      duration - a float, measured in seconds, for how long the animation should last; commonly 0.12f
    • bump

      public void bump​(int x, int y, Direction direction, float duration)
      Start a bumping animation in the given direction that will last duration seconds.
      Parameters:
      x -
      y -
      direction -
      duration - a float, measured in seconds, for how long the animation should last; commonly 0.12f
    • bump

      public void bump​(int x, int y, Direction direction)
      Starts a bumping animation in the direction provided.
      Parameters:
      x -
      y -
      direction -
    • bump

      public void bump​(Coord location, Direction direction)
      Starts a bumping animation in the direction provided.
      Parameters:
      location -
      direction -
    • slide

      public void slide​(AnimatedEntity ae, int newX, int newY, float duration)
      Start a movement animation for the object at the grid location x, y and moves it to newX, newY over a number of seconds given by duration (often 0.12f or somewhere around there).
      Parameters:
      ae - an AnimatedEntity returned by animateActor()
      newX -
      newY -
      duration -
    • slide

      public void slide​(int x, int y, int newX, int newY, float duration)
      Start a movement animation for the object at the grid location x, y and moves it to newX, newY over a number of seconds given by duration (often 0.12f or somewhere around there).
      Parameters:
      x -
      y -
      newX -
      newY -
      duration -
    • slide

      public void slide​(int x, int y, String name, com.badlogic.gdx.graphics.Color color, int newX, int newY, float duration)
      Slides name from (x,y) to (newx, newy). If name or color is null, it is picked from this panel (hereby removing the current name, if any).
      Parameters:
      x - Where to start the slide, horizontally.
      y - Where to start the slide, vertically.
      name - The name to slide, or null to pick it from this panel's (x,y) cell.
      color - The color to use, or null to pick it from this panel's (x,y) cell.
      newX - Where to end the slide, horizontally.
      newY - Where to end the slide, vertically.
      duration - The animation's duration.
    • slide

      public void slide​(int x, int y, String name, com.badlogic.gdx.graphics.Color color, int newX, int newY, float duration, Runnable postRunnable)
      Slides name from (x,y) to (newx, newy). If name or color is null, it is picked from this panel (thereby removing the current name, if any). This also allows a Runnable to be given as postRunnable to be run after the slide completes.
      Parameters:
      x - Where to start the slide, horizontally.
      y - Where to start the slide, vertically.
      name - The name to slide, or null to pick it from this panel's (x,y) cell.
      color - The color to use, or null to pick it from this panel's (x,y) cell.
      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.
    • slide

      public void slide​(Coord start, Coord end)
      Starts a movement animation for the object at the given grid location at the default speed.
      Parameters:
      start - Coord to pick up a tile from and slide
      end - Coord to end the slide on
    • slide

      public void slide​(Coord start, Direction direction)
      Starts a movement animation for the object at the given grid location at the default speed for one grid square in the direction provided.
      Parameters:
      start - Coord to pick up a tile from and slide
      direction - Direction enum that indicates which way the slide should go
    • slide

      public void slide​(Coord start, Coord end, float duration)
      Starts a sliding movement animation for the object at the given location at the provided speed. The duration is how many seconds should pass for the entire animation.
      Parameters:
      start - Coord to pick up a tile from and slide
      end - Coord to end the slide on
      duration - in seconds, as a float
    • wiggle

      public void wiggle​(AnimatedEntity ae, float duration)
      Starts an wiggling animation for the object at the given location for the given duration in seconds.
      Parameters:
      ae - an AnimatedEntity returned by animateActor()
      duration - in seconds, as a float
    • wiggle

      public void wiggle​(int x, int y, float duration)
      Starts an wiggling animation for the object at the given location for the given duration in seconds.
      Parameters:
      x -
      y -
      duration -
    • tint

      public void tint​(AnimatedEntity ae, com.badlogic.gdx.graphics.Color color, float duration)
      Starts a tint animation for ae for the given duration in seconds.
      Parameters:
      ae - an AnimatedEntity returned by animateActor()
      color - what to transition ae's color towards, and then transition back from
      duration - how long the total "round-trip" transition should take in seconds
    • tint

      public void tint​(float delay, int x, int y, com.badlogic.gdx.graphics.Color color, float duration)
      Like tint(int, int, Color, float), but waits for delay (in seconds) before performing it.
      Parameters:
      delay - how long to wait in seconds before starting the effect
      x - the x-coordinate of the cell to tint
      y - the y-coordinate of the cell to tint
      color - what to transition ae's color towards, and then transition back from
      duration - how long the total "round-trip" transition should take in seconds
    • tint

      public void tint​(float delay, int x, int y, com.badlogic.gdx.graphics.Color color, float duration, Runnable postRunnable)
      Like tint(int, int, Color, float), but waits for delay (in seconds) before performing it. Additionally, enqueue postRunnable for running after the created action ends.
      Parameters:
      delay - how long to wait in seconds before starting the effect
      x - the x-coordinate of the cell to tint
      y - the y-coordinate of the cell to tint
      color - what to transition ae's color towards, and then transition back from
      duration - how long the total "round-trip" transition should take in seconds
      postRunnable - a Runnable to execute after the tint completes; may be null to do nothing.
    • tint

      public void tint​(int x, int y, com.badlogic.gdx.graphics.Color color, float duration)
      Starts a tint animation for the object at (x,y) for the given duration (in seconds).
      Parameters:
      x - the x-coordinate of the cell to tint
      y - the y-coordinate of the cell to tint
      color -
      duration -
    • fade

      public void fade​(int x, int y, com.badlogic.gdx.graphics.Color color, float duration)
      Fade the cell at (x,y) to color. Contrary to tint(int, int, Color, float), this action does not restore the cell's color at the end of its execution. This is for example useful to fade the game screen when the rogue dies.
      Parameters:
      x - the x-coordinate of the cell to tint
      y - the y-coordinate of the cell to tint
      color - The color at the end of the fadeout.
      duration - The fadeout's duration.
    • summon

      public void summon​(int x, int y, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, float startRotation, float endRotation, float duration)
      Create a new Actor at (x, y) that looks like glyph but can rotate, and immediately starts changing color from startColor to endColor and changing rotation from startRotation to endRotation, taking duration seconds to complete before removing the Actor.
      Parameters:
      x - the x position in cells; doesn't change
      y - the y position in cells; doesn't change
      glyph - the char to show (the same char throughout the effect, but it can rotate)
      startColor - the starting Color
      endColor - the Color to transition to
      startRotation - the amount of rotation, in degrees, the glyph should start at
      endRotation - the amount of rotation, in degrees, the glyph should end at
      duration - the duration in seconds for the effect
    • summon

      public void summon​(int startX, int startY, int endX, int endY, char glyph, com.badlogic.gdx.graphics.Color color, float startRotation, float endRotation, float duration)
      Create a new Actor at (startX, startY) that looks like glyph but can rotate, sets its color, and immediately starts changing position so it ends on the cell (endX, endY) and changing rotation from startRotation to endRotation, taking duration seconds to complete before removing the Actor.
      Parameters:
      startX - the starting x position in cells
      startY - the starting y position in cells
      endX - the ending x position in cells
      endY - the ending y position in cells
      glyph - the char to show (the same char throughout the effect, but it can rotate)
      color - the Color of the glyph throughout the effect
      startRotation - the amount of rotation, in degrees, the glyph should start at
      endRotation - the amount of rotation, in degrees, the glyph should end at
      duration - the duration in seconds for the effect
    • summon

      public void summon​(int startX, int startY, int endX, int endY, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, float rotation, float duration)
      Create a new Actor at (startX, startY) that looks like glyph but has the given rotation, and immediately starts changing color from startColor to endColor, and changing position so it ends on the cell (endX, endY), taking duration seconds to complete before removing the Actor.
      Parameters:
      startX - the starting x position in cells
      startY - the starting y position in cells
      endX - the ending x position in cells
      endY - the ending y position in cells
      glyph - the char to show (the same char throughout the effect, but it can rotate)
      startColor - the starting Color
      endColor - the Color to transition to
      rotation - the amount of rotation, in degrees, the glyph should have throughout the effect
      duration - the duration in seconds for the effect
    • summon

      public void summon​(int startX, int startY, int endX, int endY, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, float startRotation, float endRotation, float duration)
      Create a new Actor at (startX, startY) that looks like glyph but can rotate, and immediately starts changing color from startColor to endColor, changing position so it ends on the cell (endX, endY), and changing rotation from startRotation to endRotation, taking duration seconds to complete before removing the Actor.
      Parameters:
      startX - the starting x position in cells
      startY - the starting y position in cells
      endX - the ending x position in cells
      endY - the ending y position in cells
      glyph - the char to show (the same char throughout the effect, but it can rotate)
      startColor - the starting Color
      endColor - the Color to transition to
      startRotation - the amount of rotation, in degrees, the glyph should start at
      endRotation - the amount of rotation, in degrees, the glyph should end at
      duration - the duration in seconds for the effect
    • summon

      public void summon​(int startX, int startY, int endX, int endY, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, boolean doubleWidth, float startRotation, float endRotation, float duration)
      Create a new Actor at (startX, startY) that looks like glyph but can rotate, and immediately starts changing color from startColor to endColor, changing position so it ends on the cell (endX, endY), and changing rotation from startRotation to endRotation, taking duration seconds to complete before removing the Actor. Allows setting doubleWidth, which centers the created Actor in the space between the two glyphs in a cell.
      Parameters:
      startX - the starting x position in cells
      startY - the starting y position in cells
      endX - the ending x position in cells
      endY - the ending y position in cells
      glyph - the char to show (the same char throughout the effect, but it can rotate)
      startColor - the starting Color
      endColor - the Color to transition to
      doubleWidth - true if this uses double-width cells, false in most cases
      startRotation - the amount of rotation, in degrees, the glyph should start at
      endRotation - the amount of rotation, in degrees, the glyph should end at
      duration - the duration in seconds for the effect
    • summon

      public void summon​(float delay, int startX, int startY, int endX, int endY, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, boolean doubleWidth, float startRotation, float endRotation, float duration)
      Create a new Actor at (startX, startY) that looks like glyph but can rotate, and immediately starts changing color from startColor to endColor, changing position so it ends on the cell (endX, endY), and changing rotation from startRotation to endRotation, taking duration seconds to complete before removing the Actor. Allows setting doubleWidth, which centers the created Actor in the space between the two glyphs in a cell.
      Parameters:
      delay - amount of time, in seconds, to wait before starting the effect
      startX - the starting x position in cells
      startY - the starting y position in cells
      endX - the ending x position in cells
      endY - the ending y position in cells
      glyph - the char to show (the same char throughout the effect, but it can rotate)
      startColor - the starting Color
      endColor - the Color to transition to
      doubleWidth - true if this uses double-width cells, false in most cases
      startRotation - the amount of rotation, in degrees, the glyph should start at
      endRotation - the amount of rotation, in degrees, the glyph should end at
      duration - the duration in seconds for the effect
    • burst

      public void burst​(int x, int y, boolean eightWay, char glyph, com.badlogic.gdx.graphics.Color startColor, float duration)
      Convenience method to produce an explosion, splash, or burst effect. Calls summon(float, int, int, int, int, char, Color, Color, boolean, float, float, float) repeatedly with different parameters. As with summon(), this creates temporary Actors that change color, position, and rotation. This overload always moves Actors 1 cell away, which is a safe default, uses a "normal" amount of rotation for for all of the actors (a value of 1f if you used another overload), and always uses an end color that is a modified copy of startColor with 0 alpha (making the Actors all fade to transparent). The parameter eightWay determines whether this produces 4 (cardinal) or 8 (cardinal and diagonal) rotations and directions.
      Parameters:
      x - the starting, center, x-position to create all Actors at
      y - the starting, center, y-position to create all Actors at
      eightWay - if true, creates 8 Actors and moves them away in a square, otherwise, 4 Actors in a diamond
      glyph - the char to make a rotate-able Actor of; should definitely be visible
      startColor - the color to start the effect with
      duration - how long, in seconds, the effect should last
    • burst

      public void burst​(int x, int y, boolean eightWay, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, float duration)
      Convenience method to produce an explosion, splash, or burst effect. Calls summon(float, int, int, int, int, char, Color, Color, boolean, float, float, float) repeatedly with different parameters. As with summon(), this creates temporary Actors that change color, position, and rotation. This overload always moves Actors 1 cell away, which is a safe default, and uses a "normal" amount of rotation for all of the actors (a value of 1f if you used another overload). The parameter eightWay determines whether this produces 4 (cardinal) or 8 (cardinal and diagonal) rotations and directions.
      Parameters:
      x - the starting, center, x-position to create all Actors at
      y - the starting, center, y-position to create all Actors at
      eightWay - if true, creates 8 Actors and moves them away in a square, otherwise, 4 Actors in a diamond
      glyph - the char to make a rotate-able Actor of; should definitely be visible
      startColor - the color to start the effect with
      endColor - the color to end the effect on
      duration - how long, in seconds, the effect should last
    • burst

      public void burst​(int x, int y, boolean eightWay, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, float rotationStrength, float duration)
      Convenience method to produce an explosion, splash, or burst effect. Calls summon(float, int, int, int, int, char, Color, Color, boolean, float, float, float) repeatedly with different parameters. As with summon(), this creates temporary Actors that change color, position, and rotation. This overload always moves Actors 1 cell away, which is a safe default. Some parameters need explanation: eightWay determines whether this produces 4 (cardinal) or 8 (cardinal and diagonal) rotations and directions; rotationStrength can default to 1 if you want some rotation (which looks good) or 0 if you want the Actors to start at the correct rotation and not change that rotation over the course of the effect, but can be between 0 and 1 or higher than 1 (negative values may also work).
      Parameters:
      x - the starting, center, x-position to create all Actors at
      y - the starting, center, y-position to create all Actors at
      eightWay - if true, creates 8 Actors and moves them away in a square, otherwise, 4 Actors in a diamond
      glyph - the char to make a rotate-able Actor of; should definitely be visible
      startColor - the color to start the effect with
      endColor - the color to end the effect on
      rotationStrength - how strongly to rotate the Actors; 0 is no rotation, 1 is a normal rotation
      duration - how long, in seconds, the effect should last
    • burst

      public void burst​(int x, int y, int distance, boolean eightWay, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, float rotationStrength, float duration)
      Convenience method to produce an explosion, splash, or burst effect. Calls summon(float, int, int, int, int, char, Color, Color, boolean, float, float, float) repeatedly with different parameters. As with summon(), this creates temporary Actors that change color, position, and rotation. Some parameters need explanation: distance is how many cells away to move the created Actors away from (x,y); eightWay determines whether this produces 4 (cardinal) or 8 (cardinal and diagonal) rotations and directions; rotationStrength can default to 1 if you want some rotation (which looks good) or 0 if you want the Actors to start at the correct rotation and not change that rotation over the course of the effect, but can be between 0 and 1 or higher than 1 (negative values may also work).
      Parameters:
      x - the starting, center, x-position to create all Actors at
      y - the starting, center, y-position to create all Actors at
      distance - how far away, in cells, to move each actor from the center (Chebyshev distance, forming a square)
      eightWay - if true, creates 8 Actors and moves them away in a square, otherwise, 4 Actors in a diamond
      glyph - the char to make a rotate-able Actor of; should definitely be visible
      startColor - the color to start the effect with
      endColor - the color to end the effect on
      rotationStrength - how strongly to rotate the Actors; 0 is no rotation, 1 is a normal rotation
      duration - how long, in seconds, the effect should last
    • burst

      public void burst​(int x, int y, boolean eightWay, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, boolean doubleWidth, float rotationStrength, float duration)
      Convenience method to produce an explosion, splash, or burst effect. Calls summon(float, int, int, int, int, char, Color, Color, boolean, float, float, float) repeatedly with different parameters. As with summon(), this creates temporary Actors that change color, position, and rotation. This overload always moves Actors 1 cell away, which is a safe default. Some parameters need explanation: eightWay determines whether this produces 4 (cardinal) or 8 (cardinal and diagonal) rotations and directions; rotationStrength can default to 1 if you want some rotation (which looks good) or 0 if you want the Actors to start at the correct rotation and not change that rotation over the course of the effect, but can be between 0 and 1 or higher than 1 (negative values may also work).
      Parameters:
      x - the starting, center, x-position to create all Actors at
      y - the starting, center, y-position to create all Actors at
      eightWay - if true, creates 8 Actors and moves them away in a square, otherwise, 4 Actors in a diamond
      glyph - the char to make a rotate-able Actor of; should definitely be visible
      startColor - the color to start the effect with
      endColor - the color to end the effect on
      doubleWidth - true if this should use the double-width-cell technique, false in most cases
      rotationStrength - how strongly to rotate the Actors; 0 is no rotation, 1 is a normal rotation
      duration - how long, in seconds, the effect should last
    • burst

      public void burst​(int x, int y, int distance, boolean eightWay, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, boolean doubleWidth, float rotationStrength, float duration)
      Convenience method to produce an explosion, splash, or burst effect. Calls summon(float, int, int, int, int, char, Color, Color, boolean, float, float, float) repeatedly with different parameters. As with summon(), this creates temporary Actors that change color, position, and rotation. Some parameters need explanation: distance is how many cells away to move the created Actors away from (x,y); eightWay determines whether this produces 4 (cardinal) or 8 (cardinal and diagonal) rotations and directions; rotationStrength can default to 1 if you want some rotation (which looks good) or 0 if you want the Actors to start at the correct rotation and not change that rotation over the course of the effect, but can be between 0 and 1 or higher than 1 (negative values may also work).
      Parameters:
      x - the starting, center, x-position to create all Actors at
      y - the starting, center, y-position to create all Actors at
      distance - how far away, in cells, to move each actor from the center (Chebyshev distance, forming a square)
      eightWay - if true, creates 8 Actors and moves them away in a square, otherwise, 4 Actors in a diamond
      glyph - the char to make a rotate-able Actor of; should definitely be visible
      startColor - the color to start the effect with
      endColor - the color to end the effect on
      doubleWidth - true if this should use the double-width-cell technique, false in most cases
      rotationStrength - how strongly to rotate the Actors; 0 is no rotation, 1 is a normal rotation
      duration - how long, in seconds, the effect should last
    • burst

      public void burst​(float delay, int x, int y, int distance, boolean eightWay, char glyph, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor, boolean doubleWidth, float rotationStrength, float duration)
      Convenience method to produce an explosion, splash, or burst effect. Calls summon(float, int, int, int, int, char, Color, Color, boolean, float, float, float) repeatedly with different parameters. As with summon(), this creates temporary Actors that change color, position, and rotation. Some parameters need explanation: distance is how many cells away to move the created Actors away from (x,y); eightWay determines whether this produces 4 (cardinal) or 8 (cardinal and diagonal) rotations and directions; rotationStrength can default to 1 if you want some rotation (which looks good) or 0 if you want the Actors to start at the correct rotation and not change that rotation over the course of the effect, but can be between 0 and 1 or higher than 1 (negative values may also work).
      Parameters:
      delay - amount of time, in seconds, to wait before starting the effect
      x - the starting, center, x-position to create all Actors at
      y - the starting, center, y-position to create all Actors at
      distance - how far away, in cells, to move each actor from the center (Chebyshev distance, forming a square)
      eightWay - if true, creates 8 Actors and moves them away in a square, otherwise, 4 Actors in a diamond
      glyph - the char to make a rotate-able Actor of; should definitely be visible
      startColor - the color to start the effect with
      endColor - the color to end the effect on
      doubleWidth - true if this should use the double-width-cell technique, false in most cases
      rotationStrength - how strongly to rotate the Actors; 0 is no rotation, 1 is a normal rotation
      duration - how long, in seconds, the effect should last
    • hasActiveAnimations

      public boolean hasActiveAnimations()
      Specified by:
      hasActiveAnimations in interface IPackedColorPanel
      Returns:
      Returns true if there are animations running when this method is called.
    • getAnimatedEntities

    • removeAnimatedEntity

      public void removeAnimatedEntity​(AnimatedEntity ae)
    • getColorCenter

      public IColorCenter<com.badlogic.gdx.graphics.Color> getColorCenter()
      Returns:
      The current color center. Never null.
    • setColorCenter

      public void setColorCenter​(IColorCenter<com.badlogic.gdx.graphics.Color> scc)
      Use this method if you use your own IColorCenter and want this panel not to allocate its own colors (or fill DefaultResources.getSCC() but instead to the provided center.
      Parameters:
      scc - The color center to use. Should not be null.
      Throws:
      NullPointerException - If scc is null.
    • getAt

      public char getAt​(int x, int y)
    • getColorAt

      public com.badlogic.gdx.graphics.Color getColorAt​(int x, int y)
    • getLightingColor

      public com.badlogic.gdx.graphics.Color getLightingColor()
    • setLightingColor

      public void setLightingColor​(com.badlogic.gdx.graphics.Color lightingColor)
    • clampDuration

      protected float clampDuration​(float duration)
    • getGridOffsetX

      public int getGridOffsetX()
      The X offset that the whole panel's internals will be rendered at. If the gridWidth of this SquidPanel is less than the actual size of the char[][] it renders, then you can use gridOffsetX to start rendering at a different position
      Returns:
      the current offset in cells along the x axis
    • setGridOffsetX

      public void setGridOffsetX​(int gridOffsetX)
      Sets the X offset that the whole panel's internals will be rendered at.
      Parameters:
      gridOffsetX - the requested offset in cells
    • getGridOffsetY

      public int getGridOffsetY()
      The Y offset that the whole panel's internals will be rendered at.
      Returns:
      the current offset in cells along the y axis
    • setGridOffsetY

      public void setGridOffsetY​(int gridOffsetY)
      Sets the Y offset that the whole panel's internals will be rendered at.
      Parameters:
      gridOffsetY - the requested offset in cells
    • getGridWidth

      public int getGridWidth()
      The number of cells along the x-axis that will be rendered of this panel.
      Returns:
      the number of cells along the x-axis that will be rendered of this panel
    • setGridWidth

      public void setGridWidth​(int gridWidth)
      Sets the number of cells along the x-axis that will be rendered of this panel to gridWidth.
      Parameters:
      gridWidth - the requested width in cells
    • getGridHeight

      public int getGridHeight()
      The number of cells along the y-axis that will be rendered of this panel
      Returns:
      the number of cells along the y-axis that will be rendered of this panel
    • setGridHeight

      public void setGridHeight​(int gridHeight)
      Sets the number of cells along the y-axis that will be rendered of this panel to gridHeight.
      Parameters:
      gridHeight - the requested height in cells
    • getTotalWidth

      public int getTotalWidth()
      Gets the total number of cells along the x-axis that this stores; this is usually equivalent to getGridWidth(), but not if the constructor SquidPanel(int, int, TextCellFactory, IColorCenter, float, float, char[][]) was used to set a larger-than-normal map.
      Returns:
      the width of the internal array this can render, which may be larger than the visible width
    • getTotalHeight

      public int getTotalHeight()
      Gets the total number of cells along the y-axis that this stores; this is usually equivalent to getGridHeight(), but not if the constructor SquidPanel(int, int, TextCellFactory, IColorCenter, float, float, char[][]) was used to set a larger-than-normal map.
      Returns:
      the height of the internal array this can render, which may be larger than the visible height
    • setPosition

      public void setPosition​(float x, float y)
      Sets the position of the actor's bottom left corner.
      Overrides:
      setPosition in class com.badlogic.gdx.scenes.scene2d.Actor
      Parameters:
      x -
      y -
    • getxOffset

      public float getxOffset()
    • setOffsetX

      public void setOffsetX​(float xOffset)
    • getyOffset

      public float getyOffset()
    • setOffsetY

      public void setOffsetY​(float yOffset)
    • setOffsets

      public void setOffsets​(float x, float y)
    • getOnlyRenderEven

      public boolean getOnlyRenderEven()
      Gets the status of a boolean flag used for rendering thin maps; it will almost always be false unless it was set to true with setOnlyRenderEven(boolean).
      This is meant for thin-wall maps, where only cells where x and y are both even numbers have backgrounds displayed. Should be false when using this SquidPanel for anything that isn't specifically a background of a map that uses the thin-wall method from ThinDungeonGenerator or something similar. Even the foregrounds of thin-wall maps should have this false, since ThinDungeonGenerator (in conjunction with DungeonUtility's hashesToLines() method) makes thin lines for walls that should be displayed as between the boundaries of other cells. The overlap behavior needed for some "thin enough" cells to be displayed between the cells can be accomplished by using setTextSize(float, float) to double the previously-given cell width and height.
      Returns:
      the current status of the onlyRenderEven flag, which defaults to false
    • setOnlyRenderEven

      public void setOnlyRenderEven​(boolean onlyRenderEven)
      Sets the status of a boolean flag used for rendering thin maps; it should almost always be the default, which is false, unless you are using a thin-wall map, and then this should be true only if this SquidPanel is used for the background layer.
      This is meant for thin-wall maps, where only cells where x and y are both even numbers have backgrounds displayed. Should be false when using this SquidPanel for anything that isn't specifically a background of a map that uses the thin-wall method from ThinDungeonGenerator or something similar. Even the foregrounds of thin-wall maps should have this false, since ThinDungeonGenerator (in conjunction with DungeonUtility's hashesToLines() method) makes thin lines for walls that should be displayed as between the boundaries of other cells. The overlap behavior needed for some "thin enough" cells to be displayed between the cells can be accomplished by using setTextSize(float, float) to double the previously-given cell width and height.
      Parameters:
      onlyRenderEven - generally, should only be true if this SquidPanel is a background of a thin map
    • getSnapshot

      Gets a "snapshot" of the data represented by this SquidPanel; stores the dimensions, the char data, and the color data in a way that can be set back to a SquidPanel using setFromSnapshot(String, int, int, int, int) or its overload that takes a StringBuilder. The actual contents of the returned StringBuilder are unlikely to be legible in any way if read as text, and are meant to be concise and stable across versions.
      Returns:
      a StringBuilder representation of this SquidPanel's data that can be passed later to setFromSnapshot(StringBuilder, int, int, int, int) or converted to String and passed to its overload
    • getSnapshot

      public StringBuilder getSnapshot​(int startX, int startY, int width, int height)
      Gets a "snapshot" of the data represented by this SquidPanel; stores the dimensions, the char data, and the color data in a way that can be set back to a SquidPanel using setFromSnapshot(String, int, int, int, int) or its overload that takes a StringBuilder. The actual contents of the returned StringBuilder are unlikely to be legible in any way if read as text, and are meant to be concise and stable across versions. This overload allows the first x and y position used to be specified, as well as the width and height to use (the actual width and height stored may be different if this SquidPanel's gridWidth and/or gridHeight are smaller than the width and/or height given).
      Parameters:
      startX - the first x position to use in the snapshot, inclusive
      startY - the first y position to use in the snapshot, inclusive
      width - how wide the snapshot area should be; x positions from startX to startX + width - 1 will be used
      height - how tall the snapshot area should be; y positions from startY to startY + height - 1 will be used
      Returns:
      a StringBuilder representation of this SquidPanel's data that can be passed later to setFromSnapshot(StringBuilder, int, int, int, int) or converted to String and passed to its overload
    • setFromSnapshot

      Given a "snapshot" from getSnapshot(int, int, int, int), this assigns the chars and colors in this SquidPanel from 0,0 (inclusive) up to the dimensions stored in the snapshot to match the snapshot's data.
      Parameters:
      snapshot - a StringBuilder in a special format as produced by getSnapshot(int, int, int, int)
      Returns:
      this after setting, for chaining
    • setFromSnapshot

      public SquidPanel setFromSnapshot​(StringBuilder snapshot, int putX, int putY)
      Given a "snapshot" from getSnapshot(int, int, int, int), this assigns the chars and colors in this SquidPanel from the position given by putX,putY (inclusive) up to the dimensions stored in the snapshot (considering putX and putY as offsets) so they have the values stored in the snapshot.
      Parameters:
      snapshot - a StringBuilder in a special format as produced by getSnapshot(int, int, int, int)
      putX - where to start placing the data from the snapshot, x position
      putY - where to start placing the data from the snapshot, y position
      Returns:
      this after setting, for chaining
    • setFromSnapshot

      public SquidPanel setFromSnapshot​(StringBuilder snapshot, int putX, int putY, int limitWidth, int limitHeight)
      Given a "snapshot" from getSnapshot(int, int, int, int), this assigns the chars and colors in this SquidPanel from the position given by putX,putY (inclusive) to putX+limitWidth,putY+limitHeight (exclusive) so they have the values stored in the snapshot. If limitWidth or limitHeight is negative, this uses the full width and height of the snapshot (stopping early if it would extend past the gridWidth or gridHeight of this SquidPanel).
      Parameters:
      snapshot - a StringBuilder in a special format as produced by getSnapshot(int, int, int, int)
      putX - where to start placing the data from the snapshot, x position
      putY - where to start placing the data from the snapshot, y position
      limitWidth - if negative, uses all of snapshot's width as possible, otherwise restricts the width allowed
      limitHeight - if negative, uses all of snapshot's height as possible, otherwise restricts the height allowed
      Returns:
      this after setting, for chaining
    • setFromSnapshot

      public SquidPanel setFromSnapshot​(String snapshot)
      Given a "snapshot" from getSnapshot(int, int, int, int), this assigns the chars and colors in this SquidPanel from 0,0 (inclusive) up to the dimensions stored in the snapshot to match the snapshot's data.
      This overload takes a String instead of a StringBuilder for potentially-easier loading from files.
      Parameters:
      snapshot - a String in a special format as produced by getSnapshot(int, int, int, int)
      Returns:
      this after setting, for chaining
    • setFromSnapshot

      public SquidPanel setFromSnapshot​(String snapshot, int putX, int putY)
      Given a "snapshot" from getSnapshot(int, int, int, int), this assigns the chars and colors in this SquidPanel from the position given by putX,putY (inclusive) up to the dimensions stored in the snapshot (considering putX and putY as offsets) so they have the values stored in the snapshot.
      This overload takes a String instead of a StringBuilder for potentially-easier loading from files.
      Parameters:
      snapshot - a String in a special format as produced by getSnapshot(int, int, int, int)
      putX - where to start placing the data from the snapshot, x position
      putY - where to start placing the data from the snapshot, y position
      Returns:
      this after setting, for chaining
    • setFromSnapshot

      public SquidPanel setFromSnapshot​(String snapshot, int putX, int putY, int limitWidth, int limitHeight)
      Given a "snapshot" from getSnapshot(int, int, int, int), this assigns the chars and colors in this SquidPanel from the position given by putX,putY (inclusive) to putX+limitWidth,putY+limitHeight (exclusive) so they have the values stored in the snapshot. If limitWidth or limitHeight is negative, this uses the full width and height of the snapshot (stopping early if it would extend past the gridWidth or gridHeight of this SquidPanel).
      This overload takes a String instead of a StringBuilder for potentially-easier loading from files.
      Parameters:
      snapshot - a String in a special format as produced by getSnapshot(int, int, int, int)
      putX - where to start placing the data from the snapshot, x position
      putY - where to start placing the data from the snapshot, y position
      limitWidth - if negative, uses all of snapshot's width as possible, otherwise restricts the width allowed
      limitHeight - if negative, uses all of snapshot's height as possible, otherwise restricts the height allowed
      Returns:
      this after setting, for chaining