public abstract class GameContainer
extends java.lang.Object
implements com.badlogic.gdx.Screen
Modifier and Type | Field and Description |
---|---|
protected Graphics |
graphics |
protected int |
height |
static float |
MAXIMUM_DELTA |
protected com.badlogic.gdx.graphics.glutils.ShapeRenderer |
shapeRenderer |
protected com.badlogic.gdx.graphics.g2d.SpriteBatch |
spriteBatch |
protected int |
width |
Constructor and Description |
---|
GameContainer() |
Modifier and Type | Method and Description |
---|---|
com.badlogic.gdx.scenes.scene2d.Stage |
createStage(com.badlogic.gdx.utils.viewport.Viewport viewport)
Creates a LibGDX using the internal
Graphics context |
void |
dispose() |
int |
getHeight() |
int |
getWidth() |
void |
hide() |
abstract void |
initialise()
Initialse the game
|
abstract void |
interpolate(float alpha)
Interpolate the game state
|
abstract void |
onPause() |
abstract void |
onResize(int width,
int height)
Called when the game window changes dimensions.
|
abstract void |
onResume() |
void |
pause() |
protected void |
postinit()
Internal post-initialisation code
|
protected void |
preinit()
Internal pre-initialisation code
|
void |
render(float delta) |
abstract void |
render(Graphics g)
Render the game
|
void |
resize(int width,
int height) |
void |
resume() |
void |
show() |
abstract void |
update(float delta)
Update the game
|
public static final float MAXIMUM_DELTA
protected int width
protected int height
protected Graphics graphics
protected com.badlogic.gdx.graphics.g2d.SpriteBatch spriteBatch
protected com.badlogic.gdx.graphics.glutils.ShapeRenderer shapeRenderer
public abstract void initialise()
public abstract void update(float delta)
delta
- The time in seconds since the last updatepublic abstract void interpolate(float alpha)
alpha
- The alpha value to use during interpolationpublic abstract void render(Graphics g)
g
- The Graphics
context available for renderingpublic abstract void onResize(int width, int height)
width
- The new game window widthheight
- The new game window heightpublic abstract void onPause()
public abstract void onResume()
public void render(float delta)
render
in interface com.badlogic.gdx.Screen
public void resize(int width, int height)
resize
in interface com.badlogic.gdx.Screen
public com.badlogic.gdx.scenes.scene2d.Stage createStage(com.badlogic.gdx.utils.viewport.Viewport viewport)
Graphics
contextviewport
- The Viewport
to be appliedStage
protected void preinit()
protected void postinit()
public void show()
show
in interface com.badlogic.gdx.Screen
public void dispose()
dispose
in interface com.badlogic.gdx.Screen
public void hide()
hide
in interface com.badlogic.gdx.Screen
public void pause()
pause
in interface com.badlogic.gdx.Screen
public void resume()
resume
in interface com.badlogic.gdx.Screen
public int getWidth()
public int getHeight()