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
FieldsModifier and TypeFieldDescriptionstatic final intHeight of the UI frame buffer.static final doubleHalf of the ratio between height and width.static final doubleRatio between height and width.static final intWidth of the UI frame buffer. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccept(boolean value, XrControllerDevice device) voidbuild(com.badlogic.gdx.scenes.scene2d.ui.Skin skin) booleancameraMode(boolean value, XrControllerDevice device) booleanRemoves the focus from this GUI and returns true if the focus was in the GUI, false otherwise.booleancontains(int x, int y, com.badlogic.gdx.math.Vector3[] points) Checks whether the quadrilateral or polygon defined by points contains the point [x,y].voiddispose()voiddoneLoading(com.badlogic.gdx.assets.AssetManager assetManager) Hook that runs after the assets have been loaded.com.badlogic.gdx.scenes.scene2d.ActorReturns the first actor found with the specified name.com.badlogic.gdx.scenes.scene2d.StageReturns the stagefloatGets the units per pixel of this GUI.voidinitialize(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 loadingbooleanisVR()Returns whether this GUI is a VR gui.booleankeyDown(int keycode) booleankeyTyped(char character) booleankeyUp(int keycode) booleanmouseMoved(int screenX, int screenY) booleanmove(com.badlogic.gdx.math.Vector2 value, XrControllerDevice device) booleanmustDraw()Returns whether this GUI must be drawn or notvoidEvent notification call.voidrender(int rw, int rh) Renders this GUIvoidresize(int width, int height) Resizes this GUI to the given values at the end of the current loopvoidresizeImmediate(int width, int height) Resizes without waiting for the current loop to finishbooleanrotate(boolean value, XrControllerDevice device) booleanscrolled(float amountX, float amountY) booleanselect(float value, XrControllerDevice device) voidsetBackBufferSize(int width, int height) Sets the back buffer size.voidvoidsetSkin(com.badlogic.gdx.scenes.scene2d.ui.Skin skin) voidsetVisibilityToggles(ComponentTypes.ComponentType[] entities, ComponentTypes visible) Sets the visibility state of the component entitiesvoidsetVR(boolean vr) Whether this GUI is to be used in VR modebooleanshowUI(boolean value, XrControllerDevice device) booleantouchCancelled(int screenX, int screenY, int pointer, int button) booleantouchDown(int screenX, int screenY, int pointer, int button) booleantouchDragged(int screenX, int screenY, int pointer) booleantouchUp(int screenX, int screenY, int pointer, int button) voidupdate(double dt) Updates the GUIbooleanupdateUnitsPerPixel(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:IGuiInitializes the GUI, adding all the resources to the asset manager queue for loading- Specified by:
initializein 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:IGuiHook that runs after the assets have been loaded. Completes the initialization process- Specified by:
doneLoadingin interfaceIGui- Parameters:
assetManager- The asset manager
-
build
public void build(com.badlogic.gdx.scenes.scene2d.ui.Skin skin) -
update
-
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
-
resize
-
resizeImmediate
public void resizeImmediate(int width, int height) Description copied from interface:IGuiResizes without waiting for the current loop to finish- Specified by:
resizeImmediatein interfaceIGui- Parameters:
width- The new widthheight- The new height
-
cancelTouchFocus
public boolean cancelTouchFocus()Description copied from interface:IGuiRemoves the focus from this GUI and returns true if the focus was in the GUI, false otherwise.- Specified by:
cancelTouchFocusin 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:IGuiReturns the stage- Specified by:
getGuiStagein interfaceIGui- Returns:
- The stage
-
setVisibilityToggles
Description copied from interface:IGuiSets the visibility state of the component entities- Specified by:
setVisibilityTogglesin interfaceIGui- Parameters:
entities- The entitiesvisible- The states
-
findActor
Description copied from interface:IGuiReturns the first actor found with the specified name. Note this recursively compares the name of every actor in the GUI. -
setVR
-
isVR
-
mustDraw
-
updateUnitsPerPixel
public boolean updateUnitsPerPixel(float upp) Description copied from interface:IGuiUpdates the units-per-pixel value of this GUI. This defines the size of the GUI.- Specified by:
updateUnitsPerPixelin interfaceIGui
-
getUnitsPerPixel
public float getUnitsPerPixel()Description copied from interface:IGuiGets the units per pixel of this GUI.- Specified by:
getUnitsPerPixelin interfaceIGui- Returns:
- The units per pixel value.
-
setBackBufferSize
public void setBackBufferSize(int width, int height) Description copied from interface:IGuiSets the back buffer size.- Specified by:
setBackBufferSizein interfaceIGui
-
dispose
public void dispose()- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable
-
notify
-
setScene
-
setSkin
public void setSkin(com.badlogic.gdx.scenes.scene2d.ui.Skin skin) -
keyDown
public boolean keyDown(int keycode) - Specified by:
keyDownin interfacecom.badlogic.gdx.InputProcessor
-
keyUp
public boolean keyUp(int keycode) - Specified by:
keyUpin interfacecom.badlogic.gdx.InputProcessor
-
keyTyped
public boolean keyTyped(char character) - Specified by:
keyTypedin interfacecom.badlogic.gdx.InputProcessor
-
touchDown
public boolean touchDown(int screenX, int screenY, int pointer, int button) - Specified by:
touchDownin interfacecom.badlogic.gdx.InputProcessor
-
touchUp
public boolean touchUp(int screenX, int screenY, int pointer, int button) - Specified by:
touchUpin interfacecom.badlogic.gdx.InputProcessor
-
touchCancelled
public boolean touchCancelled(int screenX, int screenY, int pointer, int button) - Specified by:
touchCancelledin interfacecom.badlogic.gdx.InputProcessor
-
touchDragged
public boolean touchDragged(int screenX, int screenY, int pointer) - Specified by:
touchDraggedin interfacecom.badlogic.gdx.InputProcessor
-
mouseMoved
public boolean mouseMoved(int screenX, int screenY) - Specified by:
mouseMovedin interfacecom.badlogic.gdx.InputProcessor
-
scrolled
public boolean scrolled(float amountX, float amountY) - Specified by:
scrolledin interfacecom.badlogic.gdx.InputProcessor
-
showUI
- Specified by:
showUIin interfaceXrInputListener
-
accept
- Specified by:
acceptin interfaceXrInputListener
-
cameraMode
- Specified by:
cameraModein interfaceXrInputListener
-
rotate
- Specified by:
rotatein interfaceXrInputListener
-
move
- Specified by:
movein interfaceXrInputListener
-
select
- Specified by:
selectin interfaceXrInputListener
-