Class GamepadGui
java.lang.Object
gaiasky.gui.main.AbstractGui
gaiasky.gui.main.GamepadGui
Provides a way to navigate and edit the most important settings in Gaia Sky using a gamepad or a VR controller.
-
Field Summary
Fields inherited from class AbstractGui
backBufferHeight, backBufferWidth, graphics, interfaces, lock, name, POOLS, skin, stage, unitsPerPixel, vrModifier and TypeFieldDescriptionprotected intprotected intprotected com.badlogic.gdx.GraphicsGraphics instance.protected com.badlogic.gdx.utils.Array<IGuiInterface> The GUI interfaces, if any.protected final ObjectLock for sync.protected StringThe name of this GUI.static final com.badlogic.gdx.utils.PoolManagerprotected com.badlogic.gdx.scenes.scene2d.ui.SkinThe skin to use.protected com.badlogic.gdx.scenes.scene2d.StageThe user interface stage.protected floatUnits per pixel, 1/uiScale.protected booleanWhether we're in VR mode. -
Constructor Summary
ConstructorsConstructorDescriptionGamepadGui(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.Graphics graphics, Float unitsPerPixel) GamepadGui(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.Graphics graphics, Float unitsPerPixel, boolean vrMode) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidback()voidbuild()booleancheckString(String text, Scene scene) voiddoneLoading(com.badlogic.gdx.assets.AssetManager assetManager) Hook that runs after the assets have been loaded.voiddown()com.badlogic.gdx.scenes.scene2d.ui.Tablevoidinitialize(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 loadingvoidinitialize(com.badlogic.gdx.scenes.scene2d.Stage stage) voidleft()voidEvent notification call.voidprotected voidAdds the already created GUI objects to the stage.booleanvoidresizeImmediate(int width, int height) Resizes without waiting for the current loop to finishvoidright()voidbooleanselectInCol(int i, int j, boolean down) Selects the given object.booleanselectInRow(int i, int j, boolean right) Selects the given object.voidtabLeft()voidtabRight()voidup()voidupdate(double dt) Updates the GUIvoidvoidupdateFocused(boolean force) voidMethods inherited from class AbstractGui
cancelTouchFocus, clearScreen, dispose, findActor, getBackBufferHeight, getBackBufferWidth, getGuiStage, getName, getUnitsPerPixel, isVR, mustDraw, render, resize, setBackBufferSize, setVisibilityToggles, setVR, updateUnitsPerPixelModifier and TypeMethodDescriptionbooleanRemoves the focus from this GUI and returns true if the focus was in the GUI, false otherwise.protected voidvoiddispose()com.badlogic.gdx.scenes.scene2d.ActorReturns the first actor found with the specified name.intintcom.badlogic.gdx.scenes.scene2d.StageReturns the stagegetName()floatGets the units per pixel of this GUI.booleanisVR()Returns whether this GUI is a VR gui.booleanmustDraw()Returns whether this GUI must be drawn or notvoidrender(int rw, int rh) Renders this GUIvoidresize(int width, int height) Resizes this GUI to the given values at the end of the current loopvoidsetBackBufferSize(int width, int height) Sets the back buffer size.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 modebooleanupdateUnitsPerPixel(float upp) Updates the units-per-pixel value of this GUI.
-
Constructor Details
-
Method Details
-
initialize
public void initialize(com.badlogic.gdx.assets.AssetManager assetManager, com.badlogic.gdx.graphics.g2d.SpriteBatch sb) Description copied from interface:IGuiInitializes the GUI, adding all the resources to the asset manager queue for loading- Parameters:
assetManager- The asset manager to load the resources withsb- The sprite batch to use for this GUI's stage
-
initialize
public void initialize(com.badlogic.gdx.scenes.scene2d.Stage stage) -
build
public void build() -
rebuildGui
protected void rebuildGui()Description copied from class:AbstractGuiAdds the already created GUI objects to the stage.- Specified by:
rebuildGuiin classAbstractGui
-
checkString
-
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- Parameters:
assetManager- The asset manager
-
update
public void update(double dt) Description copied from interface:IGuiUpdates the GUI- Specified by:
updatein interfaceIGui- Overrides:
updatein classAbstractGui- Parameters:
dt- Time in seconds since the last frame
-
updateTabs
public void updateTabs() -
selectInRow
public boolean selectInRow(int i, int j, boolean right) Selects the given object. If it is null, it scans the row in the given direction until all elements have been scanned.- Parameters:
i- The columnj- The rowright- Whether scan right or left- Returns:
- True if the element was selected, false otherwise
-
selectInCol
public boolean selectInCol(int i, int j, boolean down) Selects the given object. If it is null, it scans the column in the given direction until all elements have been scanned.- Parameters:
i- The columnj- The rowdown- Whether scan up or down- Returns:
- True if the element was selected, false otherwise
-
selectFirst
public void selectFirst() -
updateFocused
public void updateFocused() -
updateFocused
public void updateFocused(boolean force) -
tabLeft
public void tabLeft() -
tabRight
public void tabRight() -
up
public void up() -
down
public void down() -
left
public void left() -
right
public void right() -
back
public void back() -
getContent
public com.badlogic.gdx.scenes.scene2d.ui.Table getContent() -
notify
Description copied from interface:IObserverEvent notification call.- Specified by:
notifyin interfaceIObserver- Overrides:
notifyin classAbstractGui- Parameters:
event- The event type.source- The source object, if any.data- The data associated with this event.
-
removeGamepadGui
public boolean removeGamepadGui() -
addGamepadGui
public void addGamepadGui() -
programmaticUpdate
public void programmaticUpdate() -
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- Overrides:
resizeImmediatein classAbstractGui- Parameters:
width- The new widthheight- The new height
-