Package com.csse3200.game.ui.terminal
Class TerminalDisplay
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.ui.UIComponent
com.csse3200.game.ui.terminal.TerminalDisplay
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,Renderable
,Comparable<Renderable>
A UI component for displaying the global debug terminal.
This class handles the visual representation of the terminal, including its
background, text history, and input line with a blinking cursor.
-
Field Summary
Fields inherited from class com.csse3200.game.ui.UIComponent
skin, stage
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
create()
Called when the entity is created and registered.void
dispose()
Disposes the current root table to free up resources.void
draw
(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draws the terminal, setting its visibility based on the terminal's state.com.badlogic.gdx.scenes.scene2d.ui.TextArea
getInput()
com.badlogic.gdx.scenes.scene2d.ui.TextField
com.badlogic.gdx.scenes.scene2d.Actor
getRoot()
Gets the root actor of the terminal display.Methods inherited from class com.csse3200.game.ui.UIComponent
getLayer, getZIndex
Methods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, render, setLayer
Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.csse3200.game.rendering.Renderable
render
-
Constructor Details
-
TerminalDisplay
public TerminalDisplay()
-
-
Method Details
-
create
public void create()Description copied from class:Component
Called when the entity is created and registered. Initial logic such as calls to GetComponent should be made here, not in the constructor which is called before an entity is finished.- Overrides:
create
in classUIComponent
-
getRoot
public com.badlogic.gdx.scenes.scene2d.Actor getRoot()Gets the root actor of the terminal display.- Returns:
- The root actor.
-
getInput
-
getInputField
public com.badlogic.gdx.scenes.scene2d.ui.TextField getInputField() -
getHistoryArea
public com.badlogic.gdx.scenes.scene2d.ui.TextArea getHistoryArea() -
clearInput
public void clearInput() -
draw
public void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draws the terminal, setting its visibility based on the terminal's state. The actual drawing is handled by the stage.- Specified by:
draw
in classRenderComponent
- Parameters:
batch
- Batch to render to.
-
dispose
public void dispose()Disposes the current root table to free up resources.- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
- Overrides:
dispose
in classRenderComponent
-