public abstract class ScreenBasedGame extends GameContainer
GameContainer that allows for separation of a
game into multiple GameScreens and provides support for
Transitions between such screens via a ScreenManagergraphics, height, shapeRenderer, spriteBatch, width| Constructor and Description |
|---|
ScreenBasedGame() |
| Modifier and Type | Method and Description |
|---|---|
void |
addScreen(GameScreen screen)
Add a
GameScreen to this game |
void |
enterGameScreen(int id,
Transition transitionOut,
Transition transitionIn)
Begins a transition to a new
GameScreen |
abstract int |
getInitialScreenId()
Returns the identifier of the
GameScreen that should be shown
when the game starts |
void |
interpolate(float alpha)
Interpolate the game state
|
void |
pause() |
protected void |
postinit()
Internal post-initialisation code
|
protected void |
preinit()
Internal pre-initialisation code
|
void |
render(Graphics g)
Render the game
|
void |
resume() |
void |
update(float delta)
Update the game
|
dispose, getHeight, getWidth, hide, initialise, render, resize, showpublic abstract int getInitialScreenId()
GameScreen that should be shown
when the game startsGameScreen identifier via GameScreen.getId()public void pause()
public void resume()
public void update(float delta)
GameContainerupdate in class GameContainerdelta - The time in seconds since the last updatepublic void interpolate(float alpha)
GameContainerinterpolate in class GameContaineralpha - The alpha value to use during interpolationpublic void render(Graphics g)
GameContainerrender in class GameContainerg - The Graphics context available for renderingpublic void addScreen(GameScreen screen)
GameScreen to this gamescreen - The GameScreen to be addedpublic void enterGameScreen(int id,
Transition transitionOut,
Transition transitionIn)
GameScreenid - The id of the GameScreen to transition totransitionOut - The outgoing Transition, e.g. fade outtransitionIn - The incoming Transition, e.g. fade inprotected void preinit()
GameContainerpreinit in class GameContainerprotected void postinit()
GameContainerpostinit in class GameContainer