Class MainGameScreen

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

public class MainGameScreen extends com.badlogic.gdx.ScreenAdapter
The game screen containing the main game.

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

  • Field Details

    • viewportWidth

      public static int viewportWidth
    • viewportHeight

      public static int viewportHeight
  • Constructor Details

    • MainGameScreen

      public MainGameScreen(GdxGame game)
  • Method Details

    • getBackgroundTexture

      public com.badlogic.gdx.graphics.Texture getBackgroundTexture()
      Retrieves the background texture based on the currently selected game level.

      The method returns different textures for each game level:

      • Ice Level: "images/ice_bg.png"
      • Lava Level: "images/lava_bg.png"
      • Any other level: Default to "images/desert_bg.png"
      Returns:
      The background Texture corresponding to the selected level.
    • render

      public void render(float delta)
      Specified by:
      render in interface com.badlogic.gdx.Screen
      Overrides:
      render in class com.badlogic.gdx.ScreenAdapter
    • resize

      public void resize(int width, int height)
      Specified by:
      resize in interface com.badlogic.gdx.Screen
      Overrides:
      resize in class com.badlogic.gdx.ScreenAdapter
    • pause

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

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

      public void dispose()
      Specified by:
      dispose in interface com.badlogic.gdx.Screen
      Overrides:
      dispose in class com.badlogic.gdx.ScreenAdapter