Class GuiRegistry

  • All Implemented Interfaces:
    IObserver

    public class GuiRegistry
    extends java.lang.Object
    implements IObserver
    Manages the Graphical User Interfaces of Gaia Sky
    • Constructor Summary

      Constructors 
      Constructor Description
      GuiRegistry​(com.badlogic.gdx.scenes.scene2d.ui.Skin skin)
      One object to handle observer pattern
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void addProcessor​(IGui gui)
      Adds the stage of the given GUI to the processors in the input multiplexer
      static void change​(IGui gui)
      Switches the current GUI with the given one, updating the processors
      static void change​(IGui gui, IGui previous)
      Switches the current GUI with the given one, updating the processors.
      void dispose()  
      static com.badlogic.gdx.InputMultiplexer getInputMultiplexer()  
      void notify​(Events event, java.lang.Object... data)  
      static void registerGui​(IGui gui)
      Registers a new GUI
      boolean removeControllerGui()  
      boolean removeModeChangePopup()  
      static void removeProcessor​(IGui gui)  
      static void render​(int rw, int rh)
      Renders the registered GUIs
      static void set​(IGui gui)
      Sets the given GUI as current
      static void setInputMultiplexer​(com.badlogic.gdx.InputMultiplexer im)  
      static void setPrevious​(IGui gui)
      Sets the given GUI as previous
      static boolean unregisterAll()
      Unregisters all GUIs
      static boolean unregisterGui​(IGui gui)
      Unregisters a GUI
      static void unset()
      Unsets the current GUI and sets it as previous
      static void unset​(IGui gui)
      Unsets the given GUI and sets it as previous
      static void update​(double dt)
      Updates the registered GUIs
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • guirenderlock

        public static java.lang.Object guirenderlock
        Render lock object
      • current

        public static IGui current
        Current GUI object
      • previous

        public static IGui previous
        Previous GUI object, if any
      • modeChangeTable

        public com.badlogic.gdx.scenes.scene2d.ui.Table modeChangeTable
        Mode change info popup
    • Constructor Detail

      • GuiRegistry

        public GuiRegistry​(com.badlogic.gdx.scenes.scene2d.ui.Skin skin)
        One object to handle observer pattern
    • Method Detail

      • setInputMultiplexer

        public static void setInputMultiplexer​(com.badlogic.gdx.InputMultiplexer im)
      • getInputMultiplexer

        public static com.badlogic.gdx.InputMultiplexer getInputMultiplexer()
      • change

        public static void change​(IGui gui,
                                  IGui previous)
        Switches the current GUI with the given one, updating the processors. It also sets the previous GUI to the given value.
        Parameters:
        gui - The new GUI
        previous - The new previous GUI
      • change

        public static void change​(IGui gui)
        Switches the current GUI with the given one, updating the processors
        Parameters:
        gui - The new gui
      • unset

        public static void unset()
        Unsets the current GUI and sets it as previous
      • unset

        public static void unset​(IGui gui)
        Unsets the given GUI and sets it as previous
        Parameters:
        gui - The GUI
      • set

        public static void set​(IGui gui)
        Sets the given GUI as current
        Parameters:
        gui - The new GUI
      • setPrevious

        public static void setPrevious​(IGui gui)
        Sets the given GUI as previous
        Parameters:
        gui - The new previous GUI
      • registerGui

        public static void registerGui​(IGui gui)
        Registers a new GUI
        Parameters:
        gui - The GUI to register
      • unregisterGui

        public static boolean unregisterGui​(IGui gui)
        Unregisters a GUI
        Parameters:
        gui - The GUI to unregister
        Returns:
        True if the GUI was unregistered
      • unregisterAll

        public static boolean unregisterAll()
        Unregisters all GUIs
        Returns:
        True if operation succeeded
      • render

        public static void render​(int rw,
                                  int rh)
        Renders the registered GUIs
        Parameters:
        rw - The render width
        rh - The render height
      • addProcessor

        public static void addProcessor​(IGui gui)
        Adds the stage of the given GUI to the processors in the input multiplexer
        Parameters:
        gui - The gui
      • removeProcessor

        public static void removeProcessor​(IGui gui)
      • update

        public static void update​(double dt)
        Updates the registered GUIs
        Parameters:
        dt - The delta time in seconds
      • dispose

        public void dispose()
      • notify

        public void notify​(Events event,
                           java.lang.Object... data)
        Specified by:
        notify in interface IObserver
      • removeControllerGui

        public boolean removeControllerGui()
      • removeModeChangePopup

        public boolean removeModeChangePopup()