public class SpeechBox
extends java.lang.Object
Usage: SpeechBox sb = new SpeechBox(..) sb.render();
Note: add to InputMultiplexer if using with other UI elements.
Modifier and Type | Field and Description |
---|---|
private static com.badlogic.gdx.graphics.Color |
BACKGROUND_COLOR
The constant color variables for all SpeechBox's
|
private static com.badlogic.gdx.graphics.Color |
BORDER_COLOUR |
private static int |
BORDER_WIDTH |
private static int |
BUTTON_ROW_HEIGHT |
private java.util.ArrayList<SpeechBoxButton> |
buttons
List of buttons to be displayed on the SpeechBox
|
private com.badlogic.gdx.scenes.scene2d.ui.Skin |
buttonSkin |
private static int |
HEIGHT |
private com.badlogic.gdx.scenes.scene2d.ui.Skin |
labelSkin |
private static int |
PADDING |
private java.lang.String |
person
The name of the person talking, if any
|
private com.badlogic.gdx.scenes.scene2d.ui.Skin |
personLabelSkin |
com.badlogic.gdx.scenes.scene2d.Stage |
stage
The stage to render the elemts to
|
private static int |
TABLE_HEIGHT |
private static int |
TABLE_WIDTH |
private static com.badlogic.gdx.graphics.Color |
TEXT_COLOUR |
private static int |
TEXT_ROW_HEIGHT |
private java.lang.String |
textContent
This is the text component to display.
|
int |
timeoutDuration
The timeout duration for a SpeechBox
|
private static int |
WIDTH
Layout constants
|
private static int |
Y_OFFSET |
Constructor and Description |
---|
SpeechBox(java.lang.String content,
java.util.ArrayList<SpeechBoxButton> buttonList,
int timeout)
The constructor for the SpeechBox
|
SpeechBox(java.lang.String content,
int timeout)
The constructor for the SpeechBox without buttons
|
SpeechBox(java.lang.String personName,
java.lang.String speechText,
java.util.ArrayList<SpeechBoxButton> buttonList,
int timeout)
The constructor for the SpeechBox with personName
|
SpeechBox(java.lang.String personName,
java.lang.String speechText,
int timeout)
The constructor for the SpeechBox without buttons with personName
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes of SpeechBox resources
|
private void |
fillTableContent(com.badlogic.gdx.scenes.scene2d.ui.Table table)
Add relevant SpeechBox UI controls to table element
|
private void |
initButtonSkin()
Sets up the skin for buttons on the speech box
|
private void |
initLabelSkin()
Sets up the skin for buttons on the speech box
|
private void |
initPersonLabelSkin()
Sets up the skin for buttons on the speech box
|
private void |
initSkins()
Sets up skin variables used for defining UI control styles
|
void |
render()
Renders the speech box
Should be called within the render() method of a screen
|
void |
resize(int width,
int height)
This method is called on a window resize
|
private void |
setupStage()
Sets up the SpeechBox stage ready for rendering
The stage is a Scene2D class that deals with putting UI controls on the screen
|
void |
update()
This method is called once a tick by the logic Thread
|
private static final com.badlogic.gdx.graphics.Color BACKGROUND_COLOR
private static final com.badlogic.gdx.graphics.Color BORDER_COLOUR
private static final com.badlogic.gdx.graphics.Color TEXT_COLOUR
private static final int WIDTH
private static final int PADDING
private static final int BORDER_WIDTH
private static final int Y_OFFSET
private static final int TABLE_WIDTH
private static final int TEXT_ROW_HEIGHT
private static final int BUTTON_ROW_HEIGHT
private static final int TABLE_HEIGHT
private static final int HEIGHT
public com.badlogic.gdx.scenes.scene2d.Stage stage
public int timeoutDuration
private java.lang.String person
private java.lang.String textContent
private java.util.ArrayList<SpeechBoxButton> buttons
private com.badlogic.gdx.scenes.scene2d.ui.Skin buttonSkin
private com.badlogic.gdx.scenes.scene2d.ui.Skin labelSkin
private com.badlogic.gdx.scenes.scene2d.ui.Skin personLabelSkin
public SpeechBox(java.lang.String content, java.util.ArrayList<SpeechBoxButton> buttonList, int timeout)
public SpeechBox(java.lang.String personName, java.lang.String speechText, java.util.ArrayList<SpeechBoxButton> buttonList, int timeout)
public SpeechBox(java.lang.String content, int timeout)
public SpeechBox(java.lang.String personName, java.lang.String speechText, int timeout)
private void setupStage()
private void fillTableContent(com.badlogic.gdx.scenes.scene2d.ui.Table table)
table
- Table to add controls topublic void render()
public void update()
private void initSkins()
private void initButtonSkin()
private void initLabelSkin()
private void initPersonLabelSkin()
public void dispose()
public void resize(int width, int height)
width
- - the new widthheight
- - the new height