public class Drawer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static com.badlogic.gdx.graphics.g2d.SpriteBatch |
batch |
private static TTFont |
defaultTTFont |
private static com.badlogic.gdx.graphics.g2d.BitmapFont |
font04b08 |
private static com.badlogic.gdx.graphics.g2d.GlyphLayout |
glyphLayout |
private static com.badlogic.gdx.graphics.glutils.ShapeRenderer |
renderer |
private static com.badlogic.gdx.graphics.Color[] |
roboCustColours |
private static int[] |
roboCustOffsetX |
private static int[] |
roboCustOffsetY |
private static com.badlogic.gdx.graphics.g2d.Sprite |
roboticonSprite |
private static com.badlogic.gdx.graphics.g2d.SpriteBatch |
textDrawBatch |
Constructor and Description |
---|
Drawer(com.badlogic.gdx.Game game)
Class constructor
Stores the game's state inside the drawer class
|
Modifier and Type | Method and Description |
---|---|
void |
addTableRow(com.badlogic.gdx.scenes.scene2d.ui.Table table,
com.badlogic.gdx.scenes.scene2d.Actor actor)
Automatically adds an actor on to a new row within a specified table
Exists primarily to cut down on statement quantities
Assumes that the new cell to be created has a width of 1 column
Fits the dimensions of the new cell around the contents of the surrounding cells and the provided actor's size
Does not pad the new cell
|
void |
addTableRow(com.badlogic.gdx.scenes.scene2d.ui.Table table,
com.badlogic.gdx.scenes.scene2d.Actor actor,
float width,
float height)
Automatically adds an actor on to a new row within a specified table
Exists primarily to cut down on statement quantities
Assumes that the new cell to be created has a width of 1 column
Does not pad the new cell
|
void |
addTableRow(com.badlogic.gdx.scenes.scene2d.ui.Table table,
com.badlogic.gdx.scenes.scene2d.Actor actor,
float padTop,
float padLeft,
float padBottom,
float padRight)
Automatically adds an actor on to a new row within a specified table
Exists primarily to cut down on statement quantities
Assumes that the new cell to be created has a width of 1 column
Fits the dimensions of the new cell around the contents of the surrounding cells and the provided actor's size
|
void |
addTableRow(com.badlogic.gdx.scenes.scene2d.ui.Table table,
com.badlogic.gdx.scenes.scene2d.Actor actor,
float width,
float height,
float padTop,
float padLeft,
float padBottom,
float padRight)
Automatically adds an actor on to a new row within a specified table
Exists primarily to cut down on statement quantities
Assumes that the new cell to be created has a width of 1 column
|
void |
addTableRow(com.badlogic.gdx.scenes.scene2d.ui.Table table,
com.badlogic.gdx.scenes.scene2d.Actor actor,
float width,
float height,
float padTop,
float padLeft,
float padBottom,
float padRight,
int colSpan)
Automatically adds an actor on to a new row within a specified table
Exists primarily to cut down on statement quantities
|
void |
addTableRow(com.badlogic.gdx.scenes.scene2d.ui.Table table,
com.badlogic.gdx.scenes.scene2d.Actor actor,
float padTop,
float padLeft,
float padBottom,
float padRight,
int colSpan)
Automatically adds an actor on to a new row within a specified table
Exists primarily to cut down on statement quantities
Fits the dimensions of the new cell around the contents of the surrounding cells and the provided actor's size
|
void |
addTableRow(com.badlogic.gdx.scenes.scene2d.ui.Table table,
com.badlogic.gdx.scenes.scene2d.Actor actor,
float width,
float height,
int colSpan)
Automatically adds an actor on to a new row within a specified table
Exists primarily to cut down on statement quantities
Does not pad the new cell
|
void |
addTableRow(com.badlogic.gdx.scenes.scene2d.ui.Table table,
com.badlogic.gdx.scenes.scene2d.Actor actor,
int colSpan)
Automatically adds an actor on to a new row within a specified table
Exists primarily to cut down on statement quantities
Fits the dimensions of the new cell around the contents of the surrounding cells and the provided actor's size
Does not pad the new cell
|
void |
borderedRectangle(com.badlogic.gdx.graphics.Color fillColor,
com.badlogic.gdx.graphics.Color lineColor,
int x,
int y,
int width,
int height,
int thickness)
Draws a bordered, solid-coloured rectangle on the next frame to be rendered
This basically draws a filled rectangle and a line-only rectangle of equal dimensions in the same place
|
void |
debug(com.badlogic.gdx.scenes.scene2d.Stage stage)
Draws debug lines around all actors on the specified stage
|
void |
drawRoboticon(Roboticon roboticon,
float x,
float y) |
void |
filledRectangle(com.badlogic.gdx.graphics.Color color,
int x,
int y,
int width,
int height)
Draws a solid-coloured rectangle on the next frame to be rendered
Overloaded variant of the [rectangle()] method which automatically determines the resultant rectangle's
rendering method
|
void |
lineRectangle(com.badlogic.gdx.graphics.Color color,
int x,
int y,
int width,
int height,
int thickness)
Draws a line-only rectangle on the next frame to be rendered
Overloaded variant of the [rectangle()] method which automatically determines the resultant rectangle's
rendering method
|
void |
rectangle(com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType type,
com.badlogic.gdx.graphics.Color color,
int x,
int y,
int width,
int height,
int thickness)
Draws a rectangle on the next frame to be rendered
Works by kickstarting a rendering pipeline and drawing a rectangle in that pipeline before disposing of it again
|
void |
stretchCurrentCell(com.badlogic.gdx.scenes.scene2d.ui.Table table)
Stretches the last row in the provided table to span across the maximum number of columns in that table
|
void |
text(java.lang.String text,
TTFont font,
float x,
float y)
Prints text directly on to the next frame, foregoing the need to generate any labels or scenes
Works by orthographically projecting the bitmaps in the provided TTFont object's internal BitmapFont during
a rendering pipeline which only exists while the method itself exists
|
void |
toggleButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton button,
boolean enabled,
com.badlogic.gdx.graphics.Color buttonColor)
Simplifies simultaneously changing TextButtons' colours and enabling/disabling them on the fly
|
private static com.badlogic.gdx.graphics.g2d.SpriteBatch batch
private static com.badlogic.gdx.graphics.g2d.SpriteBatch textDrawBatch
private static com.badlogic.gdx.graphics.glutils.ShapeRenderer renderer
private static com.badlogic.gdx.graphics.g2d.Sprite roboticonSprite
private static TTFont defaultTTFont
private static com.badlogic.gdx.graphics.g2d.BitmapFont font04b08
private static com.badlogic.gdx.graphics.g2d.GlyphLayout glyphLayout
private static int[] roboCustOffsetX
private static int[] roboCustOffsetY
private static com.badlogic.gdx.graphics.Color[] roboCustColours
public Drawer(com.badlogic.gdx.Game game)
game
- A reference the livgdx game objectpublic void rectangle(com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType type, com.badlogic.gdx.graphics.Color color, int x, int y, int width, int height, int thickness)
type
- Defines the type of rectangle to be drawn: it can be filled or line-onlycolor
- Defines the colour of the rectangle to be drawnx
- X-coordinate of the new rectangle's top-left cornery
- Y-coordinate of the new rectangle's top-left cornerwidth
- Width of the new rectangleheight
- Height of the new rectanglethickness
- an integer value of how thick the lines are to bepublic void filledRectangle(com.badlogic.gdx.graphics.Color color, int x, int y, int width, int height)
color
- Defines the colour of the rectangle to be drawnx
- X-coordinate of the new rectangle's top-left cornery
- Y-coordinate of the new rectangle's top-left cornerwidth
- Width of the new rectangleheight
- Height of the new rectanglepublic void lineRectangle(com.badlogic.gdx.graphics.Color color, int x, int y, int width, int height, int thickness)
color
- Defines the colour of the rectangle to be drawnx
- X-coordinate of the new rectangle's top-left cornery
- Y-coordinate of the new rectangle's top-left cornerwidth
- Width of the new rectangleheight
- Height of the new rectanglethickness
- an integer value of how thick the lines are to bepublic void borderedRectangle(com.badlogic.gdx.graphics.Color fillColor, com.badlogic.gdx.graphics.Color lineColor, int x, int y, int width, int height, int thickness)
fillColor
- Defines the fill-colour of the rectangle to be drawnlineColor
- Defines the line-colour of the rectangle to be drawnx
- X-coordinate of the new rectangle's top-left cornery
- Y-coordinate of the new rectangle's top-left cornerwidth
- Width of the new rectangleheight
- Height of the new rectanglethickness
- an integer value of how thick the lines are to bepublic void text(java.lang.String text, TTFont font, float x, float y)
text
- The text to be printedfont
- The font of the text to be printedx
- The X-coordinate of the text's locationy
- The Y-coordinate of the text's locationpublic void debug(com.badlogic.gdx.scenes.scene2d.Stage stage)
stage
- The stage holding the actors around which to draw debug linespublic void addTableRow(com.badlogic.gdx.scenes.scene2d.ui.Table table, com.badlogic.gdx.scenes.scene2d.Actor actor, float width, float height, float padTop, float padLeft, float padBottom, float padRight, int colSpan)
table
- The table to be expandedactor
- The actor to add to the provided tablewidth
- The width of the cell in which the provided actor is to be placedheight
- The height of the cell in which the provided actor is to be placedpadTop
- The top-most padding of the cell in which the provided actor is to be placedpadLeft
- The left-most padding of the cell in which the provided actor is to be placedpadBottom
- The bottom-most padding of the cell in which the provided actor is to be placedpadRight
- The right-most padding of the cell in which the provided actor is to be placedcolSpan
- The number of columns over which the new cell will spanpublic void addTableRow(com.badlogic.gdx.scenes.scene2d.ui.Table table, com.badlogic.gdx.scenes.scene2d.Actor actor, float width, float height, float padTop, float padLeft, float padBottom, float padRight)
table
- The table to be expandedactor
- The actor to add to the provided tablewidth
- The width of the cell in which the provided actor is to be placedheight
- The height of the cell in which the provided actor is to be placedpadTop
- The top-most padding of the cell in which the provided actor is to be placedpadLeft
- The left-most padding of the cell in which the provided actor is to be placedpadBottom
- The bottom-most padding of the cell in which the provided actor is to be placedpadRight
- The right-most padding of the cell in which the provided actor is to be placedpublic void addTableRow(com.badlogic.gdx.scenes.scene2d.ui.Table table, com.badlogic.gdx.scenes.scene2d.Actor actor, float padTop, float padLeft, float padBottom, float padRight, int colSpan)
table
- The table to be expandedactor
- The actor to add to the provided tablepadTop
- The top-most padding of the cell in which the provided actor is to be placedpadLeft
- The left-most padding of the cell in which the provided actor is to be placedpadBottom
- The bottom-most padding of the cell in which the provided actor is to be placedpadRight
- The right-most padding of the cell in which the provided actor is to be placedcolSpan
- The number of columns over which the new cell will spanpublic void addTableRow(com.badlogic.gdx.scenes.scene2d.ui.Table table, com.badlogic.gdx.scenes.scene2d.Actor actor, float padTop, float padLeft, float padBottom, float padRight)
table
- The table to be expandedactor
- The actor to add to the provided tablepadTop
- The top-most padding of the cell in which the provided actor is to be placedpadLeft
- The left-most padding of the cell in which the provided actor is to be placedpadBottom
- The bottom-most padding of the cell in which the provided actor is to be placedpadRight
- The right-most padding of the cell in which the provided actor is to be placedpublic void addTableRow(com.badlogic.gdx.scenes.scene2d.ui.Table table, com.badlogic.gdx.scenes.scene2d.Actor actor, float width, float height, int colSpan)
table
- The table to be expandedactor
- The actor to add to the provided tablewidth
- The width of the cell in which the provided actor is to be placedheight
- The height of the cell in which the provided actor is to be placedcolSpan
- The number of columns over which the new cell will spanpublic void addTableRow(com.badlogic.gdx.scenes.scene2d.ui.Table table, com.badlogic.gdx.scenes.scene2d.Actor actor, float width, float height)
table
- The table to be expandedactor
- The actor to add to the provided tablewidth
- The width of the cell in which the provided actor is to be placedheight
- The height of the cell in which the provided actor is to be placedpublic void addTableRow(com.badlogic.gdx.scenes.scene2d.ui.Table table, com.badlogic.gdx.scenes.scene2d.Actor actor, int colSpan)
table
- The table to be expandedactor
- The actor to add to the provided tablecolSpan
- The number of columns over which the new cell will spanpublic void addTableRow(com.badlogic.gdx.scenes.scene2d.ui.Table table, com.badlogic.gdx.scenes.scene2d.Actor actor)
table
- The table to be expandedactor
- The actor to add to the provided tablepublic void stretchCurrentCell(com.badlogic.gdx.scenes.scene2d.ui.Table table)
table
- The table containing the cell to be stretchedpublic void toggleButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton button, boolean enabled, com.badlogic.gdx.graphics.Color buttonColor)
button
- The button to be enabled/disabledenabled
- The button's new statusbuttonColor
- The new colour that the button should assumepublic void drawRoboticon(Roboticon roboticon, float x, float y)