public class ScreenManagerSystem extends GameSystem<GameScreenEntity> implements ScreenManager<GameScreenEntity>
ScreenManager
as a System
suitable for
the Entity-Component-System architectureModifier and Type | Field and Description |
---|---|
protected GameScreenEntity |
currentScreen |
protected GameScreenEntity |
nextScreen |
protected Transition |
transitionIn |
protected Transition |
transitionOut |
Constructor and Description |
---|
ScreenManagerSystem() |
Modifier and Type | Method and Description |
---|---|
void |
addGameScreen(GameScreenEntity screen)
Interface implementation.
|
void |
enterGameScreen(int id,
Transition transitionOut,
Transition transitionIn)
Begins a transition to a new
GameScreen |
GameScreenEntity |
getGameScreen(int id)
Returns the
GameScreen with the given id |
void |
initialise(GameContainer gc)
Initialise the
System |
void |
interpolate(GameContainer gc,
float alpha)
Interpolate the
System |
boolean |
isDebugging()
Returns if this
System is debugging |
boolean |
isTransitioning()
Returns if the
ScreenManager is moving between Screen s |
void |
render(GameContainer gc,
Graphics g)
Render the
System |
void |
setDebugging(boolean debugging)
Sets whether or not this
System is in debug mode |
void |
update(GameContainer gc,
float delta)
Update the
System |
update
addEntity, getEntity, removeEntity
protected GameScreenEntity currentScreen
protected GameScreenEntity nextScreen
protected Transition transitionIn
protected Transition transitionOut
public void initialise(GameContainer gc)
GameSystem
System
initialise
in class GameSystem<GameScreenEntity>
gc
- The GameContainer
calling initialisepublic void update(GameContainer gc, float delta)
GameSystem
System
update
in interface ScreenManager<GameScreenEntity>
update
in class GameSystem<GameScreenEntity>
gc
- The GameContainer
calling updatedelta
- The time in seconds since the last updatepublic void interpolate(GameContainer gc, float alpha)
GameSystem
System
interpolate
in interface ScreenManager<GameScreenEntity>
interpolate
in class GameSystem<GameScreenEntity>
gc
- The GameContainer
calling interpolatealpha
- The alpha value to use during interpolationpublic void render(GameContainer gc, Graphics g)
GameSystem
System
render
in interface ScreenManager<GameScreenEntity>
render
in class GameSystem<GameScreenEntity>
gc
- The GameContainer
calling renderg
- The Graphics
instancepublic boolean isDebugging()
System
System
is debuggingisDebugging
in class System<GameScreenEntity>
public void setDebugging(boolean debugging)
System
System
is in debug modesetDebugging
in class System<GameScreenEntity>
debugging
- True if debuggingpublic void enterGameScreen(int id, Transition transitionOut, Transition transitionIn)
ScreenManager
GameScreen
enterGameScreen
in interface ScreenManager<GameScreenEntity>
id
- The id of the GameScreen
to transition totransitionOut
- The outgoing Transition
, e.g. fade outtransitionIn
- The incoming Transition
, e.g. fade inpublic void addGameScreen(GameScreenEntity screen)
addGameScreen
in interface ScreenManager<GameScreenEntity>
screen
- The GameScreen
to be addedpublic GameScreenEntity getGameScreen(int id)
ScreenManager
GameScreen
with the given idgetGameScreen
in interface ScreenManager<GameScreenEntity>
id
- The id to search forGameScreen
registered with this
managerpublic boolean isTransitioning()
ScreenManager
ScreenManager
is moving between Screen
sisTransitioning
in interface ScreenManager<GameScreenEntity>
Transition
s active