public class TextCellFactory extends Object
| Modifier and Type | Field and Description |
|---|---|
protected com.badlogic.gdx.graphics.Texture |
block |
protected com.badlogic.gdx.graphics.g2d.BitmapFont |
bmpFont |
protected int |
bottomPadding |
static String |
DEFAULT_FITTING
The commonly used symbols in roguelike games.
|
protected String |
fitting |
protected int |
height |
protected int |
leftPadding |
static String |
LINE_FITTING
The commonly used symbols in roguelike games.
|
protected int |
rightPadding |
static String |
SQUID_FITTING
The commonly used symbols in roguelike games.
|
protected int |
topPadding |
protected int |
width |
| Constructor and Description |
|---|
TextCellFactory()
Creates a default valued factory.
|
| Modifier and Type | Method and Description |
|---|---|
TextCellFactory |
addFit(String fit)
Adds the code points in the string to the list of characters that will be
guaranteed to fit.
|
boolean |
antialias()
Returns whether this factory is currently set to do antialiasing on the
characters rendered, which is always true.
|
TextCellFactory |
antialias(boolean antialias)
Deprecated.
AA is the wave of the future!
|
int |
bottomPadding()
Returns the padding on the bottom side.
|
TextCellFactory |
bottomPadding(int padding)
Sets the amount of padding on the bottom side to the provided value.
|
TextCellFactory |
defaultNarrowFont()
Sets this factory to use a default 12x24 font.
|
TextCellFactory |
defaultSquareFont()
Sets this factory to use a default 12x12 font.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
String s,
com.badlogic.gdx.graphics.Color color,
float x,
float y)
Use the specified Batch to draw a String (often just one char long) in the specified LibGDX Color, with x and y
determining the world-space coordinates for the upper-left corner.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
String s,
float x,
float y)
Use the specified Batch to draw a String (often just one char long) with the default color (white), with x and y
determining the world-space coordinates for the upper-left corner.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
String s,
float r,
float g,
float b,
float a,
float x,
float y)
Use the specified Batch to draw a String (often just one char long) in the specified rgba color, with x and y
determining the world-space coordinates for the upper-left corner.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
com.badlogic.gdx.graphics.Color color,
float x,
float y)
Use the specified Batch to draw a TextureRegion tinted with the specified LibGDX Color, with x and y
determining the world-space coordinates for the upper-left corner.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
com.badlogic.gdx.graphics.Color color,
float x,
float y,
float width,
float height)
Use the specified Batch to draw a TextureRegion tinted with the specified LibGDX Color, with x and y
determining the world-space coordinates for the upper-left corner.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
float x,
float y)
Use the specified Batch to draw a TextureRegion with the default tint color (white, so un-tinted), with x and y
determining the world-space coordinates for the upper-left corner.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
float x,
float y,
float width,
float height)
Use the specified Batch to draw a TextureRegion with the default tint color (white, so un-tinted), with x and y
determining the world-space coordinates for the upper-left corner.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
float r,
float g,
float b,
float a,
float x,
float y)
Use the specified Batch to draw a TextureRegion tinted with the specified rgba color, with x and y
determining the world-space coordinates for the upper-left corner.
|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
com.badlogic.gdx.graphics.g2d.TextureRegion tr,
float r,
float g,
float b,
float a,
float x,
float y,
float width,
float height)
Use the specified Batch to draw a TextureRegion tinted with the specified rgba color, with x and y
determining the world-space coordinates for the upper-left corner.
|
String |
fit()
Returns the current String of code points that are used for sizing the
cells.
|
TextCellFactory |
fit(String fit)
Sets the characters that will be guaranteed to fit to the provided ones.
|
com.badlogic.gdx.graphics.g2d.BitmapFont |
font()
Returns the font used by this factory.
|
TextCellFactory |
font(String fontpath)
Sets this factory to use the provided font.
|
com.badlogic.gdx.graphics.Texture |
getSolid()
Returns a solid block of white, 1x1 pixel in size; can be drawn at other sizes by Batch.
|
int |
height()
Returns the height of a single cell.
|
TextCellFactory |
height(int height)
Sets the factory's cell height to the provided value.
|
TextCellFactory |
initByFont()
Initializes the factory to then be able to create text cells on demand.
|
TextCellFactory |
initBySize()
Initializes the factory to then be able to create text cells on demand.
|
boolean |
initialized()
Returns true if this factory is fully initialized and ready to build text cells.
|
TextCellFactory |
initVerbatim()
Initializes the factory to then be able to create text cells on demand.
|
int |
leftPadding()
Returns the padding on the left side.
|
TextCellFactory |
leftPadding(int padding)
Sets the amount of padding on the left side to the provided value.
|
com.badlogic.gdx.scenes.scene2d.Actor |
makeActor(String s,
com.badlogic.gdx.graphics.Color color)
Converts a String into a Label, or if the argument s is null, creates an Image of a solid block.
|
com.badlogic.gdx.scenes.scene2d.Actor |
makeActor(com.badlogic.gdx.graphics.g2d.TextureRegion tr,
com.badlogic.gdx.graphics.Color color)
Converts a TextureRegion into an Image, or if the argument s is null, creates an Image of a solid block.
|
com.badlogic.gdx.scenes.scene2d.Actor |
makeActor(com.badlogic.gdx.graphics.g2d.TextureRegion tr,
com.badlogic.gdx.graphics.Color color,
float width,
float height)
Converts a TextureRegion into an Image, or if the argument s is null, creates an Image of a solid block.
|
TextCellFactory |
padding(int padding)
Sets the amount of padding on all sides to the provided value.
|
int |
rightPadding()
Returns the padding on the right side.
|
TextCellFactory |
rightPadding(int padding)
Sets the amount of padding on the right side to the provided value.
|
int |
topPadding()
Returns the padding on the top side.
|
TextCellFactory |
topPadding(int padding)
Sets the amount of padding on the top side to the provided value.
|
int |
width()
Returns the width of a single cell.
|
TextCellFactory |
width(int width)
Sets the factory's cell width to the provided value.
|
boolean |
willFit(int codepoint)
Returns true if the given character will fit inside the current cell
dimensions with the current font.
|
public static final String DEFAULT_FITTING
public static final String LINE_FITTING
public static final String SQUID_FITTING
protected com.badlogic.gdx.graphics.g2d.BitmapFont bmpFont
protected com.badlogic.gdx.graphics.Texture block
protected int leftPadding
protected int rightPadding
protected int topPadding
protected int bottomPadding
protected int width
protected int height
public TextCellFactory()
public TextCellFactory initByFont()
public TextCellFactory initBySize()
public TextCellFactory initVerbatim()
public com.badlogic.gdx.graphics.g2d.BitmapFont font()
public TextCellFactory font(String fontpath)
fontpath - the path to the font to usepublic TextCellFactory defaultNarrowFont()
public TextCellFactory defaultSquareFont()
public int width()
public TextCellFactory width(int width)
width - the desired widthpublic int height()
public TextCellFactory height(int height)
height - the desired widthpublic String fit()
public TextCellFactory fit(String fit)
fit - the String of code points to size topublic TextCellFactory addFit(String fit)
fit - the String of code points to size topublic boolean antialias()
public TextCellFactory antialias(boolean antialias)
antialias - ignored, will always use antialiasingpublic TextCellFactory padding(int padding)
padding - how much padding in pixelspublic int leftPadding()
public TextCellFactory leftPadding(int padding)
padding - how much padding in pixelspublic int rightPadding()
public TextCellFactory rightPadding(int padding)
padding - how much padding in pixelspublic int topPadding()
public TextCellFactory topPadding(int padding)
padding - how much padding in pixelspublic int bottomPadding()
public TextCellFactory bottomPadding(int padding)
padding - how much padding in pixelspublic boolean initialized()
public boolean willFit(int codepoint)
codepoint - public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, String s, float x, float y)
batch - the LibGDX Batch to do the drawings - the string to draw, often but not necessarily one char. Can be null to draw a solid block instead.x - x of the upper-left corner of the region of text in world coordinates.y - y of the upper-left corner of the region of text in world coordinates.public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, String s, float r, float g, float b, float a, float x, float y)
batch - the LibGDX Batch to do the drawings - the string to draw, often but not necessarily one char. Can be null to draw a solid block instead.r - 0.0 to 0.1 red valueg - 0.0 to 0.1 green valueb - 0.0 to 0.1 blue valuea - 0.0 to 0.1 alpha valuex - x of the upper-left corner of the region of text in world coordinates.y - y of the upper-left corner of the region of text in world coordinates.public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, String s, com.badlogic.gdx.graphics.Color color, float x, float y)
batch - the LibGDX Batch to do the drawings - the string to draw, often but not necessarily one char. Can be null to draw a solid block instead.color - the LibGDX Color to draw the char(s) with, all the same colorx - x of the upper-left corner of the region of text in world coordinates.y - y of the upper-left corner of the region of text in world coordinates.public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion tr, float x, float y)
batch - the LibGDX Batch to do the drawingtr - the TextureRegion to draw. Can be null to draw a solid block instead.x - x of the upper-left corner of the region of text in world coordinates.y - y of the upper-left corner of the region of text in world coordinates.public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion tr, float r, float g, float b, float a, float x, float y)
batch - the LibGDX Batch to do the drawingtr - the TextureRegion to draw. Can be null to draw a solid block instead.r - 0.0 to 0.1 red valueg - 0.0 to 0.1 green valueb - 0.0 to 0.1 blue valuea - 0.0 to 0.1 alpha valuex - x of the upper-left corner of the region of text in world coordinates.y - y of the upper-left corner of the region of text in world coordinates.public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion tr, com.badlogic.gdx.graphics.Color color, float x, float y)
batch - the LibGDX Batch to do the drawingtr - the TextureRegion to draw. Can be null to draw a solid block instead.color - the LibGDX Color to draw the char(s) with, all the same colorx - x of the upper-left corner of the region of text in world coordinates.y - y of the upper-left corner of the region of text in world coordinates.public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion tr, float x, float y, float width, float height)
batch - the LibGDX Batch to do the drawingtr - the TextureRegion to draw. Can be null to draw a solid block instead.x - x of the upper-left corner of the region of text in world coordinates.y - y of the upper-left corner of the region of text in world coordinates.width - the width of the TextureRegion or solid block in pixels.height - the height of the TextureRegion or solid block in pixels.public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion tr, float r, float g, float b, float a, float x, float y, float width, float height)
batch - the LibGDX Batch to do the drawingtr - the TextureRegion to draw. Can be null to draw a solid block instead.r - 0.0 to 0.1 red valueg - 0.0 to 0.1 green valueb - 0.0 to 0.1 blue valuea - 0.0 to 0.1 alpha valuex - x of the upper-left corner of the region of text in world coordinates.y - y of the upper-left corner of the region of text in world coordinates.width - the width of the TextureRegion or solid block in pixels.height - the height of the TextureRegion or solid block in pixels.public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion tr, com.badlogic.gdx.graphics.Color color, float x, float y, float width, float height)
batch - the LibGDX Batch to do the drawingtr - the TextureRegion to draw. Can be null to draw a solid block instead.color - the LibGDX Color to draw the char(s) with, all the same colorx - x of the upper-left corner of the region of text in world coordinates.y - y of the upper-left corner of the region of text in world coordinates.width - the width of the TextureRegion or solid block in pixels.height - the height of the TextureRegion or solid block in pixels.public com.badlogic.gdx.scenes.scene2d.Actor makeActor(String s, com.badlogic.gdx.graphics.Color color)
s - a String to make into an Actor, which can be null for a solid block.color - a Color to tint s with.public com.badlogic.gdx.scenes.scene2d.Actor makeActor(com.badlogic.gdx.graphics.g2d.TextureRegion tr, com.badlogic.gdx.graphics.Color color)
tr - a TextureRegion to make into an Actor, which can be null for a solid block.color - a Color to tint tr with.public com.badlogic.gdx.scenes.scene2d.Actor makeActor(com.badlogic.gdx.graphics.g2d.TextureRegion tr, com.badlogic.gdx.graphics.Color color, float width, float height)
tr - a TextureRegion to make into an Actor, which can be null for a solid block.color - a Color to tint tr with.public com.badlogic.gdx.graphics.Texture getSolid()
Copyright © 2012–2015. All rights reserved.