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,VRDeviceListener
public class MainVRGui
extends Object
implements VRDeviceListener, com.badlogic.gdx.InputProcessor, IGui, IObserver, com.badlogic.gdx.utils.Disposable
Creates and manages the VR UI and all its interactions with controllers.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaxisMoved(VRContext.VRDevice device, int axis, float valueX, float valueY) An axis was moved on theVRContext.VRDevicevoidbuild(com.badlogic.gdx.scenes.scene2d.ui.Skin skin) booleanbuttonPressed(VRContext.VRDevice device, int button) A button was pressed on theVRContext.VRDevicebooleanbuttonReleased(VRContext.VRDevice device, int button) A button was released on theVRContext.VRDevicebooleanbuttonTouched(VRContext.VRDevice device, int button) A button was touched on theVRContext.VRDevicebooleanbuttonUntouched(VRContext.VRDevice device, int button) A button was untouched on theVRContext.VRDevicebooleanRemoves the focus from this GUI and returns true if the focus was in the GUI, false otherwise.voidconnected(VRContext.VRDevice device) A newVRContext.VRDevicehas connectedbooleancontains(int x, int y, com.badlogic.gdx.math.Vector3[] points) Checks whether the quadrilateral or polygon defined by points contains the point [x,y].voiddisconnected(VRContext.VRDevice device) AVRContext.VRDevicehas disconnectedvoiddispose()voiddoneLoading(com.badlogic.gdx.assets.AssetManager assetManager) Hook that runs after the assets have been loaded.voidevent(int code) Unhandled event on theVRContext.VRDevicecom.badlogic.gdx.scenes.scene2d.ActorReturns the first actor found with the specified name.com.badlogic.gdx.scenes.scene2d.StageReturns the stagevoidinitialize(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) 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 finishbooleanscrolled(float amountX, float amountY) 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 modebooleantouchDown(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 WIDTH- See Also:
-
HEIGHT
public static final int HEIGHT- 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
public void update(double dt) Description copied from interface:IGuiUpdates 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:IGuiRenders this GUI -
resize
public void resize(int width, int height) Description copied from interface:IGuiResizes 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: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
public void setVR(boolean vr) Description copied from interface:IGuiWhether this GUI is to be used in VR mode -
isVR
public boolean isVR()Description copied from interface:IGuiReturns whether this GUI is a VR gui. -
mustDraw
public boolean mustDraw()Description copied from interface:IGuiReturns whether this GUI must be drawn or not -
updateUnitsPerPixel
public boolean updateUnitsPerPixel(float upp) Description copied from interface:IGuiUpdates the units-per-pixel value of this GUI. The units-per-pixel is the same as 1/UI_SCALE.- Specified by:
updateUnitsPerPixelin interfaceIGui
-
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
Description copied from interface:IObserverEvent notification call. -
setScene
-
setSkin
public void setSkin(com.badlogic.gdx.scenes.scene2d.ui.Skin skin) -
connected
Description copied from interface:VRDeviceListenerA newVRContext.VRDevicehas connected- Specified by:
connectedin interfaceVRDeviceListener
-
disconnected
Description copied from interface:VRDeviceListenerAVRContext.VRDevicehas disconnected- Specified by:
disconnectedin interfaceVRDeviceListener
-
buttonPressed
Description copied from interface:VRDeviceListenerA button was pressed on theVRContext.VRDevice- Specified by:
buttonPressedin interfaceVRDeviceListener- Returns:
- True if the event was handled.
-
buttonReleased
Description copied from interface:VRDeviceListenerA button was released on theVRContext.VRDevice- Specified by:
buttonReleasedin interfaceVRDeviceListener- Returns:
- True if the event was handled.
-
buttonTouched
Description copied from interface:VRDeviceListenerA button was touched on theVRContext.VRDevice- Specified by:
buttonTouchedin interfaceVRDeviceListener- Returns:
- True if the event was handled.
-
buttonUntouched
Description copied from interface:VRDeviceListenerA button was untouched on theVRContext.VRDevice- Specified by:
buttonUntouchedin interfaceVRDeviceListener- Returns:
- True if the event was handled.
-
axisMoved
Description copied from interface:VRDeviceListenerAn axis was moved on theVRContext.VRDevice- Specified by:
axisMovedin interfaceVRDeviceListener- Returns:
- True if the event was handled.
-
event
public void event(int code) Description copied from interface:VRDeviceListenerUnhandled event on theVRContext.VRDevice- Specified by:
eventin interfaceVRDeviceListener- Parameters:
code- Event code
-
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
-
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
-