Class PopupState

java.lang.Object
com.jme3.app.state.BaseAppState
com.simsilica.lemur.event.PopupState
All Implemented Interfaces:
AppState

public class PopupState extends BaseAppState
Provides modal-style popup support where a single UI element can essentially 'take over' the screen. The single pop-up will be the only thing that can receive events. Outside mouse clicks will either close the panel or be ignored depending on how the popup was configured when opened.
  • Constructor Details Link icon

    • PopupState Link icon

      public PopupState()
    • PopupState Link icon

      public PopupState(Node guiNode)
  • Method Details Link icon

    • hasActivePopups Link icon

      public boolean hasActivePopups()
    • showPopup Link icon

      public void showPopup(Spatial popup)
      Shows the specified spatial on the GUI node with a background blocker geometry that will automatically close the spatial when clicked.
    • showPopup Link icon

      public void showPopup(Spatial popup, Command<? super PopupState> closeCommand)
      Shows the specified spatial on the GUI node with a background blocker geometry that will automatically close the spatial when clicked.
    • showModalPopup Link icon

      public void showModalPopup(Spatial popup)
      Shows the specified spatial on the GUI node with a background blocker geometry that will consume all mouse events until the popup has been closed.
    • showModalPopup Link icon

      public void showModalPopup(Spatial popup, Command<? super PopupState> closeCommand)
      Shows the specified spatial on the GUI node with a background blocker geometry that will consume all mouse events until the popup has been closed.
    • showModalPopup Link icon

      public void showModalPopup(Spatial popup, ColorRGBA backgroundColor)
      Shows the specified spatial on the GUI node with a background blocker geometry that will consume all mouse events until the popup has been closed.
    • showModalPopup Link icon

      public void showModalPopup(Spatial popup, Command<? super PopupState> closeCommand, ColorRGBA backgroundColor)
      Shows the specified spatial on the GUI node with a background blocker geometry that will consume all mouse events until the popup has been closed.
    • showPopup Link icon

      public void showPopup(Spatial popup, PopupState.ClickMode clickMode, Command<? super PopupState> closeCommand, ColorRGBA backgroundColor)
      Shows the specified popup on the GUI node with the specified click mode determining how background mouse events will be handled. An optional closeCommand will be called when the popup is closed. An optional background color will be used for the background 'blocker' geometry.
    • isPopup Link icon

      public boolean isPopup(Spatial s)
      Returns true if the specified Spatial is still an active popup.
    • closePopup Link icon

      public void closePopup(Spatial popup)
      Closes a previously opened popup. Throws IllegalArgumentException if the specified popup is not open.
    • close Link icon

      protected void close(com.simsilica.lemur.event.PopupState.PopupEntry entry)
    • getEntry Link icon

      protected com.simsilica.lemur.event.PopupState.PopupEntry getEntry(Spatial popup)
    • getMaxGuiZ Link icon

      protected float getMaxGuiZ()
      Calcules that maximum Z value given the current contents of the GUI node.
    • getMaxZ Link icon

      protected float getMaxZ(BoundingVolume bv)
    • getMinZ Link icon

      protected float getMinZ(BoundingVolume bv)
    • createBlockerMaterial Link icon

      protected GuiMaterial createBlockerMaterial(ColorRGBA color)
    • createBlocker Link icon

      protected Geometry createBlocker(float z, ColorRGBA backgroundColor)
    • getGuiSize Link icon

      public Vector2f getGuiSize()
      Returns the size of the screen based on the app's main camera size and the current scale of the guiNode.
    • centerInGui Link icon

      public void centerInGui(Spatial s)
      Positions the specified spatial so that it is in the center of the GUI.
    • clampToGui Link icon

      public boolean clampToGui(Spatial s)
      Moves the specified GUI element so that it is the most on the screen that it can be based on the current GUI size. Returns true if the spatial was actually moved.
    • setGuiNode Link icon

      public void setGuiNode(Node guiNode)
      Sets the GUI node that will be used to display the option panel. By default, this is SimpleApplication.getGuiNode().
    • getGuiNode Link icon

      public Node getGuiNode()
      Returns the GUI node that will be used to display the option panel. By default, this is SimpleApplication.getGuiNode().
    • screenToGui Link icon

      public Vector3f screenToGui(Vector3f screen)
      Converts a screen coordinate into a properly scaled GUI coordinate.
    • initialize Link icon

      protected void initialize(Application app)
      Description copied from class: BaseAppState
      Called during initialization once the app state is attached and before onEnable() is called.
      Specified by:
      initialize in class BaseAppState
      Parameters:
      app - the application
    • cleanup Link icon

      protected void cleanup(Application app)
      Description copied from class: BaseAppState
      Called after the app state is detached or during application shutdown if the state is still attached. onDisable() is called before this cleanup() method if the state is enabled at the time of cleanup.
      Specified by:
      cleanup in class BaseAppState
      Parameters:
      app - the application
    • onEnable Link icon

      protected void onEnable()
      Description copied from class: BaseAppState
      Called when the state is fully enabled, ie: is attached and isEnabled() is true or when the setEnabled() status changes after the state is attached.
      Specified by:
      onEnable in class BaseAppState
    • update Link icon

      public void update(float tpf)
      Description copied from interface: AppState
      Called to update the AppState. This method will be called every render pass if the AppState is both attached and enabled.
      Specified by:
      update in interface AppState
      Overrides:
      update in class BaseAppState
      Parameters:
      tpf - Time since the last call to update(), in seconds.
    • onDisable Link icon

      protected void onDisable()
      Description copied from class: BaseAppState
      Called when the state was previously enabled but is now disabled either because setEnabled(false) was called or the state is being cleaned up.
      Specified by:
      onDisable in class BaseAppState