Package com.dragonboatrace.screens
Class MainMenuScreen
- java.lang.Object
-
- com.dragonboatrace.screens.MainMenuScreen
-
- All Implemented Interfaces:
com.badlogic.gdx.Screen
public class MainMenuScreen extends java.lang.Object implements com.badlogic.gdx.ScreenRepresents the Main Menu where the game first starts.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Runnable[]buttonActionsArray of functional interfaces that are invoked when each button is pressed.private Button[]buttonsArray of buttons.protected DragonBoatRacegameThe instance of the game.private com.badlogic.gdx.graphics.TexturelogoThe texture of the main logo.private floatlogoXOffsetThe logo position X offset.private floatlogoYOffsetThe logo position Y offset.
-
Constructor Summary
Constructors Constructor Description MainMenuScreen(DragonBoatRace game)Creates a new window that shows the main menu of the game.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()voidhide()voidpause()voidrender(float delta)Renders the main window.voidresize(int width, int height)private voidrestore()Restores the game from the last save or notifies teh user if no such save exists.voidresume()voidshow()
-
-
-
Field Detail
-
game
protected final DragonBoatRace game
The instance of the game.
-
logoXOffset
private final float logoXOffset
The logo position X offset.
-
logoYOffset
private final float logoYOffset
The logo position Y offset.
-
logo
private final com.badlogic.gdx.graphics.Texture logo
The texture of the main logo.
-
buttonActions
private final java.lang.Runnable[] buttonActions
Array of functional interfaces that are invoked when each button is pressed.
-
buttons
private final Button[] buttons
Array of buttons.
-
-
Constructor Detail
-
MainMenuScreen
public MainMenuScreen(DragonBoatRace game)
Creates a new window that shows the main menu of the game.- Parameters:
game- The instance of the game.
-
-
Method Detail
-
show
public void show()
- Specified by:
showin interfacecom.badlogic.gdx.Screen
-
render
public void render(float delta)
Renders the main window.- Specified by:
renderin interfacecom.badlogic.gdx.Screen- Parameters:
delta- The time passed since the last frame.
-
resize
public void resize(int width, int height)- Specified by:
resizein interfacecom.badlogic.gdx.Screen
-
pause
public void pause()
- Specified by:
pausein interfacecom.badlogic.gdx.Screen
-
resume
public void resume()
- Specified by:
resumein interfacecom.badlogic.gdx.Screen
-
hide
public void hide()
- Specified by:
hidein interfacecom.badlogic.gdx.Screen
-
dispose
public void dispose()
- Specified by:
disposein interfacecom.badlogic.gdx.Screen
-
restore
private void restore()
Restores the game from the last save or notifies teh user if no such save exists. Invoked by a button
-
-