Package gaiasky.interfce
Class AbstractGui
- java.lang.Object
-
- gaiasky.interfce.AbstractGui
-
- Direct Known Subclasses:
DebugGui
,FullGui
,InitialGui
,LoadingGui
,RenderGui
,SpacecraftGui
,StereoGui
,VRControllerInfoGui
,VRInfoGui
,VRSelectionGui
public abstract class AbstractGui extends java.lang.Object implements IObserver, IGui
Provides general methods and attributes that all GUIs should have
-
-
Field Summary
Fields Modifier and Type Field Description protected int
hoffset
Horizontal offset, for VRprotected com.badlogic.gdx.utils.Array<IGuiInterface>
interfaces
The GUI interfaces, if anyprotected java.lang.Object
lock
Lock for syncprotected java.lang.String
name
The name of this GUIprotected com.badlogic.gdx.scenes.scene2d.ui.Skin
skin
The skin to useprotected com.badlogic.gdx.scenes.scene2d.Stage
ui
The user interface stageprotected boolean
vr
Whether we're in VR mode
-
Constructor Summary
Constructors Constructor Description AbstractGui()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
cancelTouchFocus()
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
findActor(java.lang.String name)
Returns the first actor found with the specified name.com.badlogic.gdx.scenes.scene2d.Stage
getGuiStage()
Returns the stagejava.lang.String
getName()
boolean
mustDraw()
Returns whether this GUI must be drawn or notvoid
notify(Events event, java.lang.Object... data)
protected abstract void
rebuildGui()
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
setHoffset(int hoffset)
Sets the horizontal offset, for VRvoid
setSceneGraph(ISceneGraph sg)
Sets the scene graph to this GUIvoid
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 GUI-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gaiasky.interfce.IGui
doneLoading, initialize
-
-
-
-
Field Detail
-
ui
protected com.badlogic.gdx.scenes.scene2d.Stage ui
The user interface stage
-
skin
protected com.badlogic.gdx.scenes.scene2d.ui.Skin skin
The skin to use
-
interfaces
protected com.badlogic.gdx.utils.Array<IGuiInterface> interfaces
The GUI interfaces, if any
-
name
protected java.lang.String name
The name of this GUI
-
vr
protected boolean vr
Whether we're in VR mode
-
hoffset
protected int hoffset
Horizontal offset, for VR
-
lock
protected java.lang.Object lock
Lock for sync
-
-
Method Detail
-
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
public java.lang.String 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
public com.badlogic.gdx.scenes.scene2d.Actor findActor(java.lang.String name)
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
public void setVisibilityToggles(ComponentTypes.ComponentType[] entities, ComponentTypes visible)
Description copied from interface:IGui
Sets the visibility state of the component entities- Specified by:
setVisibilityToggles
in interfaceIGui
- Parameters:
entities
- The entitiesvisible
- The states
-
setSceneGraph
public void setSceneGraph(ISceneGraph sg)
Description copied from interface:IGui
Sets the scene graph to this GUI- Specified by:
setSceneGraph
in interfaceIGui
- Parameters:
sg
- The scene graph
-
notify
public void notify(Events event, java.lang.Object... data)
-
setHoffset
public void setHoffset(int hoffset)
Description copied from interface:IGui
Sets the horizontal offset, for VR- Specified by:
setHoffset
in interfaceIGui
- Parameters:
hoffset
- The horizontal offset in pixels
-
setVr
public void setVr(boolean vr)
Description copied from interface:IGui
Whether this GUI is to be used in VR mode
-
-