Package imgui
Class ImGuiStorage
java.lang.Object
imgui.binding.ImGuiStruct
imgui.binding.ImGuiStructDestroyable
imgui.ImGuiStorage
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.
-
Field Summary
Fields inherited from class imgui.binding.ImGuiStruct
ptr -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidFor quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.voidclear()protected longcreate()booleangetBool(int key) booleangetBool(int key, boolean defaultVal) floatgetFloat(int key) floatgetFloat(int key, float defaultVal) intgetInt(int key) intgetInt(int key, int defaultVal) voidsetAllInt(int val) Use on your own storage if you know only integer are being stored (open/close all tree nodes)voidsetBool(int key, boolean val) voidsetFloat(int key, float val) voidsetInt(int key, int val) Methods inherited from class imgui.binding.ImGuiStructDestroyable
destroyMethods inherited from class imgui.binding.ImGuiStruct
isNotValidPtr, isValidPtr
-
Constructor Details
-
ImGuiStorage
public ImGuiStorage() -
ImGuiStorage
public ImGuiStorage(long ptr)
-
-
Method Details
-
create
protected long create()- Specified by:
createin classImGuiStructDestroyable
-
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)
-