public class MainMenu
extends java.lang.Object
implements com.badlogic.gdx.Screen
Modifier and Type | Field and Description |
---|---|
private com.badlogic.gdx.graphics.g2d.Sprite |
background
The object which will encode the menu's background
|
private com.badlogic.gdx.graphics.g2d.SpriteBatch |
batch
Batch that manages the rendering pipeline for all of the images to be displayed on the screen
|
private com.badlogic.gdx.scenes.scene2d.ui.TextButton[] |
buttons
Array of all menu buttons
|
private Drawer |
drawer
Object defining QOL drawing functions for rectangles and on-screen tables
Used in this class accelerate table row creation
|
private com.badlogic.gdx.Game |
game
Stores current game-state, enabling transitions between screens and external QOL drawing functions
|
private TTFont |
menuFont
Establishes the font which is used to encode the menu's options
|
private com.badlogic.gdx.scenes.scene2d.Stage |
stage
On-screen stage which can be populated with actors
|
private com.badlogic.gdx.scenes.scene2d.ui.Table |
table
Provides the spatial framework for menu buttons and labels to be organised over
|
private TTFont |
tempFont
Establishes the font which, at the moment, encodes a "Title TBC" message
|
private TTFont |
titleFont
Establishes the font which is used to encode the game's title
|
Constructor and Description |
---|
MainMenu(com.badlogic.gdx.Game game)
The menu-screen's initial constructor
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes of all visual data used to construct previous frames
This is called after each frame is rendered, and remains necessary to prevent memory leaks
|
void |
hide() |
void |
pause() |
void |
render(float delta)
Renders all visual elements (set up in the [show()] subroutine and all of its subsiduaries) to the window
This is called to prepare each and every frame that the screen deploys
|
void |
resize(int width,
int height) |
void |
resume() |
void |
show()
Secondary constructor of the main menu which focuses on preparing visual elements
Specifically instantiates the menu's stage; spatial construction table; fonts; background image and buttons
before adding the stage containing the table (which itself contains the menu's labels, buttons and background
image) to the screen's rendering pipeline, which is also set up at the beginning of this method
|
private com.badlogic.gdx.Game game
private com.badlogic.gdx.scenes.scene2d.Stage stage
private com.badlogic.gdx.scenes.scene2d.ui.Table table
private com.badlogic.gdx.scenes.scene2d.ui.TextButton[] buttons
private TTFont menuFont
private TTFont titleFont
private TTFont tempFont
private Drawer drawer
private com.badlogic.gdx.graphics.g2d.SpriteBatch batch
private com.badlogic.gdx.graphics.g2d.Sprite background
public MainMenu(com.badlogic.gdx.Game game)
game
- Variable storing the game's state for rendering purposespublic void show()
show
in interface com.badlogic.gdx.Screen
public void render(float delta)
render
in interface com.badlogic.gdx.Screen
delta
- public void resize(int width, int height)
resize
in interface com.badlogic.gdx.Screen
public void pause()
pause
in interface com.badlogic.gdx.Screen
public void resume()
resume
in interface com.badlogic.gdx.Screen
public void hide()
hide
in interface com.badlogic.gdx.Screen
public void dispose()
dispose
in interface com.badlogic.gdx.Screen