Package com.csse3200.game.screens
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
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Disposes of resources used by the game screen.void
pause()
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
rest()
Puts the screen into a resting state, pausing music and resting all entities.void
resume()
Resumes the game and restarts music if not in resting state.void
setMap
(MapHandler.MapType mapType) Sets the beginning map of the game.void
wake()
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
-
Constructor Details
-
MainGameScreen
Constructs a MainGameScreen instance.- Parameters:
game
- The main game instance used.
-
-
Method Details
-
setMap
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 interfacecom.badlogic.gdx.Screen
- Overrides:
render
in classcom.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 interfacecom.badlogic.gdx.Screen
- Overrides:
resize
in classcom.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 interfacecom.badlogic.gdx.Screen
- Overrides:
pause
in classcom.badlogic.gdx.ScreenAdapter
-
resume
public void resume()Resumes the game and restarts music if not in resting state.- Specified by:
resume
in interfacecom.badlogic.gdx.Screen
- Overrides:
resume
in classcom.badlogic.gdx.ScreenAdapter
-
dispose
public void dispose()Disposes of resources used by the game screen.- Specified by:
dispose
in interfacecom.badlogic.gdx.Screen
- Overrides:
dispose
in classcom.badlogic.gdx.ScreenAdapter
-
rest
public void rest()Puts the screen into a resting state, pausing music and resting all entities.- Overrides:
rest
in classPausableScreen
-
wake
public void wake()Wakes the screen from a resting state.- Overrides:
wake
in classPausableScreen
-
getGameArea
-