Package com.skloch.game
Class HustleGame
java.lang.Object
com.badlogic.gdx.Game
com.skloch.game.HustleGame
- All Implemented Interfaces:
com.badlogic.gdx.ApplicationListener
public class HustleGame
extends com.badlogic.gdx.Game
A class that is initially created by DesktopLauncher, loads consistent files at the start of the game and initialises lots of important classes.
Loads the map, ui skin, text files and makes sound manager and more
-
Field Summary
FieldsModifier and TypeFieldDescriptionint[]
com.badlogic.gdx.graphics.g2d.SpriteBatch
com.badlogic.gdx.scenes.scene2d.Stage
int[]
int
com.badlogic.gdx.maps.tiled.TiledMap
com.badlogic.gdx.maps.MapProperties
float
int
int[]
com.badlogic.gdx.graphics.glutils.ShapeRenderer
com.badlogic.gdx.scenes.scene2d.ui.Skin
int
Fields inherited from class com.badlogic.gdx.Game
screen
-
Constructor Summary
ConstructorsConstructorDescriptionHustleGame
(int width, int height) A class to initialise a lot of the assets required for the game, including the map, sound and UI skin. -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Loads resources used throughout the game.void
dispose()
Disposes of elements that are loaded at the start of the gamereadTextFile
(String filepath) Reads and returns text read from the provided text file pathvoid
render()
Very important, renders the game, remove super.render() to get a black screenMethods inherited from class com.badlogic.gdx.Game
getScreen, pause, resize, resume, setScreen
-
Field Details
-
batch
public com.badlogic.gdx.graphics.g2d.SpriteBatch batch -
WIDTH
public int WIDTH -
HEIGHT
public int HEIGHT -
skin
public com.badlogic.gdx.scenes.scene2d.ui.Skin skin -
map
public com.badlogic.gdx.maps.tiled.TiledMap map -
credits
-
tutorialText
-
gameScreen
-
shapeRenderer
public com.badlogic.gdx.graphics.glutils.ShapeRenderer shapeRenderer -
soundManager
-
blueBackground
public com.badlogic.gdx.scenes.scene2d.Stage blueBackground -
backgroundLayers
public int[] backgroundLayers -
foregroundLayers
public int[] foregroundLayers -
objectLayers
public int[] objectLayers -
mapSquareSize
public int mapSquareSize -
mapScale
public float mapScale -
mapProperties
public com.badlogic.gdx.maps.MapProperties mapProperties
-
-
Constructor Details
-
HustleGame
public HustleGame(int width, int height) A class to initialise a lot of the assets required for the game, including the map, sound and UI skin. A instance of this object should be shared to most screens to allow resources to be shared and disposed of correctly. Should be created in DesktopLauncher,- Parameters:
width
- Width of the windowheight
- Height of the window
-
-
Method Details
-
create
public void create()Loads resources used throughout the game. Creates a new spritebatch Loads the UI skin to use Loads the map and configures which layers are background, foreground and object layers Loads a shape renderer for debug options Loads a sound manager to play sounds Loads credit and tutorial texts Creates a stage with a blue background for screens to use -
render
public void render()Very important, renders the game, remove super.render() to get a black screen- Specified by:
render
in interfacecom.badlogic.gdx.ApplicationListener
- Overrides:
render
in classcom.badlogic.gdx.Game
-
dispose
public void dispose()Disposes of elements that are loaded at the start of the game- Specified by:
dispose
in interfacecom.badlogic.gdx.ApplicationListener
- Overrides:
dispose
in classcom.badlogic.gdx.Game
-
readTextFile
Reads and returns text read from the provided text file path- Parameters:
filepath
- The path to the text file- Returns:
- The contents of the file as a String
-