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 TypeMethodDescriptionvoidvoidcreate()Called when the entity is created and registered.voiddispose()Disposes the current root table to free up resources.voiddraw(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.TextAreagetInput()com.badlogic.gdx.scenes.scene2d.ui.TextFieldcom.badlogic.gdx.scenes.scene2d.ActorgetRoot()Gets the root actor of the terminal display.Methods inherited from class com.csse3200.game.ui.UIComponent
getLayer, getZIndexMethods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, render, setLayerMethods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, getPrio, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, updateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.csse3200.game.rendering.Renderable
render
-
Constructor Details
-
TerminalDisplay
public TerminalDisplay()
-
-
Method Details
-
create
public void create()Description copied from class:ComponentCalled 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:
createin 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:
drawin classRenderComponent- Parameters:
batch- Batch to render to.
-
dispose
public void dispose()Disposes the current root table to free up resources.- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable- Overrides:
disposein classRenderComponent
-