@ -231,18 +231,17 @@ See the [Software using dear imgui page](https://github.com/ocornut/imgui/wiki/S
The library started its life and is best known as "ImGui" only due to the fact that I didn't give it a proper name when I released it. However, the term IMGUI (immediate-mode graphical user interface) was coined before and is being used in variety of other situations. It seemed confusing and unfair to hog the name. To reduce the ambiguity without affecting existing codebases, I have decided on an alternate, longer name "dear imgui" that people can use to refer to this specific library in ambiguous situations.
The library started its life and is best known as "ImGui" only due to the fact that I didn't give it a proper name when I released it. However, the term IMGUI (immediate-mode graphical user interface) was coined before and is being used in variety of other situations. It seemed confusing and unfair to hog the name. To reduce the ambiguity without affecting existing codebases, I have decided on an alternate, longer name "dear imgui" that people can use to refer to this specific library in ambiguous situations.
<b>How can I help?</b>
<b>How can I tell whether to dispatch mouse/keyboard to imgui or to my application?</b>
<br><b>How can I display an image? What is ImTextureID, how does it works?</b>
<br><b>How can I display an image? What is ImTextureID, how does it works?</b>
<br><b>How can I have multiple widgets with the same label, or without any label? (Yes). A primer on labels and ID stack.</b>
<br><b>How can I have multiple widgets with the same label, or without any label? (Yes). A primer on labels and ID stack.</b>
<br><b>How can I tell when Dear ImGui wants my mouse/keyboard inputs VS when I can pass them to my application?</b>
<br><b>How can I load a different font than the default?</b>
<br><b>How can I load a different font than the default?</b>
<br><b>How can I easily use icons in my application?</b>
<br><b>How can I easily use icons in my application?</b>
<br><b>How can I load multiple fonts?</b>
<br><b>How can I load multiple fonts?</b>
<br><b>How can I display and input non-latin characters such as Chinese, Japanese, Korean, Cyrillic?</b>
<br><b>How can I display and input non-latin characters such as Chinese, Japanese, Korean, Cyrillic?</b>
<br><b>How can I preserve my Dear ImGui context across reloading a DLL? (loss of the global/static variables)</b>
<br><b>How can I use the drawing facilities without an Dear ImGui window? (using ImDrawList API)</b>
<br><b>How can I use the drawing facilities without an Dear ImGui window? (using ImDrawList API)</b>
<br><b>I integrated Dear ImGui in my engine and the text or lines are blurry..</b>
<br><b>I integrated Dear ImGui in my engine and the text or lines are blurry..</b>
<br><b>I integrated Dear ImGui in my engine and some elements are disappearing when I move windows around..</b>
<br><b>I integrated Dear ImGui in my engine and some elements are disappearing when I move windows around..</b>
<br><b>How can I help?</b>
See the FAQ in imgui.cpp for answers.
See the FAQ in imgui.cpp for answers.
@ -250,7 +249,7 @@ See the FAQ in imgui.cpp for answers.
You can control Dear ImGui with a gamepad, see the explanation in imgui.cpp about how to use the navigation feature (short version: map your gamepad inputs into the `io.NavInputs[]` array and set `io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad`).
You can control Dear ImGui with a gamepad, see the explanation in imgui.cpp about how to use the navigation feature (short version: map your gamepad inputs into the `io.NavInputs[]` array and set `io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad`).
You can share your computer mouse seamlessy with your console/tablet/phone using [Synergy](http://synergy-project.org). This is the prefered solution for developer productivity. In particular, their [micro-synergy-client](https://github.com/symless/micro-synergy-client) repo there is _uSynergy.c_ sources for a small embeddable that you can use on any platform to connect to your host PC. You may also use a third party solution such as [Remote ImGui](https://github.com/JordiRos/remoteimgui).
You can share your computer mouse seamlessy with your console/tablet/phone using [Synergy](http://synergy-project.org). This is the prefered solution for developer productivity. In particular, their [micro-synergy-client](https://github.com/symless/micro-synergy-client) repo there is _uSynergy.c_ sources for a small embeddable that you can use on any platform to connect to your host PC using Synergy 1.x. You may also use a third party solution such as [Remote ImGui](https://github.com/JordiRos/remoteimgui).
For touch inputs, you can increase the hit box of widgets (via the _style.TouchPadding_ setting) to accommodate a little for the lack of precision of touch inputs, but it is recommended you use a mouse or gamepad to allow optimising for screen real-estate and precision.
For touch inputs, you can increase the hit box of widgets (via the _style.TouchPadding_ setting) to accommodate a little for the lack of precision of touch inputs, but it is recommended you use a mouse or gamepad to allow optimising for screen real-estate and precision.
// (minor and older changes stripped away, please see git history for details)
// (minor and older changes stripped away, please see git history for details)
// 2018-03-06: OpenGL: Added const char* glsl_version parameter to ImGui_ImplOpenGL3_Init() so user can override the GLSL version e.g. "#version 150".
// 2018-02-23: OpenGL: Create the VAO in the render function so the setup can more easily be used with multiple shared GL context.
// 2018-02-23: OpenGL: Create the VAO in the render function so the setup can more easily be used with multiple shared GL context.
// 2018-XX-XX: OpenGL: Offset projection matrix and clipping rectangle by io.DisplayPos (which will be non-zero for multi-viewport applications).
// 2018-XX-XX: OpenGL: Offset projection matrix and clipping rectangle by io.DisplayPos (which will be non-zero for multi-viewport applications).
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplSdlGL3_RenderDrawData() in the .h file so you can call it yourself.
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplSdlGL3_RenderDrawData() in the .h file so you can call it yourself.
@ -14,11 +15,16 @@
// 2016-09-05: OpenGL: Fixed save and restore of current scissor rectangle.
// 2016-09-05: OpenGL: Fixed save and restore of current scissor rectangle.
// 2016-07-29: OpenGL: Explicitly setting GL_UNPACK_ROW_LENGTH to reduce issues because SDL changes it. (#752)
// 2016-07-29: OpenGL: Explicitly setting GL_UNPACK_ROW_LENGTH to reduce issues because SDL changes it. (#752)
#include<GL/gl3w.h> // This example is using gl3w to access OpenGL functions (because it is small). You may use glew/glad/glLoadGen/etc. whatever already works for you.
#include<GL/gl3w.h> // This example is using gl3w to access OpenGL functions (because it is small). You may use glew/glad/glLoadGen/etc. whatever already works for you.
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
// Note that vertex buffers have been created and are wasted, so it is best practice that you don't create windows in the first place, or consistently respond to Begin() returning false.
if(window_to_render_front_most&&window_to_render_front_most->Active&&window_to_render_front_most->HiddenFrames<=0)// NavWindowingTarget is always temporarily displayed as the front-most window
if(window_to_render_front_most&&window_to_render_front_most->Active&&window_to_render_front_most->HiddenFrames<=0)// NavWindowingTarget is always temporarily displayed as the front-most window
// After Begin() we fill the last item / hovered data using the title bar data. Make that a standard behavior (to allow usage of context menus on title bar only, etc.).
// After Begin() we fill the last item / hovered data using the title bar data. Make that a standard behavior (to allow usage of context menus on title bar only, etc.).
// Clear 'accessed' flag last thing (After PushClipRect which will set the flag. We want the flag to stay false when the default "Debug" window is unused)
// Clear 'accessed' flag last thing (After PushClipRect which will set the flag. We want the flag to stay false when the default "Debug" window is unused)
if(first_begin_of_the_frame)
if(first_begin_of_the_frame)
@ -13014,7 +12999,7 @@ static float GetDraggedColumnOffset(ImGuiColumnsSet* columns, int column_index)
// window creates a feedback loop because we store normalized positions. So while dragging we enforce absolute positioning.
// window creates a feedback loop because we store normalized positions. So while dragging we enforce absolute positioning.
ImGuiContext&g=*GImGui;
ImGuiContext&g=*GImGui;
ImGuiWindow*window=g.CurrentWindow;
ImGuiWindow*window=g.CurrentWindow;
IM_ASSERT(column_index>0);// We cannot drag column 0. If you get this assert you may have a conflict between the ID of your columns and another widgets.
IM_ASSERT(column_index>0);// We are not supposed to drag column 0.
IMGUI_APIImVec2GetItemRectSize();// get size of last item, in screen space
IMGUI_APIImVec2GetItemRectSize();// get size of last item, in screen space
IMGUI_APIvoidSetItemAllowOverlap();// allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area.
IMGUI_APIvoidSetItemAllowOverlap();// allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area.
IMGUI_APIboolIsWindowFocused(ImGuiFocusedFlagsflags=0);// is current window focused? or its root/child, depending on flags. see flags for options.
IMGUI_APIboolIsWindowFocused(ImGuiFocusedFlagsflags=0);// is current window focused? or its root/child, depending on flags. see flags for options.
IMGUI_APIboolIsWindowHovered(ImGuiHoveredFlagsflags=0);// is current window hovered (and typically: not blocked by a popup/modal)? see flags for options.
IMGUI_APIboolIsWindowHovered(ImGuiHoveredFlagsflags=0);// is current window hovered (and typically: not blocked by a popup/modal)? see flags for options. NB: If you are trying to check whether your mouse should be dispatched to imgui or to your app, you should use the 'io.WantCaptureMouse' boolean for that! Please read the FAQ!
IMGUI_APIboolIsRectVisible(constImVec2&size);// test if rectangle (of given size, starting from cursor position) is visible / not clipped.
IMGUI_APIboolIsRectVisible(constImVec2&size);// test if rectangle (of given size, starting from cursor position) is visible / not clipped.
IMGUI_APIboolIsRectVisible(constImVec2&rect_min,constImVec2&rect_max);// test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side.
IMGUI_APIboolIsRectVisible(constImVec2&rect_min,constImVec2&rect_max);// test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side.
IMGUI_APIfloatGetTime();
IMGUI_APIfloatGetTime();
@ -661,6 +661,7 @@ enum ImGuiFocusedFlags_
};
};
// Flags for ImGui::IsItemHovered(), ImGui::IsWindowHovered()
// Flags for ImGui::IsItemHovered(), ImGui::IsWindowHovered()
// Note: If you are trying to check whether your mouse should be dispatched to imgui or to your app, you should use the 'io.WantCaptureMouse' boolean for that. Please read the FAQ!
enumImGuiHoveredFlags_
enumImGuiHoveredFlags_
{
{
ImGuiHoveredFlags_Default=0,// Return true if directly over the item/window, not obstructed by another window, not obstructed by an active popup or modal blocking inputs under them.
ImGuiHoveredFlags_Default=0,// Return true if directly over the item/window, not obstructed by another window, not obstructed by an active popup or modal blocking inputs under them.
@ -1713,10 +1714,10 @@ struct ImFontAtlas
IMGUI_APIImFont*AddFontFromMemoryTTF(void*font_data,intfont_size,floatsize_pixels,constImFontConfig*font_cfg=NULL,constImWchar*glyph_ranges=NULL);// Note: Transfer ownership of 'ttf_data' to ImFontAtlas! Will be deleted after Build(). Set font_cfg->FontDataOwnedByAtlas to false to keep ownership.
IMGUI_APIImFont*AddFontFromMemoryTTF(void*font_data,intfont_size,floatsize_pixels,constImFontConfig*font_cfg=NULL,constImWchar*glyph_ranges=NULL);// Note: Transfer ownership of 'ttf_data' to ImFontAtlas! Will be deleted after Build(). Set font_cfg->FontDataOwnedByAtlas to false to keep ownership.
IMGUI_APIImFont*AddFontFromMemoryCompressedTTF(constvoid*compressed_font_data,intcompressed_font_size,floatsize_pixels,constImFontConfig*font_cfg=NULL,constImWchar*glyph_ranges=NULL);// 'compressed_font_data' still owned by caller. Compress with binary_to_compressed_c.cpp.
IMGUI_APIImFont*AddFontFromMemoryCompressedTTF(constvoid*compressed_font_data,intcompressed_font_size,floatsize_pixels,constImFontConfig*font_cfg=NULL,constImWchar*glyph_ranges=NULL);// 'compressed_font_data' still owned by caller. Compress with binary_to_compressed_c.cpp.
IMGUI_APIImFont*AddFontFromMemoryCompressedBase85TTF(constchar*compressed_font_data_base85,floatsize_pixels,constImFontConfig*font_cfg=NULL,constImWchar*glyph_ranges=NULL);// 'compressed_font_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 parameter.
IMGUI_APIImFont*AddFontFromMemoryCompressedBase85TTF(constchar*compressed_font_data_base85,floatsize_pixels,constImFontConfig*font_cfg=NULL,constImWchar*glyph_ranges=NULL);// 'compressed_font_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 parameter.
IMGUI_APIvoidClearTexData();// Clear the CPU-side texture data. Saves RAM once the texture has been copied to graphics memory.
IMGUI_APIvoidClearInputData();// Clear input data (all ImFontConfig structures including sizes, TTF data, glyph ranges, etc.) = all the data used to build the texture and fonts.
IMGUI_APIvoidClearInputData();// Clear the input TTF data (inc sizes, glyph ranges)
IMGUI_APIvoidClearTexData();// Clear output texture data (CPU side). Saves RAM once the texture has been copied to graphics memory.
IMGUI_APIvoidClearFonts();// Clear the ImGui-side font data (glyphs storage, UV coordinates)
IMGUI_APIvoidClearFonts();// Clear output font data (glyphs storage, UV coordinates).
IMGUI_APIvoidClear();// Clear all
IMGUI_APIvoidClear();// Clear all input and output.
// Build atlas, retrieve pixel data.
// Build atlas, retrieve pixel data.
// User is in charge of copying the pixels into graphics memory (e.g. create a texture with your engine). Then store your texture handle with SetTexID().
// User is in charge of copying the pixels into graphics memory (e.g. create a texture with your engine). Then store your texture handle with SetTexID().
font->RenderChar(draw_list,cell_size.x,cell_p1,ImGui::GetColorU32(ImGuiCol_Text),(ImWchar)(base+n));// We use ImFont::RenderChar as a shortcut because we don't have UTF-8 conversion functions available to generate a string.
font->RenderChar(draw_list,cell_size.x,cell_p1,ImGui::GetColorU32(ImGuiCol_Text),(ImWchar)(base+n));// We use ImFont::RenderChar as a shortcut because we don't have UTF-8 conversion functions available to generate a string.