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 TypeMethodDescriptionvoidCalculate the x and y coordinates based on the given information.voidDraws the container of the menu.getTextSize(Graphics g, String text) Gets the text size in the givenGraphicscontext.voidImport 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- theRendererwhere 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- theRendererwhere 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- theRendererwhere the menu will be drawn ontext- the texts in the menufont- the font for the texts
-
TextMenu
Creates a new text menu.- Parameters:
render- theRendererwhere 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 givenGraphicscontext.- Parameters:
g- the givenGraphicscontexttext- the text- Returns:
- the size of the text, represents by a
Rectangle2D
-
draw
Draws the container of the menu. Draws the texts.
-