Class PopUp

java.lang.Object
de.luckymcdev.foundryengine.client.editor.popup.PopUp

public class PopUp extends Object
A base class for creating and managing ImGui popups in the Foundry Engine.

This class provides functionality to create, open, close, and render both modal and non-modal popups. It serves as a foundation for custom popups by allowing subclasses to override the content() method.

  • Constructor Summary

    Constructors
    Constructor
    Description
    PopUp(net.minecraft.resources.Identifier id, String strId)
    Constructs a non-modal popup with default flags.
    PopUp(net.minecraft.resources.Identifier id, String strId, boolean modal, int popUpFlags)
    Constructs a popup with customizable modal behavior and flags.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes this popup if it is currently open.
    void
    Renders the content of this popup.
    net.minecraft.resources.Identifier
    Returns the unique identifier of this popup.
    Returns the string identifier used by ImGui to manage this popup.
    void
    Handles the rendering of this popup.
    boolean
    Checks if this popup is currently open.
    void
    Opens this popup.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PopUp

      public PopUp(net.minecraft.resources.Identifier id, String strId)
      Constructs a non-modal popup with default flags.
      Parameters:
      id - The unique identifier for this popup.
      strId - The string identifier used by ImGui to manage the popup.
    • PopUp

      public PopUp(net.minecraft.resources.Identifier id, String strId, boolean modal, int popUpFlags)
      Constructs a popup with customizable modal behavior and flags.
      Parameters:
      id - The unique identifier for this popup.
      strId - The string identifier used by ImGui to manage the popup.
      modal - If true, the popup will be modal (blocks interaction with other windows).
      popUpFlags - Flags to control the popup's behavior. See ImGuiPopupFlags for available options.
  • Method Details

    • getId

      public net.minecraft.resources.Identifier getId()
      Returns the unique identifier of this popup.
      Returns:
      The popup's Identifier.
    • getStrId

      public String getStrId()
      Returns the string identifier used by ImGui to manage this popup.
      Returns:
      The ImGui string identifier.
    • isOpen

      public boolean isOpen()
      Checks if this popup is currently open.
      Returns:
      true if the popup is open, false otherwise.
    • open

      public void open()
      Opens this popup.

      This method triggers the popup to appear in the next ImGui frame.

    • close

      public void close()
      Closes this popup if it is currently open.

      This method ensures the popup is closed gracefully by checking its state first.

    • handleRender

      public void handleRender()
      Handles the rendering of this popup.

      This method begins the popup context, renders its content, and ensures proper cleanup afterward. The actual content is delegated to the content() method, which can be overridden by subclasses.

    • content

      public void content()
      Renders the content of this popup.

      Subclasses should override this method to define custom content for the popup. The default implementation does nothing.