Package squidpony.squidgrid.gui.gdx
Class MapUtility
java.lang.Object
squidpony.squidgrid.gui.gdx.MapUtility
public class MapUtility extends Object
Created by Tommy Ettinger on 7/9/2017.
-
Constructor Summary
Constructors Constructor Description MapUtility()
-
Method Summary
Modifier and Type Method Description static float[][]
fillDefaultBGColorsFloat(float[][] packed, char[][] map)
Fills an existing float[][] with packed float colors that correspond to appropriate default background colors for the usual meanings of the chars in map.static float[][]
fillDefaultBGColorsFloat(float[][] packed, char[][] map, char deepChar, float deepColor, char shallowChar, float shallowColor)
Fills an existing float[][] with packed float colors that correspond to appropriate default background colors for the usual meanings of the chars in map.static float[][]
fillDefaultBGColorsFloat(float[][] packed, char[][] map, char deepChar, float deepColor, char shallowChar, float shallowColor, float hueChange, float saturationChange, float valueChange)
Fills an existing float[][] with packed float colors that correspond to appropriate default background colors for the usual meanings of the chars in map.static float[][]
fillDefaultBGColorsFloat(float[][] packed, char[][] map, float hueChange, float saturationChange, float valueChange)
Fills an existing float[][] with packed float colors that correspond to appropriate default background colors for the usual meanings of the chars in map.static float[][]
fillDefaultColorsFloat(float[][] packed, char[][] map)
Fills an existing float[][] with packed float colors that correspond to appropriate default colors for the usual meanings of the chars in map.static float[][]
fillDefaultColorsFloat(float[][] packed, char[][] map, char deepChar, float deepColor, char shallowChar, float shallowColor)
Produces a float[][] that corresponds to appropriate default colors for the usual meanings of the chars in map.static float[][]
fillDefaultColorsFloat(float[][] packed, char[][] map, char deepChar, float deepColor, char shallowChar, float shallowColor, float hueChange, float saturationChange, float valueChange)
Produces a float[][] that corresponds to appropriate default colors for the usual meanings of the chars in map.static float[][]
fillDefaultColorsFloat(float[][] packed, char[][] map, float hueChange, float saturationChange, float valueChange)
Fills an existing float[][] with packed float colors that correspond to appropriate default colors for the usual meanings of the chars in map.static int[][]
fillLightnessModifiers(int[][] lights, char[][] map)
Fills an existing int[][] with lighting values that can be used with SquidLayers to alter the background colors.static int[][]
fillLightnessModifiers(int[][] lights, char[][] map, double frame)
Fills an existing int[][] with lighting values that can be used with SquidLayers to alter the background colors, accepting a parameter for animation frame if rippling water and waving grass using SeededNoise are desired.static int[][]
fillLightnessModifiers(int[][] lights, char[][] map, double frame, char deepLiquid, char shallowLiquid)
Fills an existing int[][] with lighting values that can be used with SquidLayers to alter the background colors, accepting a parameter for animation frame if rippling water and waving grass using SeededNoise are desired.static float[][]
fillLinesToBoxes(float[][] into, char[][] map, float[][] colors)
Meant to be used withTextCellFactory.draw(Batch, float[][], float, float, int, int)
, this finds the box-drawing characters inmap
and fills 3x3 boxes ininto
with the matching color fromcolors
in the shape of that box-drawing character.static com.badlogic.gdx.graphics.Color[][]
generateDefaultBGColors(char[][] map)
Produces a Color[][] that corresponds to appropriate default background colors for the usual meanings of the chars in map.static com.badlogic.gdx.graphics.Color[][]
generateDefaultBGColors(char[][] map, char deepChar, com.badlogic.gdx.graphics.Color deepColor, char shallowChar, com.badlogic.gdx.graphics.Color shallowColor)
Produces a Color[][] that corresponds to appropriate default background colors for the usual meanings of the chars in map.static float[][]
generateDefaultBGColorsFloat(char[][] map)
Produces a float[][] of packed float colors that corresponds to appropriate default background colors for the usual meanings of the chars in map.static float[][]
generateDefaultBGColorsFloat(char[][] map, char deepChar, float deepColor, char shallowChar, float shallowColor)
Produces a float[][] of packed float colors that corresponds to appropriate default background colors for the usual meanings of the chars in map.static float[][]
generateDefaultBGColorsFloat(char[][] map, char deepChar, float deepColor, char shallowChar, float shallowColor, float hueChange, float saturationChange, float valueChange)
Produces a float[][] of packed float colors that corresponds to appropriate default background colors for the usual meanings of the chars in map.static float[][]
generateDefaultBGColorsFloat(char[][] map, float hueChange, float saturationChange, float valueChange)
Produces a float[][] of packed float colors that corresponds to appropriate default background colors for the usual meanings of the chars in map.static com.badlogic.gdx.graphics.Color[][]
generateDefaultColors(char[][] map)
Produces a Color[][] that corresponds to appropriate default colors for the usual meanings of the chars in map.static com.badlogic.gdx.graphics.Color[][]
generateDefaultColors(char[][] map, char deepChar, com.badlogic.gdx.graphics.Color deepColor, char shallowChar, com.badlogic.gdx.graphics.Color shallowColor)
Produces a Color[][] that corresponds to appropriate default colors for the usual meanings of the chars in map.static float[][]
generateDefaultColorsFloat(char[][] map)
Produces a float[][] that corresponds to appropriate default colors for the usual meanings of the chars in map.static float[][]
generateDefaultColorsFloat(char[][] map, char deepChar, float deepColor, char shallowChar, float shallowColor)
Produces a float[][] that corresponds to appropriate default colors for the usual meanings of the chars in map.static float[][]
generateDefaultColorsFloat(char[][] map, char deepChar, float deepColor, char shallowChar, float shallowColor, float hueChange, float saturationChange, float valueChange)
Produces a float[][] that corresponds to appropriate default colors for the usual meanings of the chars in map.static float[][]
generateDefaultColorsFloat(char[][] map, float hueChange, float saturationChange, float valueChange)
Produces a float[][] that corresponds to appropriate default colors for the usual meanings of the chars in map.static int[][]
generateLightnessModifiers(char[][] map)
Produces an int[][] that can be used with SquidLayers to alter the background colors.static int[][]
generateLightnessModifiers(char[][] map, double frame)
Produces an int[][] that can be used with SquidLayers to alter the background colors, accepting a parameter for animation frame if rippling water and waving grass using SeededNoise are desired.static int[][]
generateLightnessModifiers(char[][] map, double frame, char deepLiquid, char shallowLiquid)
Produces an int[][] that can be used with SquidLayers to alter the background colors, accepting a parameter for animation frame if rippling water and waving grass using SeededNoise are desired.static float[][]
generateLinesToBoxes(char[][] map, float[][] colors)
Meant to be used withTextCellFactory.draw(Batch, float[][], float, float, int, int)
, this produces a triple-width, triple-height float color array by finding the box-drawing characters inmap
and placing 3x3 boxes into that triple-size array with the matching color fromcolors
in the shape of that box-drawing character.
-
Constructor Details
-
MapUtility
public MapUtility()
-
-
Method Details
-
generateDefaultColors
Produces a Color[][] that corresponds to appropriate default colors for the usual meanings of the chars in map.
This takes its values fromSColor.LIMITED_PALETTE
; if that field is changed then the colors this returns will also change. Tiles containing nothing but a floor ('.') will be silver-gray; this can be changed by editingSColor.LIMITED_PALETTE[3]
. Walls are brownish-black, and can be '#' marks or box-drawing lines; this can be changed by editingSColor.LIMITED_PALETTE[2]
.Doors ('+' and '/' in the map) will be rust brown; this can be changed by editingSColor.LIMITED_PALETTE[4]
. Both shallow and deep water (',' and '~') will be gray-blue; this can be changed by editingSColor.LIMITED_PALETTE[5]
. Traps ('^') will be shown in bright orange; this can be changed by editingSColor.LIMITED_PALETTE[6]
. Grass ('"') will be the expected green; this can be changed by editingSColor.LIMITED_PALETTE[20]
. Anything else will use white; this can be changed by editingSColor.LIMITED_PALETTE[1]
.- Parameters:
map
- a char[][] containing foreground characters- Returns:
- a 2D array of Colors with the same size as map, that can be used for the corresponding chars
-
generateDefaultColors
public static com.badlogic.gdx.graphics.Color[][] generateDefaultColors(char[][] map, char deepChar, com.badlogic.gdx.graphics.Color deepColor, char shallowChar, com.badlogic.gdx.graphics.Color shallowColor)Produces a Color[][] that corresponds to appropriate default colors for the usual meanings of the chars in map. This overload also takes a char that corresponds to deep non-water lakes (whichSectionDungeonGenerator
can produce) and a Color to use for that deep liquid, as well as a char for shallow lakes and a Color for that shallow liquid.
This takes its values fromSColor.LIMITED_PALETTE
; if that field is changed then the colors this returns will also change. Tiles containing nothing but a floor ('.') will be silver-gray; this can be changed by editingSColor.LIMITED_PALETTE[3]
. Walls are brownish-black, and can be '#' marks or box-drawing lines; this can be changed by editingSColor.LIMITED_PALETTE[2]
.Doors ('+' and '/' in the map) will be rust brown; this can be changed by editingSColor.LIMITED_PALETTE[4]
. Both shallow and deep water (',' and '~') will be gray-blue; this can be changed by editingSColor.LIMITED_PALETTE[5]
. Traps ('^') will be shown in bright orange; this can be changed by editingSColor.LIMITED_PALETTE[6]
. Grass ('"') will be the expected green; this can be changed by editingSColor.LIMITED_PALETTE[20]
. Anything else will use white; this can be changed by editingSColor.LIMITED_PALETTE[1]
. Deep and shallow lakes of non-water will use the given Color parameters. If you are using SectionDungeonGenerator to produce normal water lakes, then you don't need this overload, andgenerateDefaultColors(char[][])
will be fine.- Parameters:
map
- a char[][] containing foreground charactersdeepChar
- the char that represents deep parts of non-water lakes, fromSectionDungeonGenerator
deepColor
- the Color to use for deep parts of non-water lakesshallowChar
- the char that represents shallow parts of non-water lakes, fromSectionDungeonGenerator
shallowColor
- the Color to use for shallow parts of non-water lakes- Returns:
- a 2D array of Colors with the same size as map, that can be used for the corresponding chars
-
generateDefaultColorsFloat
Produces a float[][] that corresponds to appropriate default colors for the usual meanings of the chars in map. Each float represents a color in an efficient way;SparseLayers
primarily uses this kind of packed float to represent colors, andSquidPanel
uses it internally.
This takes its values fromSColor.LIMITED_PALETTE
; if that field is changed then the colors this returns will also change. Tiles containing nothing but a floor ('.') will be silver-gray; this can be changed by editingSColor.LIMITED_PALETTE[3]
. Walls are brownish-black, and can be '#' marks or box-drawing lines; this can be changed by editingSColor.LIMITED_PALETTE[2]
.Doors ('+' and '/' in the map) will be rust brown; this can be changed by editingSColor.LIMITED_PALETTE[4]
. Both shallow and deep water (',' and '~') will be gray-blue; this can be changed by editingSColor.LIMITED_PALETTE[5]
. Traps ('^') will be shown in bright orange; this can be changed by editingSColor.LIMITED_PALETTE[6]
. Grass ('"') will be the expected green; this can be changed by editingSColor.LIMITED_PALETTE[20]
. Anything else will use white; this can be changed by editingSColor.LIMITED_PALETTE[1]
.- Parameters:
map
- a char[][] containing foreground characters- Returns:
- a 2D float array with the same size as map, containing packed floats that can be used for the corresponding chars
-
fillDefaultColorsFloat
Fills an existing float[][] with packed float colors that correspond to appropriate default colors for the usual meanings of the chars in map. Each float represents a color in an efficient way;SparseLayers
primarily uses this kind of packed float to represent colors, andSquidPanel
uses it internally.
This takes its values fromSColor.LIMITED_PALETTE
; if that field is changed then the colors this returns will also change. Tiles containing nothing but a floor ('.') will be silver-gray; this can be changed by editingSColor.LIMITED_PALETTE[3]
. Walls are brownish-black, and can be '#' marks or box-drawing lines; this can be changed by editingSColor.LIMITED_PALETTE[2]
.Doors ('+' and '/' in the map) will be rust brown; this can be changed by editingSColor.LIMITED_PALETTE[4]
. Both shallow and deep water (',' and '~') will be gray-blue; this can be changed by editingSColor.LIMITED_PALETTE[5]
. Traps ('^') will be shown in bright orange; this can be changed by editingSColor.LIMITED_PALETTE[6]
. Grass ('"') will be the expected green; this can be changed by editingSColor.LIMITED_PALETTE[20]
. Anything else will use white; this can be changed by editingSColor.LIMITED_PALETTE[1]
.- Parameters:
packed
- a float[][] that will be modified, filled with packed float colors; must match map's sizemap
- a char[][] containing foreground characters- Returns:
- a 2D float array with the same size as map, containing packed floats that can be used for the corresponding chars
-
generateDefaultColorsFloat
public static float[][] generateDefaultColorsFloat(char[][] map, char deepChar, float deepColor, char shallowChar, float shallowColor)Produces a float[][] that corresponds to appropriate default colors for the usual meanings of the chars in map. Each float represents a color in an efficient way;SparseLayers
primarily uses this kind of packed float to represent colors, andSquidPanel
uses it internally. This overload also takes a char that corresponds to deep non-water lakes (whichSectionDungeonGenerator
can produce) and a packed float color to use for that deep liquid, as well as a char for shallow lakes and another packed float color for that shallow liquid.
This takes its values fromSColor.LIMITED_PALETTE
; if that field is changed then the colors this returns will also change. Tiles containing nothing but a floor ('.') will be silver-gray; this can be changed by editingSColor.LIMITED_PALETTE[3]
. Walls are brownish-black, and can be '#' marks or box-drawing lines; this can be changed by editingSColor.LIMITED_PALETTE[2]
.Doors ('+' and '/' in the map) will be rust brown; this can be changed by editingSColor.LIMITED_PALETTE[4]
. Both shallow and deep water (',' and '~') will be gray-blue; this can be changed by editingSColor.LIMITED_PALETTE[5]
. Traps ('^') will be shown in bright orange; this can be changed by editingSColor.LIMITED_PALETTE[6]
. Grass ('"') will be the expected green; this can be changed by editingSColor.LIMITED_PALETTE[20]
. Anything else will use white; this can be changed by editingSColor.LIMITED_PALETTE[1]
. Deep and shallow lakes of non-water will use the given packed float color parameters. If you are using SectionDungeonGenerator to produce normal water lakes, then you don't need this overload, andgenerateDefaultColorsFloat(char[][])
will be fine.- Parameters:
map
- a char[][] containing foreground charactersdeepChar
- the char that represents deep parts of non-water lakes, fromSectionDungeonGenerator
deepColor
- the packed float color to use for deep parts of non-water lakesshallowChar
- the char that represents shallow parts of non-water lakes, fromSectionDungeonGenerator
shallowColor
- the packed float color to use for shallow parts of non-water lakes- Returns:
- a 2D float array with the same size as map, containing packed floats that can be used for the corresponding chars
-
fillDefaultColorsFloat
public static float[][] fillDefaultColorsFloat(float[][] packed, char[][] map, char deepChar, float deepColor, char shallowChar, float shallowColor)Produces a float[][] that corresponds to appropriate default colors for the usual meanings of the chars in map. Each float represents a color in an efficient way;SparseLayers
primarily uses this kind of packed float to represent colors, andSquidPanel
uses it internally. This overload also takes a char that corresponds to deep non-water lakes (whichSectionDungeonGenerator
can produce) and a packed float color to use for that deep liquid, as well as a char for shallow lakes and another packed float color for that shallow liquid.
This takes its values fromSColor.LIMITED_PALETTE
; if that field is changed then the colors this returns will also change. Tiles containing nothing but a floor ('.') will be silver-gray; this can be changed by editingSColor.LIMITED_PALETTE[3]
. Walls are brownish-black, and can be '#' marks or box-drawing lines; this can be changed by editingSColor.LIMITED_PALETTE[2]
.Doors ('+' and '/' in the map) will be rust brown; this can be changed by editingSColor.LIMITED_PALETTE[4]
. Both shallow and deep water (',' and '~') will be gray-blue; this can be changed by editingSColor.LIMITED_PALETTE[5]
. Traps ('^') will be shown in bright orange; this can be changed by editingSColor.LIMITED_PALETTE[6]
. Grass ('"') will be the expected green; this can be changed by editingSColor.LIMITED_PALETTE[20]
. Anything else will use white; this can be changed by editingSColor.LIMITED_PALETTE[1]
. Deep and shallow lakes of non-water will use the given packed float color parameters. If you are using SectionDungeonGenerator to produce normal water lakes, then you don't need this overload, andgenerateDefaultColorsFloat(char[][])
will be fine.- Parameters:
packed
- a float[][] that will be modified, filled with packed float colors; must match map's sizemap
- a char[][] containing foreground charactersdeepChar
- the char that represents deep parts of non-water lakes, fromSectionDungeonGenerator
deepColor
- the packed float color to use for deep parts of non-water lakesshallowChar
- the char that represents shallow parts of non-water lakes, fromSectionDungeonGenerator
shallowColor
- the packed float color to use for shallow parts of non-water lakes- Returns:
- a 2D float array with the same size as map, containing packed floats that can be used for the corresponding chars
-
generateDefaultColorsFloat
public static float[][] generateDefaultColorsFloat(char[][] map, float hueChange, float saturationChange, float valueChange)Produces a float[][] that corresponds to appropriate default colors for the usual meanings of the chars in map. Each float represents a color in an efficient way and the version this uses can be altered by the specified hue, saturation, and value changes;SparseLayers
primarily uses this kind of packed float to represent colors, andSquidPanel
uses it internally.
This takes its values fromSColor.LIMITED_PALETTE
; if that field is changed then the colors this returns will also change. Tiles containing nothing but a floor ('.') will be silver-gray; this can be changed by editingSColor.LIMITED_PALETTE[3]
. Walls are brownish-black, and can be '#' marks or box-drawing lines; this can be changed by editingSColor.LIMITED_PALETTE[2]
.Doors ('+' and '/' in the map) will be rust brown; this can be changed by editingSColor.LIMITED_PALETTE[4]
. Both shallow and deep water (',' and '~') will be gray-blue; this can be changed by editingSColor.LIMITED_PALETTE[5]
. Traps ('^') will be shown in bright orange; this can be changed by editingSColor.LIMITED_PALETTE[6]
. Grass ('"') will be the expected green; this can be changed by editingSColor.LIMITED_PALETTE[20]
. Anything else will use white; this can be changed by editingSColor.LIMITED_PALETTE[1]
.- Parameters:
map
- a char[][] containing foreground charactershueChange
- a float from -1f to 1f that will be added to the hues of colors this usessaturationChange
- a float from -1f to 1f that will be added to the saturation of colors this usesvalueChange
- a float from -1f to 1f that will be added to the values of colors this uses- Returns:
- a 2D float array with the same size as map, containing packed floats that can be used for the corresponding chars
-
fillDefaultColorsFloat
public static float[][] fillDefaultColorsFloat(float[][] packed, char[][] map, float hueChange, float saturationChange, float valueChange)Fills an existing float[][] with packed float colors that correspond to appropriate default colors for the usual meanings of the chars in map. Each float represents a color in an efficient way and the version this uses can be altered by the specified hue, saturation, and value changes;SparseLayers
primarily uses this kind of packed float to represent colors, andSquidPanel
uses it internally.
This takes its values fromSColor.LIMITED_PALETTE
; if that field is changed then the colors this returns will also change. Tiles containing nothing but a floor ('.') will be silver-gray; this can be changed by editingSColor.LIMITED_PALETTE[3]
. Walls are brownish-black, and can be '#' marks or box-drawing lines; this can be changed by editingSColor.LIMITED_PALETTE[2]
.Doors ('+' and '/' in the map) will be rust brown; this can be changed by editingSColor.LIMITED_PALETTE[4]
. Both shallow and deep water (',' and '~') will be gray-blue; this can be changed by editingSColor.LIMITED_PALETTE[5]
. Traps ('^') will be shown in bright orange; this can be changed by editingSColor.LIMITED_PALETTE[6]
. Grass ('"') will be the expected green; this can be changed by editingSColor.LIMITED_PALETTE[20]
. Anything else will use white; this can be changed by editingSColor.LIMITED_PALETTE[1]
.- Parameters:
packed
- a float[][] that will be modified, filled with packed float colors; must match map's sizemap
- a char[][] containing foreground charactershueChange
- a float from -1f to 1f that will be added to the hues of colors this usessaturationChange
- a float from -1f to 1f that will be added to the saturation of colors this usesvalueChange
- a float from -1f to 1f that will be added to the values of colors this uses- Returns:
- a 2D float array with the same size as map, containing packed floats that can be used for the corresponding chars
-
generateDefaultColorsFloat
public static float[][] generateDefaultColorsFloat(char[][] map, char deepChar, float deepColor, char shallowChar, float shallowColor, float hueChange, float saturationChange, float valueChange)Produces a float[][] that corresponds to appropriate default colors for the usual meanings of the chars in map. Each float represents a color in an efficient way and the version this uses can be altered by the specified hue, saturation, and value changes;SparseLayers
primarily uses this kind of packed float to represent colors, andSquidPanel
uses it internally. This overload also takes a char that corresponds to deep non-water lakes (whichSectionDungeonGenerator
can produce) and a packed float color to use for that deep liquid, as well as a char for shallow lakes and another packed float color for that shallow liquid.
This takes its values fromSColor.LIMITED_PALETTE
; if that field is changed then the colors this returns will also change. Tiles containing nothing but a floor ('.') will be silver-gray; this can be changed by editingSColor.LIMITED_PALETTE[3]
. Walls are brownish-black, and can be '#' marks or box-drawing lines; this can be changed by editingSColor.LIMITED_PALETTE[2]
.Doors ('+' and '/' in the map) will be rust brown; this can be changed by editingSColor.LIMITED_PALETTE[4]
. Both shallow and deep water (',' and '~') will be gray-blue; this can be changed by editingSColor.LIMITED_PALETTE[5]
. Traps ('^') will be shown in bright orange; this can be changed by editingSColor.LIMITED_PALETTE[6]
. Grass ('"') will be the expected green; this can be changed by editingSColor.LIMITED_PALETTE[20]
. Anything else will use white; this can be changed by editingSColor.LIMITED_PALETTE[1]
. Deep and shallow lakes of non-water will use the given packed float color parameters. If you are using SectionDungeonGenerator to produce normal water lakes, then you don't need this overload, andgenerateDefaultColorsFloat(char[][])
will be fine.- Parameters:
map
- a char[][] containing foreground charactersdeepChar
- the char that represents deep parts of non-water lakes, fromSectionDungeonGenerator
deepColor
- the packed float color to use for deep parts of non-water lakesshallowChar
- the char that represents shallow parts of non-water lakes, fromSectionDungeonGenerator
shallowColor
- the packed float color to use for shallow parts of non-water lakeshueChange
- a float from -1f to 1f that will be added to the hues of colors this usessaturationChange
- a float from -1f to 1f that will be added to the saturation of colors this usesvalueChange
- a float from -1f to 1f that will be added to the values of colors this uses- Returns:
- a 2D float array with the same size as map, containing packed floats that can be used for the corresponding chars
-
fillDefaultColorsFloat
public static float[][] fillDefaultColorsFloat(float[][] packed, char[][] map, char deepChar, float deepColor, char shallowChar, float shallowColor, float hueChange, float saturationChange, float valueChange)Produces a float[][] that corresponds to appropriate default colors for the usual meanings of the chars in map. Each float represents a color in an efficient way and the version this uses can be altered by the specified hue, saturation, and value changes;SparseLayers
primarily uses this kind of packed float to represent colors, andSquidPanel
uses it internally. This overload also takes a char that corresponds to deep non-water lakes (whichSectionDungeonGenerator
can produce) and a packed float color to use for that deep liquid, as well as a char for shallow lakes and another packed float color for that shallow liquid.
This takes its values fromSColor.LIMITED_PALETTE
; if that field is changed then the colors this returns will also change. Tiles containing nothing but a floor ('.') will be silver-gray; this can be changed by editingSColor.LIMITED_PALETTE[3]
. Walls are brownish-black, and can be '#' marks or box-drawing lines; this can be changed by editingSColor.LIMITED_PALETTE[2]
.Doors ('+' and '/' in the map) will be rust brown; this can be changed by editingSColor.LIMITED_PALETTE[4]
. Both shallow and deep water (',' and '~') will be gray-blue; this can be changed by editingSColor.LIMITED_PALETTE[5]
. Traps ('^') will be shown in bright orange; this can be changed by editingSColor.LIMITED_PALETTE[6]
. Grass ('"') will be the expected green; this can be changed by editingSColor.LIMITED_PALETTE[20]
. Anything else will use white; this can be changed by editingSColor.LIMITED_PALETTE[1]
. Deep and shallow lakes of non-water will use the given packed float color parameters. If you are using SectionDungeonGenerator to produce normal water lakes, then you don't need this overload, andgenerateDefaultColorsFloat(char[][])
will be fine.- Parameters:
packed
- a float[][] that will be modified, filled with packed float colors; must match map's sizemap
- a char[][] containing foreground charactersdeepChar
- the char that represents deep parts of non-water lakes, fromSectionDungeonGenerator
deepColor
- the packed float color to use for deep parts of non-water lakesshallowChar
- the char that represents shallow parts of non-water lakes, fromSectionDungeonGenerator
shallowColor
- the packed float color to use for shallow parts of non-water lakeshueChange
- a float from -1f to 1f that will be added to the hues of colors this usessaturationChange
- a float from -1f to 1f that will be added to the saturation of colors this usesvalueChange
- a float from -1f to 1f that will be added to the values of colors this uses- Returns:
- a 2D float array with the same size as map, containing packed floats that can be used for the corresponding chars
-
generateDefaultBGColors
Produces a Color[][] that corresponds to appropriate default background colors for the usual meanings of the chars in map. This takes its values fromSColor.LIMITED_PALETTE
, and if that field is changed then the colors this returns will also change. Most backgrounds will be black. but deep water ('~') will be dark blue-green, shallow water (',') will be a lighter blue-green, and grass ('"') will be dark green. You can adjust the brightness of the backgrounds usinggenerateLightnessModifiers(char[][])
, or if you want water and grass to ripple, you can use the overloadgenerateLightnessModifiers(char[][], double)
with some rising frame count.- Parameters:
map
- a char[][] containing foreground characters (this gets their background color)- Returns:
- a 2D array of background Colors with the same size as map, that can be used for the corresponding chars
-
generateDefaultBGColors
public static com.badlogic.gdx.graphics.Color[][] generateDefaultBGColors(char[][] map, char deepChar, com.badlogic.gdx.graphics.Color deepColor, char shallowChar, com.badlogic.gdx.graphics.Color shallowColor)Produces a Color[][] that corresponds to appropriate default background colors for the usual meanings of the chars in map. This overload also takes a char that corresponds to deep non-water lakes (whichSectionDungeonGenerator
can produce) and a Color to use for that deep liquid, as well as a char for shallow lakes and a Color for that shallow liquid.
This takes its values fromSColor.LIMITED_PALETTE
, and if that field is changed then the colors this returns will also change. Most backgrounds will be black, but deep water ('~') will be dark blue-green, shallow water (',') will be a lighter blue-green, and grass ('"') will be dark green. Deep and shallow lakes of non-water will use the given Colors. If you are using SectionDungeonGenerator to produce normal water lakes, then you don't need this overload, andgenerateDefaultBGColors(char[][])
will be fine. You can adjust the brightness of the backgrounds usinggenerateLightnessModifiers(char[][])
, or if you want water, grass, and lakes to ripple, you can use the overloadgenerateLightnessModifiers(char[][], double, char, char)
with some rising frame count.- Parameters:
map
- a char[][] containing foreground characters (this gets their background color)deepChar
- the char that represents deep parts of non-water lakes, fromSectionDungeonGenerator
deepColor
- the Color to use for deep parts of non-water lakesshallowChar
- the char that represents shallow parts of non-water lakes, fromSectionDungeonGenerator
shallowColor
- the Color to use for shallow parts of non-water lakes- Returns:
- a 2D array of background Colors with the same size as map, that can be used for the corresponding chars
-
generateDefaultBGColorsFloat
Produces a float[][] of packed float colors that corresponds to appropriate default background colors for the usual meanings of the chars in map.
This takes its values fromSColor.LIMITED_PALETTE
, and if that field is changed then the colors this returns will also change. Most backgrounds will be black; this can be changed by editingSColor.LIMITED_PALETTE[0]
. Deep water ('~') will be dark blue-green; this can be changed by editingSColor.LIMITED_PALETTE[24]
. Shallow water (',') will be a lighter blue-green; this can be changed by editingSColor.LIMITED_PALETTE[23]
. Grass ('"') will be dark green; this can be changed by editingSColor.LIMITED_PALETTE[21]
. Bridges (':') will be a medium-dark beige color; this can be changed by editingSColor.LIMITED_PALETTE[35]
. You can adjust the brightness of the backgrounds usinggenerateLightnessModifiers(char[][])
, or if you want water and grass to ripple, you can use the overloadgenerateLightnessModifiers(char[][], double, char, char)
with some rising frame or millisecond count.- Parameters:
map
- a char[][] containing foreground characters (this gets their background color)- Returns:
- a 2D array of background Colors with the same size as map, that can be used for the corresponding chars
-
fillDefaultBGColorsFloat
Fills an existing float[][] with packed float colors that correspond to appropriate default background colors for the usual meanings of the chars in map. The sizes of map and packed should be identical.
This takes its values fromSColor.LIMITED_PALETTE
, and if that field is changed then the colors this returns will also change. Most backgrounds will be black; this can be changed by editingSColor.LIMITED_PALETTE[0]
. Deep water ('~') will be dark blue-green; this can be changed by editingSColor.LIMITED_PALETTE[24]
. Shallow water (',') will be a lighter blue-green; this can be changed by editingSColor.LIMITED_PALETTE[23]
. Grass ('"') will be dark green; this can be changed by editingSColor.LIMITED_PALETTE[21]
. Bridges (':') will be a medium-dark beige color; this can be changed by editingSColor.LIMITED_PALETTE[35]
. You can adjust the brightness of the backgrounds usinggenerateLightnessModifiers(char[][])
, or if you want water and grass to ripple, you can use the overloadgenerateLightnessModifiers(char[][], double, char, char)
with some rising frame or millisecond count.- Parameters:
packed
- a float[][] that will be modified, filled with packed float colors; must match map's sizemap
- a char[][] containing foreground characters (this gets their background color)- Returns:
- a 2D array of background Colors with the same size as map, that can be used for the corresponding chars
-
generateDefaultBGColorsFloat
public static float[][] generateDefaultBGColorsFloat(char[][] map, char deepChar, float deepColor, char shallowChar, float shallowColor)Produces a float[][] of packed float colors that corresponds to appropriate default background colors for the usual meanings of the chars in map. This overload also takes a char that corresponds to deep non-water lakes (whichSectionDungeonGenerator
can produce) and a packed float color to use for that deep liquid, as well as a char for shallow lakes and a packed float color for that shallow liquid.
This takes its values fromSColor.LIMITED_PALETTE
, and if that field is changed then the colors this returns will also change. Most backgrounds will be black; this can be changed by editingSColor.LIMITED_PALETTE[0]
. Deep water ('~') will be dark blue-green; this can be changed by editingSColor.LIMITED_PALETTE[24]
. Shallow water (',') will be a lighter blue-green; this can be changed by editingSColor.LIMITED_PALETTE[23]
. Grass ('"') will be dark green; this can be changed by editingSColor.LIMITED_PALETTE[21]
. Bridges (':') will be a medium-dark beige color; this can be changed by editingSColor.LIMITED_PALETTE[35]
. Deep and shallow lakes of non-water will use the given packed float color parameters. If you are using SectionDungeonGenerator to produce normal water lakes, then you don't need this overload, andgenerateDefaultBGColorsFloat(char[][])
will be fine. You can adjust the brightness of the backgrounds usinggenerateLightnessModifiers(char[][])
, or if you want water, grass, and lakes to ripple, you can use the overloadgenerateLightnessModifiers(char[][], double, char, char)
with some rising frame or millisecond count.- Parameters:
map
- a char[][] containing foreground characters (this gets their background color)deepChar
- the char that represents deep parts of non-water lakes, fromSectionDungeonGenerator
deepColor
- the packed float color to use for deep parts of non-water lakesshallowChar
- the char that represents shallow parts of non-water lakes, fromSectionDungeonGenerator
shallowColor
- the packed float color to use for shallow parts of non-water lakes- Returns:
- a 2D array of background packed float colors with the same size as map, that can be used for the corresponding chars
-
fillDefaultBGColorsFloat
public static float[][] fillDefaultBGColorsFloat(float[][] packed, char[][] map, char deepChar, float deepColor, char shallowChar, float shallowColor)Fills an existing float[][] with packed float colors that correspond to appropriate default background colors for the usual meanings of the chars in map. This overload also takes a char that corresponds to deep non-water lakes (whichSectionDungeonGenerator
can produce) and a packed float color to use for that deep liquid, as well as a char for shallow lakes and a packed float color for that shallow liquid. The sizes of packed and map should be identical.
This takes its values fromSColor.LIMITED_PALETTE
, and if that field is changed then the colors this returns will also change. Most backgrounds will be black; this can be changed by editingSColor.LIMITED_PALETTE[0]
. Deep water ('~') will be dark blue-green; this can be changed by editingSColor.LIMITED_PALETTE[24]
. Shallow water (',') will be a lighter blue-green; this can be changed by editingSColor.LIMITED_PALETTE[23]
. Grass ('"') will be dark green; this can be changed by editingSColor.LIMITED_PALETTE[21]
. Bridges (':') will be a medium-dark beige color; this can be changed by editingSColor.LIMITED_PALETTE[35]
. Deep and shallow lakes of non-water will use the given packed float color parameters. If you are using SectionDungeonGenerator to produce normal water lakes, then you don't need this overload, andgenerateDefaultBGColorsFloat(char[][])
will be fine. You can adjust the brightness of the backgrounds usinggenerateLightnessModifiers(char[][])
, or if you want water, grass, and lakes to ripple, you can use the overloadgenerateLightnessModifiers(char[][], double, char, char)
with some rising frame or millisecond count.- Parameters:
packed
- a float[][] that will be modified, filled with packed float colors; must match map's sizemap
- a char[][] containing foreground characters (this gets their background color)deepChar
- the char that represents deep parts of non-water lakes, fromSectionDungeonGenerator
deepColor
- the packed float color to use for deep parts of non-water lakesshallowChar
- the char that represents shallow parts of non-water lakes, fromSectionDungeonGenerator
shallowColor
- the packed float color to use for shallow parts of non-water lakes- Returns:
- a 2D array of background packed float colors with the same size as map, that can be used for the corresponding chars
-
generateDefaultBGColorsFloat
public static float[][] generateDefaultBGColorsFloat(char[][] map, float hueChange, float saturationChange, float valueChange)Produces a float[][] of packed float colors that corresponds to appropriate default background colors for the usual meanings of the chars in map. Each float represents a color in an efficient way and the version this uses can be altered by the specified hue, saturation, and value changes.
This takes its values fromSColor.LIMITED_PALETTE
, and if that field is changed then the colors this returns will also change. Most backgrounds will be black; this can be changed by editingSColor.LIMITED_PALETTE[0]
. Deep water ('~') will be dark blue-green; this can be changed by editingSColor.LIMITED_PALETTE[24]
. Shallow water (',') will be a lighter blue-green; this can be changed by editingSColor.LIMITED_PALETTE[23]
. Grass ('"') will be dark green; this can be changed by editingSColor.LIMITED_PALETTE[21]
. Bridges (':') will be a medium-dark beige color; this can be changed by editingSColor.LIMITED_PALETTE[35]
. You can adjust the brightness of the backgrounds usinggenerateLightnessModifiers(char[][])
, or if you want water and grass to ripple, you can use the overloadgenerateLightnessModifiers(char[][], double, char, char)
with some rising frame or millisecond count.- Parameters:
map
- a char[][] containing foreground characters (this gets their background color)- Returns:
- a 2D array of background Colors with the same size as map, that can be used for the corresponding chars
-
fillDefaultBGColorsFloat
public static float[][] fillDefaultBGColorsFloat(float[][] packed, char[][] map, float hueChange, float saturationChange, float valueChange)Fills an existing float[][] with packed float colors that correspond to appropriate default background colors for the usual meanings of the chars in map. Each float represents a color in an efficient way and the version this uses can be altered by the specified hue, saturation, and value changes. The sizes of map and packed should be identical.
This takes its values fromSColor.LIMITED_PALETTE
, and if that field is changed then the colors this returns will also change. Most backgrounds will be black; this can be changed by editingSColor.LIMITED_PALETTE[0]
. Deep water ('~') will be dark blue-green; this can be changed by editingSColor.LIMITED_PALETTE[24]
. Shallow water (',') will be a lighter blue-green; this can be changed by editingSColor.LIMITED_PALETTE[23]
. Grass ('"') will be dark green; this can be changed by editingSColor.LIMITED_PALETTE[21]
. Bridges (':') will be a medium-dark beige color; this can be changed by editingSColor.LIMITED_PALETTE[35]
. You can adjust the brightness of the backgrounds usinggenerateLightnessModifiers(char[][])
, or if you want water and grass to ripple, you can use the overloadgenerateLightnessModifiers(char[][], double, char, char)
with some rising frame or millisecond count.- Parameters:
packed
- a float[][] that will be modified, filled with packed float colors; must match map's sizemap
- a char[][] containing foreground characters (this gets their background color)hueChange
- a float from -1f to 1f that will be added to the hues of colors this usessaturationChange
- a float from -1f to 1f that will be added to the saturation of colors this usesvalueChange
- a float from -1f to 1f that will be added to the values of colors this uses- Returns:
- a 2D array of background Colors with the same size as map, that can be used for the corresponding chars
-
generateDefaultBGColorsFloat
public static float[][] generateDefaultBGColorsFloat(char[][] map, char deepChar, float deepColor, char shallowChar, float shallowColor, float hueChange, float saturationChange, float valueChange)Produces a float[][] of packed float colors that corresponds to appropriate default background colors for the usual meanings of the chars in map. Each float represents a color in an efficient way and the version this uses can be altered by the specified hue, saturation, and value changes. This overload also takes a char that corresponds to deep non-water lakes (whichSectionDungeonGenerator
can produce) and a packed float color to use for that deep liquid, as well as a char for shallow lakes and a packed float color for that shallow liquid.
This takes its values fromSColor.LIMITED_PALETTE
, and if that field is changed then the colors this returns will also change. Most backgrounds will be black; this can be changed by editingSColor.LIMITED_PALETTE[0]
. Deep water ('~') will be dark blue-green; this can be changed by editingSColor.LIMITED_PALETTE[24]
. Shallow water (',') will be a lighter blue-green; this can be changed by editingSColor.LIMITED_PALETTE[23]
. Grass ('"') will be dark green; this can be changed by editingSColor.LIMITED_PALETTE[21]
. Bridges (':') will be a medium-dark beige color; this can be changed by editingSColor.LIMITED_PALETTE[35]
. Deep and shallow lakes of non-water will use the given packed float color parameters. If you are using SectionDungeonGenerator to produce normal water lakes, then you don't need this overload, andgenerateDefaultBGColorsFloat(char[][])
will be fine. You can adjust the brightness of the backgrounds usinggenerateLightnessModifiers(char[][])
, or if you want water, grass, and lakes to ripple, you can use the overloadgenerateLightnessModifiers(char[][], double, char, char)
with some rising frame or millisecond count.- Parameters:
map
- a char[][] containing foreground characters (this gets their background color)deepChar
- the char that represents deep parts of non-water lakes, fromSectionDungeonGenerator
deepColor
- the packed float color to use for deep parts of non-water lakesshallowChar
- the char that represents shallow parts of non-water lakes, fromSectionDungeonGenerator
shallowColor
- the packed float color to use for shallow parts of non-water lakeshueChange
- a float from -1f to 1f that will be added to the hues of colors this usessaturationChange
- a float from -1f to 1f that will be added to the saturation of colors this usesvalueChange
- a float from -1f to 1f that will be added to the values of colors this uses- Returns:
- a 2D array of background packed float colors with the same size as map, that can be used for the corresponding chars
-
fillDefaultBGColorsFloat
public static float[][] fillDefaultBGColorsFloat(float[][] packed, char[][] map, char deepChar, float deepColor, char shallowChar, float shallowColor, float hueChange, float saturationChange, float valueChange)Fills an existing float[][] with packed float colors that correspond to appropriate default background colors for the usual meanings of the chars in map. Each float represents a color in an efficient way and the version this uses can be altered by the specified hue, saturation, and value changes. This overload also takes a char that corresponds to deep non-water lakes (whichSectionDungeonGenerator
can produce) and a packed float color to use for that deep liquid, as well as a char for shallow lakes and a packed float color for that shallow liquid. The sizes of packed and map should be identical.
This takes its values fromSColor.LIMITED_PALETTE
, and if that field is changed then the colors this returns will also change. Most backgrounds will be black; this can be changed by editingSColor.LIMITED_PALETTE[0]
. Deep water ('~') will be dark blue-green; this can be changed by editingSColor.LIMITED_PALETTE[24]
. Shallow water (',') will be a lighter blue-green; this can be changed by editingSColor.LIMITED_PALETTE[23]
. Grass ('"') will be dark green; this can be changed by editingSColor.LIMITED_PALETTE[21]
. Bridges (':') will be a medium-dark beige color; this can be changed by editingSColor.LIMITED_PALETTE[35]
. Deep and shallow lakes of non-water will use the given packed float color parameters. If you are using SectionDungeonGenerator to produce normal water lakes, then you don't need this overload, andgenerateDefaultBGColorsFloat(char[][])
will be fine. You can adjust the brightness of the backgrounds usinggenerateLightnessModifiers(char[][])
, or if you want water, grass, and lakes to ripple, you can use the overloadgenerateLightnessModifiers(char[][], double, char, char)
with some rising frame or millisecond count.- Parameters:
packed
- a float[][] that will be modified, filled with packed float colors; must match map's sizemap
- a char[][] containing foreground characters (this gets their background color)deepChar
- the char that represents deep parts of non-water lakes, fromSectionDungeonGenerator
deepColor
- the packed float color to use for deep parts of non-water lakesshallowChar
- the char that represents shallow parts of non-water lakes, fromSectionDungeonGenerator
shallowColor
- the packed float color to use for shallow parts of non-water lakeshueChange
- a float from -1f to 1f that will be added to the hues of colors this usessaturationChange
- a float from -1f to 1f that will be added to the saturation of colors this usesvalueChange
- a float from -1f to 1f that will be added to the values of colors this uses- Returns:
- a 2D array of background packed float colors with the same size as map, that can be used for the corresponding chars
-
generateLightnessModifiers
Produces an int[][] that can be used with SquidLayers to alter the background colors.- Parameters:
map
- a char[][] that you want to be find background lightness modifiers for- Returns:
- a 2D array of lightness values from -255 to 255 but usually close to 0; can be passed to SquidLayers
-
fillLightnessModifiers
Fills an existing int[][] with lighting values that can be used with SquidLayers to alter the background colors.- Parameters:
map
- a char[][] that you want to be find background lightness modifiers for- Returns:
- a 2D array of lightness values from -255 to 255 but usually close to 0; can be passed to SquidLayers
-
generateLightnessModifiers
Produces an int[][] that can be used with SquidLayers to alter the background colors, accepting a parameter for animation frame if rippling water and waving grass using SeededNoise are desired.- Parameters:
map
- a char[][] that you want to be find background lightness modifiers forframe
- a counter that typically should increase by between 10.0 and 20.0 each second; higher numbers make water and grass move more, and 0.013 multiplied by the current time in milliseconds works well as long as only the smaller digits of the time are used; this can be accomplished with(System.currentTimeMillis() & 0xFFFFFF) * 0.013
.- Returns:
- a 2D array of lightness values from -255 to 255 but usually close to 0; can be passed to SquidLayers
-
fillLightnessModifiers
Fills an existing int[][] with lighting values that can be used with SquidLayers to alter the background colors, accepting a parameter for animation frame if rippling water and waving grass using SeededNoise are desired.- Parameters:
lights
- an int[][] that will be modified, filled with lighting ints; must match map's sizemap
- a char[][] that you want to be find background lightness modifiers forframe
- a counter that typically should increase by between 10.0 and 20.0 each second; higher numbers make water and grass move more, and 0.013 multiplied by the current time in milliseconds works well as long as only the smaller digits of the time are used; this can be accomplished with(System.currentTimeMillis() & 0xFFFFFF) * 0.013
.- Returns:
- a 2D array of lightness values from -255 to 255 but usually close to 0; can be passed to SquidLayers
-
generateLightnessModifiers
public static int[][] generateLightnessModifiers(char[][] map, double frame, char deepLiquid, char shallowLiquid)Produces an int[][] that can be used with SquidLayers to alter the background colors, accepting a parameter for animation frame if rippling water and waving grass using SeededNoise are desired. Also allows additional chars to be treated like deep and shallow liquid regarding the ripple animation.- Parameters:
map
- a char[][] that you want to be find background lightness modifiers forframe
- a counter that typically should increase by between 10.0 and 20.0 each second; higher numbers make water and grass move more, and 0.013 multiplied by the current time in milliseconds works well as long as only the smaller digits of the time are used; this can be accomplished with(System.currentTimeMillis() & 0xFFFFFF) * 0.013
.deepLiquid
- a char that will be treated like deep water when animating ripplesshallowLiquid
- a char that will be treated like shallow water when animating ripples- Returns:
- a 2D array of lightness values from -255 to 255 but usually close to 0; can be passed to SquidLayers
-
fillLightnessModifiers
public static int[][] fillLightnessModifiers(int[][] lights, char[][] map, double frame, char deepLiquid, char shallowLiquid)Fills an existing int[][] with lighting values that can be used with SquidLayers to alter the background colors, accepting a parameter for animation frame if rippling water and waving grass using SeededNoise are desired. Also allows additional chars to be treated like deep and shallow liquid regarding the ripple animation.- Parameters:
lights
- an int[][] that will be modified, filled with lighting ints; must match map's sizemap
- a char[][] that you want to be find background lightness modifiers forframe
- a counter that typically should increase by between 10.0 and 20.0 each second; higher numbers make water and grass move more, and 0.013 multiplied by the current time in milliseconds works well as long as only the smaller digits of the time are used; this can be accomplished with(System.currentTimeMillis() & 0xFFFFFF) * 0.013
.deepLiquid
- a char that will be treated like deep water when animating ripplesshallowLiquid
- a char that will be treated like shallow water when animating ripples- Returns:
- a 2D array of lightness values from -255 to 255 but usually close to 0; can be passed to SquidLayers
-
generateLinesToBoxes
Meant to be used withTextCellFactory.draw(Batch, float[][], float, float, int, int)
, this produces a triple-width, triple-height float color array by finding the box-drawing characters inmap
and placing 3x3 boxes into that triple-size array with the matching color fromcolors
in the shape of that box-drawing character.map
andcolors
should be the same size. Will return a new 2D float array. This should usually be passed to the aforementioned TextCellFactory draw method with 3 xSubCells and 3 ySubCells. An intended purpose for this is to draw box-drawing-like blocks when the font doesn't support box-drawing characters or those characters don't line up correctly for any reason.- Parameters:
map
- a 2D char array that will not be modified; box drawing characters in this will be drawn in the returned arraycolors
- a 2D float array of packed float colors to use for drawing boxes (possibly produced byfillDefaultColorsFloat(float[][], char[][])
or other methods in this class)- Returns:
- a 2D float array that can be drawn by
TextCellFactory.draw(Batch, float[][], float, float, int, int)
with 3x3 subcells
-
fillLinesToBoxes
Meant to be used withTextCellFactory.draw(Batch, float[][], float, float, int, int)
, this finds the box-drawing characters inmap
and fills 3x3 boxes ininto
with the matching color fromcolors
in the shape of that box-drawing character. This meansinto
must have at least 3 times the width and height ofmap
, andmap
andcolors
should be the same size. Ifinto
is appropriately-sized, then this will modifyinto
in-place; otherwise it will return a new 2D float array. This should usually be passed to the aforementioned TextCellFactory draw method with 3 xSubCells and 3 ySubCells. An intended purpose for this is to draw box-drawing-like blocks when the font doesn't support box-drawing characters or those characters don't line up correctly for any reason.- Parameters:
into
- a 2D float array that will be cleared, then modified in-place and returned; should be 3x the width and 3x the height of map and colors, but if it is not (or is null) a new array will be allocatedmap
- a 2D char array that will not be modified; box drawing characters in this will be drawn in intocolors
- a 2D float array of packed float colors to use for drawing boxes (possibly produced byfillDefaultColorsFloat(float[][], char[][])
or other methods in this class)- Returns:
into
, if modified, or a new 2D float array if into was null or incorrectly sized
-