mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 05:01:05 +01:00 
			
		
		
		
	Merge branch 'master' into docking
# Conflicts: # imgui_demo.cpp
This commit is contained in:
		| @@ -123,9 +123,13 @@ Other Changes: | ||||
| - Added IsMouseTripleClicked() function. Tracking multi-click count in IO structure. (#3229) [@kudaba] | ||||
| - Modals: fixed issue hovering popups inside a child inside a modal. (#4676, #4527) | ||||
| - Fixed IsWindowFocused()/IsWindowHovered() issues with childs inside popups. (#4676) | ||||
| - Nav: Ctrl+tabbing to cycle through windows is now enabled regardless of using the _NavEnableKeyboard | ||||
|   configuration flag. This is part of an effort to generalize the use of keyboard inputs. (#4023, #787). | ||||
|   Note that while this is active you can also moving windows (with arrow) and resize (shift+arrows). | ||||
| - Nav: tabbing now cycles through clipped items and scroll accordingly. (#4449) | ||||
| - Nav: pressing PageUp/PageDown/Home/End when in Menu layer automatically moves back to Main layer. | ||||
| - Nav: fixed resizing window from borders setting navigation to Menu layer. | ||||
| - Nav: prevent child from clipping items when using _NavFlattened and parent has a pending request. | ||||
| - Nav: pressing Esc to exit a child window reactivates the Nav highlight if it was disabled by mouse. | ||||
| - Nav: with ImGuiConfigFlags_NavEnableSetMousePos enabled: Fixed absolute mouse position when using | ||||
|   Home/End leads to scrolling. Fixed not setting mouse position when a failed move request (e.g. when | ||||
| @@ -136,9 +140,11 @@ Other Changes: | ||||
| - Clipper: currently focused item is automatically included in clipper range. | ||||
|   Fixes issue where e.g. drag and dropping an item and scrolling ensure the item source location is | ||||
|   still submitted. (#3841, #1725) [@GamingMinds-DanielC, @ocornut] | ||||
| - Cliooer: added ForceDisplayRangeByIndices() to force a given item (or several) to be stepped out | ||||
|   during a clipping operation. (#3841) [@@GamingMinds-DanielC] | ||||
| - Clipper: rework so gamepad/keyboard navigation doesn't create spikes in number of items requested | ||||
|   by the clipper to display. (#3841) | ||||
| - Clipper: Fixed content height declaration slightly mismatching the value of when not using a clipper. | ||||
| - Clipper: fixed content height declaration slightly mismatching the value of when not using a clipper. | ||||
|   (an additional ItemSpacing.y was declared, affecting scrollbar range). | ||||
| - Backends: Vulkan: Call vkCmdSetScissor() at the end of render with a full-viewport to reduce | ||||
|   likehood of issues with people using VK_DYNAMIC_STATE_SCISSOR in their app without calling | ||||
|   | ||||
| @@ -204,10 +204,10 @@ Ongoing Dear ImGui development is currently financially supported by users and p | ||||
| - [Google](https://github.com/google/filament), [Nvidia](https://developer.nvidia.com/nvidia-omniverse), [Ubisoft](https://montreal.ubisoft.com/en/ubisoft-sponsors-user-interface-library-for-c-dear-imgui) | ||||
|  | ||||
| *Chocolate sponsors* | ||||
| - [Activision](https://careers.activision.com/c/programmingsoftware-engineering-jobs), [Adobe](https://www.adobe.com/products/medium.html), [Aras Pranckevičius](https://aras-p.info), [Arkane Studios](https://www.arkane-studios.com), [Epic](https://www.unrealengine.com/en-US/megagrants), [RAD Game Tools](http://www.radgametools.com/) | ||||
| - [Activision](https://careers.activision.com/c/programmingsoftware-engineering-jobs), [Adobe](https://www.adobe.com/products/medium.html), [Aras Pranckevičius](https://aras-p.info), [Arkane Studios](https://www.arkane-studios.com), [Epic](https://www.unrealengine.com/en-US/megagrants), [RAD Game Tools](http://www.radgametools.com/), [Supercell](https://supercell.com) | ||||
|  | ||||
| *Salty-caramel sponsors* | ||||
| - [Framefield](http://framefield.com), [Grinding Gear Games](https://www.grindinggear.com), [Kylotonn](https://www.kylotonn.com), [Next Level Games](https://www.nextlevelgames.com), [O-Net Communications (USA)](http://en.o-netcom.com), [Supercell](https://supercell.com). | ||||
| - [Framefield](http://framefield.com), [Grinding Gear Games](https://www.grindinggear.com), [Kylotonn](https://www.kylotonn.com), [Next Level Games](https://www.nextlevelgames.com), [O-Net Communications (USA)](http://en.o-netcom.com) | ||||
|  | ||||
| Please see [detailed list of Dear ImGui supporters](https://github.com/ocornut/imgui/wiki/Sponsors) for past sponsors. | ||||
| From November 2014 to December 2019, ongoing development has also been financially supported by its users on Patreon and through individual donations. | ||||
|   | ||||
| @@ -142,7 +142,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i | ||||
|  - plot: option/feature: draw unit | ||||
|  - plot: add a helper e.g. Plot(char* label, float value, float time_span=2.0f) that stores values and Plot them for you - probably another function name. and/or automatically allow to plot ANY displayed value (more reliance on stable ID) | ||||
|  | ||||
|  - clipper: ability to force display 1 item in the list would be convenient (for patterns where we need to set active id etc.) (#3841) (can resurrect ForceDisplayRangeXXX functions removed) | ||||
|  - clipper: ability to disable the clipping through a simple flag/bool. | ||||
|  - clipper: ability to run without knowing full count in advance. | ||||
|  - clipper: horizontal clipping support. (#2580) | ||||
|   | ||||
							
								
								
									
										40
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								imgui.cpp
									
									
									
									
									
								
							| @@ -937,7 +937,7 @@ static void             NavEndFrame(); | ||||
| static bool             NavScoreItem(ImGuiNavItemData* result); | ||||
| static void             NavApplyItemToResult(ImGuiNavItemData* result); | ||||
| static void             NavProcessItem(); | ||||
| static void             NavProcessItemForTabbingRequest(ImGuiWindow* window, ImGuiID id); | ||||
| static void             NavProcessItemForTabbingRequest(ImGuiID id); | ||||
| static ImVec2           NavCalcPreferredRefPos(); | ||||
| static void             NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_window); | ||||
| static ImGuiWindow*     NavRestoreLastChildNavWindow(ImGuiWindow* window); | ||||
| @@ -2447,6 +2447,15 @@ void ImGuiListClipper::End() | ||||
|     } | ||||
| } | ||||
|  | ||||
| void ImGuiListClipper::ForceDisplayRangeByIndices(int item_min, int item_max) | ||||
| { | ||||
|     ImGuiListClipperData* data = (ImGuiListClipperData*)TempData; | ||||
|     IM_ASSERT(DisplayStart < 0); // Only allowed after Begin() and if there has not been a specified range yet. | ||||
|     IM_ASSERT(item_min <= item_max); | ||||
|     if (item_min < item_max) | ||||
|         data->Ranges.push_back(ImGuiListClipperRange::FromIndices(item_min, item_max)); | ||||
| } | ||||
|  | ||||
| bool ImGuiListClipper::Step() | ||||
| { | ||||
|     ImGuiContext& g = *GImGui; | ||||
| @@ -5834,7 +5843,7 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s | ||||
|     { | ||||
|         ImVec2 nav_resize_delta; | ||||
|         if (g.NavInputSource == ImGuiInputSource_Keyboard && g.IO.KeyShift) | ||||
|             nav_resize_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard, ImGuiInputReadMode_Down); | ||||
|             nav_resize_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_RawKeyboard, ImGuiInputReadMode_Down); | ||||
|         if (g.NavInputSource == ImGuiInputSource_Gamepad) | ||||
|             nav_resize_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_PadDPad, ImGuiInputReadMode_Down); | ||||
|         if (nav_resize_delta.x != 0.0f || nav_resize_delta.y != 0.0f) | ||||
| @@ -6910,9 +6919,12 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) | ||||
|             // Mark them as collapsed so commands are skipped earlier (we can't manually collapse them because they have no title bar). | ||||
|             IM_ASSERT((flags& ImGuiWindowFlags_NoTitleBar) != 0 || (window->DockIsActive)); | ||||
|             if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0) // FIXME: Doesn't make sense for ChildWindow?? | ||||
|                 if (!g.LogEnabled) | ||||
|             { | ||||
|                 const bool nav_request = (flags & ImGuiWindowFlags_NavFlattened) && (g.NavAnyRequest && g.NavWindow && g.NavWindow->RootWindowForNav == window->RootWindowForNav); | ||||
|                 if (!g.LogEnabled && !nav_request) | ||||
|                     if (window->OuterRectClipped.Min.x >= window->OuterRectClipped.Max.x || window->OuterRectClipped.Min.y >= window->OuterRectClipped.Max.y) | ||||
|                         window->HiddenFramesCanSkipItems = 1; | ||||
|             } | ||||
|  | ||||
|             // Hide along with parent or if parent is collapsed | ||||
|             if (parent_window && (parent_window->Collapsed || parent_window->HiddenFramesCanSkipItems > 0)) | ||||
| @@ -9689,7 +9701,7 @@ static void ImGui::NavProcessItem() | ||||
|         if (is_tabbing) | ||||
|         { | ||||
|             if (is_tab_stop || (g.NavMoveFlags & ImGuiNavMoveFlags_FocusApi)) | ||||
|                 NavProcessItemForTabbingRequest(window, id); | ||||
|                 NavProcessItemForTabbingRequest(id); | ||||
|         } | ||||
|         else if ((g.NavId != id || (g.NavMoveFlags & ImGuiNavMoveFlags_AllowCurrentNavId)) && !(item_flags & (ImGuiItemFlags_Disabled | ImGuiItemFlags_NoNav))) | ||||
|         { | ||||
| @@ -9727,11 +9739,12 @@ static void ImGui::NavProcessItem() | ||||
| // - Case 3: tab forward wrap:    set result to first eligible item (preemptively), on ref id set counter, on next frame if counter hasn't elapsed store result. // FIXME-TABBING: Could be done as a next-frame forwarded request | ||||
| // - Case 4: tab backward:        store all results, on ref id pick prev, stop storing | ||||
| // - Case 5: tab backward wrap:   store all results, on ref id if no result keep storing until last // FIXME-TABBING: Could be done as next-frame forwarded requested | ||||
| void ImGui::NavProcessItemForTabbingRequest(ImGuiWindow* window, ImGuiID id) | ||||
| void ImGui::NavProcessItemForTabbingRequest(ImGuiID id) | ||||
| { | ||||
|     ImGuiContext& g = *GImGui; | ||||
|  | ||||
|     ImGuiNavItemData* result = (window == g.NavWindow) ? &g.NavMoveResultLocal : &g.NavMoveResultOther; | ||||
|     // Always store in NavMoveResultLocal (unlike directional request which uses NavMoveResultOther on sibling/flattened windows) | ||||
|     ImGuiNavItemData* result = &g.NavMoveResultLocal; | ||||
|     if (g.NavTabbingDir == +1) | ||||
|     { | ||||
|         // Tab Forward or SetKeyboardFocusHere() with >= 0 | ||||
| @@ -9975,6 +9988,8 @@ float ImGui::GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode) | ||||
| ImVec2 ImGui::GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor, float fast_factor) | ||||
| { | ||||
|     ImVec2 delta(0.0f, 0.0f); | ||||
|     if (dir_sources & ImGuiNavDirSourceFlags_RawKeyboard) | ||||
|         delta += ImVec2((float)IsKeyDown(GetKeyIndex(ImGuiKey_RightArrow)) - (float)IsKeyDown(GetKeyIndex(ImGuiKey_LeftArrow)), (float)IsKeyDown(GetKeyIndex(ImGuiKey_DownArrow)) - (float)IsKeyDown(GetKeyIndex(ImGuiKey_UpArrow))); | ||||
|     if (dir_sources & ImGuiNavDirSourceFlags_Keyboard) | ||||
|         delta += ImVec2(GetNavInputAmount(ImGuiNavInput_KeyRight_, mode)   - GetNavInputAmount(ImGuiNavInput_KeyLeft_,   mode), GetNavInputAmount(ImGuiNavInput_KeyDown_,   mode) - GetNavInputAmount(ImGuiNavInput_KeyUp_,   mode)); | ||||
|     if (dir_sources & ImGuiNavDirSourceFlags_PadDPad) | ||||
| @@ -10323,11 +10338,8 @@ void ImGui::NavMoveRequestApplyResult() | ||||
|  | ||||
|     // Tabbing forward wrap | ||||
|     if (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing) | ||||
|         if (g.NavTabbingCounter == 1 || g.NavTabbingDir == 0) | ||||
|         { | ||||
|             IM_ASSERT(g.NavTabbingResultFirst.ID != 0); | ||||
|         if ((g.NavTabbingCounter == 1 || g.NavTabbingDir == 0) && g.NavTabbingResultFirst.ID) | ||||
|             result = &g.NavTabbingResultFirst; | ||||
|         } | ||||
|  | ||||
|     // In a situation when there is no results but NavId != 0, re-enable the Navigation highlight (because g.NavId is not considered as a possible result) | ||||
|     if (result == NULL) | ||||
| @@ -10659,10 +10671,9 @@ static void ImGui::NavUpdateWindowing() | ||||
|             g.NavWindowingTargetAnim = NULL; | ||||
|     } | ||||
|  | ||||
|     // Start CTRL-TAB or Square+L/R window selection | ||||
|     const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0; | ||||
|     // Start CTRL+Tab or Square+L/R window selection | ||||
|     const bool start_windowing_with_gamepad = allow_windowing && !g.NavWindowingTarget && IsNavInputTest(ImGuiNavInput_Menu, ImGuiInputReadMode_Pressed); | ||||
|     const bool start_windowing_with_keyboard = allow_windowing && !g.NavWindowingTarget && nav_keyboard_active && io.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab); | ||||
|     const bool start_windowing_with_keyboard = allow_windowing && !g.NavWindowingTarget && io.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab); | ||||
|     if (start_windowing_with_gamepad || start_windowing_with_keyboard) | ||||
|         if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1)) | ||||
|         { | ||||
| @@ -10713,6 +10724,7 @@ static void ImGui::NavUpdateWindowing() | ||||
|     // Keyboard: Press and Release ALT to toggle menu layer | ||||
|     // - Testing that only Alt is tested prevents Alt+Shift or AltGR from toggling menu layer. | ||||
|     // - AltGR is normally Alt+Ctrl but we can't reliably detect it (not all backends/systems/layout emit it as Alt+Ctrl). But even on keyboards without AltGR we don't want Alt+Ctrl to open menu anyway. | ||||
| 	const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0; | ||||
|     if (nav_keyboard_active && io.KeyMods == ImGuiKeyModFlags_Alt && (io.KeyModsPrev & ImGuiKeyModFlags_Alt) == 0) | ||||
|     { | ||||
|         g.NavWindowingToggleLayer = true; | ||||
| @@ -10741,7 +10753,7 @@ static void ImGui::NavUpdateWindowing() | ||||
|     { | ||||
|         ImVec2 move_delta; | ||||
|         if (g.NavInputSource == ImGuiInputSource_Keyboard && !io.KeyShift) | ||||
|             move_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard, ImGuiInputReadMode_Down); | ||||
|             move_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_RawKeyboard, ImGuiInputReadMode_Down); | ||||
|         if (g.NavInputSource == ImGuiInputSource_Gamepad) | ||||
|             move_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_PadLStick, ImGuiInputReadMode_Down); | ||||
|         if (move_delta.x != 0.0f || move_delta.y != 0.0f) | ||||
|   | ||||
							
								
								
									
										7
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								imgui.h
									
									
									
									
									
								
							| @@ -65,7 +65,7 @@ Index of this file: | ||||
| // 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) | ||||
| #define IMGUI_VERSION               "1.86 WIP" | ||||
| #define IMGUI_VERSION_NUM           18508 | ||||
| #define IMGUI_VERSION_NUM           18510 | ||||
| #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_VIEWPORT          // Viewport WIP branch | ||||
| @@ -155,7 +155,7 @@ struct ImGuiContext;                // Dear ImGui context (opaque structure, unl | ||||
| struct ImGuiIO;                     // Main configuration and I/O between your application and ImGui | ||||
| struct ImGuiInputTextCallbackData;  // Shared state of InputText() when using custom ImGuiInputTextCallback (rare/advanced use) | ||||
| struct ImGuiListClipper;            // Helper to manually clip large list of items | ||||
| struct ImGuiOnceUponAFrame;         // Helper for running a block of code not more than once a frame, used by IMGUI_ONCE_UPON_A_FRAME macro | ||||
| struct ImGuiOnceUponAFrame;         // Helper for running a block of code not more than once a frame | ||||
| struct ImGuiPayload;                // User data payload for drag and drop operations | ||||
| struct ImGuiPlatformIO;             // Multi-viewport support: interface for Platform/Renderer backends + viewports to render | ||||
| struct ImGuiPlatformMonitor;        // Multi-viewport support: user-provided bounds for each connected monitor/display. Used when positioning popups and tooltips to avoid them straddling monitors | ||||
| @@ -2313,6 +2313,9 @@ struct ImGuiListClipper | ||||
|     IMGUI_API void  End();             // Automatically called on the last call of Step() that returns false. | ||||
|     IMGUI_API bool  Step();            // Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items. | ||||
|  | ||||
|     // Call ForceDisplayRangeByIndices() before first call to Step() if you need a range of items to be displayed regardless of visibility. | ||||
|     IMGUI_API void  ForceDisplayRangeByIndices(int item_min, int item_max); // item_max is exclusive e.g. use (42, 42+1) to make item 42 always visible BUT due to alignment/padding of certain items it is likely that an extra item may be included on either end of the display range. | ||||
|  | ||||
| #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | ||||
|     inline ImGuiListClipper(int items_count, float items_height = -1.0f) { memset(this, 0, sizeof(*this)); ItemsCount = -1; Begin(items_count, items_height); } // [removed in 1.79] | ||||
| #endif | ||||
|   | ||||
							
								
								
									
										177
									
								
								imgui_demo.cpp
									
									
									
									
									
								
							
							
						
						
									
										177
									
								
								imgui_demo.cpp
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1250,9 +1250,10 @@ enum ImGuiNavHighlightFlags_ | ||||
| enum ImGuiNavDirSourceFlags_ | ||||
| { | ||||
|     ImGuiNavDirSourceFlags_None             = 0, | ||||
|     ImGuiNavDirSourceFlags_Keyboard         = 1 << 0, | ||||
|     ImGuiNavDirSourceFlags_PadDPad          = 1 << 1, | ||||
|     ImGuiNavDirSourceFlags_PadLStick        = 1 << 2 | ||||
|     ImGuiNavDirSourceFlags_RawKeyboard      = 1 << 0,   // Raw keyboard (not pulled from nav), faciliate use of some functions before we can unify nav and keys | ||||
|     ImGuiNavDirSourceFlags_Keyboard         = 1 << 1, | ||||
|     ImGuiNavDirSourceFlags_PadDPad          = 1 << 2, | ||||
|     ImGuiNavDirSourceFlags_PadLStick        = 1 << 3 | ||||
| }; | ||||
|  | ||||
| enum ImGuiNavMoveFlags_ | ||||
|   | ||||
| @@ -226,6 +226,12 @@ namespace | ||||
|         uint32_t glyph_index = FT_Get_Char_Index(Face, codepoint); | ||||
|         if (glyph_index == 0) | ||||
|             return NULL; | ||||
|  | ||||
| 		// If this crash for you: FreeType 2.11.0 has a crash bug on some bitmap/colored fonts. | ||||
| 		// - https://gitlab.freedesktop.org/freetype/freetype/-/issues/1076 | ||||
| 		// - https://github.com/ocornut/imgui/issues/4567 | ||||
| 		// - https://github.com/ocornut/imgui/issues/4566 | ||||
| 		// You can use FreeType 2.10, or the patched version of 2.11.0 in VcPkg, or probably any upcoming FreeType version. | ||||
|         FT_Error error = FT_Load_Glyph(Face, glyph_index, LoadFlags); | ||||
|         if (error) | ||||
|             return NULL; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user