Package gaiasky.gui
Class AbstractGui
java.lang.Object
gaiasky.gui.AbstractGui
- Direct Known Subclasses:
CrashGui
,DebugGui
,FullGui
,GamepadGui
,LoadingGui
,RenderGui
,SpacecraftGui
,StereoGui
,WelcomeGui
,WelcomeGuiVR
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
protected int
protected com.badlogic.gdx.Graphics
Graphics instance.protected com.badlogic.gdx.utils.Array
<IGuiInterface> The GUI interfaces, if any.protected Object
Lock for sync.protected String
The name of this GUI.protected com.badlogic.gdx.scenes.scene2d.ui.Skin
The skin to use.protected com.badlogic.gdx.scenes.scene2d.Stage
The user interface stage.protected float
Units per pixel, 1/uiScale.protected boolean
Whether we're in VR mode. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Removes the focus from this GUI and returns true if the focus was in the GUI, false otherwise.void
dispose()
com.badlogic.gdx.scenes.scene2d.Actor
Returns the first actor found with the specified name.int
int
com.badlogic.gdx.scenes.scene2d.Stage
Returns the stagegetName()
boolean
isVR()
Returns whether this GUI is a VR gui.boolean
mustDraw()
Returns whether this GUI must be drawn or notvoid
Event notification call.protected abstract void
Adds the already created GUI objects to the stage.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 finishvoid
setBackBufferSize
(int width, int height) Sets the back buffer size.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 modevoid
update
(double dt) Updates the GUIboolean
updateUnitsPerPixel
(float upp) 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
Methods inherited from interface gaiasky.gui.IGui
doneLoading, initialize
-
Field Details
-
graphics
protected com.badlogic.gdx.Graphics graphicsGraphics instance. -
stage
protected com.badlogic.gdx.scenes.scene2d.Stage stageThe user interface stage. -
skin
protected com.badlogic.gdx.scenes.scene2d.ui.Skin skinThe skin to use. -
interfaces
The GUI interfaces, if any. -
name
The name of this GUI. -
vr
protected boolean vrWhether we're in VR mode. -
unitsPerPixel
protected float unitsPerPixelUnits per pixel, 1/uiScale. This only works with a screen viewport. -
lock
Lock for sync. -
backBufferWidth
protected int backBufferWidth -
backBufferHeight
protected int backBufferHeight
-
-
Constructor Details
-
AbstractGui
-
-
Method Details
-
update
public void update(double dt) Description copied from interface:IGui
Updates the GUI -
render
public void render(int rw, int rh) Description copied from interface:IGui
Renders this GUI -
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
-
getName
-
dispose
public void dispose()- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
-
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
-
rebuildGui
protected abstract void rebuildGui()Adds the already created GUI objects to the stage. -
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.
-
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. -
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
-
notify
Description copied from interface:IObserver
Event notification call. -
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
-
getBackBufferWidth
public int getBackBufferWidth() -
getBackBufferHeight
public int getBackBufferHeight()
-