mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-03 22:51:06 +01:00 
			
		
		
		
	Merge branch 'master' into docking
# Conflicts: # imgui.cpp # imgui.h # imgui_draw.cpp
This commit is contained in:
		@@ -308,6 +308,8 @@ static int ImGui_ImplGlfw_TranslateUntranslatedKey(int key, int scancode)
 | 
				
			|||||||
    // See https://github.com/glfw/glfw/issues/1502 for details.
 | 
					    // See https://github.com/glfw/glfw/issues/1502 for details.
 | 
				
			||||||
    // Adding a workaround to undo this (so our keys are translated->untranslated->translated, likely a lossy process).
 | 
					    // Adding a workaround to undo this (so our keys are translated->untranslated->translated, likely a lossy process).
 | 
				
			||||||
    // This won't cover edge cases but this is at least going to cover common cases.
 | 
					    // This won't cover edge cases but this is at least going to cover common cases.
 | 
				
			||||||
 | 
					    if (key >= GLFW_KEY_KP_0 && key <= GLFW_KEY_KP_EQUAL)
 | 
				
			||||||
 | 
					        return key;
 | 
				
			||||||
    const char* key_name = glfwGetKeyName(key, scancode);
 | 
					    const char* key_name = glfwGetKeyName(key, scancode);
 | 
				
			||||||
    if (key_name && key_name[0] != 0 && key_name[1] == 0)
 | 
					    if (key_name && key_name[0] != 0 && key_name[1] == 0)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,6 +25,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// CHANGELOG
 | 
					// CHANGELOG
 | 
				
			||||||
// (minor and older changes stripped away, please see git history for details)
 | 
					// (minor and older changes stripped away, please see git history for details)
 | 
				
			||||||
 | 
					//  2022-01-31: Fix building with old Xcode versions that are missing gamepad features.
 | 
				
			||||||
//  2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago)with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
 | 
					//  2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago)with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
 | 
				
			||||||
//  2021-01-20: Inputs: calling new io.AddKeyAnalogEvent() for gamepad support, instead of writing directly to io.NavInputs[].
 | 
					//  2021-01-20: Inputs: calling new io.AddKeyAnalogEvent() for gamepad support, instead of writing directly to io.NavInputs[].
 | 
				
			||||||
//  2022-01-17: Inputs: calling new io.AddMousePosEvent(), io.AddMouseButtonEvent(), io.AddMouseWheelEvent() API (1.87+).
 | 
					//  2022-01-17: Inputs: calling new io.AddMousePosEvent(), io.AddMouseButtonEvent(), io.AddMouseWheelEvent() API (1.87+).
 | 
				
			||||||
@@ -48,6 +49,10 @@
 | 
				
			|||||||
//  2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window.
 | 
					//  2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window.
 | 
				
			||||||
//  2018-07-07: Initial version.
 | 
					//  2018-07-07: Initial version.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define APPLE_HAS_BUTTON_OPTIONS (__IPHONE_OS_VERSION_MIN_REQUIRED >= 130000 || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500 || __TV_OS_VERSION_MIN_REQUIRED >= 130000)
 | 
				
			||||||
 | 
					#define APPLE_HAS_CONTROLLER     (__IPHONE_OS_VERSION_MIN_REQUIRED >= 140000 || __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000 || __TV_OS_VERSION_MIN_REQUIRED >= 140000)
 | 
				
			||||||
 | 
					#define APPLE_HAS_THUMBSTICKS    (__IPHONE_OS_VERSION_MIN_REQUIRED >= 120100 || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101401 || __TV_OS_VERSION_MIN_REQUIRED >= 120100)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@class ImFocusObserver;
 | 
					@class ImFocusObserver;
 | 
				
			||||||
@class KeyEventResponder;
 | 
					@class KeyEventResponder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -492,12 +497,11 @@ static void ImGui_ImplOSX_UpdateGamepads()
 | 
				
			|||||||
    if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0)
 | 
					    if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0)
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    GCController* controller;
 | 
					#if APPLE_HAS_CONTROLLER
 | 
				
			||||||
    if (@available(macOS 11.0, *))
 | 
					    GCController* controller = GCController.current;
 | 
				
			||||||
        controller = GCController.current;
 | 
					#else
 | 
				
			||||||
    else
 | 
					    GCController* controller = GCController.controllers.firstObject;
 | 
				
			||||||
        controller = GCController.controllers.firstObject;
 | 
					#endif
 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (controller == nil || controller.extendedGamepad == nil)
 | 
					    if (controller == nil || controller.extendedGamepad == nil)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        io.BackendFlags &= ~ImGuiBackendFlags_HasGamepad;
 | 
					        io.BackendFlags &= ~ImGuiBackendFlags_HasGamepad;
 | 
				
			||||||
@@ -511,11 +515,10 @@ static void ImGui_ImplOSX_UpdateGamepads()
 | 
				
			|||||||
    #define MAP_BUTTON(KEY_NO, BUTTON_NAME)       { io.AddKeyEvent(KEY_NO, gp.BUTTON_NAME.isPressed); }
 | 
					    #define MAP_BUTTON(KEY_NO, BUTTON_NAME)       { io.AddKeyEvent(KEY_NO, gp.BUTTON_NAME.isPressed); }
 | 
				
			||||||
    #define MAP_ANALOG(KEY_NO, AXIS_NAME, V0, V1) { float vn = (float)(gp.AXIS_NAME.value - V0) / (float)(V1 - V0); vn = IM_SATURATE(vn); io.AddKeyAnalogEvent(KEY_NO, vn > 0.1f, vn); }
 | 
					    #define MAP_ANALOG(KEY_NO, AXIS_NAME, V0, V1) { float vn = (float)(gp.AXIS_NAME.value - V0) / (float)(V1 - V0); vn = IM_SATURATE(vn); io.AddKeyAnalogEvent(KEY_NO, vn > 0.1f, vn); }
 | 
				
			||||||
    const float thumb_dead_zone = 0.0f;
 | 
					    const float thumb_dead_zone = 0.0f;
 | 
				
			||||||
    if (@available(macOS 10.15, *))
 | 
					
 | 
				
			||||||
    {
 | 
					#if APPLE_HAS_BUTTON_OPTIONS
 | 
				
			||||||
        MAP_BUTTON(ImGuiKey_GamepadStart,           buttonMenu);
 | 
					 | 
				
			||||||
    MAP_BUTTON(ImGuiKey_GamepadBack,            buttonOptions);
 | 
					    MAP_BUTTON(ImGuiKey_GamepadBack,            buttonOptions);
 | 
				
			||||||
    }
 | 
					#endif
 | 
				
			||||||
    MAP_BUTTON(ImGuiKey_GamepadFaceDown,        buttonA);              // Xbox A, PS Cross
 | 
					    MAP_BUTTON(ImGuiKey_GamepadFaceDown,        buttonA);              // Xbox A, PS Cross
 | 
				
			||||||
    MAP_BUTTON(ImGuiKey_GamepadFaceRight,       buttonB);              // Xbox B, PS Circle
 | 
					    MAP_BUTTON(ImGuiKey_GamepadFaceRight,       buttonB);              // Xbox B, PS Circle
 | 
				
			||||||
    MAP_BUTTON(ImGuiKey_GamepadFaceLeft,        buttonX);              // Xbox X, PS Square
 | 
					    MAP_BUTTON(ImGuiKey_GamepadFaceLeft,        buttonX);              // Xbox X, PS Square
 | 
				
			||||||
@@ -528,11 +531,10 @@ static void ImGui_ImplOSX_UpdateGamepads()
 | 
				
			|||||||
    MAP_ANALOG(ImGuiKey_GamepadR1,              rightShoulder, 0.0f, 1.0f);
 | 
					    MAP_ANALOG(ImGuiKey_GamepadR1,              rightShoulder, 0.0f, 1.0f);
 | 
				
			||||||
    MAP_ANALOG(ImGuiKey_GamepadL2,              leftTrigger,  0.0f, 1.0f);
 | 
					    MAP_ANALOG(ImGuiKey_GamepadL2,              leftTrigger,  0.0f, 1.0f);
 | 
				
			||||||
    MAP_ANALOG(ImGuiKey_GamepadR2,              rightTrigger, 0.0f, 1.0f);
 | 
					    MAP_ANALOG(ImGuiKey_GamepadR2,              rightTrigger, 0.0f, 1.0f);
 | 
				
			||||||
    if (@available(macOS 10.14.1, *))
 | 
					#if APPLE_HAS_THUMBSTICKS
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
    MAP_BUTTON(ImGuiKey_GamepadL3,              leftThumbstickButton);
 | 
					    MAP_BUTTON(ImGuiKey_GamepadL3,              leftThumbstickButton);
 | 
				
			||||||
    MAP_BUTTON(ImGuiKey_GamepadR3,              rightThumbstickButton);
 | 
					    MAP_BUTTON(ImGuiKey_GamepadR3,              rightThumbstickButton);
 | 
				
			||||||
    }
 | 
					#endif
 | 
				
			||||||
    MAP_ANALOG(ImGuiKey_GamepadLStickLeft,      leftThumbstick.xAxis,  -thumb_dead_zone, -1.0f);
 | 
					    MAP_ANALOG(ImGuiKey_GamepadLStickLeft,      leftThumbstick.xAxis,  -thumb_dead_zone, -1.0f);
 | 
				
			||||||
    MAP_ANALOG(ImGuiKey_GamepadLStickRight,     leftThumbstick.xAxis,  +thumb_dead_zone, +1.0f);
 | 
					    MAP_ANALOG(ImGuiKey_GamepadLStickRight,     leftThumbstick.xAxis,  +thumb_dead_zone, +1.0f);
 | 
				
			||||||
    MAP_ANALOG(ImGuiKey_GamepadLStickUp,        leftThumbstick.yAxis,  +thumb_dead_zone, +1.0f);
 | 
					    MAP_ANALOG(ImGuiKey_GamepadLStickUp,        leftThumbstick.yAxis,  +thumb_dead_zone, +1.0f);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,7 +38,7 @@ Dear ImGui is highly portable and only requires a few things to run and render,
 | 
				
			|||||||
 - Optional: multi-viewports support.
 | 
					 - Optional: multi-viewports support.
 | 
				
			||||||
 etc.
 | 
					 etc.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This is essentially what each backends are doing + obligatory portability cruft. Using default backends ensure you can get all those features including the ones that would be harder to implement on your side (e.g. multi-viewports support).
 | 
					This is essentially what each backend is doing + obligatory portability cruft. Using default backends ensure you can get all those features including the ones that would be harder to implement on your side (e.g. multi-viewports support).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
It is important to understand the difference between the core Dear ImGui library (files in the root folder)
 | 
					It is important to understand the difference between the core Dear ImGui library (files in the root folder)
 | 
				
			||||||
and backends which we are describing here (backends/ folder).
 | 
					and backends which we are describing here (backends/ folder).
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -216,6 +216,7 @@ Other Changes:
 | 
				
			|||||||
- Backends: OSX: Submit gamepad data using io.AddKeyEvent/AddKeyAnalogEvent() functions, stopped writing to io.NavInputs[]. (#4858)
 | 
					- Backends: OSX: Submit gamepad data using io.AddKeyEvent/AddKeyAnalogEvent() functions, stopped writing to io.NavInputs[]. (#4858)
 | 
				
			||||||
- Backends: OSX: Added basic Platform IME support. (#3108, #2598) [@liuliu]
 | 
					- Backends: OSX: Added basic Platform IME support. (#3108, #2598) [@liuliu]
 | 
				
			||||||
- Backends: OSX: Fix Game Controller nav mapping to use shoulder for both focusing and tweak speed. (#4759)
 | 
					- Backends: OSX: Fix Game Controller nav mapping to use shoulder for both focusing and tweak speed. (#4759)
 | 
				
			||||||
 | 
					- Backends: OSX: Fix building with old Xcode versions that are missing gamepad features. [@rokups]
 | 
				
			||||||
- Backends: Android, GLUT: Submit keys using io.AddKeyEvent(). Submit keymods using io.AddKeyModsEvent() at the same time. (#2625)
 | 
					- Backends: Android, GLUT: Submit keys using io.AddKeyEvent(). Submit keymods using io.AddKeyModsEvent() at the same time. (#2625)
 | 
				
			||||||
- Backends: Android, GLUT: Submit mouse data using io.AddMousePosEvent(), AddMouseButtonEvent(), AddMouseWheelEvent() functions. (#4858)
 | 
					- Backends: Android, GLUT: Submit mouse data using io.AddMousePosEvent(), AddMouseButtonEvent(), AddMouseWheelEvent() functions. (#4858)
 | 
				
			||||||
- Backends: OpenGL3: Fixed a buffer overflow in imgui_impl_opengl3_loader.h init (added in 1.86). (#4468, #4830) [@dymk]
 | 
					- Backends: OpenGL3: Fixed a buffer overflow in imgui_impl_opengl3_loader.h init (added in 1.86). (#4468, #4830) [@dymk]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,7 +72,7 @@ Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui
 | 
				
			|||||||
Please read the comments and instruction at the top of each file.
 | 
					Please read the comments and instruction at the top of each file.
 | 
				
			||||||
Please read FAQ at http://www.dearimgui.org/faq
 | 
					Please read FAQ at http://www.dearimgui.org/faq
 | 
				
			||||||
 | 
					
 | 
				
			||||||
If you are using of the backend provided here, you can add the backends/imgui_impl_xxxx(.cpp,.h)
 | 
					If you are using any of the backends provided here, you can add the backends/imgui_impl_xxxx(.cpp,.h)
 | 
				
			||||||
files to your project and use as-in. Each imgui_impl_xxxx.cpp file comes with its own individual
 | 
					files to your project and use as-in. Each imgui_impl_xxxx.cpp file comes with its own individual
 | 
				
			||||||
Changelog, so if you want to update them later it will be easier to catch up with what changed.
 | 
					Changelog, so if you want to update them later it will be easier to catch up with what changed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -654,7 +654,7 @@ A reasonably skinned application may look like (screenshot from [#2529](https://
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
### Q: Why using C++ (as opposed to C)?
 | 
					### Q: Why using C++ (as opposed to C)?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Dear ImGui takes advantage of a few C++ languages features for convenience but nothing anywhere Boost insanity/quagmire. Dear ImGui does NOT require C++11 so it can be used with most old C++ compilers. Dear ImGui doesn't use any C++ header file. Language-wise, function overloading and default parameters are used to make the API easier to use and code more terse. Doing so I believe the API is sitting on a sweet spot and giving up on those features would make the API more cumbersome. Other features such as namespace, constructors and templates (in the case of the ImVector<> class) are also relied on as a convenience.
 | 
					Dear ImGui takes advantage of a few C++ languages features for convenience but nothing anywhere Boost insanity/quagmire. Dear ImGui doesn't use any C++ header file. Dear ImGui uses a very small subset of C++11 features. In particular, function overloading and default parameters are used to make the API easier to use and code more terse. Doing so I believe the API is sitting on a sweet spot and giving up on those features would make the API more cumbersome. Other features such as namespace, constructors and templates (in the case of the ImVector<> class) are also relied on as a convenience.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
There is an auto-generated [c-api for Dear ImGui (cimgui)](https://github.com/cimgui/cimgui) by Sonoro1234 and Stephan Dilly. It is designed for creating bindings to other languages. If possible, I would suggest using your target language functionalities to try replicating the function overloading and default parameters used in C++ else the API may be harder to use. Also see [Bindings](https://github.com/ocornut/imgui/wiki/Bindings) for various third-party bindings.
 | 
					There is an auto-generated [c-api for Dear ImGui (cimgui)](https://github.com/cimgui/cimgui) by Sonoro1234 and Stephan Dilly. It is designed for creating bindings to other languages. If possible, I would suggest using your target language functionalities to try replicating the function overloading and default parameters used in C++ else the API may be harder to use. Also see [Bindings](https://github.com/ocornut/imgui/wiki/Bindings) for various third-party bindings.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -309,7 +309,7 @@ ImFont* font = io.Fonts->AddFontFromMemoryCompressedBase85TTF(compressed_data_ba
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## About filenames
 | 
					## About filenames
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Please note that many new C/C++ users have issues their files _because the filename they provide is wrong_.**
 | 
					**Please note that many new C/C++ users have issues loading their files _because the filename they provide is wrong_.**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Two things to watch for:
 | 
					Two things to watch for:
 | 
				
			||||||
- Make sure your IDE/debugger settings starts your executable from the right working directory. In Visual Studio you can change your working directory in project `Properties > General > Debugging > Working Directory`. People assume that their execution will start from the root folder of the project, where by default it oftens start from the folder where object or executable files are stored.
 | 
					- Make sure your IDE/debugger settings starts your executable from the right working directory. In Visual Studio you can change your working directory in project `Properties > General > Debugging > Working Directory`. People assume that their execution will start from the root folder of the project, where by default it oftens start from the folder where object or executable files are stored.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										21
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								imgui.cpp
									
									
									
									
									
								
							@@ -1134,7 +1134,7 @@ ImGuiIO::ImGuiIO()
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    // Most fields are initialized with zero
 | 
					    // Most fields are initialized with zero
 | 
				
			||||||
    memset(this, 0, sizeof(*this));
 | 
					    memset(this, 0, sizeof(*this));
 | 
				
			||||||
    IM_ASSERT(IM_ARRAYSIZE(ImGuiIO::MouseDown) == ImGuiMouseButton_COUNT && IM_ARRAYSIZE(ImGuiIO::MouseClicked) == ImGuiMouseButton_COUNT); // Our pre-C++11 IM_STATIC_ASSERT() macros triggers warning on modern compilers so we don't use it here.
 | 
					    IM_STATIC_ASSERT(IM_ARRAYSIZE(ImGuiIO::MouseDown) == ImGuiMouseButton_COUNT && IM_ARRAYSIZE(ImGuiIO::MouseClicked) == ImGuiMouseButton_COUNT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Settings
 | 
					    // Settings
 | 
				
			||||||
    ConfigFlags = ImGuiConfigFlags_None;
 | 
					    ConfigFlags = ImGuiConfigFlags_None;
 | 
				
			||||||
@@ -3555,7 +3555,7 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        // Special handling for calling after Begin() which represent the title bar or tab.
 | 
					        // Special handling for calling after Begin() which represent the title bar or tab.
 | 
				
			||||||
        // When the window is collapsed (SkipItems==true) that last item will never be overwritten so we need to detect the case.
 | 
					        // When the window is collapsed (SkipItems==true) that last item will never be overwritten so we need to detect the case.
 | 
				
			||||||
        if ((g.LastItemData.ID == window->ID || g.LastItemData.ID == window->MoveId) && window->WriteAccessed)
 | 
					        if (g.LastItemData.ID == window->MoveId && window->WriteAccessed)
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -6758,6 +6758,18 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // [Test Engine] Register whole window in the item system
 | 
				
			||||||
 | 
					#ifdef IMGUI_ENABLE_TEST_ENGINE
 | 
				
			||||||
 | 
					        if (g.TestEngineHookItems)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            IM_ASSERT(window->IDStack.Size == 1);
 | 
				
			||||||
 | 
					            window->IDStack.Size = 0;
 | 
				
			||||||
 | 
					            IMGUI_TEST_ENGINE_ITEM_ADD(window->Rect(), window->ID);
 | 
				
			||||||
 | 
					            IMGUI_TEST_ENGINE_ITEM_INFO(window->ID, window->Name, (g.HoveredWindow == window) ? ImGuiItemStatusFlags_HoveredRect : 0);
 | 
				
			||||||
 | 
					            window->IDStack.Size = 1;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Decide if we are going to handle borders and resize grips
 | 
					        // Decide if we are going to handle borders and resize grips
 | 
				
			||||||
        const bool handle_borders_and_resize_grips = (window->DockNodeAsHost || !window->DockIsActive);
 | 
					        const bool handle_borders_and_resize_grips = (window->DockNodeAsHost || !window->DockIsActive);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -7026,14 +7038,13 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
 | 
				
			|||||||
        // We fill last item data based on Title Bar/Tab, in order for IsItemHovered() and IsItemActive() to be usable after Begin().
 | 
					        // We fill last item data based on Title Bar/Tab, in order for IsItemHovered() and IsItemActive() to be usable after Begin().
 | 
				
			||||||
        // This is useful to allow creating context menus on title bar only, etc.
 | 
					        // This is useful to allow creating context menus on title bar only, etc.
 | 
				
			||||||
        if (window->DockIsActive)
 | 
					        if (window->DockIsActive)
 | 
				
			||||||
            SetLastItemData(window->ID, g.CurrentItemFlags, window->DockTabItemStatusFlags, window->DockTabItemRect);
 | 
					            SetLastItemData(window->MoveId, g.CurrentItemFlags, window->DockTabItemStatusFlags, window->DockTabItemRect);
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
            SetLastItemData(window->MoveId, g.CurrentItemFlags, IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max, false) ? ImGuiItemStatusFlags_HoveredRect : 0, title_bar_rect);
 | 
					            SetLastItemData(window->MoveId, g.CurrentItemFlags, IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max, false) ? ImGuiItemStatusFlags_HoveredRect : 0, title_bar_rect);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
 | 
					        // [Test Engine] Register title bar / tab
 | 
				
			||||||
        if (!(window->Flags & ImGuiWindowFlags_NoTitleBar))
 | 
					        if (!(window->Flags & ImGuiWindowFlags_NoTitleBar))
 | 
				
			||||||
            IMGUI_TEST_ENGINE_ITEM_ADD(g.LastItemData.Rect, g.LastItemData.ID);
 | 
					            IMGUI_TEST_ENGINE_ITEM_ADD(g.LastItemData.Rect, g.LastItemData.ID);
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										6
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								imgui.h
									
									
									
									
									
								
							@@ -65,7 +65,7 @@ Index of this file:
 | 
				
			|||||||
// Version
 | 
					// Version
 | 
				
			||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
 | 
					// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
 | 
				
			||||||
#define IMGUI_VERSION               "1.87 WIP"
 | 
					#define IMGUI_VERSION               "1.87 WIP"
 | 
				
			||||||
#define IMGUI_VERSION_NUM           18615
 | 
					#define IMGUI_VERSION_NUM           18616
 | 
				
			||||||
#define IMGUI_CHECKVERSION()        ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
 | 
					#define IMGUI_CHECKVERSION()        ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
 | 
				
			||||||
#define IMGUI_HAS_TABLE
 | 
					#define IMGUI_HAS_TABLE
 | 
				
			||||||
#define IMGUI_HAS_VIEWPORT          // Viewport WIP branch
 | 
					#define IMGUI_HAS_VIEWPORT          // Viewport WIP branch
 | 
				
			||||||
@@ -230,8 +230,8 @@ typedef signed short        ImS16;  // 16-bit signed integer
 | 
				
			|||||||
typedef unsigned short      ImU16;  // 16-bit unsigned integer
 | 
					typedef unsigned short      ImU16;  // 16-bit unsigned integer
 | 
				
			||||||
typedef signed int          ImS32;  // 32-bit signed integer == int
 | 
					typedef signed int          ImS32;  // 32-bit signed integer == int
 | 
				
			||||||
typedef unsigned int        ImU32;  // 32-bit unsigned integer (often used to store packed colors)
 | 
					typedef unsigned int        ImU32;  // 32-bit unsigned integer (often used to store packed colors)
 | 
				
			||||||
typedef signed   long long  ImS64;  // 64-bit signed integer (C++11)
 | 
					typedef signed   long long  ImS64;  // 64-bit signed integer
 | 
				
			||||||
typedef unsigned long long  ImU64;  // 64-bit unsigned integer (C++11)
 | 
					typedef unsigned long long  ImU64;  // 64-bit unsigned integer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Character types
 | 
					// Character types
 | 
				
			||||||
// (we generally use UTF-8 encoded string in the API. This is storage specifically for a decoded character used for keyboard input and display)
 | 
					// (we generally use UTF-8 encoded string in the API. This is storage specifically for a decoded character used for keyboard input and display)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -408,10 +408,9 @@ void ImDrawListSharedData::SetCircleTessellationMaxError(float max_error)
 | 
				
			|||||||
void ImDrawList::_ResetForNewFrame()
 | 
					void ImDrawList::_ResetForNewFrame()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // Verify that the ImDrawCmd fields we want to memcmp() are contiguous in memory.
 | 
					    // Verify that the ImDrawCmd fields we want to memcmp() are contiguous in memory.
 | 
				
			||||||
    // (those should be IM_STATIC_ASSERT() in theory but with our pre C++11 setup the whole check doesn't compile with GCC)
 | 
					    IM_STATIC_ASSERT(IM_OFFSETOF(ImDrawCmd, ClipRect) == 0);
 | 
				
			||||||
    IM_ASSERT(IM_OFFSETOF(ImDrawCmd, ClipRect) == 0);
 | 
					    IM_STATIC_ASSERT(IM_OFFSETOF(ImDrawCmd, TextureId) == sizeof(ImVec4));
 | 
				
			||||||
    IM_ASSERT(IM_OFFSETOF(ImDrawCmd, TextureId) == sizeof(ImVec4));
 | 
					    IM_STATIC_ASSERT(IM_OFFSETOF(ImDrawCmd, VtxOffset) == sizeof(ImVec4) + sizeof(ImTextureID));
 | 
				
			||||||
    IM_ASSERT(IM_OFFSETOF(ImDrawCmd, VtxOffset) == sizeof(ImVec4) + sizeof(ImTextureID));
 | 
					 | 
				
			||||||
    if (_Splitter._Count > 1)
 | 
					    if (_Splitter._Count > 1)
 | 
				
			||||||
        _Splitter.Merge(this);
 | 
					        _Splitter.Merge(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -553,7 +553,7 @@ inline void     ImBitArraySetBitRange(ImU32* arr, int n, int n2) // Works on ran
 | 
				
			|||||||
// Helper: ImBitArray class (wrapper over ImBitArray functions)
 | 
					// Helper: ImBitArray class (wrapper over ImBitArray functions)
 | 
				
			||||||
// Store 1-bit per value.
 | 
					// Store 1-bit per value.
 | 
				
			||||||
template<int BITCOUNT, int OFFSET = 0>
 | 
					template<int BITCOUNT, int OFFSET = 0>
 | 
				
			||||||
struct IMGUI_API ImBitArray
 | 
					struct ImBitArray
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ImU32           Storage[(BITCOUNT + 31) >> 5];
 | 
					    ImU32           Storage[(BITCOUNT + 31) >> 5];
 | 
				
			||||||
    ImBitArray()                                { ClearAllBits(); }
 | 
					    ImBitArray()                                { ClearAllBits(); }
 | 
				
			||||||
@@ -634,7 +634,7 @@ struct ImSpanAllocator
 | 
				
			|||||||
// Honor constructor/destructor. Add/remove invalidate all pointers. Indexes have the same lifetime as the associated object.
 | 
					// Honor constructor/destructor. Add/remove invalidate all pointers. Indexes have the same lifetime as the associated object.
 | 
				
			||||||
typedef int ImPoolIdx;
 | 
					typedef int ImPoolIdx;
 | 
				
			||||||
template<typename T>
 | 
					template<typename T>
 | 
				
			||||||
struct IMGUI_API ImPool
 | 
					struct ImPool
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ImVector<T>     Buf;        // Contiguous data
 | 
					    ImVector<T>     Buf;        // Contiguous data
 | 
				
			||||||
    ImGuiStorage    Map;        // ID->Index
 | 
					    ImGuiStorage    Map;        // ID->Index
 | 
				
			||||||
@@ -671,7 +671,7 @@ struct IMGUI_API ImPool
 | 
				
			|||||||
// We store the chunk size first, and align the final size on 4 bytes boundaries.
 | 
					// We store the chunk size first, and align the final size on 4 bytes boundaries.
 | 
				
			||||||
// The tedious/zealous amount of casting is to avoid -Wcast-align warnings.
 | 
					// The tedious/zealous amount of casting is to avoid -Wcast-align warnings.
 | 
				
			||||||
template<typename T>
 | 
					template<typename T>
 | 
				
			||||||
struct IMGUI_API ImChunkStream
 | 
					struct ImChunkStream
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ImVector<char>  Buf;
 | 
					    ImVector<char>  Buf;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -3200,7 +3200,8 @@ extern const char*  ImGuiTestEngine_FindItemDebugLabel(ImGuiContext* ctx, ImGuiI
 | 
				
			|||||||
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS)      if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemInfo(&g, _ID, _LABEL, _FLAGS)   // Register item label and status flags (optional)
 | 
					#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS)      if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemInfo(&g, _ID, _LABEL, _FLAGS)   // Register item label and status flags (optional)
 | 
				
			||||||
#define IMGUI_TEST_ENGINE_LOG(_FMT,...)                     if (g.TestEngineHookItems) ImGuiTestEngineHook_Log(&g, _FMT, __VA_ARGS__)          // Custom log entry from user land into test log
 | 
					#define IMGUI_TEST_ENGINE_LOG(_FMT,...)                     if (g.TestEngineHookItems) ImGuiTestEngineHook_Log(&g, _FMT, __VA_ARGS__)          // Custom log entry from user land into test log
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS)      ((void)0)
 | 
					#define IMGUI_TEST_ENGINE_ITEM_ADD(_BB,_ID)                 ((void)0)
 | 
				
			||||||
 | 
					#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS)      ((void)g)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//-----------------------------------------------------------------------------
 | 
					//-----------------------------------------------------------------------------
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -731,6 +731,7 @@ bool ImGui::SmallButton(const char* label)
 | 
				
			|||||||
// Then you can keep 'str_id' empty or the same for all your buttons (instead of creating a string based on a non-string id)
 | 
					// Then you can keep 'str_id' empty or the same for all your buttons (instead of creating a string based on a non-string id)
 | 
				
			||||||
bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg, ImGuiButtonFlags flags)
 | 
					bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg, ImGuiButtonFlags flags)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    ImGuiContext& g = *GImGui;
 | 
				
			||||||
    ImGuiWindow* window = GetCurrentWindow();
 | 
					    ImGuiWindow* window = GetCurrentWindow();
 | 
				
			||||||
    if (window->SkipItems)
 | 
					    if (window->SkipItems)
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -748,16 +749,17 @@ bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg, ImGuiBut
 | 
				
			|||||||
    bool hovered, held;
 | 
					    bool hovered, held;
 | 
				
			||||||
    bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
 | 
					    bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    IMGUI_TEST_ENGINE_ITEM_INFO(id, str_id, g.LastItemData.StatusFlags);
 | 
				
			||||||
    return pressed;
 | 
					    return pressed;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiButtonFlags flags)
 | 
					bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiButtonFlags flags)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    ImGuiContext& g = *GImGui;
 | 
				
			||||||
    ImGuiWindow* window = GetCurrentWindow();
 | 
					    ImGuiWindow* window = GetCurrentWindow();
 | 
				
			||||||
    if (window->SkipItems)
 | 
					    if (window->SkipItems)
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ImGuiContext& g = *GImGui;
 | 
					 | 
				
			||||||
    const ImGuiID id = window->GetID(str_id);
 | 
					    const ImGuiID id = window->GetID(str_id);
 | 
				
			||||||
    const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
 | 
					    const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
 | 
				
			||||||
    const float default_size = GetFrameHeight();
 | 
					    const float default_size = GetFrameHeight();
 | 
				
			||||||
@@ -778,6 +780,7 @@ bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiBu
 | 
				
			|||||||
    RenderFrame(bb.Min, bb.Max, bg_col, true, g.Style.FrameRounding);
 | 
					    RenderFrame(bb.Min, bb.Max, bg_col, true, g.Style.FrameRounding);
 | 
				
			||||||
    RenderArrow(window->DrawList, bb.Min + ImVec2(ImMax(0.0f, (size.x - g.FontSize) * 0.5f), ImMax(0.0f, (size.y - g.FontSize) * 0.5f)), text_col, dir);
 | 
					    RenderArrow(window->DrawList, bb.Min + ImVec2(ImMax(0.0f, (size.x - g.FontSize) * 0.5f), ImMax(0.0f, (size.y - g.FontSize) * 0.5f)), text_col, dir);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    IMGUI_TEST_ENGINE_ITEM_INFO(id, str_id, g.LastItemData.StatusFlags);
 | 
				
			||||||
    return pressed;
 | 
					    return pressed;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,10 +1,6 @@
 | 
				
			|||||||
// dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.)
 | 
					// dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.)
 | 
				
			||||||
// This is also an example of how you may wrap your own similar types.
 | 
					// This is also an example of how you may wrap your own similar types.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Compatibility:
 | 
					 | 
				
			||||||
// - std::string support is only guaranteed to work from C++11.
 | 
					 | 
				
			||||||
//   If you try to use it pre-C++11, please share your findings (w/ info about compiler/architecture)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Changelog:
 | 
					// Changelog:
 | 
				
			||||||
// - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string
 | 
					// - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,10 +1,6 @@
 | 
				
			|||||||
// dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.)
 | 
					// dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.)
 | 
				
			||||||
// This is also an example of how you may wrap your own similar types.
 | 
					// This is also an example of how you may wrap your own similar types.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Compatibility:
 | 
					 | 
				
			||||||
// - std::string support is only guaranteed to work from C++11.
 | 
					 | 
				
			||||||
//   If you try to use it pre-C++11, please share your findings (w/ info about compiler/architecture)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Changelog:
 | 
					// Changelog:
 | 
				
			||||||
// - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string
 | 
					// - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,12 +26,12 @@ See https://gist.github.com/ocornut/b3a9ecf13502fd818799a452969649ad
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
### Comparaison
 | 
					### Comparaison
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Small, thin anti-aliased fonts are typically benefiting a lots from Freetype's hinting:
 | 
					Small, thin anti-aliased fonts typically benefit a lot from FreeType's hinting:
 | 
				
			||||||

 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Colorful glyphs/emojis
 | 
					### Colorful glyphs/emojis
 | 
				
			||||||
 | 
					
 | 
				
			||||||
You can use the `ImGuiFreeTypeBuilderFlags_LoadColor` flag to load certain colorful glyphs. See
 | 
					You can use the `ImGuiFreeTypeBuilderFlags_LoadColor` flag to load certain colorful glyphs. See the
 | 
				
			||||||
["Using Colorful Glyphs/Emojis"](https://github.com/ocornut/imgui/edit/master/docs/FONTS.md#using-colorful-glyphsemojis) section of FONTS.md.
 | 
					["Using Colorful Glyphs/Emojis"](https://github.com/ocornut/imgui/edit/master/docs/FONTS.md#using-colorful-glyphsemojis) section of FONTS.md.
 | 
				
			||||||
 | 
					
 | 
				
			||||||

 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user