public class SubScreenContext extends java.lang.Object implements ScreenContext
| Modifier and Type | Field and Description |
|---|---|
protected ScreenSwitch |
screenSwitch
List of subScreen's plus visibility flag
|
protected boolean |
showSubScreen
True if a subScreen is visible
|
protected com.badlogic.gdx.utils.viewport.Viewport |
viewport
viewport of the screen (manages the glViewport)
|
| Constructor and Description |
|---|
SubScreenContext(com.badlogic.gdx.utils.viewport.Viewport viewport)
Constructs a context with the given viewport.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSubScreen(SubScreenId id,
SubScreen subScreen)
Add a sub screen to the screen.
|
void |
applyViewport()
Applies the viewport of the context.
|
void |
dispose() |
SubScreen |
getActiveSubScreen() |
com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch |
getBatch() |
com.badlogic.gdx.InputMultiplexer |
getInputHandler() |
com.badlogic.gdx.utils.viewport.Viewport |
getViewport() |
void |
hideScreen()
Hides the currently active screen.
|
void |
initialize(SubScreenId id)
Initializes the context with the given screen.
|
void |
onActivate(ScreenId screenKey) |
float |
onDeactivate(ScreenId screenKey) |
void |
pauseSubScreen() |
void |
renderScreen() |
void |
resizeSubScreen(int width,
int height) |
void |
resumeSubScreen() |
void |
setBatch(com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch polygonSpriteBatch)
Sets the batch of the context.
|
void |
setDependencies(java.util.Map<java.lang.String,java.lang.Object> dependencies)
Sets the dependency map of the screen switch.
|
void |
setInputHandler(com.badlogic.gdx.InputMultiplexer inputHandler)
Sets the inputHandler of the context.
|
void |
showScreen(SubScreenId id)
Shows the screen mapped to the given id.
|
void |
update() |
void |
updateViewport(int width,
int height)
Updates the viewport of the context.
|
protected final ScreenSwitch screenSwitch
protected final com.badlogic.gdx.utils.viewport.Viewport viewport
protected boolean showSubScreen
public SubScreenContext(com.badlogic.gdx.utils.viewport.Viewport viewport)
viewport - viewport viewport of the screenpublic void setDependencies(java.util.Map<java.lang.String,java.lang.Object> dependencies)
dependencies - map of dependenciespublic void setBatch(com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch polygonSpriteBatch)
polygonSpriteBatch - batchpublic void setInputHandler(com.badlogic.gdx.InputMultiplexer inputHandler)
inputHandler - inputHandlerpublic com.badlogic.gdx.InputMultiplexer getInputHandler()
public void onActivate(ScreenId screenKey)
public float onDeactivate(ScreenId screenKey)
public void applyViewport()
Viewport.apply(boolean).public void updateViewport(int width,
int height)
Viewport.update(int, int, boolean).width - width of the frameheight - height of the framepublic void update()
public void renderScreen()
public void resizeSubScreen(int width,
int height)
public void pauseSubScreen()
public void resumeSubScreen()
public void dispose()
public com.badlogic.gdx.utils.viewport.Viewport getViewport()
getViewport in interface ScreenContextpublic com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch getBatch()
getBatch in interface ScreenContextpublic void addSubScreen(SubScreenId id, SubScreen subScreen)
ScreenContextaddSubScreen in interface ScreenContextid - id of the screensubScreen - the screen itselfpublic SubScreen getActiveSubScreen()
getActiveSubScreen in interface ScreenContextpublic void showScreen(SubScreenId id)
ScreenContextshowScreen in interface ScreenContextid - id of an added subscreenpublic void initialize(SubScreenId id)
ScreenContextinitialize in interface ScreenContextid - id of the screenpublic void hideScreen()
ScreenContexthideScreen in interface ScreenContext