Class AbstractGui

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int hoffset
      Horizontal offset, for VR
      protected com.badlogic.gdx.utils.Array<IGuiInterface> interfaces
      The GUI interfaces, if any
      protected java.lang.Object lock
      Lock for sync
      protected java.lang.String name
      The name of this GUI
      protected com.badlogic.gdx.scenes.scene2d.ui.Skin skin
      The skin to use
      protected com.badlogic.gdx.scenes.scene2d.Stage ui
      The user interface stage
      protected boolean vr
      Whether we're in VR mode
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractGui()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean cancelTouchFocus()
      Removes the focus from this GUI and returns true if the focus was in the GUI, false otherwise.
      void dispose()  
      com.badlogic.gdx.scenes.scene2d.Actor findActor​(java.lang.String name)
      Returns the first actor found with the specified name.
      com.badlogic.gdx.scenes.scene2d.Stage getGuiStage()
      Returns the stage
      java.lang.String getName()  
      boolean mustDraw()
      Returns whether this GUI must be drawn or not
      void notify​(Events event, java.lang.Object... data)  
      protected abstract void rebuildGui()
      Adds the already created GUI objects to the stage.
      void render​(int rw, int rh)
      Renders this GUI
      void resize​(int width, int height)
      Resizes this GUI to the given values at the end of the current loop
      void resizeImmediate​(int width, int height)
      Resizes without waiting for the current loop to finish
      void setHoffset​(int hoffset)
      Sets the horizontal offset, for VR
      void setSceneGraph​(ISceneGraph sg)
      Sets the scene graph to this GUI
      void setVisibilityToggles​(ComponentTypes.ComponentType[] entities, ComponentTypes visible)
      Sets the visibility state of the component entities
      void setVr​(boolean vr)
      Whether this GUI is to be used in VR mode
      void update​(double dt)
      Updates the GUI
      • Methods inherited from class java.lang.Object

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

      • ui

        protected com.badlogic.gdx.scenes.scene2d.Stage ui
        The user interface stage
      • skin

        protected com.badlogic.gdx.scenes.scene2d.ui.Skin skin
        The skin to use
      • interfaces

        protected com.badlogic.gdx.utils.Array<IGuiInterface> interfaces
        The GUI interfaces, if any
      • name

        protected java.lang.String name
        The name of this GUI
      • vr

        protected boolean vr
        Whether we're in VR mode
      • hoffset

        protected int hoffset
        Horizontal offset, for VR
      • lock

        protected java.lang.Object lock
        Lock for sync
    • Constructor Detail

      • AbstractGui

        public AbstractGui()
    • Method Detail

      • update

        public void update​(double dt)
        Description copied from interface: IGui
        Updates the GUI
        Specified by:
        update in interface IGui
        Parameters:
        dt - Time in seconds since the last frame
      • render

        public void render​(int rw,
                           int rh)
        Description copied from interface: IGui
        Renders this GUI
        Specified by:
        render in interface IGui
        Parameters:
        rw - The render width
        rh - The render height
      • getGuiStage

        public com.badlogic.gdx.scenes.scene2d.Stage getGuiStage()
        Description copied from interface: IGui
        Returns the stage
        Specified by:
        getGuiStage in interface IGui
        Returns:
        The stage
      • getName

        public java.lang.String getName()
      • dispose

        public void dispose()
        Specified by:
        dispose in interface com.badlogic.gdx.utils.Disposable
      • resize

        public void resize​(int width,
                           int height)
        Description copied from interface: IGui
        Resizes this GUI to the given values at the end of the current loop
        Specified by:
        resize in interface IGui
        Parameters:
        width - The new width
        height - The new height
      • resizeImmediate

        public void resizeImmediate​(int width,
                                    int height)
        Description copied from interface: IGui
        Resizes without waiting for the current loop to finish
        Specified by:
        resizeImmediate in interface IGui
        Parameters:
        width - The new width
        height - The new height
      • rebuildGui

        protected abstract void rebuildGui()
        Adds the already created GUI objects to the stage.
      • cancelTouchFocus

        public boolean cancelTouchFocus()
        Description copied from interface: IGui
        Removes the focus from this GUI and returns true if the focus was in the GUI, false otherwise.
        Specified by:
        cancelTouchFocus in interface IGui
        Returns:
        true if the focus was in the GUI, false otherwise.
      • findActor

        public com.badlogic.gdx.scenes.scene2d.Actor findActor​(java.lang.String name)
        Description copied from interface: IGui
        Returns the first actor found with the specified name. Note this recursively compares the name of every actor in the GUI.
        Specified by:
        findActor in interface IGui
        Returns:
        The actor if it exists, null otherwise.
      • setSceneGraph

        public void setSceneGraph​(ISceneGraph sg)
        Description copied from interface: IGui
        Sets the scene graph to this GUI
        Specified by:
        setSceneGraph in interface IGui
        Parameters:
        sg - The scene graph
      • notify

        public void notify​(Events event,
                           java.lang.Object... data)
        Specified by:
        notify in interface IObserver
      • setHoffset

        public void setHoffset​(int hoffset)
        Description copied from interface: IGui
        Sets the horizontal offset, for VR
        Specified by:
        setHoffset in interface IGui
        Parameters:
        hoffset - The horizontal offset in pixels
      • setVr

        public void setVr​(boolean vr)
        Description copied from interface: IGui
        Whether this GUI is to be used in VR mode
        Specified by:
        setVr in interface IGui
        Parameters:
        vr - Vr mode is active
      • mustDraw

        public boolean mustDraw()
        Description copied from interface: IGui
        Returns whether this GUI must be drawn or not
        Specified by:
        mustDraw in interface IGui
        Returns:
        Whether this is visible