Class MainGameScreen

java.lang.Object
com.badlogic.gdx.ScreenAdapter
com.csse3200.game.screens.PausableScreen
com.csse3200.game.screens.MainGameScreen
All Implemented Interfaces:
com.badlogic.gdx.Screen

public class MainGameScreen extends PausableScreen
The game screen containing the main game.

Details on libGDX screens: https://happycoding.io/tutorials/libgdx/game-screens

  • Field Summary

    Fields inherited from class com.csse3200.game.screens.PausableScreen

    game, resting
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a MainGameScreen instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Disposes of resources used by the game screen.
     
    void
    Pauses the game, stopping any ongoing music and setting the paused state.
    void
    render(float delta)
    Renders the game screen and updates the physics engine, game entities, and renderer.
    void
    resize(int width, int height)
    Resizes the renderer to fit dimensions.
    void
    Puts the screen into a resting state, pausing music and resting all entities.
    void
    Resumes the game and restarts music if not in resting state.
    void
    Sets the beginning map of the game.
    void
    Wakes the screen from a resting state.

    Methods inherited from class com.csse3200.game.screens.PausableScreen

    addOverlay, addSnakePopupOverlay, removeOverlay

    Methods inherited from class com.badlogic.gdx.ScreenAdapter

    hide, show

    Methods inherited from class java.lang.Object

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

    • MainGameScreen

      public MainGameScreen(GdxGame game)
      Constructs a MainGameScreen instance.
      Parameters:
      game - The main game instance used.
  • Method Details

    • setMap

      public void setMap(MapHandler.MapType mapType)
      Sets the beginning map of the game.
      Parameters:
      mapType - The map type to set the map to.
    • render

      public void render(float delta)
      Renders the game screen and updates the physics engine, game entities, and renderer.
      Specified by:
      render in interface com.badlogic.gdx.Screen
      Overrides:
      render in class com.badlogic.gdx.ScreenAdapter
      Parameters:
      delta - The time elapsed since the last render call.
    • resize

      public void resize(int width, int height)
      Resizes the renderer to fit dimensions.
      Specified by:
      resize in interface com.badlogic.gdx.Screen
      Overrides:
      resize in class com.badlogic.gdx.ScreenAdapter
      Parameters:
      width - width of the screen.
      height - height of the screen.
    • pause

      public void pause()
      Pauses the game, stopping any ongoing music and setting the paused state.
      Specified by:
      pause in interface com.badlogic.gdx.Screen
      Overrides:
      pause in class com.badlogic.gdx.ScreenAdapter
    • resume

      public void resume()
      Resumes the game and restarts music if not in resting state.
      Specified by:
      resume in interface com.badlogic.gdx.Screen
      Overrides:
      resume in class com.badlogic.gdx.ScreenAdapter
    • dispose

      public void dispose()
      Disposes of resources used by the game screen.
      Specified by:
      dispose in interface com.badlogic.gdx.Screen
      Overrides:
      dispose in class com.badlogic.gdx.ScreenAdapter
    • rest

      public void rest()
      Puts the screen into a resting state, pausing music and resting all entities.
      Overrides:
      rest in class PausableScreen
    • wake

      public void wake()
      Wakes the screen from a resting state.
      Overrides:
      wake in class PausableScreen
    • getGameArea

      public GameArea getGameArea()