public abstract class ScreenBasedGame extends GameContainer
GameContainer
that allows for separation of a
game into multiple GameScreen
s and provides support for
Transition
s between such screens via a ScreenManager
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 |
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, show
public 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)
GameContainer
update
in class GameContainer
delta
- The time in seconds since the last updatepublic void render(Graphics g)
GameContainer
render
in class GameContainer
g
- 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)
GameScreen
id
- The id of the GameScreen
to transition totransitionOut
- The outgoing Transition
, e.g. fade outtransitionIn
- The incoming Transition
, e.g. fade inprotected void preinit()
GameContainer
preinit
in class GameContainer
protected void postinit()
GameContainer
postinit
in class GameContainer
Copyright © 2014. All rights reserved.