public class BasicScreenManager<T extends GameScreen> extends java.lang.Object implements ScreenManager<T>
Modifier and Type | Field and Description |
---|---|
protected T |
currentScreen |
protected T |
nextScreen |
protected Transition |
transitionIn |
protected Transition |
transitionOut |
Constructor and Description |
---|
BasicScreenManager() |
Modifier and Type | Method and Description |
---|---|
void |
addGameScreen(T screen)
Adds a
GameScreen to this manager |
void |
enterGameScreen(int id,
Transition transitionOut,
Transition transitionIn)
Begins a transition to a new
GameScreen |
T |
getGameScreen(int id)
Returns the
GameScreen with the given id |
java.util.Iterator<T> |
getGameScreens()
Returns an
Iterator over all the game screens |
void |
interpolate(GameContainer gc,
float alpha)
Interpolate between the previous and current state
|
boolean |
isTransitioning()
Returns if the
ScreenManager is moving between Screen s |
void |
onPause() |
void |
onResize(int width,
int height) |
void |
onResume() |
void |
render(GameContainer gc,
Graphics g)
Renders the current
GameScreen and any Transition that
may be occurring |
void |
update(GameContainer gc,
float delta)
Updates the current
GameScreen and any Transition that
may be occurring |
protected T extends GameScreen currentScreen
protected T extends GameScreen nextScreen
protected Transition transitionIn
protected Transition transitionOut
public void update(GameContainer gc, float delta)
ScreenManager
GameScreen
and any Transition
that
may be occurringupdate
in interface ScreenManager<T extends GameScreen>
gc
- The GameContainer
that is updating this
ScreenManager
delta
- The time since the last updatepublic void interpolate(GameContainer gc, float alpha)
ScreenManager
interpolate
in interface ScreenManager<T extends GameScreen>
alpha
- The interpolation alpha valuepublic void render(GameContainer gc, Graphics g)
ScreenManager
GameScreen
and any Transition
that
may be occurringrender
in interface ScreenManager<T extends GameScreen>
gc
- The GameContainer
that is rendering this
ScreenManager
g
- The Graphics
context available for renderingpublic void enterGameScreen(int id, Transition transitionOut, Transition transitionIn)
ScreenManager
GameScreen
enterGameScreen
in interface ScreenManager<T extends GameScreen>
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(T screen)
ScreenManager
GameScreen
to this manageraddGameScreen
in interface ScreenManager<T extends GameScreen>
screen
- The GameScreen
to be addedpublic T getGameScreen(int id)
ScreenManager
GameScreen
with the given idgetGameScreen
in interface ScreenManager<T extends GameScreen>
id
- The id to search forGameScreen
registered with this
managerpublic boolean isTransitioning()
ScreenManager
ScreenManager
is moving between Screen
sisTransitioning
in interface ScreenManager<T extends GameScreen>
Transition
s activepublic void onResize(int width, int height)
onResize
in interface GameResizeListener
public void onPause()
onPause
in interface ScreenManager<T extends GameScreen>
public void onResume()
onResume
in interface ScreenManager<T extends GameScreen>
public java.util.Iterator<T> getGameScreens()
ScreenManager
Iterator
over all the game screensgetGameScreens
in interface ScreenManager<T extends GameScreen>