public class Menu
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static com.badlogic.gdx.graphics.Color |
BACKGROUND_COLOR
The background color of the menu
|
private com.badlogic.gdx.graphics.g2d.SpriteBatch |
batch
This is the sprite batch of the menu that elements are rendered on.
|
private com.badlogic.gdx.scenes.scene2d.ui.Skin |
buttonSkin
The default button skins
|
private com.badlogic.gdx.graphics.OrthographicCamera |
camera
This is the camera for the menu
|
private boolean |
pauseMenu
This stores whether or not the menu is for the main menu (false) or pause menu (true)
|
com.badlogic.gdx.scenes.scene2d.Stage |
stage
the stage to render the menu to
|
private static int |
WIDTH
The width of the menu
|
Constructor and Description |
---|
Menu(GameMain game,
boolean pauseMenu)
Constructor for the menu
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
This method disposes of all elements
|
private void |
initButtonSkin()
This method creates the skins for the buttons
|
private void |
initMenu(GameMain game)
This method is called if you want to initialise the main menu
|
void |
render()
This method is called to render the main menu to the stage
|
void |
resize(int width,
int height)
This method is called when the window is resized.
|
private static final com.badlogic.gdx.graphics.Color BACKGROUND_COLOR
private static final int WIDTH
public com.badlogic.gdx.scenes.scene2d.Stage stage
private com.badlogic.gdx.scenes.scene2d.ui.Skin buttonSkin
private boolean pauseMenu
private com.badlogic.gdx.graphics.OrthographicCamera camera
private com.badlogic.gdx.graphics.g2d.SpriteBatch batch
public Menu(GameMain game, boolean pauseMenu)
game
- - The game object the menu is being loaded forpauseMenu
- - Whether it is a pause menu or notprivate void initMenu(GameMain game)
game
- - The game to initialise the menu forprivate void initButtonSkin()
public void render()
public void dispose()
public void resize(int width, int height)
width
- - The new widthheight
- - The new height