Class MenuScreen

java.lang.Object
com.skloch.game.MenuScreen
All Implemented Interfaces:
com.badlogic.gdx.Screen

public class MenuScreen extends Object implements 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

    Fields
    Modifier and Type
    Field
    Description
    (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

    Constructors
    Constructor
    Description
    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 Type
    Method
    Description
    void
    Dispose of all menu assets
    void
     
    com.badlogic.gdx.scenes.scene2d.ui.Table
    Creates an avatar selection screen, consisting of a label and two buttons
    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
    void
     
    void
    render(float delta)
    Renders the main menu, and any windows that are displaying information
    void
    resize(int width, int height)
    Correctly resizes the menu screen
    void
     
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • game

      final HustleGame 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

      public MenuScreen(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. 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 interface com.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 interface com.badlogic.gdx.Screen
      Parameters:
      width -
      height -
    • show

      public void show()
      Specified by:
      show in interface com.badlogic.gdx.Screen
    • hide

      public void hide()
      Specified by:
      hide in interface com.badlogic.gdx.Screen
    • pause

      public void pause()
      Specified by:
      pause in interface com.badlogic.gdx.Screen
    • resume

      public void resume()
      Specified by:
      resume in interface com.badlogic.gdx.Screen
    • dispose

      public void dispose()
      Dispose of all menu assets
      Specified by:
      dispose in interface com.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