Skip to content

Commit 110f506

Browse files
committed
Comments in imgui.h
1 parent fbc93de commit 110f506

File tree

1 file changed

+29
-21
lines changed

1 file changed

+29
-21
lines changed

imgui.h

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ Index of this file:
112112
// Forward declarations and basic types
113113
//-----------------------------------------------------------------------------
114114

115+
// Forward declarations
115116
struct ImDrawChannel; // Temporary storage to output draw commands out of order, used by ImDrawListSplitter and ImDrawList::ChannelsSplit()
116117
struct ImDrawCmd; // A single draw command within a parent ImDrawList (generally maps to 1 GPU draw call, unless it is a callback)
117118
struct ImDrawData; // All draw command lists required to render the frame + pos/size coordinates to use for the projection matrix.
@@ -135,19 +136,12 @@ struct ImGuiSizeCallbackData; // Callback data when using SetNextWindowSiz
135136
struct ImGuiStorage; // Helper for key->value storage
136137
struct ImGuiStyle; // Runtime data for styling/colors
137138
struct ImGuiTextBuffer; // Helper to hold and append into a text buffer (~string builder)
138-
struct ImGuiTextFilter; // Helper to parse and apply text filters (e.g. "aaaaa[,bbbb][,ccccc]")
139+
struct ImGuiTextFilter; // Helper to parse and apply text filters (e.g. "aaaaa[,bbbbb][,ccccc]")
139140

140-
// Typedefs and Enums/Flags (declared as int for compatibility with old C++, to allow using as flags and to not pollute the top of this file)
141-
// Use your programming IDE "Go to definition" facility on the names in the central column below to find the actual flags/enum lists.
142-
#ifndef ImTextureID
143-
typedef void* ImTextureID; // User data to identify a texture (this is whatever to you want it to be! read the FAQ about ImTextureID in imgui.cpp)
144-
#endif
145-
typedef unsigned int ImGuiID; // Unique ID used by widgets (typically hashed from a stack of string)
146-
#ifndef ImWchar
147-
#define ImWchar ImWchar16
148-
#endif
149-
typedef unsigned short ImWchar16; // A single U16 character for keyboard input/display. We encode them as multi bytes UTF-8 when used in strings.
150-
typedef unsigned int ImWchar32; // A single U32 character for keyboard input/display. Define ImWchar to ImWchar32 to use it. See imconfig.h .
141+
// Enums/Flags (declared as int for compatibility with old C++, to allow using as flags and to not pollute the top of this file)
142+
// - Tip: Use your programming IDE navigation facilities on the names in the _central column_ below to find the actual flags/enum lists!
143+
// In Visual Studio IDE: CTRL+comma ("Edit.NavigateTo") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot.
144+
// With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments.
151145
typedef int ImGuiCol; // -> enum ImGuiCol_ // Enum: A color identifier for styling
152146
typedef int ImGuiCond; // -> enum ImGuiCond_ // Enum: A condition for many Set*() functions
153147
typedef int ImGuiDataType; // -> enum ImGuiDataType_ // Enum: A primary data type
@@ -174,10 +168,21 @@ typedef int ImGuiTabBarFlags; // -> enum ImGuiTabBarFlags_ // Flags: f
174168
typedef int ImGuiTabItemFlags; // -> enum ImGuiTabItemFlags_ // Flags: for BeginTabItem()
175169
typedef int ImGuiTreeNodeFlags; // -> enum ImGuiTreeNodeFlags_ // Flags: for TreeNode(), TreeNodeEx(), CollapsingHeader()
176170
typedef int ImGuiWindowFlags; // -> enum ImGuiWindowFlags_ // Flags: for Begin(), BeginChild()
171+
172+
// Other types
173+
#ifndef ImTextureID // ImTextureID [configurable type: override in imconfig.h]
174+
typedef void* ImTextureID; // User data for rendering back-end to identify a texture. This is whatever to you want it to be! read the FAQ about ImTextureID for details.
175+
#endif
176+
#ifndef ImWchar // ImWchar [configurable type: override in imconfig.h]
177+
#define ImWchar ImWchar16 // Storage for a single decoded character/code point, default to 16-bit. Set to ImWchar32 to support larger Unicode planes. Note that we generally support UTF-8 encoded string, this is storage for a decoded character.
178+
#endif
179+
typedef unsigned int ImGuiID; // A unique ID used by widgets, typically hashed from a stack of string.
180+
typedef unsigned short ImWchar16; // A single decoded U16 character/code point for keyboard input/display. We encode them as multi bytes UTF-8 when used in strings.
181+
typedef unsigned int ImWchar32; // A single decoded U32 character/code point for keyboard input/display. To enable, use '#define ImWchar ImWchar32' in imconfig.h.
177182
typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData *data);
178183
typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data);
179184

180-
// Scalar data types
185+
// Basic scalar data types
181186
typedef signed char ImS8; // 8-bit signed integer
182187
typedef unsigned char ImU8; // 8-bit unsigned integer
183188
typedef signed short ImS16; // 16-bit signed integer
@@ -196,7 +201,7 @@ typedef signed long long ImS64; // 64-bit signed integer (post C++11)
196201
typedef unsigned long long ImU64; // 64-bit unsigned integer (post C++11)
197202
#endif
198203

199-
// 2D vector (often used to store positions, sizes, etc.)
204+
// 2D vector (often used to store positions or sizes)
200205
struct ImVec2
201206
{
202207
float x, y;
@@ -234,7 +239,6 @@ namespace ImGui
234239
IMGUI_API void DestroyContext(ImGuiContext* ctx = NULL); // NULL = destroy current context
235240
IMGUI_API ImGuiContext* GetCurrentContext();
236241
IMGUI_API void SetCurrentContext(ImGuiContext* ctx);
237-
IMGUI_API bool DebugCheckVersionAndDataLayout(const char* version_str, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_drawvert, size_t sz_drawidx);
238242

239243
// Main
240244
IMGUI_API ImGuiIO& GetIO(); // access the IO structure (mouse/keyboard/gamepad inputs, time, various configuration options/flags)
@@ -633,7 +637,7 @@ namespace ImGui
633637
IMGUI_API void LogText(const char* fmt, ...) IM_FMTARGS(1); // pass text data straight to log (without being displayed)
634638

635639
// Drag and Drop
636-
// [BETA API] API may evolve!
640+
// - [BETA API] API may evolve!
637641
IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags = 0); // call when the current item is active. If this return true, you can call SetDragDropPayload() + EndDragDropSource()
638642
IMGUI_API bool SetDragDropPayload(const char* type, const void* data, size_t sz, ImGuiCond cond = 0); // type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui.
639643
IMGUI_API void EndDragDropSource(); // only call EndDragDropSource() if BeginDragDropSource() returns true!
@@ -726,7 +730,8 @@ namespace ImGui
726730
IMGUI_API void SetMouseCursor(ImGuiMouseCursor cursor_type); // set desired cursor type
727731
IMGUI_API void CaptureMouseFromApp(bool want_capture_mouse_value = true); // attention: misleading name! manually override io.WantCaptureMouse flag next frame (said flag is entirely left for your application to handle). This is equivalent to setting "io.WantCaptureMouse = want_capture_mouse_value;" after the next NewFrame() call.
728732

729-
// Clipboard Utilities (also see the LogToClipboard() function to capture or output text data to the clipboard)
733+
// Clipboard Utilities
734+
// - Also see the LogToClipboard() function to capture GUI into clipboard, or easily output text data to the clipboard.
730735
IMGUI_API const char* GetClipboardText();
731736
IMGUI_API void SetClipboardText(const char* text);
732737

@@ -738,6 +743,9 @@ namespace ImGui
738743
IMGUI_API void SaveIniSettingsToDisk(const char* ini_filename); // this is automatically called (if io.IniFilename is not empty) a few seconds after any modification that should be reflected in the .ini file (and also by DestroyContext).
739744
IMGUI_API const char* SaveIniSettingsToMemory(size_t* out_ini_size = NULL); // return a zero-terminated string with the .ini data which you can save by your own mean. call when io.WantSaveIniSettings is set, then save data by your own mean and clear io.WantSaveIniSettings.
740745

746+
// Debug Utilities
747+
IMGUI_API bool DebugCheckVersionAndDataLayout(const char* version_str, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_drawvert, size_t sz_drawidx); // This is called by IMGUI_CHECKVERSION() macro.
748+
741749
// Memory Allocators
742750
// - All those functions are not reliant on the current context.
743751
// - If you reload the contents of imgui.cpp at runtime, you may need to call SetCurrentContext() + SetAllocatorFunctions() again because we use global storage for those.
@@ -1825,7 +1833,7 @@ struct ImColor
18251833
// Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList.
18261834
//-----------------------------------------------------------------------------
18271835

1828-
// Draw callbacks for advanced uses.
1836+
// ImDrawCallback: Draw callbacks for advanced uses [configurable type: override in imconfig.h]
18291837
// NB: You most likely do NOT need to use draw callbacks just to create your own widget or customized UI rendering,
18301838
// you can poke into the draw list for that! Draw callback may be useful for example to:
18311839
// A) Change your GPU render state,
@@ -1858,9 +1866,9 @@ struct ImDrawCmd
18581866
ImDrawCmd() { ElemCount = 0; TextureId = (ImTextureID)NULL; VtxOffset = IdxOffset = 0; UserCallback = NULL; UserCallbackData = NULL; }
18591867
};
18601868

1861-
// Vertex index
1862-
// (to allow large meshes with 16-bit indices: set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset' and handle ImDrawCmd::VtxOffset in the renderer back-end)
1863-
// (to use 32-bit indices: override with '#define ImDrawIdx unsigned int' in imconfig.h)
1869+
// Vertex index, default to 16-bit
1870+
// To allow large meshes with 16-bit indices: set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset' and handle ImDrawCmd::VtxOffset in the renderer back-end (recommended).
1871+
// To use 32-bit indices: override with '#define ImDrawIdx unsigned int' in imconfig.h.
18641872
#ifndef ImDrawIdx
18651873
typedef unsigned short ImDrawIdx;
18661874
#endif

0 commit comments

Comments
 (0)