Package com.skloch.game
Class MenuScreen
java.lang.Object
com.skloch.game.MenuScreen
- All Implemented Interfaces:
com.badlogic.gdx.Screen
A screen to display the game menu to the player has the buttons "Start", "Settings", "Credits, "Exit"
ALso diaplays a tutorial window and an avatar select screen
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) com.badlogic.gdx.graphics.OrthographicCamera
(package private) final HustleGame
private com.badlogic.gdx.scenes.scene2d.Stage
private com.badlogic.gdx.scenes.scene2d.ui.Image
private com.badlogic.gdx.utils.viewport.Viewport
-
Constructor Summary
ConstructorsConstructorDescriptionMenuScreen
(HustleGame game) A class to display a menu screen, initially gives the player 4 options, Start, Settings, Credits, Quit Upon hitting start, a tutorial window is shown, and then an avatar select screen is shown, and then it is switched to GameScreen. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Dispose of all menu assetsvoid
hide()
com.badlogic.gdx.scenes.scene2d.ui.Table
Creates an avatar selection screen, consisting of a label and two buttonscom.badlogic.gdx.scenes.scene2d.ui.Window
makeTutorialWindow
(com.badlogic.gdx.scenes.scene2d.ui.Table nextTable) Generates a window to teach the player how to play the game Displays the tutorial text shown in Text/tutorial_text.txtvoid
pause()
void
render
(float delta) Renders the main menu, and any windows that are displaying informationvoid
resize
(int width, int height) Correctly resizes the menu screenvoid
resume()
void
show()
-
Field Details
-
game
-
camera
com.badlogic.gdx.graphics.OrthographicCamera camera -
viewport
private com.badlogic.gdx.utils.viewport.Viewport viewport -
titleImage
private com.badlogic.gdx.scenes.scene2d.ui.Image titleImage
-
-
Constructor Details
-
MenuScreen
A class to display a menu screen, initially gives the player 4 options, Start, Settings, Credits, Quit Upon hitting start, a tutorial window is shown, and then an avatar select screen is shown, and then it is switched to GameScreen. Settings switches to SettingsScreen Credits switches to CreditsScreen Quit exits the game- Parameters:
game
- An instance of HustleGame with loaded variables
-
-
Method Details
-
render
public void render(float delta) Renders the main menu, and any windows that are displaying information- Specified by:
render
in interfacecom.badlogic.gdx.Screen
- Parameters:
delta
- The time in seconds since the last render.
-
resize
public void resize(int width, int height) Correctly resizes the menu screen- Specified by:
resize
in interfacecom.badlogic.gdx.Screen
- Parameters:
width
-height
-
-
show
public void show()- Specified by:
show
in interfacecom.badlogic.gdx.Screen
-
hide
public void hide()- Specified by:
hide
in interfacecom.badlogic.gdx.Screen
-
pause
public void pause()- Specified by:
pause
in interfacecom.badlogic.gdx.Screen
-
resume
public void resume()- Specified by:
resume
in interfacecom.badlogic.gdx.Screen
-
dispose
public void dispose()Dispose of all menu assets- Specified by:
dispose
in interfacecom.badlogic.gdx.Screen
-
makeTutorialWindow
public com.badlogic.gdx.scenes.scene2d.ui.Window makeTutorialWindow(com.badlogic.gdx.scenes.scene2d.ui.Table nextTable) Generates a window to teach the player how to play the game Displays the tutorial text shown in Text/tutorial_text.txt- Returns:
- A small window to explain the game
-
makeAvatarSelectTable
public com.badlogic.gdx.scenes.scene2d.ui.Table makeAvatarSelectTable()Creates an avatar selection screen, consisting of a label and two buttons- Returns:
- A table containing UI elements
-