Package dev.kyzel.game.menu
Class TextMenu
java.lang.Object
dev.kyzel.game.menu.Menu
dev.kyzel.game.menu.TextMenu
The text menu super class.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new text menu.Creates a new text menu.Creates a new text menu.Creates a new text menu. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Calculate the x and y coordinates based on the given information.void
Draws the container of the menu.getTextSize
(Graphics g, String text) Gets the text size in the givenGraphics
context.void
Import all the texts and fonts.Methods inherited from class dev.kyzel.game.menu.Menu
getXAlignment, getYAlignment
-
Field Details
-
text
The texts in the menu. -
textWidth
private final int[] textWidthThe texts' width. -
textHeight
private final int[] textHeightThe texts' height. -
fontList
The fonts list. -
useOneFont
private final boolean useOneFontA variable to see if the menu only uses one font.
-
-
Constructor Details
-
TextMenu
Creates a new text menu.- Parameters:
render
- theRenderer
where the menu will be drawn ontext
- the texts in the menufont
- the font for the textsalignment
- the alignment of the menu
-
TextMenu
Creates a new text menu.- Parameters:
render
- theRenderer
where the menu will be drawn ontext
- the texts in the menufontList
- the fonts for the textsalignment
- the alignment of the menu
-
TextMenu
Creates a new text menu.- Parameters:
render
- theRenderer
where the menu will be drawn ontext
- the texts in the menufont
- the font for the texts
-
TextMenu
Creates a new text menu.- Parameters:
render
- theRenderer
where the menu will be drawn ontext
- the texts in the menufontList
- the fonts for the texts
-
-
Method Details
-
importTextAndFont
public void importTextAndFont()Import all the texts and fonts. -
calculateXY
public void calculateXY()Calculate the x and y coordinates based on the given information. -
getTextSize
Gets the text size in the givenGraphics
context.- Parameters:
g
- the givenGraphics
contexttext
- the text- Returns:
- the size of the text, represents by a
Rectangle2D
-
draw
Draws the container of the menu. Draws the texts.
-