public class ScreenSwitch
extends java.lang.Object
| Constructor and Description |
|---|
ScreenSwitch()
Constructs a new screen switch.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDependency(java.lang.String id,
java.lang.Object dependency)
Add a dependency to this screen switch.
|
void |
addScreen(ScreenId id,
Screen screen)
Adds a screen to the switch and maps it to the given id.
|
boolean |
containsScreen(ScreenId id)
Checks if the screen has been added to the switch.
|
void |
dispose()
Calls dispose on every added screen.
|
Screen |
getActiveScreen()
Returns the active screen.
|
ScreenId |
getActiveScreenId() |
com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch |
getBatch() |
com.badlogic.gdx.InputMultiplexer |
getInputHandler() |
void |
pause()
Calls pause on every added screen.
|
void |
renderScreen()
Renders the active screen.
|
void |
resize(int width,
int height)
Calls resize of the active screen.
|
void |
resume()
Calls resume on every added screen.
|
void |
setActive(ScreenId id)
Sets the screen mapped to the given id as currently active.
|
void |
setBatch(com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch batch)
Sets the given batch as current switch batch.
|
void |
setDependencyMap(java.util.Map<java.lang.String,java.lang.Object> dependencyMap)
Set the dependency map.
|
void |
setInputHandler(com.badlogic.gdx.InputMultiplexer inputMultiplexer) |
void |
setScreenSimple(ScreenId id)
Just sets the active screen without calling onActivate.
|
void |
updateScreen()
Updates the screen without updating the switch itself.
|
void |
updateSwitch()
Updates the switch itself without updating the active screen.
|
public ScreenSwitch()
public void setBatch(com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch batch)
batch - batchpublic void setInputHandler(com.badlogic.gdx.InputMultiplexer inputMultiplexer)
public com.badlogic.gdx.InputMultiplexer getInputHandler()
public com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch getBatch()
public void addScreen(ScreenId id, Screen screen)
id - id of the screenscreen - the screen itselfpublic void setScreenSimple(ScreenId id)
id - id of the screenpublic void setActive(ScreenId id)
Screen.onDeactivate(ScreenId) on the old screen and Screen.onActivate(ScreenId) on the new screen.id - id of the new screenpublic Screen getActiveScreen()
public ScreenId getActiveScreenId()
public boolean containsScreen(ScreenId id)
id - id to checkpublic void updateSwitch()
public void updateScreen()
public void renderScreen()
public void resize(int width,
int height)
width - width of the frameheight - height of the framepublic void pause()
public void resume()
public void dispose()
public void addDependency(java.lang.String id,
java.lang.Object dependency)
id - id of the dependencydependency - the dependencypublic void setDependencyMap(java.util.Map<java.lang.String,java.lang.Object> dependencyMap)
dependencyMap - map of dependencies