Package gaiasky.gui.vr
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
Modifier and TypeFieldDescriptionstatic 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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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
dispose()
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 stagevoid
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 loadingboolean
isVR()
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
mustDraw()
Returns whether this GUI must be drawn or notvoid
Event notification call.void
render
(int rw, int rh) Renders this GUIvoid
resize
(int width, int height) Resizes this GUI to the given values at the end of the current loopvoid
resizeImmediate
(int width, int height) Resizes without waiting for the current loop to finishboolean
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
void
setSkin
(com.badlogic.gdx.scenes.scene2d.ui.Skin skin) void
setVisibilityToggles
(ComponentTypes.ComponentType[] entities, ComponentTypes visible) Sets the visibility state of the component entitiesvoid
setVR
(boolean vr) Whether this GUI is to be used in VR modeboolean
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 GUIboolean
updateUnitsPerPixel
(float upp) Updates the units-per-pixel value of this GUI.
-
Field Details
-
WIDTH
public static final int WIDTHWidth of the UI frame buffer.- See Also:
-
HEIGHT
public static final int HEIGHTHeight of the UI frame buffer.- See Also:
-
HEIGHT_OVER_WIDTH
public static final double HEIGHT_OVER_WIDTHRatio between height and width.- See Also:
-
HEIGHT_OVER_2WIDTH
public static final double HEIGHT_OVER_2WIDTHHalf 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 interfaceIGui
- Parameters:
manager
- The asset manager to load the resources withbatch
- 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 interfaceIGui
- 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 -
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 -
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 -
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 interfaceIGui
- Parameters:
width
- The new widthheight
- 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 interfaceIGui
- 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 interfaceIGui
- Returns:
- The stage
-
setVisibilityToggles
Description copied from interface:IGui
Sets the visibility state of the component entities- Specified by:
setVisibilityToggles
in interfaceIGui
- Parameters:
entities
- The entitiesvisible
- The states
-
findActor
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. -
setVR
public void setVR(boolean vr) Description copied from interface:IGui
Whether this GUI is to be used in VR mode -
isVR
public boolean isVR()Description copied from interface:IGui
Returns whether this GUI is a VR gui. -
mustDraw
public boolean mustDraw()Description copied from interface:IGui
Returns whether this GUI must be drawn or not -
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 interfaceIGui
-
setBackBufferSize
public void setBackBufferSize(int width, int height) Description copied from interface:IGui
Sets the back buffer size.- Specified by:
setBackBufferSize
in interfaceIGui
-
dispose
public void dispose()- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
-
notify
Description copied from interface:IObserver
Event notification call. -
setScene
-
setSkin
public void setSkin(com.badlogic.gdx.scenes.scene2d.ui.Skin skin) -
keyDown
public boolean keyDown(int keycode) - Specified by:
keyDown
in interfacecom.badlogic.gdx.InputProcessor
-
keyUp
public boolean keyUp(int keycode) - Specified by:
keyUp
in interfacecom.badlogic.gdx.InputProcessor
-
keyTyped
public boolean keyTyped(char character) - Specified by:
keyTyped
in interfacecom.badlogic.gdx.InputProcessor
-
touchDown
public boolean touchDown(int screenX, int screenY, int pointer, int button) - Specified by:
touchDown
in interfacecom.badlogic.gdx.InputProcessor
-
touchUp
public boolean touchUp(int screenX, int screenY, int pointer, int button) - Specified by:
touchUp
in interfacecom.badlogic.gdx.InputProcessor
-
touchCancelled
public boolean touchCancelled(int screenX, int screenY, int pointer, int button) - Specified by:
touchCancelled
in interfacecom.badlogic.gdx.InputProcessor
-
touchDragged
public boolean touchDragged(int screenX, int screenY, int pointer) - Specified by:
touchDragged
in interfacecom.badlogic.gdx.InputProcessor
-
mouseMoved
public boolean mouseMoved(int screenX, int screenY) - Specified by:
mouseMoved
in interfacecom.badlogic.gdx.InputProcessor
-
scrolled
public boolean scrolled(float amountX, float amountY) - Specified by:
scrolled
in interfacecom.badlogic.gdx.InputProcessor
-
showUI
- Specified by:
showUI
in interfaceXrInputListener
-
accept
- Specified by:
accept
in interfaceXrInputListener
-
cameraMode
- Specified by:
cameraMode
in interfaceXrInputListener
-
rotate
- Specified by:
rotate
in interfaceXrInputListener
-
move
- Specified by:
move
in interfaceXrInputListener
-
select
- Specified by:
select
in interfaceXrInputListener
-