Package ch.epfl.cs107.play.engine.actor
Class Text
java.lang.Object
ch.epfl.cs107.play.engine.actor.Entity
ch.epfl.cs107.play.engine.actor.Text
- All Implemented Interfaces:
Acoustics,Actor,Graphics,Updatable,Positionable
Text entity, can be used as actor and put and aligned inside a cell .
-
Constructor Summary
ConstructorsConstructorDescriptionText(String text, DiscreteCoordinates position, Area area, boolean isScreenRelative, float fontSize, Color color) Alternative Text constructorText(String text, DiscreteCoordinates position, Area area, boolean isScreenRelative, float fontSize, Color color, boolean bold, boolean italics) Alternative Text constructorText(String text, DiscreteCoordinates position, Area area, boolean isScreenRelative, float fontSize, Color color, boolean bold, boolean italics, TextAlign.Horizontal hAlign, TextAlign.Vertical vAlign, float alpha, float depth) Default Text constructorText(String text, DiscreteCoordinates position, Area area, boolean isScreenRelative, float fontSize, Color color, float alpha, float depth) Alternative Text constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidRenders itself on specified canvas.voidmakeItAppear(float stepSize) Make the text appear by step of given sizevoidmakeItDisappear(float stepSize) Make the text disappear by step of given sizevoidUpdate the text displayedvoidupdate(float deltaTime) Simulates a single time step.Methods inherited from class ch.epfl.cs107.play.engine.actor.Entity
getPosition, getTransform, getVelocity, setCurrentPosition
-
Constructor Details
-
Text
public Text(String text, DiscreteCoordinates position, Area area, boolean isScreenRelative, float fontSize, Color color, boolean bold, boolean italics, TextAlign.Horizontal hAlign, TextAlign.Vertical vAlign, float alpha, float depth) Default Text constructor- Parameters:
text- (String): String of the text, not nullposition- (DiscreteCoordinates): Initial position in the grid, not nullarea- (Area): Area context of the text, not nullisScreenRelative- (boolean): indicate if the text is relative to the world or the windowfontSize- (float): the font size (i.e. 1 is one cell high)color- (Color): Color of the text, not nullbold- (boolean): Is the text bolditalics- (boolean): Is the text italicshAlign- (Horizontal): Which horizontal alignment has the text, not nullvAlign- (Vertical): Which vertical alignment has the text, not nullalpha- (float): transparency of the text (0 is full invisible and 1 is full opaque)depth- (float): the depth of the text, small depth draw first
-
Text
public Text(String text, DiscreteCoordinates position, Area area, boolean isScreenRelative, float fontSize, Color color, boolean bold, boolean italics) Alternative Text constructor- Parameters:
text- (String): String of the text, not nullposition- (DiscreteCoordinates): Initial position in the grid, not nullarea- (Area): Area context of the text, not nullisScreenRelative- (boolean): indicate if the text is relative to the world or the windowfontSize- (float): the font size (i.e. 1 is one cell high)color- (Color): Color of the text, not nullbold- (boolean): Is the text bolditalics- (boolean): Is the text italics
-
Text
public Text(String text, DiscreteCoordinates position, Area area, boolean isScreenRelative, float fontSize, Color color, float alpha, float depth) Alternative Text constructor- Parameters:
text- (String): String of the text, not nullposition- (DiscreteCoordinates): Initial position in the grid, not nullarea- (Area): Area context of the text, not nullisScreenRelative- (boolean): indicate if the text is relative to the world or the windowfontSize- (float): the font size (i.e. 1 is one cell high)color- (Color): Color of the text, not nullalpha- (float): transparency of the text (0 is full invisible and 1 is full opaque)depth- (float): the depth of the text, small depth draw first
-
Text
public Text(String text, DiscreteCoordinates position, Area area, boolean isScreenRelative, float fontSize, Color color) Alternative Text constructor- Parameters:
text- (String): String of the text, not nullposition- (DiscreteCoordinates): Initial position in the grid, not nullarea- (Area): Area context of the text, not nullisScreenRelative- (boolean): indicate if the text is relative to the world or the windowfontSize- (float): the font size (i.e. 1 is one cell high)color- (Color): Color of the text, not null
-
-
Method Details
-
setText
Update the text displayed- Parameters:
text- (String) the new text, not null
-
makeItAppear
public void makeItAppear(float stepSize) Make the text appear by step of given size- Parameters:
stepSize- (float): the step size
-
makeItDisappear
public void makeItDisappear(float stepSize) Make the text disappear by step of given size- Parameters:
stepSize- (float): the step size
-
update
public void update(float deltaTime) Description copied from interface:UpdatableSimulates a single time step. Note: Need to be Override- Parameters:
deltaTime- elapsed time since last update, in seconds, non-negative
-
draw
Description copied from interface:GraphicsRenders itself on specified canvas.- Parameters:
canvas- target, not null
-