Package imgui

Class ImGuiStorage


public final class ImGuiStorage extends ImGuiStructDestroyable
Helper: Key-Value storage Typically you don't have to worry about this since a storage is held within each Window. We use it to e.g. store collapse state for a tree (Int 0/1) This is optimized for efficient lookup (dichotomy into a contiguous buffer) and rare insertion (typically tied to user interactions aka max once a frame) You can use it as custom user storage for temporary values. Declare your own storage if, for example: - You want to manipulate the open/close state of a particular sub-tree in your interface (tree node uses Int 0/1 to store their state). - You want to store custom debug data easily without adding or editing structures in your code (probably not efficient, but convenient) Types are NOT stored, so it is up to you to make sure your Key don't collide with different types.
  • Constructor Details

    • ImGuiStorage

      public ImGuiStorage()
    • ImGuiStorage

      public ImGuiStorage(long ptr)
  • Method Details

    • create

      protected long create()
      Specified by:
      create in class ImGuiStructDestroyable
    • clear

      public void clear()
    • getInt

      public int getInt(int key)
    • getInt

      public int getInt(int key, int defaultVal)
    • setInt

      public void setInt(int key, int val)
    • getBool

      public boolean getBool(int key)
    • getBool

      public boolean getBool(int key, boolean defaultVal)
    • setBool

      public void setBool(int key, boolean val)
    • getFloat

      public float getFloat(int key)
    • getFloat

      public float getFloat(int key, float defaultVal)
    • setFloat

      public void setFloat(int key, float val)
    • buildSortByKey

      public void buildSortByKey()
      For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.
    • setAllInt

      public void setAllInt(int val)
      Use on your own storage if you know only integer are being stored (open/close all tree nodes)