Package dev.kyzel.game.menu
Class Menu
java.lang.Object
dev.kyzel.game.menu.Menu
- Direct Known Subclasses:
TextMenu
The menu super class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe alignment of the menu.protected intThe height of the menu.protected RendererTheRendererwhere the menu will be drawn on.protected intThe width of the menu.protected intThe x coordinate of the menu.static final intThe constant for the center alignment on the x-axis.static final intThe constant for the left alignment.static final intThe constant for the right alignment.protected intThe y coordinate of the menu.static final intThe constant for the bottom alignment.static final intThe constant for the center alignment on the y-axis.static final intThe constant for the top alignment. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new menu with no information, aligned to the center of the screen by default.Creates a menu without x, y coordinates and width, height.Creates a new menu, aligned to the center of the screen by default.Creates a new menu. -
Method Summary
Modifier and TypeMethodDescriptionvoidDraws the container of the menu.intGets the x-axis alignment.intGets the y-axis alignment.
-
Field Details
-
X_LEFT
public static final int X_LEFTThe constant for the left alignment.- See Also:
-
X_CENTER
public static final int X_CENTERThe constant for the center alignment on the x-axis.- See Also:
-
X_RIGHT
public static final int X_RIGHTThe constant for the right alignment.- See Also:
-
Y_TOP
public static final int Y_TOPThe constant for the top alignment.- See Also:
-
Y_CENTER
public static final int Y_CENTERThe constant for the center alignment on the y-axis.- See Also:
-
Y_BOTTOM
public static final int Y_BOTTOMThe constant for the bottom alignment.- See Also:
-
render
TheRendererwhere the menu will be drawn on. -
x
protected int xThe x coordinate of the menu. -
y
protected int yThe y coordinate of the menu. -
width
protected int widthThe width of the menu. -
height
protected int heightThe height of the menu. -
alignment
protected int alignmentThe alignment of the menu.
-
-
Constructor Details
-
Menu
Creates a new menu.- Parameters:
render- theRendererwhere the menu will be drawn onx- the x coordinatey- the y coordinatewidth- the width of the menuheight- the height of the menualignment- the alignment of the menu
-
Menu
Creates a new menu, aligned to the center of the screen by default.- Parameters:
render- theRendererwhere the menu will be drawn onx- the x coordinatey- the y coordinatewidth- the width of the menuheight- the height of the menu
-
Menu
Creates a menu without x, y coordinates and width, height.- Parameters:
render- theRendererwhere the menu will be drawn onalignment- the alignment of the menu
-
Menu
Creates a new menu with no information, aligned to the center of the screen by default.- Parameters:
render- theRendererwhere the menu will be drawn on
-
-
Method Details
-
getXAlignment
public int getXAlignment()Gets the x-axis alignment.- Returns:
- the x-axis alignment
-
getYAlignment
public int getYAlignment()Gets the y-axis alignment.- Returns:
- the y-axis alignment
-
draw
Draws the container of the menu.- Parameters:
g- theGraphicswhich is used to draw
-