Package gaiasky.interafce
Class AbstractGui
java.lang.Object
gaiasky.interafce.AbstractGui
- Direct Known Subclasses:
ControllerGui,CrashGui,DebugGui,FullGui,LoadingGui,RenderGui,SpacecraftGui,StereoGui,VRControllerInfoGui,VRInfoGui,VRSelectionGui,WelcomeGui,WelcomeGuiVR
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 com.badlogic.gdx.backends.lwjgl3.Lwjgl3GraphicsgraphicsGraphics instanceprotected inthoffsetHorizontal offset, for VRprotected com.badlogic.gdx.utils.Array<IGuiInterface>interfacesThe GUI interfaces, if anyprotected java.lang.ObjectlockLock for syncprotected java.lang.StringnameThe name of this GUIprotected com.badlogic.gdx.scenes.scene2d.ui.SkinskinThe skin to useprotected com.badlogic.gdx.scenes.scene2d.StageuiThe user interface stageprotected floatunitsPerPixelUnits per pixel, 1/uiScale This only works with a screen viewportprotected booleanvrWhether we're in VR mode -
Constructor Summary
Constructors Constructor Description AbstractGui(com.badlogic.gdx.backends.lwjgl3.Lwjgl3Graphics graphics, java.lang.Float unitsPerPixel) -
Method Summary
Modifier and Type Method Description booleancancelTouchFocus()Removes the focus from this GUI and returns true if the focus was in the GUI, false otherwise.voiddispose()com.badlogic.gdx.scenes.scene2d.ActorfindActor(java.lang.String name)Returns the first actor found with the specified name.com.badlogic.gdx.scenes.scene2d.StagegetGuiStage()Returns the stagejava.lang.StringgetName()booleanmustDraw()Returns whether this GUI must be drawn or notvoidnotify(Events event, java.lang.Object... data)protected abstract voidrebuildGui()Adds the already created GUI objects to the stage.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 finishvoidsetHoffset(int hoffset)Sets the horizontal offset, for VRvoidsetVisibilityToggles(ComponentTypes.ComponentType[] entities, ComponentTypes visible)Sets the visibility state of the component entitiesvoidsetVr(boolean vr)Whether this GUI is to be used in VR modevoidupdate(double dt)Updates the GUIbooleanupdateUnitsPerPixel(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, waitMethods inherited from interface gaiasky.interafce.IGui
doneLoading, initialize
-
Field Details
-
graphics
protected com.badlogic.gdx.backends.lwjgl3.Lwjgl3Graphics graphicsGraphics instance -
ui
protected com.badlogic.gdx.scenes.scene2d.Stage uiThe user interface stage -
skin
protected com.badlogic.gdx.scenes.scene2d.ui.Skin skinThe skin to use -
interfaces
The GUI interfaces, if any -
name
protected java.lang.String nameThe name of this GUI -
vr
protected boolean vrWhether we're in VR mode -
hoffset
protected int hoffsetHorizontal offset, for VR -
unitsPerPixel
protected float unitsPerPixelUnits per pixel, 1/uiScale This only works with a screen viewport -
lock
protected java.lang.Object lockLock for sync
-
-
Constructor Details
-
AbstractGui
public AbstractGui(com.badlogic.gdx.backends.lwjgl3.Lwjgl3Graphics graphics, java.lang.Float unitsPerPixel)
-
-
Method Details
-
update
public void update(double dt)Description copied from interface:IGuiUpdates the GUI -
render
public void render(int rw, int rh)Description copied from interface:IGuiRenders this GUI -
getGuiStage
public com.badlogic.gdx.scenes.scene2d.Stage getGuiStage()Description copied from interface:IGuiReturns the stage- Specified by:
getGuiStagein interfaceIGui- Returns:
- The stage
-
getName
public java.lang.String getName() -
dispose
public void dispose()- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable
-
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
-
rebuildGui
protected abstract void rebuildGui()Adds the already created GUI objects to the stage. -
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.
-
findActor
public com.badlogic.gdx.scenes.scene2d.Actor findActor(java.lang.String name)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. -
setVisibilityToggles
Description copied from interface:IGuiSets the visibility state of the component entities- Specified by:
setVisibilityTogglesin interfaceIGui- Parameters:
entities- The entitiesvisible- The states
-
notify
-
setHoffset
public void setHoffset(int hoffset)Description copied from interface:IGuiSets the horizontal offset, for VR- Specified by:
setHoffsetin interfaceIGui- Parameters:
hoffset- The horizontal offset in pixels
-
setVr
public void setVr(boolean vr)Description copied from interface:IGuiWhether this GUI is to be used in VR mode -
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
-