Package group24.escaperoom.screens
Class AbstractScreen
java.lang.Object
com.badlogic.gdx.InputAdapter
com.badlogic.gdx.scenes.scene2d.Stage
group24.escaperoom.screens.AbstractScreen
- All Implemented Interfaces:
com.badlogic.gdx.InputProcessor,com.badlogic.gdx.Screen,com.badlogic.gdx.utils.Disposable
- Direct Known Subclasses:
ItemEditor,MapScreen,MenuScreen
public abstract class AbstractScreen
extends com.badlogic.gdx.scenes.scene2d.Stage
implements com.badlogic.gdx.Screen
Abstract class from which all screens extend
-
Nested Class Summary
Nested classes/interfaces inherited from class com.badlogic.gdx.scenes.scene2d.Stage
com.badlogic.gdx.scenes.scene2d.Stage.TouchFocus -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.badlogic.gdx.utils.viewport.FillViewportFor drawing background textures outside the game worldprotected Optional<com.badlogic.gdx.scenes.scene2d.Actor>An actor which our main camera will followprotected com.badlogic.gdx.InputMultiplexerInput processors (e.g.static final intRender constantsstatic final intRender constantsstatic final com.badlogic.gdx.scenes.scene2d.ui.SkinSkin used for all UI elementsprotected final com.badlogic.gdx.graphics.g2d.SpriteBatchThe batch used for drawing spritesprotected final HashSet<group24.escaperoom.screens.AbstractScreen.RenderSprite>The sprites to draw duringrender(float)static final intRender constantsstatic final intRender constants -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidact(float delta) protected voidaddInputProcessor(com.badlogic.gdx.InputProcessor... processors) Add some number of input processors to screenvoidaddPollable(Poll pollable) protected voidaddSprite(com.badlogic.gdx.graphics.Texture t, float x, float y, float width, float height) voidaddUI(com.badlogic.gdx.scenes.scene2d.Actor actor) Add UI to theuiStagevoiddispose()com.badlogic.gdx.math.Vector2gameCoordToUI(com.badlogic.gdx.math.Vector2 gameCoords) com.badlogic.gdx.scenes.scene2d.Stagevoidhide()protected voidinit()This will be called when the scene is shown Use this function to add any UI or actors to the scene Note that ui should use super.uiStage and other actors can be added directly with addActorvoidpause()voidremovePollable(Poll pollable) voidrender(float delta) voidresize(int width, int height) voidresume()voidshow()com.badlogic.gdx.math.Vector2UIcoordToGame(com.badlogic.gdx.math.Vector2 uiCoords) Methods inherited from class com.badlogic.gdx.scenes.scene2d.Stage
act, actorRemoved, addAction, addActor, addCaptureListener, addListener, addTouchFocus, calculateScissors, cancelTouchFocus, cancelTouchFocus, cancelTouchFocusExcept, clear, draw, getActionsRequestRendering, getActors, getBatch, getCamera, getDebugColor, getHeight, getKeyboardFocus, getRoot, getScrollFocus, getViewport, getWidth, hit, isDebugAll, isInsideViewport, keyDown, keyTyped, keyUp, mouseMoved, removeCaptureListener, removeListener, removeTouchFocus, screenToStageCoordinates, scrolled, setActionsRequestRendering, setDebugAll, setDebugInvisible, setDebugParentUnderMouse, setDebugTableUnderMouse, setDebugTableUnderMouse, setDebugUnderMouse, setKeyboardFocus, setRoot, setScrollFocus, setViewport, stageToScreenCoordinates, toScreenCoordinates, touchCancelled, touchDown, touchDragged, touchUp, unfocus, unfocusAll
-
Field Details
-
SCREEN_WIDTH
public static final int SCREEN_WIDTHRender constants- See Also:
-
SCREEN_HEIGHT
public static final int SCREEN_HEIGHTRender constants- See Also:
-
WORLD_WIDTH
public static final int WORLD_WIDTHRender constants- See Also:
-
WORLD_HEIGHT
public static final int WORLD_HEIGHTRender constants- See Also:
-
skin
public static final com.badlogic.gdx.scenes.scene2d.ui.Skin skinSkin used for all UI elements -
inputPlex
protected com.badlogic.gdx.InputMultiplexer inputPlexInput processors (e.g. the uiStage, the mainStage) -
fillView
protected com.badlogic.gdx.utils.viewport.FillViewport fillViewFor drawing background textures outside the game world -
followActor
An actor which our main camera will follow -
spriteBatch
protected final com.badlogic.gdx.graphics.g2d.SpriteBatch spriteBatchThe batch used for drawing sprites -
sprites
The sprites to draw duringrender(float)
-
-
Constructor Details
-
AbstractScreen
protected AbstractScreen()
-
-
Method Details
-
getNotificationOverlay
- Returns:
- the notification overlay for this screen
-
init
protected void init()This will be called when the scene is shown Use this function to add any UI or actors to the scene Note that ui should use super.uiStage and other actors can be added directly with addActor -
resize
public void resize(int width, int height) - Specified by:
resizein interfacecom.badlogic.gdx.Screen
-
act
public void act(float delta) - Overrides:
actin classcom.badlogic.gdx.scenes.scene2d.Stage
-
addPollable
-
removePollable
-
addSprite
protected void addSprite(com.badlogic.gdx.graphics.Texture t, float x, float y, float width, float height) -
render
public void render(float delta) - Specified by:
renderin interfacecom.badlogic.gdx.Screen
-
addUI
public void addUI(com.badlogic.gdx.scenes.scene2d.Actor actor) Add UI to theuiStage- Parameters:
actor- the actor to be addd to the ui stage
-
addInputProcessor
protected void addInputProcessor(com.badlogic.gdx.InputProcessor... processors) Add some number of input processors to screen- Parameters:
processors-InputProcessorto be added
-
getUIStage
public com.badlogic.gdx.scenes.scene2d.Stage getUIStage()- Returns:
- the stage that all UI should be rendered on
-
show
public void show()- Specified by:
showin interfacecom.badlogic.gdx.Screen
-
hide
public void hide()- Specified by:
hidein interfacecom.badlogic.gdx.Screen
-
pause
public void pause()- Specified by:
pausein interfacecom.badlogic.gdx.Screen
-
resume
public void resume()- Specified by:
resumein interfacecom.badlogic.gdx.Screen
-
UIcoordToGame
public com.badlogic.gdx.math.Vector2 UIcoordToGame(com.badlogic.gdx.math.Vector2 uiCoords) - Parameters:
uiCoords- a vector in UI coordinates- Returns:
- that vector in game coordinates
-
gameCoordToUI
public com.badlogic.gdx.math.Vector2 gameCoordToUI(com.badlogic.gdx.math.Vector2 gameCoords) - Parameters:
gameCoords- A vector in game coordinates- Returns:
- that vector in ui coordinates
-
dispose
public void dispose()- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable- Specified by:
disposein interfacecom.badlogic.gdx.Screen- Overrides:
disposein classcom.badlogic.gdx.scenes.scene2d.Stage
-