#pragma clang diagnostic ignored "-Wformat-nonliteral" // warning : format string is not a string literal // passing non-literal to vsnformat(). yes, user passing incorrect format strings can crash the code.
#pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals.
#pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it.
#pragma clang diagnostic ignored "-Wmissing-noreturn" // warning : function xx could be declared with attribute 'noreturn' warning // GetDefaultFontData() asserts which some implementation makes it never return.
#pragma clang diagnostic ignored "-Wdeprecated-declarations"// warning : 'xx' is deprecated: The POSIX name for this item.. // for strdup used in demo code (so user can copy & paste the code)
#pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int'
@ -820,30 +820,30 @@ int ImFormatStringV(char* buf, int buf_size, const char* fmt, va_list args)
// Pass data_size==0 for zero-terminated strings
// FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements.
// - A default window called "Debug" is automatically stacked at the beginning of every frame so you can use widgets without explicitly calling a Begin/End pair.
// - Begin/End can be called multiple times during the frame with the same window name to append content.
// - 'size_on_first_use' for a regular window denote the initial size for first-time creation (no saved data) and isn't that useful. Use SetNextWindowSize() prior to calling Begin() for more flexible window manipulation.
// - The window name is used as a unique identifier to preserve window information across frames (and save rudimentary information to the .ini file).
// - The window name is used as a unique identifier to preserve window information across frames (and save rudimentary information to the .ini file).
// You can use the "##" or "###" markers to use the same label with different id, or same id with different label. See documentation at the top of this file.
// - Return false when window is collapsed, so you can early out in your code. You always need to call ImGui::End() even if false is returned.
// - Passing 'bool* p_opened' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed.
ImVec2clip_max=ImVec2(window->Pos.x+window->Size.x-(p_opened?title_bar_rect.GetHeight()-3:style.FramePadding.x),text_max.y);// Match the size of CloseWindowButton()
// Perform manual coarse clipping to optimize for long multi-line text
// From this point we will only compute the width of lines that are visible. Optimization only available when word-wrapping is disabled.
// From this point we will only compute the width of lines that are visible. Optimization only available when word-wrapping is disabled.
// We also don't vertically center the text within the line full height, which is unlikely to matter because we are likely the biggest and only item on the line.
io.ImeSetInputScreenPosFn((int)cursor_screen_pos.x-1,(int)(cursor_screen_pos.y-g.FontSize));// -1 x offset so that Windows IME can cover our cursor. Bit of an extra nicety.
// - struct ImGuiStorage // Custom key value storage (if you need to alter open/close states manually)
// - struct ImGuiTextEditCallbackData // Shared state of ImGui::InputText() when using custom callbacks
// - struct ImGuiListClipper // Helper to manually clip large list of items.
// - struct ImColor // Helper functions to created packed 32-bit RGBA color values
// - struct ImColor // Helper functions to created packed 32-bit RGBA color values
// - struct ImDrawList // Draw command list
// - struct ImFontAtlas // Bake multiple fonts into a single texture, TTF font loader, bake glyphs into bitmap
// - struct ImFont // Single font
@ -114,7 +114,7 @@ namespace ImGui
IMGUI_APIvoidShowMetricsWindow(bool*opened=NULL);// metrics window for debugging imgui
// Window
IMGUI_APIboolBegin(constchar*name="Debug",bool*p_opened=NULL,ImGuiWindowFlagsflags=0);// see .cpp for details. return false when window is collapsed, so you can early out in your code. 'bool* p_opened' creates a widget on the upper-right to close the window (which sets your bool to false).
IMGUI_APIboolBegin(constchar*name="Debug",bool*p_opened=NULL,ImGuiWindowFlagsflags=0);// see .cpp for details. return false when window is collapsed, so you can early out in your code. 'bool* p_opened' creates a widget on the upper-right to close the window (which sets your bool to false).
IMGUI_APIboolBegin(constchar*name,bool*p_opened,constImVec2&size_on_first_use,floatbg_alpha=-1.0f,ImGuiWindowFlagsflags=0);// this is the older/longer API. call SetNextWindowSize() instead if you want to set a window size. For regular windows, 'size_on_first_use' only applies to the first time EVER the window is created and probably not what you want! maybe obsolete this API eventually.
IMGUI_APIvoidEnd();
IMGUI_APIboolBeginChild(constchar*str_id,constImVec2&size=ImVec2(0,0),boolborder=false,ImGuiWindowFlagsextra_flags=0);// begin a scrolling region. size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). size>0.0f: fixed size. each axis can use a different mode, e.g. ImVec2(0,400).
@ -177,7 +177,7 @@ namespace ImGui
IMGUI_APIvoidPopButtonRepeat();
// Cursor / Layout
IMGUI_APIvoidBeginGroup();// once closing a group it is seen as a single item (so you can use IsItemHovered() on a group, SameLine() between groups, etc.
IMGUI_APIvoidBeginGroup();// once closing a group it is seen as a single item (so you can use IsItemHovered() on a group, SameLine() between groups, etc.
IMGUI_APIvoidEndGroup();
IMGUI_APIvoidSeparator();// horizontal line
IMGUI_APIvoidSameLine(floatlocal_pos_x=0.0f,floatspacing_w=-1.0f);// call between widgets or groups to layout them horizontally
IMGUI_APIImVec2GetCursorStartPos();// initial cursor position
IMGUI_APIImVec2GetCursorStartPos();// initial cursor position
IMGUI_APIImVec2GetCursorScreenPos();// cursor position in absolute screen coordinates [0..io.DisplaySize]
IMGUI_APIvoidSetCursorScreenPos(constImVec2&pos);// cursor position in absolute screen coordinates [0..io.DisplaySize]
IMGUI_APIvoidAlignFirstTextHeightToWidgets();// call once if the first item on the line is a Text() item and you want to vertically lower it to match subsequent (bigger) widgets
@ -228,7 +228,7 @@ namespace ImGui
IMGUI_APIvoidTextWrapped(constchar*fmt,...)IM_PRINTFARGS(1);// shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();. Note that this won't work on an auto-resizing window if there's no other widgets to extend the window width, yoy may need to set a size using SetNextWindowSize().
IMGUI_APIvoidTextUnformatted(constchar*text,constchar*text_end=NULL);// doesn't require null terminated string if 'text_end' is specified. no copy done to any bounded stack buffer, recommended for long chunks of text
IMGUI_APIvoidLabelText(constchar*label,constchar*fmt,...)IM_PRINTFARGS(2);// display text+label aligned the same way as value+label widgets
IMGUI_APIvoidLabelText(constchar*label,constchar*fmt,...)IM_PRINTFARGS(2);// display text+label aligned the same way as value+label widgets
IMGUI_APIboolIsWindowHovered();// is current window hovered and hoverable (not blocked by a popup) (differentiate child windows from each others)
IMGUI_APIboolIsWindowFocused();// is current window focused
IMGUI_APIboolIsWindowFocused();// is current window focused
IMGUI_APIboolIsRootWindowFocused();// is current root window focused (top parent window in case of child windows)
IMGUI_APIboolIsRootWindowOrAnyChildFocused();// is current root window or any of its child (including current window) focused
IMGUI_APIboolIsRectVisible(constImVec2&size);// test if rectangle of given size starting from cursor pos is visible (not clipped). to perform coarse clipping on user's side (as an optimization)
@ -389,7 +389,7 @@ namespace ImGui
IMGUI_APIboolIsKeyDown(intkey_index);// key_index into the keys_down[] array, imgui doesn't know the semantic of each entry, uses your own indices!
IMGUI_APIboolIsKeyPressed(intkey_index,boolrepeat=true);// uses user's key indices as stored in the keys_down[] array. if repeat=true. uses io.KeyRepeatDelay / KeyRepeatRate
IMGUI_APIboolIsKeyReleased(intkey_index);// "
IMGUI_APIboolIsMouseDown(intbutton);// is mouse button held
IMGUI_APIboolIsMouseDown(intbutton);// is mouse button held
IMGUI_APIboolIsMouseClicked(intbutton,boolrepeat=false);// did mouse button clicked (went from !Down to Down)
IMGUI_APIboolIsMouseDoubleClicked(intbutton);// did mouse button double-clicked. a double-click returns false in IsMouseClicked(). uses io.MouseDoubleClickTime.
IMGUI_APIboolIsMouseReleased(intbutton);// did mouse button released (went from Down to !Down)
@ -400,7 +400,7 @@ namespace ImGui
IMGUI_APIImVec2GetMousePos();// shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
IMGUI_APIImVec2GetMousePosOnOpeningCurrentPopup();// retrieve backup of mouse positioning at the time of opening popup we have BeginPopup() into
IMGUI_APIImVec2GetMouseDragDelta(intbutton=0,floatlock_threshold=-1.0f);// dragging amount since clicking, also see: GetItemActiveDragDelta(). if lock_threshold < -1.0f uses io.MouseDraggingThreshold
IMGUI_APIvoidResetMouseDragDelta(intbutton=0);//
IMGUI_APIvoidResetMouseDragDelta(intbutton=0);//
IMGUI_APIImGuiMouseCursorGetMouseCursor();// get desired cursor type, reset in ImGui::NewFrame(), this updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you
IMGUI_APIvoidSetMouseCursor(ImGuiMouseCursortype);// set desired cursor type
IMGUI_APIvoidCaptureKeyboardFromApp();// manually enforce imgui setting the io.WantCaptureKeyboard flag next frame (your application needs to handle it). e.g. capture keyboard when your widget is being hovered.
// See example code if you are unsure of how to implement this.
void(*RenderDrawListsFn)(ImDrawData*data);
void(*RenderDrawListsFn)(ImDrawData*data);
// Optional: access OS clipboard
// (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures)
@ -706,7 +706,7 @@ struct ImGuiIO
ImVec2MousePos;// Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.)
boolMouseDown[5];// Mouse buttons: left, right, middle + extras. ImGui itself mostly only uses left button (BeginPopupContext** are using right button). Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
floatMouseWheel;// Mouse wheel: 1 unit scrolls about 5 lines text.
floatMouseWheel;// Mouse wheel: 1 unit scrolls about 5 lines text.
boolMouseDrawCursor;// Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
// Lightweight std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug).
// Lightweight std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug).
// Our implementation does NOT call c++ constructors because we don't use them in ImGui. Don't use this class as a straight std::vector replacement in your code!
IMGUI_APIvoid*GetVoidPtr(ImGuiIDkey)const;// default_val is NULL
IMGUI_APIvoidSetVoidPtr(ImGuiIDkey,void*val);
// - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set.
// - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set.
// - References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer.
boolFontDataOwnedByAtlas;// true // TTF data ownership taken by the container ImFontAtlas (will delete memory itself). Set to true
boolFontDataOwnedByAtlas;// true // TTF data ownership taken by the container ImFontAtlas (will delete memory itself). Set to true
intFontNo;// 0 // Index of font within TTF file
floatSizePixels;// // Size in pixels for rasterizer
intOversampleH,OversampleV;// 3, 1 // Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis.
@ -1146,7 +1146,7 @@ struct ImFontConfig
constImWchar*GlyphRanges;// // List of Unicode range (2 value per range, values are inclusive, zero-terminated list)
boolMergeMode;// false // Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs).
boolMergeGlyphCenterV;// false // When merging (multiple ImFontInput for one ImFont), vertically center new glyphs instead of aligning their baseline
ImGui::TextWrapped("(This is testing the vertical alignment that occurs on text to keep it at the same baseline as widgets. Lines only composed of text or \"small\" widgets fit in less vertical spaces than lines with normal widgets)");
ImGui::TextWrapped("(This is testing the vertical alignment that occurs on text to keep it at the same baseline as widgets. Lines only composed of text or \"small\" widgets fit in less vertical spaces than lines with normal widgets)");
if(ImGui::SmallButton("Add Dummy Text")){AddLog("%d some text",Items.Size);AddLog("some more text");AddLog("display very important message here!");}ImGui::SameLine();
if(ImGui::SmallButton("Add Dummy Error"))AddLog("[error] something went wrong");ImGui::SameLine();
if(ImGui::SmallButton("Add Dummy Text")){AddLog("%d some text",Items.Size);AddLog("some more text");AddLog("display very important message here!");}ImGui::SameLine();
if(ImGui::SmallButton("Add Dummy Error"))AddLog("[error] something went wrong");ImGui::SameLine();
if(ImGui::SmallButton("Clear"))ClearLog();
//static float t = 0.0f; if (ImGui::GetTime() - t > 0.02f) { t = ImGui::GetTime(); AddLog("Spam %f", t); }
ImGui::Text("Printing unusually long amount of text.");
ImGui::Combo("Test type",&test_type,"Single call to TextUnformatted()\0Multiple calls to Text(), clipped manually\0Multiple calls to Text(), not clipped\0");
ImGui::Combo("Test type",&test_type,"Single call to TextUnformatted()\0Multiple calls to Text(), clipped manually\0Multiple calls to Text(), not clipped\0");