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 HustleGameprivate com.badlogic.gdx.scenes.scene2d.Stageprivate com.badlogic.gdx.scenes.scene2d.ui.Imageprivate 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 TypeMethodDescriptionvoiddispose()Dispose of all menu assetsvoidhide()com.badlogic.gdx.scenes.scene2d.ui.TableCreates an avatar selection screen, consisting of a label and two buttonscom.badlogic.gdx.scenes.scene2d.ui.WindowmakeTutorialWindow(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.txtvoidpause()voidrender(float delta) Renders the main menu, and any windows that are displaying informationvoidresize(int width, int height) Correctly resizes the menu screenvoidresume()voidshow()
-
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:
renderin 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:
resizein interfacecom.badlogic.gdx.Screen- Parameters:
width-height-
-
show
public void show()- Specified by:
showin interfacecom.badlogic.gdx.Screen
-
hide
public void hide()- Specified by:
hidein 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
-
dispose
public void dispose()Dispose of all menu assets- Specified by:
disposein 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
-