Class VRGui<T extends IGui>

java.lang.Object
gaiasky.interafce.VRGui<T>
All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable, IGui

public class VRGui<T extends IGui> extends Object implements IGui
  • Constructor Summary

    Constructors
    Constructor
    Description
    VRGui​(Class<T> clazz, int hOffset, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.backends.lwjgl3.Lwjgl3Graphics graphics, Float unitsPerPixel)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Removes the focus from this GUI and returns true if the focus was in the GUI, false otherwise.
    void
     
    void
    doneLoading​(com.badlogic.gdx.assets.AssetManager assetManager)
    Hook that runs after the assets have been loaded.
    com.badlogic.gdx.scenes.scene2d.Actor
    findActor​(String name)
    Returns the first actor found with the specified name.
    com.badlogic.gdx.scenes.scene2d.Stage
    Returns the stage
    void
    initialize​(com.badlogic.gdx.assets.AssetManager assetManager, com.badlogic.gdx.graphics.g2d.SpriteBatch sb)
    Initializes the GUI, adding all the resources to the asset manager queue for loading
     
    boolean
    Returns whether this GUI must be drawn or not
    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
    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
    boolean
    updateUnitsPerPixel​(float upp)
    Updates the units-per-pixel value of this GUI.
    void
    updateViewportSize​(int w, int h, boolean centerCamera)
     

    Methods inherited from class java.lang.Object

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

    • VRGui

      public VRGui(Class<T> clazz, int hOffset, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.backends.lwjgl3.Lwjgl3Graphics graphics, Float unitsPerPixel)
  • Method Details

    • dispose

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

      public void initialize(com.badlogic.gdx.assets.AssetManager assetManager, com.badlogic.gdx.graphics.g2d.SpriteBatch sb)
      Description copied from interface: IGui
      Initializes the GUI, adding all the resources to the asset manager queue for loading
      Specified by:
      initialize in interface IGui
      Parameters:
      assetManager - The asset manager to load the resources with
      sb - The sprite batch to use for this GUI's stage
    • doneLoading

      public void doneLoading(com.badlogic.gdx.assets.AssetManager assetManager)
      Description copied from interface: IGui
      Hook that runs after the assets have been loaded. Completes the initialization process
      Specified by:
      doneLoading in interface IGui
      Parameters:
      assetManager - The asset manager
    • 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
    • right

      public T right()
    • left

      public T left()
    • 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
    • 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
    • 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.
    • 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
    • setVisibilityToggles

      public void setVisibilityToggles(ComponentTypes.ComponentType[] entities, ComponentTypes visible)
      Description copied from interface: IGui
      Sets the visibility state of the component entities
      Specified by:
      setVisibilityToggles in interface IGui
      Parameters:
      entities - The entities
      visible - The states
    • findActor

      public com.badlogic.gdx.scenes.scene2d.Actor findActor(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.
    • 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
    • updateViewportSize

      public void updateViewportSize(int w, int h, boolean centerCamera)
    • 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
    • updateUnitsPerPixel

      public boolean updateUnitsPerPixel(float upp)
      Description copied from interface: IGui
      Updates the units-per-pixel value of this GUI. The units-per-pixel is the same as 1/UI_SCALE.
      Specified by:
      updateUnitsPerPixel in interface IGui