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

    Fields
    Modifier and Type
    Field
    Description
    protected com.badlogic.gdx.utils.viewport.FillViewport
    For drawing background textures outside the game world
    protected Optional<com.badlogic.gdx.scenes.scene2d.Actor>
    An actor which our main camera will follow
    protected com.badlogic.gdx.InputMultiplexer
    Input processors (e.g.
    static final int
    Render constants
    static final int
    Render constants
    static final com.badlogic.gdx.scenes.scene2d.ui.Skin
    Skin used for all UI elements
    protected final com.badlogic.gdx.graphics.g2d.SpriteBatch
    The batch used for drawing sprites
    protected final HashSet<group24.escaperoom.screens.AbstractScreen.RenderSprite>
    The sprites to draw during render(float)
    static final int
    Render constants
    static final int
    Render constants
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    act(float delta)
     
    protected void
    addInputProcessor(com.badlogic.gdx.InputProcessor... processors)
    Add some number of input processors to screen
    void
    addPollable(Poll pollable)
     
    protected void
    addSprite(com.badlogic.gdx.graphics.Texture t, float x, float y, float width, float height)
     
    void
    addUI(com.badlogic.gdx.scenes.scene2d.Actor actor)
    Add UI to the uiStage
    void
     
    com.badlogic.gdx.math.Vector2
    gameCoordToUI(com.badlogic.gdx.math.Vector2 gameCoords)
     
     
    com.badlogic.gdx.scenes.scene2d.Stage
     
    void
     
    protected void
    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
    void
     
    void
    removePollable(Poll pollable)
     
    void
    render(float delta)
     
    void
    resize(int width, int height)
     
    void
     
    void
     
    com.badlogic.gdx.math.Vector2
    UIcoordToGame(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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SCREEN_WIDTH

      public static final int SCREEN_WIDTH
      Render constants
      See Also:
    • SCREEN_HEIGHT

      public static final int SCREEN_HEIGHT
      Render constants
      See Also:
    • WORLD_WIDTH

      public static final int WORLD_WIDTH
      Render constants
      See Also:
    • WORLD_HEIGHT

      public static final int WORLD_HEIGHT
      Render constants
      See Also:
    • skin

      public static final com.badlogic.gdx.scenes.scene2d.ui.Skin skin
      Skin used for all UI elements
    • inputPlex

      protected com.badlogic.gdx.InputMultiplexer inputPlex
      Input processors (e.g. the uiStage, the mainStage)
    • fillView

      protected com.badlogic.gdx.utils.viewport.FillViewport fillView
      For drawing background textures outside the game world
    • followActor

      protected Optional<com.badlogic.gdx.scenes.scene2d.Actor> followActor
      An actor which our main camera will follow
    • spriteBatch

      protected final com.badlogic.gdx.graphics.g2d.SpriteBatch spriteBatch
      The batch used for drawing sprites
    • sprites

      protected final HashSet<group24.escaperoom.screens.AbstractScreen.RenderSprite> sprites
      The sprites to draw during render(float)
  • Constructor Details

    • AbstractScreen

      protected AbstractScreen()
  • Method Details

    • getNotificationOverlay

      public NotificationOverlay 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:
      resize in interface com.badlogic.gdx.Screen
    • act

      public void act(float delta)
      Overrides:
      act in class com.badlogic.gdx.scenes.scene2d.Stage
    • addPollable

      public void addPollable(Poll pollable)
    • removePollable

      public void removePollable(Poll pollable)
    • 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:
      render in interface com.badlogic.gdx.Screen
    • addUI

      public void addUI(com.badlogic.gdx.scenes.scene2d.Actor actor)
      Add UI to the uiStage
      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 - InputProcessor to 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:
      show in interface com.badlogic.gdx.Screen
    • hide

      public void hide()
      Specified by:
      hide in interface com.badlogic.gdx.Screen
    • pause

      public void pause()
      Specified by:
      pause in interface com.badlogic.gdx.Screen
    • resume

      public void resume()
      Specified by:
      resume in interface com.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:
      dispose in interface com.badlogic.gdx.utils.Disposable
      Specified by:
      dispose in interface com.badlogic.gdx.Screen
      Overrides:
      dispose in class com.badlogic.gdx.scenes.scene2d.Stage