Class AlertUIComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.ui.UIComponent
com.csse3200.game.components.player.AlertUIComponent
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable,IAlpha,Renderable,Comparable<Renderable>
A custom UIComponent used which displays text within a yellow border for alerts.
-
Field Summary
Fields inherited from class com.csse3200.game.ui.UIComponent
skin, stage -
Constructor Summary
ConstructorsConstructorDescriptionAlertUIComponent(String alert) Creates a new AlertUIComponent containing the given text. -
Method Summary
Modifier and TypeMethodDescriptionvoidcreate()Creates the UI layout for the component.protected voiddraw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draws the UI Component on to the screen by dividing the batch's projection matrix by the SCALE_FACTOR to ensure that the UI isn't drawn too large on the screen.floatgetAlpha()Returns the alpha of the component.voidsetAlpha(float alpha) Sets the alpha of the spritebatchMethods inherited from class com.csse3200.game.ui.UIComponent
getLayer, getZIndexMethods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, dispose, overrideZIndex, renderMethods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, 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
-
AlertUIComponent
Creates a new AlertUIComponent containing the given text.- Parameters:
alert- - the text to display within the component.
-
-
Method Details
-
create
public void create()Creates the UI layout for the component.- Overrides:
createin classUIComponent
-
draw
protected void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draws the UI Component on to the screen by dividing the batch's projection matrix by the SCALE_FACTOR to ensure that the UI isn't drawn too large on the screen.- Specified by:
drawin classRenderComponent- Parameters:
batch- Batch to render to.
-
setAlpha
public void setAlpha(float alpha) Sets the alpha of the spritebatch -
getAlpha
public float getAlpha()Returns the alpha of the component.- Returns:
- the alpha of the component.
-