Class MainVRGui

java.lang.Object
gaiasky.gui.vr.MainVRGui
All Implemented Interfaces:
com.badlogic.gdx.InputProcessor, com.badlogic.gdx.utils.Disposable, IObserver, IGui, XrInputListener

public class MainVRGui extends Object implements XrInputListener, com.badlogic.gdx.InputProcessor, IGui, IObserver, com.badlogic.gdx.utils.Disposable
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Height of the UI frame buffer.
    static final double
    Half of the ratio between height and width.
    static final double
    Ratio between height and width.
    static final int
    Width of the UI frame buffer.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MainVRGui(com.badlogic.gdx.scenes.scene2d.ui.Skin skin)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    accept(boolean value, XrControllerDevice device)
     
    void
    build(com.badlogic.gdx.scenes.scene2d.ui.Skin skin)
     
    boolean
    cameraMode(boolean value, XrControllerDevice device)
     
    boolean
    Removes the focus from this GUI and returns true if the focus was in the GUI, false otherwise.
    boolean
    contains(int x, int y, com.badlogic.gdx.math.Vector3[] points)
    Checks whether the quadrilateral or polygon defined by points contains the point [x,y].
    void
     
    void
    doneLoading(com.badlogic.gdx.assets.AssetManager assetManager)
    Hook that runs after the assets have been loaded.
    com.badlogic.gdx.scenes.scene2d.Actor
    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 manager, com.badlogic.gdx.graphics.g2d.SpriteBatch batch)
    Initializes the GUI, adding all the resources to the asset manager queue for loading
    boolean
    Returns whether this GUI is a VR gui.
    boolean
    keyDown(int keycode)
     
    boolean
    keyTyped(char character)
     
    boolean
    keyUp(int keycode)
     
    boolean
    mouseMoved(int screenX, int screenY)
     
    boolean
    move(com.badlogic.gdx.math.Vector2 value, XrControllerDevice device)
     
    boolean
    Returns whether this GUI must be drawn or not
    void
    notify(Event event, Object source, Object... data)
    Event notification call.
    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
    boolean
    rotate(boolean value, XrControllerDevice device)
     
    boolean
    scrolled(float amountX, float amountY)
     
    boolean
    select(float value, XrControllerDevice device)
     
    void
    setBackBufferSize(int width, int height)
    Sets the back buffer size.
    void
    setScene(Scene scene)
     
    void
    setSkin(com.badlogic.gdx.scenes.scene2d.ui.Skin skin)
     
    void
    Sets the visibility state of the component entities
    void
    setVR(boolean vr)
    Whether this GUI is to be used in VR mode
    boolean
    showUI(boolean value, XrControllerDevice device)
     
    boolean
    touchCancelled(int screenX, int screenY, int pointer, int button)
     
    boolean
    touchDown(int screenX, int screenY, int pointer, int button)
     
    boolean
    touchDragged(int screenX, int screenY, int pointer)
     
    boolean
    touchUp(int screenX, int screenY, int pointer, int button)
     
    void
    update(double dt)
    Updates the GUI
    boolean
    Updates the units-per-pixel value of this GUI.

    Methods inherited from class java.lang.Object

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

    • WIDTH

      public static final int WIDTH
      Width of the UI frame buffer.
      See Also:
    • HEIGHT

      public static final int HEIGHT
      Height of the UI frame buffer.
      See Also:
    • HEIGHT_OVER_WIDTH

      public static final double HEIGHT_OVER_WIDTH
      Ratio between height and width.
      See Also:
    • HEIGHT_OVER_2WIDTH

      public static final double HEIGHT_OVER_2WIDTH
      Half of the ratio between height and width.
      See Also:
  • Constructor Details

    • MainVRGui

      public MainVRGui(com.badlogic.gdx.scenes.scene2d.ui.Skin skin)
  • Method Details

    • initialize

      public void initialize(com.badlogic.gdx.assets.AssetManager manager, com.badlogic.gdx.graphics.g2d.SpriteBatch batch)
      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:
      manager - The asset manager to load the resources with
      batch - 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
    • build

      public void build(com.badlogic.gdx.scenes.scene2d.ui.Skin skin)
    • 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
    • contains

      public boolean contains(int x, int y, com.badlogic.gdx.math.Vector3[] points)
      Checks whether the quadrilateral or polygon defined by points contains the point [x,y].
      Parameters:
      x - The coordinate X of the point to test.
      y - The coordinate Y of the point to test.
      points - The points defining the polygon.
      Returns:
      Whether the point is in the polygon.
    • 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.
    • 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
    • isVR

      public boolean isVR()
      Description copied from interface: IGui
      Returns whether this GUI is a VR gui.
      Specified by:
      isVR in interface IGui
      Returns:
      Is this a VR gui?
    • 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
    • setBackBufferSize

      public void setBackBufferSize(int width, int height)
      Description copied from interface: IGui
      Sets the back buffer size.
      Specified by:
      setBackBufferSize in interface IGui
    • dispose

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

      public void notify(Event event, Object source, Object... data)
      Description copied from interface: IObserver
      Event notification call.
      Specified by:
      notify in interface IObserver
      Parameters:
      event - The event type.
      source - The source object, if any.
      data - The data associated with this event.
    • setScene

      public void setScene(Scene scene)
    • setSkin

      public void setSkin(com.badlogic.gdx.scenes.scene2d.ui.Skin skin)
    • keyDown

      public boolean keyDown(int keycode)
      Specified by:
      keyDown in interface com.badlogic.gdx.InputProcessor
    • keyUp

      public boolean keyUp(int keycode)
      Specified by:
      keyUp in interface com.badlogic.gdx.InputProcessor
    • keyTyped

      public boolean keyTyped(char character)
      Specified by:
      keyTyped in interface com.badlogic.gdx.InputProcessor
    • touchDown

      public boolean touchDown(int screenX, int screenY, int pointer, int button)
      Specified by:
      touchDown in interface com.badlogic.gdx.InputProcessor
    • touchUp

      public boolean touchUp(int screenX, int screenY, int pointer, int button)
      Specified by:
      touchUp in interface com.badlogic.gdx.InputProcessor
    • touchCancelled

      public boolean touchCancelled(int screenX, int screenY, int pointer, int button)
      Specified by:
      touchCancelled in interface com.badlogic.gdx.InputProcessor
    • touchDragged

      public boolean touchDragged(int screenX, int screenY, int pointer)
      Specified by:
      touchDragged in interface com.badlogic.gdx.InputProcessor
    • mouseMoved

      public boolean mouseMoved(int screenX, int screenY)
      Specified by:
      mouseMoved in interface com.badlogic.gdx.InputProcessor
    • scrolled

      public boolean scrolled(float amountX, float amountY)
      Specified by:
      scrolled in interface com.badlogic.gdx.InputProcessor
    • showUI

      public boolean showUI(boolean value, XrControllerDevice device)
      Specified by:
      showUI in interface XrInputListener
    • accept

      public boolean accept(boolean value, XrControllerDevice device)
      Specified by:
      accept in interface XrInputListener
    • cameraMode

      public boolean cameraMode(boolean value, XrControllerDevice device)
      Specified by:
      cameraMode in interface XrInputListener
    • rotate

      public boolean rotate(boolean value, XrControllerDevice device)
      Specified by:
      rotate in interface XrInputListener
    • move

      public boolean move(com.badlogic.gdx.math.Vector2 value, XrControllerDevice device)
      Specified by:
      move in interface XrInputListener
    • select

      public boolean select(float value, XrControllerDevice device)
      Specified by:
      select in interface XrInputListener