mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 05:01:05 +01:00 
			
		
		
		
	Merge branch 'viewport' into docking
# Conflicts: # imgui_internal.h # imgui_widgets.cpp
This commit is contained in:
		
							
								
								
									
										1
									
								
								.github/CONTRIBUTING.md
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/CONTRIBUTING.md
									
									
									
									
										vendored
									
									
								
							| @@ -1 +0,0 @@ | |||||||
| Please read https://github.com/ocornut/imgui/issues/2261 |  | ||||||
							
								
								
									
										12
									
								
								.github/pull_request_template.md
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								.github/pull_request_template.md
									
									
									
									
										vendored
									
									
								
							| @@ -1,12 +0,0 @@ | |||||||
| (Click "Preview" to turn any http URL into a clickable link) |  | ||||||
|  |  | ||||||
| 1. PLEASE CAREFULLY READ: |  | ||||||
| https://github.com/ocornut/imgui/issues/2261 |  | ||||||
|  |  | ||||||
| 2. PLEASE MAKE SURE YOU HAVE READ: |  | ||||||
| https://github.com/ocornut/imgui/issues/2261 |  | ||||||
|  |  | ||||||
| 3. DID I MENTION YOU SHOULD READ THIS? |  | ||||||
| https://github.com/ocornut/imgui/issues/2261 |  | ||||||
|  |  | ||||||
| (Clear this form before submitting your PR) |  | ||||||
| @@ -97,6 +97,7 @@ Breaking Changes: | |||||||
|   The addition of new configuration options in the Docking branch is pushing for a little reorganization of those names. |   The addition of new configuration options in the Docking branch is pushing for a little reorganization of those names. | ||||||
| - Made it illegal to call Begin("") with an empty string. This somehow accidentally worked before but had various  | - Made it illegal to call Begin("") with an empty string. This somehow accidentally worked before but had various  | ||||||
|   undesirable side-effect as the window would have ID zero. In particular it is causing problems in viewport/docking branches. |   undesirable side-effect as the window would have ID zero. In particular it is causing problems in viewport/docking branches. | ||||||
|  | - Renamed ImFontAtlas::GlyphRangesBuilder to ImFontGlyphRangesBuilder. Keep redirection typedef (will obsolete). | ||||||
|  |  | ||||||
| Other Changes: | Other Changes: | ||||||
|  |  | ||||||
| @@ -109,30 +110,36 @@ Other Changes: | |||||||
|   - Demo: Added "Documents" example app showcasing possible use for tabs. |   - Demo: Added "Documents" example app showcasing possible use for tabs. | ||||||
|   This feature was merged from the Docking branch in order to allow the use of regular tabs in your code. |   This feature was merged from the Docking branch in order to allow the use of regular tabs in your code. | ||||||
|   (It does not provide the docking/splitting/merging of windows available in the Docking branch) |   (It does not provide the docking/splitting/merging of windows available in the Docking branch) | ||||||
| - Added ImGuiWindowFlags_UnsavedDocument window flag to append '*' to title without altering  | - Added ImGuiWindowFlags_UnsavedDocument window flag to append '*' to title without altering the ID, | ||||||
|   the ID, as a convenience to avoid using the ### operator. |   as a convenience to avoid using the ### operator. In the Docking branch this also has an effect on tab closing behavior. | ||||||
| - Window, Focus, Popup: Fixed an issue where closing a popup by clicking another window with the _NoMove flag would refocus | - Window, Focus, Popup: Fixed an issue where closing a popup by clicking another window with the _NoMove flag would refocus | ||||||
|   the parent window of the popup instead of the newly clicked window. |   the parent window of the popup instead of the newly clicked window. | ||||||
| - Window: Contents size is preserved while a window collapsed. Fix auto-resizing window losing their size for one frame when uncollapsed. | - Window: Contents size is preserved while a window collapsed. Fix auto-resizing window losing their size for one frame when uncollapsed. | ||||||
| - Window: Contents size is preserved while a window contents is hidden (unless it is hidden for resizing purpose). | - Window: Contents size is preserved while a window contents is hidden (unless it is hidden for resizing purpose). | ||||||
| - Window: Resizing windows from edge is now enabled by default (io.ConfigWindowsResizeFromEdges=true). Note that  | - Window: Resizing windows from edge is now enabled by default (io.ConfigWindowsResizeFromEdges=true). Note that  | ||||||
|   it only works _if_ the back-end sets ImGuiBackendFlags_HasMouseCursors, which the standard back-end do. |   it only works _if_ the back-end sets ImGuiBackendFlags_HasMouseCursors, which the standard back-ends do. | ||||||
| - Window: Added io.ConfigWindowsMoveFromTitleBarOnly option. Still is ignored by window with no title bars (often popups). | - Window: Added io.ConfigWindowsMoveFromTitleBarOnly option. This is ignored by window with no title bars (often popups). | ||||||
|   This affects clamping window within the visible area: with this option enabled title bars need to be visible. (#899) |   This affects clamping window within the visible area: with this option enabled title bars need to be visible. (#899) | ||||||
| - Window: Fixed using SetNextWindowPos() on a child window (which wasn't really documented) position the cursor as expected | - Window: Fixed using SetNextWindowPos() on a child window (which wasn't really documented) position the cursor as expected | ||||||
|   in the parent window, so there is no mismatch between the layout in parent and the position of the child window.  |   in the parent window, so there is no mismatch between the layout in parent and the position of the child window.  | ||||||
| - InputFloat: When using ImGuiInputTextFlags_ReadOnly the step buttons are disabled. (#2257) | - InputFloat: When using ImGuiInputTextFlags_ReadOnly the step buttons are disabled. (#2257) | ||||||
| - Error recovery: Extraneous/undesired calls to End() are now being caught by an assert in the End() function itself  | - Nav: Fixed an keyboard issue where holding Activate/Space for longer than two frames on a button would unnecessary  | ||||||
|   at the call site (instead of being reported in EndFrame). Past the assert, they don't lead to crashes any more. (#1651) |   keep the focus on the parent window, which could steal it from newly appearing windows. (#787) | ||||||
| - Error recovery: Missing calls to End(), pass the assert, should not lead to crashes or to the fallback Debug window  | - Error recovery: Extraneous/undesired calls to End() are now being caught by an assert in the End() function closer | ||||||
|   appearing on screen, (#1651). |   to the user call site (instead of being reported in EndFrame). Past the assert, they don't lead to crashes any more. (#1651) | ||||||
|  |   Missing calls to End(), past the assert, should not lead to crashes or to the fallback Debug window appearing on screen. | ||||||
|  |   Those changes makes it easier to integrate dear imgui with a scripting language allowing, given asserts are redirected | ||||||
|  |   into e.g. an error log and stopping the script execution. | ||||||
| - IO: Added BackendPlatformUserData, BackendRendererUserData, BackendLanguageUserData void* for storage use by back-ends. | - IO: Added BackendPlatformUserData, BackendRendererUserData, BackendLanguageUserData void* for storage use by back-ends. | ||||||
|  | - IO: Renamed InputCharacters[], marked internal as was always intended. Please don't access directly, and use AddInputCharacter() instead! | ||||||
|  | - IO: AddInputCharacter() goes into a queue which can receive as many characters as needed during the frame. This is useful | ||||||
|  |   for automation to not have an upper limit on typing speed. Will later transition key/mouse to use the event queue later. | ||||||
| - Style: Tweaked default value of style.DisplayWindowPadding from (20,20) to (19,19) so the default style as a value | - Style: Tweaked default value of style.DisplayWindowPadding from (20,20) to (19,19) so the default style as a value | ||||||
|   which is the same as the title bar height. |   which is the same as the title bar height. | ||||||
| - Demo: "Simple Layout" and "Style Editor" are now using tabs. | - Demo: "Simple Layout" and "Style Editor" are now using tabs. | ||||||
| - Demo: Added a few more things under "Child windows" (changing ImGuiCol_ChildBg, positioning child, using IsItemHovered after a child). | - Demo: Added a few more things under "Child windows" (changing ImGuiCol_ChildBg, positioning child, using IsItemHovered after a child). | ||||||
| - Examples: DirectX10/11/12: Made imgui_impl_dx10/dx11/dx12.cpp link d3dcompiler.lib from the .cpp file | - Examples: DirectX10/11/12: Made imgui_impl_dx10/dx11/dx12.cpp link d3dcompiler.lib from the .cpp file to ease integration. | ||||||
|   to ease integration. | - Examples: Allegro 5: Properly destroy globals on shutdown to allow for restart. (#2262) [@DomRe] | ||||||
|  |  | ||||||
|  |  | ||||||
| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ||||||
| @@ -818,6 +825,7 @@ Breaking Changes: | |||||||
| - Removed `IsItemRectHovered()`, `IsWindowRectHovered()` recently introduced in 1.51 which were merely the more consistent/correct names for the above functions which are now obsolete anyway. (#1382) | - Removed `IsItemRectHovered()`, `IsWindowRectHovered()` recently introduced in 1.51 which were merely the more consistent/correct names for the above functions which are now obsolete anyway. (#1382) | ||||||
| - Changed `IsWindowHovered()` default parameters behavior to return false if an item is active in another window (e.g. click-dragging item from another window to this window). You can use the newly introduced IsWindowHovered() flags to requests this specific behavior if you need it. (#1382) | - Changed `IsWindowHovered()` default parameters behavior to return false if an item is active in another window (e.g. click-dragging item from another window to this window). You can use the newly introduced IsWindowHovered() flags to requests this specific behavior if you need it. (#1382) | ||||||
| - Renamed imconfig.h's `IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS`/`IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS` to `IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS`/`IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS` for consistency. | - Renamed imconfig.h's `IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS`/`IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS` to `IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS`/`IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS` for consistency. | ||||||
|  | - Renamed ImFont::Glyph to ImFontGlyph. Keep redirection typedef (will obsolete). | ||||||
|  |  | ||||||
| Other Changes: | Other Changes: | ||||||
|  |  | ||||||
|   | |||||||
| @@ -127,7 +127,8 @@ Languages: (third-party bindings) | |||||||
| - Pascal: [imgui-pas](https://github.com/dpethes/imgui-pas) | - Pascal: [imgui-pas](https://github.com/dpethes/imgui-pas) | ||||||
| - PureBasic: [pb-cimgui](https://github.com/hippyau/pb-cimgui) | - PureBasic: [pb-cimgui](https://github.com/hippyau/pb-cimgui) | ||||||
| - Python [CyImGui](https://github.com/chromy/cyimgui) or [pyimgui](https://github.com/swistakm/pyimgui) | - Python [CyImGui](https://github.com/chromy/cyimgui) or [pyimgui](https://github.com/swistakm/pyimgui) | ||||||
| - Rust: [imgui-rs](https://github.com/Gekkio/imgui-rs) | - Ruby: [ruby-imgui](https://github.com/vaiorabbit/ruby-imgui) | ||||||
|  | - Rust: [imgui-rs](https://github.com/Gekkio/imgui-rs) or [imgui-rust](https://github.com/nsf/imgui-rust) | ||||||
| - Swift [swift-imgui](https://github.com/mnmly/Swift-imgui) | - Swift [swift-imgui](https://github.com/mnmly/Swift-imgui) | ||||||
|  |  | ||||||
| Frameworks: | Frameworks: | ||||||
| @@ -205,7 +206,7 @@ See the [Wiki](https://github.com/ocornut/imgui/wiki) for more references and [B | |||||||
| Support Forums | Support Forums | ||||||
| -------------- | -------------- | ||||||
|  |  | ||||||
| If you have issues with: compiling, linking, adding fonts, running or displaying Dear ImGui, or wiring inputs: please post on the Discourse forum: https://discourse.dearimgui.org. | If you have issues with: compiling, linking, adding fonts, running or displaying Dear ImGui, or wiring inputs: please post on the Discourse forums: https://discourse.dearimgui.org. | ||||||
|  |  | ||||||
| For any other questions, bug reports, requests, feedback, you may post on https://github.com/ocornut/imgui/issues. Please read and fill the New Issue template carefully. | For any other questions, bug reports, requests, feedback, you may post on https://github.com/ocornut/imgui/issues. Please read and fill the New Issue template carefully. | ||||||
|  |  | ||||||
| @@ -273,9 +274,9 @@ Support dear imgui | |||||||
|  |  | ||||||
| **How can I help?** | **How can I help?** | ||||||
|  |  | ||||||
| - You may participate in the Discourse and GitHub [issues trackers](https://github.com/ocornut/imgui/issues). | - You may participate in the [Discourse forums](https://discourse.dearimgui.org) and the GitHub [issues tracker](https://github.com/ocornut/imgui/issues). | ||||||
| - You may help with development and submit pull requests! Please understand that by submitting a PR you are also submitting a request for the maintainer to review your code and then take over its maintenance forever. PR should be crafted both in the interest in the end-users and also to ease the maintainer into understanding and accepting it. | - You may help with development and submit pull requests! Please understand that by submitting a PR you are also submitting a request for the maintainer to review your code and then take over its maintenance forever. PR should be crafted both in the interest in the end-users and also to ease the maintainer into understanding and accepting it. | ||||||
| - See [Help wanted](https://github.com/ocornut/imgui/wiki/Help-Wanted) on the Wiki for some more ideas. | - See [Help wanted](https://github.com/ocornut/imgui/wiki/Help-Wanted) on the [Wiki](https://github.com/ocornut/imgui/wiki/) for some more ideas. | ||||||
| - Convince your company to financially support this project. | - Convince your company to financially support this project. | ||||||
|  |  | ||||||
| **How can I help financing further development of Dear ImGui?** | **How can I help financing further development of Dear ImGui?** | ||||||
|   | |||||||
| @@ -31,6 +31,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i | |||||||
|  - window: freeze window flag: if not focused/hovered, return false, render with previous ImDrawList. and/or reduce refresh rate.  |  - window: freeze window flag: if not focused/hovered, return false, render with previous ImDrawList. and/or reduce refresh rate.  | ||||||
|  - window: investigate better auto-positioning for new windows. |  - window: investigate better auto-positioning for new windows. | ||||||
|  - window/child: the first draw command of a child window could be moved into the current draw command of the parent window (unless child+tooltip?). |  - window/child: the first draw command of a child window could be moved into the current draw command of the parent window (unless child+tooltip?). | ||||||
|  |  - scrolling: while holding down a scrollbar, try to keep the same contents visible (at least while not moving mouse) | ||||||
|  - scrolling: allow immediately effective change of scroll after Begin() if we haven't appended items yet. |  - scrolling: allow immediately effective change of scroll after Begin() if we haven't appended items yet. | ||||||
|  - scrolling/clipping: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y). (2017-08-20: can't repro) |  - scrolling/clipping: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y). (2017-08-20: can't repro) | ||||||
|  - scrolling/style: shadows on scrollable areas to denote that there is more contents |  - scrolling/style: shadows on scrollable areas to denote that there is more contents | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								docs/pull_request_template.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								docs/pull_request_template.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | (Click "Preview" to turn any http URL into a clickable link) | ||||||
|  |  | ||||||
|  | PLEASE CAREFULLY READ: | ||||||
|  | https://github.com/ocornut/imgui/issues/2261 | ||||||
|  |  | ||||||
|  | (Clear this template before submitting your PR) | ||||||
| @@ -231,14 +231,16 @@ | |||||||
| 				TargetAttributes = { | 				TargetAttributes = { | ||||||
| 					8307E7C320E9F9C900473790 = { | 					8307E7C320E9F9C900473790 = { | ||||||
| 						CreatedOnToolsVersion = 9.4.1; | 						CreatedOnToolsVersion = 9.4.1; | ||||||
|  | 						ProvisioningStyle = Automatic; | ||||||
| 					}; | 					}; | ||||||
| 					8307E7D920E9F9C900473790 = { | 					8307E7D920E9F9C900473790 = { | ||||||
| 						CreatedOnToolsVersion = 9.4.1; | 						CreatedOnToolsVersion = 9.4.1; | ||||||
|  | 						ProvisioningStyle = Automatic; | ||||||
| 					}; | 					}; | ||||||
| 				}; | 				}; | ||||||
| 			}; | 			}; | ||||||
| 			buildConfigurationList = 8307E7B920E9F9C700473790 /* Build configuration list for PBXProject "example_apple_metal" */; | 			buildConfigurationList = 8307E7B920E9F9C700473790 /* Build configuration list for PBXProject "example_apple_metal" */; | ||||||
| 			compatibilityVersion = "Xcode 9.3"; | 			compatibilityVersion = "Xcode 8.0"; | ||||||
| 			developmentRegion = en; | 			developmentRegion = en; | ||||||
| 			hasScannedForEncodings = 0; | 			hasScannedForEncodings = 0; | ||||||
| 			knownRegions = ( | 			knownRegions = ( | ||||||
| @@ -444,10 +446,7 @@ | |||||||
| 				DEVELOPMENT_TEAM = ""; | 				DEVELOPMENT_TEAM = ""; | ||||||
| 				INFOPLIST_FILE = "$(SRCROOT)/iOS/Info-iOS.plist"; | 				INFOPLIST_FILE = "$(SRCROOT)/iOS/Info-iOS.plist"; | ||||||
| 				IPHONEOS_DEPLOYMENT_TARGET = 10.0; | 				IPHONEOS_DEPLOYMENT_TARGET = 10.0; | ||||||
| 				LD_RUNPATH_SEARCH_PATHS = ( | 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; | ||||||
| 					"$(inherited)", |  | ||||||
| 					"@executable_path/Frameworks", |  | ||||||
| 				); |  | ||||||
| 				PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.apple-metal-ios"; | 				PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.apple-metal-ios"; | ||||||
| 				PRODUCT_NAME = example_apple_metal; | 				PRODUCT_NAME = example_apple_metal; | ||||||
| 				SDKROOT = iphoneos; | 				SDKROOT = iphoneos; | ||||||
| @@ -463,10 +462,7 @@ | |||||||
| 				DEVELOPMENT_TEAM = ""; | 				DEVELOPMENT_TEAM = ""; | ||||||
| 				INFOPLIST_FILE = "$(SRCROOT)/iOS/Info-iOS.plist"; | 				INFOPLIST_FILE = "$(SRCROOT)/iOS/Info-iOS.plist"; | ||||||
| 				IPHONEOS_DEPLOYMENT_TARGET = 10.0; | 				IPHONEOS_DEPLOYMENT_TARGET = 10.0; | ||||||
| 				LD_RUNPATH_SEARCH_PATHS = ( | 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; | ||||||
| 					"$(inherited)", |  | ||||||
| 					"@executable_path/Frameworks", |  | ||||||
| 				); |  | ||||||
| 				PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.apple-metal-ios"; | 				PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.apple-metal-ios"; | ||||||
| 				PRODUCT_NAME = example_apple_metal; | 				PRODUCT_NAME = example_apple_metal; | ||||||
| 				SDKROOT = iphoneos; | 				SDKROOT = iphoneos; | ||||||
| @@ -483,11 +479,8 @@ | |||||||
| 				COMBINE_HIDPI_IMAGES = YES; | 				COMBINE_HIDPI_IMAGES = YES; | ||||||
| 				DEVELOPMENT_TEAM = ""; | 				DEVELOPMENT_TEAM = ""; | ||||||
| 				INFOPLIST_FILE = "$(SRCROOT)/macOS/Info-macOS.plist"; | 				INFOPLIST_FILE = "$(SRCROOT)/macOS/Info-macOS.plist"; | ||||||
| 				LD_RUNPATH_SEARCH_PATHS = ( | 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; | ||||||
| 					"$(inherited)", | 				MACOSX_DEPLOYMENT_TARGET = 10.12; | ||||||
| 					"@executable_path/../Frameworks", |  | ||||||
| 				); |  | ||||||
| 				MACOSX_DEPLOYMENT_TARGET = 10.13; |  | ||||||
| 				PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.apple-metal-macos"; | 				PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.apple-metal-macos"; | ||||||
| 				PRODUCT_NAME = example_apple_metal; | 				PRODUCT_NAME = example_apple_metal; | ||||||
| 				SDKROOT = macosx; | 				SDKROOT = macosx; | ||||||
| @@ -502,11 +495,8 @@ | |||||||
| 				COMBINE_HIDPI_IMAGES = YES; | 				COMBINE_HIDPI_IMAGES = YES; | ||||||
| 				DEVELOPMENT_TEAM = ""; | 				DEVELOPMENT_TEAM = ""; | ||||||
| 				INFOPLIST_FILE = "$(SRCROOT)/macOS/Info-macOS.plist"; | 				INFOPLIST_FILE = "$(SRCROOT)/macOS/Info-macOS.plist"; | ||||||
| 				LD_RUNPATH_SEARCH_PATHS = ( | 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; | ||||||
| 					"$(inherited)", | 				MACOSX_DEPLOYMENT_TARGET = 10.12; | ||||||
| 					"@executable_path/../Frameworks", |  | ||||||
| 				); |  | ||||||
| 				MACOSX_DEPLOYMENT_TARGET = 10.13; |  | ||||||
| 				PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.apple-metal-macos"; | 				PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.apple-metal-macos"; | ||||||
| 				PRODUCT_NAME = example_apple_metal; | 				PRODUCT_NAME = example_apple_metal; | ||||||
| 				SDKROOT = macosx; | 				SDKROOT = macosx; | ||||||
|   | |||||||
| @@ -135,11 +135,12 @@ | |||||||
| 				TargetAttributes = { | 				TargetAttributes = { | ||||||
| 					4080A96A20B029B00036BA46 = { | 					4080A96A20B029B00036BA46 = { | ||||||
| 						CreatedOnToolsVersion = 9.3.1; | 						CreatedOnToolsVersion = 9.3.1; | ||||||
|  | 						ProvisioningStyle = Automatic; | ||||||
| 					}; | 					}; | ||||||
| 				}; | 				}; | ||||||
| 			}; | 			}; | ||||||
| 			buildConfigurationList = 4080A96620B029B00036BA46 /* Build configuration list for PBXProject "example_apple_opengl2" */; | 			buildConfigurationList = 4080A96620B029B00036BA46 /* Build configuration list for PBXProject "example_apple_opengl2" */; | ||||||
| 			compatibilityVersion = "Xcode 9.3"; | 			compatibilityVersion = "Xcode 8.0"; | ||||||
| 			developmentRegion = en; | 			developmentRegion = en; | ||||||
| 			hasScannedForEncodings = 0; | 			hasScannedForEncodings = 0; | ||||||
| 			knownRegions = ( | 			knownRegions = ( | ||||||
| @@ -286,6 +287,7 @@ | |||||||
| 			isa = XCBuildConfiguration; | 			isa = XCBuildConfiguration; | ||||||
| 			buildSettings = { | 			buildSettings = { | ||||||
| 				CODE_SIGN_STYLE = Automatic; | 				CODE_SIGN_STYLE = Automatic; | ||||||
|  | 				MACOSX_DEPLOYMENT_TARGET = 10.12; | ||||||
| 				PRODUCT_NAME = "$(TARGET_NAME)"; | 				PRODUCT_NAME = "$(TARGET_NAME)"; | ||||||
| 				SYSTEM_HEADER_SEARCH_PATHS = ../libs/gl3w; | 				SYSTEM_HEADER_SEARCH_PATHS = ../libs/gl3w; | ||||||
| 				USER_HEADER_SEARCH_PATHS = ../..; | 				USER_HEADER_SEARCH_PATHS = ../..; | ||||||
| @@ -296,6 +298,7 @@ | |||||||
| 			isa = XCBuildConfiguration; | 			isa = XCBuildConfiguration; | ||||||
| 			buildSettings = { | 			buildSettings = { | ||||||
| 				CODE_SIGN_STYLE = Automatic; | 				CODE_SIGN_STYLE = Automatic; | ||||||
|  | 				MACOSX_DEPLOYMENT_TARGET = 10.12; | ||||||
| 				PRODUCT_NAME = "$(TARGET_NAME)"; | 				PRODUCT_NAME = "$(TARGET_NAME)"; | ||||||
| 				SYSTEM_HEADER_SEARCH_PATHS = ../libs/gl3w; | 				SYSTEM_HEADER_SEARCH_PATHS = ../libs/gl3w; | ||||||
| 				USER_HEADER_SEARCH_PATHS = ../..; | 				USER_HEADER_SEARCH_PATHS = ../..; | ||||||
|   | |||||||
| @@ -280,9 +280,14 @@ bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display) | |||||||
| void ImGui_ImplAllegro5_Shutdown() | void ImGui_ImplAllegro5_Shutdown() | ||||||
| { | { | ||||||
|     ImGui_ImplAllegro5_InvalidateDeviceObjects(); |     ImGui_ImplAllegro5_InvalidateDeviceObjects(); | ||||||
|     g_Display = NULL; |  | ||||||
|  |  | ||||||
|     // Destroy last known clipboard data |     g_Display = NULL; | ||||||
|  |     g_Time = 0.0; | ||||||
|  |  | ||||||
|  |     if (g_VertexDecl) | ||||||
|  |         al_destroy_vertex_decl(g_VertexDecl); | ||||||
|  |     g_VertexDecl = NULL; | ||||||
|  |  | ||||||
|     if (g_ClipboardTextData) |     if (g_ClipboardTextData) | ||||||
|         al_free(g_ClipboardTextData); |         al_free(g_ClipboardTextData); | ||||||
|     g_ClipboardTextData = NULL; |     g_ClipboardTextData = NULL; | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ | |||||||
| #include "imgui_impl_metal.h" | #include "imgui_impl_metal.h" | ||||||
|  |  | ||||||
| #import <Metal/Metal.h> | #import <Metal/Metal.h> | ||||||
| #import <QuartzCore/CAMetalLayer.h> | // #import <QuartzCore/CAMetalLayer.h> // Not suported in XCode 9.2. Maybe a macro to detect the SDK version can be used (something like #if MACOS_SDK >= 10.13 ...) | ||||||
| #import <simd/simd.h> | #import <simd/simd.h> | ||||||
|  |  | ||||||
| #pragma mark - Support classes | #pragma mark - Support classes | ||||||
|   | |||||||
							
								
								
									
										40
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								imgui.cpp
									
									
									
									
									
								
							| @@ -375,6 +375,8 @@ CODE | |||||||
|  - 2018/XX/XX (1.XX) - removed io.DisplayVisibleMin, io.DisplayVisibleMax settings (they were used to clip within the (0,0)..DisplaySize range, I don't know of anyone using it) |  - 2018/XX/XX (1.XX) - removed io.DisplayVisibleMin, io.DisplayVisibleMax settings (they were used to clip within the (0,0)..DisplaySize range, I don't know of anyone using it) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  - 2019/01/06 (1.67) - renamed io.InputCharacters[], marked internal as was always intended. Please don't access directly, and use AddInputCharacter() instead! | ||||||
|  |  - 2019/01/06 (1.67) - renamed ImFontAtlas::GlyphRangesBuilder to ImFontGlyphRangesBuilder. Keep redirection typedef (will obsolete). | ||||||
|  - 2018/12/10 (1.67) - renamed io.ConfigResizeWindowsFromEdges to io.ConfigWindowsResizeFromEdges as we are doing a large pass on configuration flags. |  - 2018/12/10 (1.67) - renamed io.ConfigResizeWindowsFromEdges to io.ConfigWindowsResizeFromEdges as we are doing a large pass on configuration flags. | ||||||
|  - 2018/10/12 (1.66) - renamed misc/stl/imgui_stl.* to misc/cpp/imgui_stdlib.* in prevision for other C++ helper files. |  - 2018/10/12 (1.66) - renamed misc/stl/imgui_stl.* to misc/cpp/imgui_stdlib.* in prevision for other C++ helper files. | ||||||
|  - 2018/09/28 (1.66) - renamed SetScrollHere() to SetScrollHereY(). Kept redirection function (will obsolete). |  - 2018/09/28 (1.66) - renamed SetScrollHere() to SetScrollHereY(). Kept redirection function (will obsolete). | ||||||
| @@ -391,6 +393,9 @@ CODE | |||||||
|  - 2018/08/01 (1.63) - renamed io.OptCursorBlink to io.ConfigCursorBlink [-> io.ConfigInputTextCursorBlink in 1.65], io.OptMacOSXBehaviors to ConfigMacOSXBehaviors for consistency. |  - 2018/08/01 (1.63) - renamed io.OptCursorBlink to io.ConfigCursorBlink [-> io.ConfigInputTextCursorBlink in 1.65], io.OptMacOSXBehaviors to ConfigMacOSXBehaviors for consistency. | ||||||
|  - 2018/07/22 (1.63) - changed ImGui::GetTime() return value from float to double to avoid accumulating floating point imprecisions over time. |  - 2018/07/22 (1.63) - changed ImGui::GetTime() return value from float to double to avoid accumulating floating point imprecisions over time. | ||||||
|  - 2018/07/08 (1.63) - style: renamed ImGuiCol_ModalWindowDarkening to ImGuiCol_ModalWindowDimBg for consistency with other features. Kept redirection enum (will obsolete). |  - 2018/07/08 (1.63) - style: renamed ImGuiCol_ModalWindowDarkening to ImGuiCol_ModalWindowDimBg for consistency with other features. Kept redirection enum (will obsolete). | ||||||
|  |  - 2018/06/08 (1.62) - examples: the imgui_impl_xxx files have been split to separate platform (Win32, Glfw, SDL2, etc.) from renderer (DX11, OpenGL, Vulkan,  etc.). | ||||||
|  |                        old binding will still work as is, however prefer using the separated bindings as they will be updated to be multi-viewport conformant. | ||||||
|  |                        when adopting new bindings follow the main.cpp code of your preferred examples/ folder to know which functions to call. | ||||||
|  - 2018/06/06 (1.62) - renamed GetGlyphRangesChinese() to GetGlyphRangesChineseFull() to distinguish other variants and discourage using the full set. |  - 2018/06/06 (1.62) - renamed GetGlyphRangesChinese() to GetGlyphRangesChineseFull() to distinguish other variants and discourage using the full set. | ||||||
|  - 2018/06/06 (1.62) - TreeNodeEx()/TreeNodeBehavior(): the ImGuiTreeNodeFlags_CollapsingHeader helper now include the ImGuiTreeNodeFlags_NoTreePushOnOpen flag. See Changelog for details.  |  - 2018/06/06 (1.62) - TreeNodeEx()/TreeNodeBehavior(): the ImGuiTreeNodeFlags_CollapsingHeader helper now include the ImGuiTreeNodeFlags_NoTreePushOnOpen flag. See Changelog for details.  | ||||||
|  - 2018/05/03 (1.61) - DragInt(): the default compile-time format string has been changed from "%.0f" to "%d", as we are not using integers internally any more. |  - 2018/05/03 (1.61) - DragInt(): the default compile-time format string has been changed from "%.0f" to "%d", as we are not using integers internally any more. | ||||||
| @@ -439,6 +444,7 @@ CODE | |||||||
|                        removed the IsItemRectHovered()/IsWindowRectHovered() names introduced in 1.51 since they were merely more consistent names for the two functions we are now obsoleting. |                        removed the IsItemRectHovered()/IsWindowRectHovered() names introduced in 1.51 since they were merely more consistent names for the two functions we are now obsoleting. | ||||||
|  - 2017/10/17 (1.52) - marked the old 5-parameters version of Begin() as obsolete (still available). Use SetNextWindowSize()+Begin() instead! |  - 2017/10/17 (1.52) - marked the old 5-parameters version of Begin() as obsolete (still available). Use SetNextWindowSize()+Begin() instead! | ||||||
|  - 2017/10/11 (1.52) - renamed AlignFirstTextHeightToWidgets() to AlignTextToFramePadding(). Kept inline redirection function (will obsolete). |  - 2017/10/11 (1.52) - renamed AlignFirstTextHeightToWidgets() to AlignTextToFramePadding(). Kept inline redirection function (will obsolete). | ||||||
|  |  - 2017/09/26 (1.52) - renamed ImFont::Glyph to ImFontGlyph. Keep redirection typedef (will obsolete). | ||||||
|  - 2017/09/25 (1.52) - removed SetNextWindowPosCenter() because SetNextWindowPos() now has the optional pivot information to do the same and more. Kept redirection function (will obsolete). |  - 2017/09/25 (1.52) - removed SetNextWindowPosCenter() because SetNextWindowPos() now has the optional pivot information to do the same and more. Kept redirection function (will obsolete). | ||||||
|  - 2017/08/25 (1.52) - io.MousePos needs to be set to ImVec2(-FLT_MAX,-FLT_MAX) when mouse is unavailable/missing. Previously ImVec2(-1,-1) was enough but we now accept negative mouse coordinates. In your binding if you need to support unavailable mouse, make sure to replace "io.MousePos = ImVec2(-1,-1)" with "io.MousePos = ImVec2(-FLT_MAX,-FLT_MAX)". |  - 2017/08/25 (1.52) - io.MousePos needs to be set to ImVec2(-FLT_MAX,-FLT_MAX) when mouse is unavailable/missing. Previously ImVec2(-1,-1) was enough but we now accept negative mouse coordinates. In your binding if you need to support unavailable mouse, make sure to replace "io.MousePos = ImVec2(-1,-1)" with "io.MousePos = ImVec2(-FLT_MAX,-FLT_MAX)". | ||||||
|  - 2017/08/22 (1.51) - renamed IsItemHoveredRect() to IsItemRectHovered(). Kept inline redirection function (will obsolete). -> (1.52) use IsItemHovered(ImGuiHoveredFlags_RectOnly)! |  - 2017/08/22 (1.51) - renamed IsItemHoveredRect() to IsItemRectHovered(). Kept inline redirection function (will obsolete). -> (1.52) use IsItemHovered(ImGuiHoveredFlags_RectOnly)! | ||||||
| @@ -830,7 +836,7 @@ CODE | |||||||
|  |  | ||||||
|       // Or create your own custom ranges (e.g. for a game you can feed your entire game script and only build the characters the game need) |       // Or create your own custom ranges (e.g. for a game you can feed your entire game script and only build the characters the game need) | ||||||
|       ImVector<ImWchar> ranges; |       ImVector<ImWchar> ranges; | ||||||
|       ImFontAtlas::GlyphRangesBuilder builder; |       ImFontGlyphRangesBuilder builder; | ||||||
|       builder.AddText("Hello world");                        // Add a string (here "Hello world" contains 7 unique characters) |       builder.AddText("Hello world");                        // Add a string (here "Hello world" contains 7 unique characters) | ||||||
|       builder.AddChar(0x7262);                               // Add a specific character |       builder.AddChar(0x7262);                               // Add a specific character | ||||||
|       builder.AddRanges(io.Fonts->GetGlyphRangesJapanese()); // Add one of the default ranges |       builder.AddRanges(io.Fonts->GetGlyphRangesJapanese()); // Add one of the default ranges | ||||||
| @@ -1198,22 +1204,23 @@ ImGuiIO::ImGuiIO() | |||||||
| // - on Windows you can get those using ToAscii+keyboard state, or via the WM_CHAR message | // - on Windows you can get those using ToAscii+keyboard state, or via the WM_CHAR message | ||||||
| void ImGuiIO::AddInputCharacter(ImWchar c) | void ImGuiIO::AddInputCharacter(ImWchar c) | ||||||
| { | { | ||||||
|     const int n = ImStrlenW(InputCharacters); |     InputQueueCharacters.push_back(c); | ||||||
|     if (n + 1 < IM_ARRAYSIZE(InputCharacters)) |  | ||||||
|     { |  | ||||||
|         InputCharacters[n] = c; |  | ||||||
|         InputCharacters[n+1] = '\0'; |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void ImGuiIO::AddInputCharactersUTF8(const char* utf8_chars) | void ImGuiIO::AddInputCharactersUTF8(const char* utf8_chars) | ||||||
| { | { | ||||||
|     // We can't pass more wchars than ImGuiIO::InputCharacters[] can hold so don't convert more |     while (*utf8_chars != 0) | ||||||
|     const int wchars_buf_len = sizeof(ImGuiIO::InputCharacters) / sizeof(ImWchar); |     { | ||||||
|     ImWchar wchars[wchars_buf_len]; |         unsigned int c = 0; | ||||||
|     ImTextStrFromUtf8(wchars, wchars_buf_len, utf8_chars, NULL); |         utf8_chars += ImTextCharFromUtf8(&c, utf8_chars, NULL); | ||||||
|     for (int i = 0; i < wchars_buf_len && wchars[i] != 0; i++) |         if (c > 0 && c <= 0xFFFF) | ||||||
|         AddInputCharacter(wchars[i]); |             InputQueueCharacters.push_back((ImWchar)c); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void ImGuiIO::ClearInputCharacters() | ||||||
|  | { | ||||||
|  |     InputQueueCharacters.resize(0); | ||||||
| } | } | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| @@ -2586,6 +2593,7 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window) | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // FIXME-NAV: The existence of SetNavID/SetNavIDWithRectRel/SetFocusID is incredibly messy and confusing and needs some explanation or refactoring. | ||||||
| void ImGui::SetFocusID(ImGuiID id, ImGuiWindow* window) | void ImGui::SetFocusID(ImGuiID id, ImGuiWindow* window) | ||||||
| { | { | ||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
| @@ -3976,7 +3984,7 @@ void ImGui::EndFrame() | |||||||
|  |  | ||||||
|     // Clear Input data for next frame |     // Clear Input data for next frame | ||||||
|     g.IO.MouseWheel = g.IO.MouseWheelH = 0.0f; |     g.IO.MouseWheel = g.IO.MouseWheelH = 0.0f; | ||||||
|     memset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters)); |     g.IO.InputQueueCharacters.resize(0); | ||||||
|     memset(g.IO.NavInputs, 0, sizeof(g.IO.NavInputs)); |     memset(g.IO.NavInputs, 0, sizeof(g.IO.NavInputs)); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -7169,7 +7177,7 @@ void ImGui::OpenPopupEx(ImGuiID id) | |||||||
|     popup_ref.OpenPopupPos = NavCalcPreferredRefPos(); |     popup_ref.OpenPopupPos = NavCalcPreferredRefPos(); | ||||||
|     popup_ref.OpenMousePos = IsMousePosValid(&g.IO.MousePos) ? g.IO.MousePos : popup_ref.OpenPopupPos; |     popup_ref.OpenMousePos = IsMousePosValid(&g.IO.MousePos) ? g.IO.MousePos : popup_ref.OpenPopupPos; | ||||||
|  |  | ||||||
|     //printf("[%05d] OpenPopupEx(0x%08X)\n", g.FrameCount, id); |     //IMGUI_DEBUG_LOG("OpenPopupEx(0x%08X)\n", g.FrameCount, id); | ||||||
|     if (g.OpenPopupStack.Size < current_stack_size + 1) |     if (g.OpenPopupStack.Size < current_stack_size + 1) | ||||||
|     { |     { | ||||||
|         g.OpenPopupStack.push_back(popup_ref); |         g.OpenPopupStack.push_back(popup_ref); | ||||||
| @@ -8677,7 +8685,7 @@ static void ImGui::NavUpdate() | |||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     g.IO.WantSetMousePos = false; |     g.IO.WantSetMousePos = false; | ||||||
| #if 0 | #if 0 | ||||||
|     if (g.NavScoringCount > 0) printf("[%05d] NavScoringCount %d for '%s' layer %d (Init:%d, Move:%d)\n", g.FrameCount, g.NavScoringCount, g.NavWindow ? g.NavWindow->Name : "NULL", g.NavLayer, g.NavInitRequest || g.NavInitResultId != 0, g.NavMoveRequest); |     if (g.NavScoringCount > 0) IMGUI_DEBUG_LOG("NavScoringCount %d for '%s' layer %d (Init:%d, Move:%d)\n", g.FrameCount, g.NavScoringCount, g.NavWindow ? g.NavWindow->Name : "NULL", g.NavLayer, g.NavInitRequest || g.NavInitResultId != 0, g.NavMoveRequest); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|     // Set input source as Gamepad when buttons are pressed before we map Keyboard (some features differs when used with Gamepad vs Keyboard) |     // Set input source as Gamepad when buttons are pressed before we map Keyboard (some features differs when used with Gamepad vs Keyboard) | ||||||
|   | |||||||
							
								
								
									
										218
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										218
									
								
								imgui.h
									
									
									
									
									
								
							| @@ -13,11 +13,12 @@ Index of this file: | |||||||
| // Forward declarations and basic types | // Forward declarations and basic types | ||||||
| // ImGui API (Dear ImGui end-user API) | // ImGui API (Dear ImGui end-user API) | ||||||
| // Flags & Enumerations | // Flags & Enumerations | ||||||
|  | // ImVector | ||||||
| // ImGuiStyle | // ImGuiStyle | ||||||
| // ImGuiIO | // ImGuiIO | ||||||
| // Misc data structures (ImGuiInputTextCallbackData, ImGuiSizeCallbackData, ImGuiPayload, ImGuiWindowClass) | // Misc data structures (ImGuiInputTextCallbackData, ImGuiSizeCallbackData, ImGuiPayload, ImGuiWindowClass) | ||||||
| // Obsolete functions | // Obsolete functions | ||||||
| // Helpers (ImVector, ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, ImColor) | // Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, ImColor) | ||||||
| // Draw List API (ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListFlags, ImDrawList, ImDrawData) | // Draw List API (ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListFlags, ImDrawList, ImDrawData) | ||||||
| // Font API (ImFontConfig, ImFontGlyph, ImFontAtlasFlags, ImFontAtlas, ImFont) | // Font API (ImFontConfig, ImFontGlyph, ImFontAtlasFlags, ImFontAtlas, ImFont) | ||||||
| // Platform interface for multi-viewport support (ImGuiPlatformMonitor, ImGuiPlatformIO, ImGuiViewport) | // Platform interface for multi-viewport support (ImGuiPlatformMonitor, ImGuiPlatformIO, ImGuiViewport) | ||||||
| @@ -88,15 +89,17 @@ Index of this file: | |||||||
| // Forward declarations and basic types | // Forward declarations and basic types | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
|  |  | ||||||
| struct ImDrawChannel;               // Temporary storage for outputting drawing commands out of order, used by ImDrawList::ChannelsSplit() | struct ImDrawChannel;               // Temporary storage for ImDrawList ot output draw commands out of order, used by ImDrawList::ChannelsSplit() | ||||||
| struct ImDrawCmd;                   // A single draw command within a parent ImDrawList (generally maps to 1 GPU draw call) | struct ImDrawCmd;                   // A single draw command within a parent ImDrawList (generally maps to 1 GPU draw call, unless it is a callback) | ||||||
| struct ImDrawData;                  // All draw command lists required to render the frame | struct ImDrawData;                  // All draw command lists required to render the frame + pos/size coordinates to use for the projection matrix. | ||||||
| struct ImDrawList;                  // A single draw command list (generally one per window, conceptually you may see this as a dynamic "mesh" builder) | struct ImDrawList;                  // A single draw command list (generally one per window, conceptually you may see this as a dynamic "mesh" builder) | ||||||
| struct ImDrawListSharedData;        // Data shared among multiple draw lists (typically owned by parent ImGui context, but you may create one yourself) | struct ImDrawListSharedData;        // Data shared among multiple draw lists (typically owned by parent ImGui context, but you may create one yourself) | ||||||
| struct ImDrawVert;                  // A single vertex (20 bytes by default, override layout with IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT) | struct ImDrawVert;                  // A single vertex (pos + uv + col = 20 bytes by default. Override layout with IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT) | ||||||
| struct ImFont;                      // Runtime data for a single font within a parent ImFontAtlas | struct ImFont;                      // Runtime data for a single font within a parent ImFontAtlas | ||||||
| struct ImFontAtlas;                 // Runtime data for multiple fonts, bake multiple fonts into a single texture, TTF/OTF font loader | struct ImFontAtlas;                 // Runtime data for multiple fonts, bake multiple fonts into a single texture, TTF/OTF font loader | ||||||
| struct ImFontConfig;                // Configuration data when adding a font or merging fonts | struct ImFontConfig;                // Configuration data when adding a font or merging fonts | ||||||
|  | struct ImFontGlyph;                 // A single font glyph (code point + coordinates within in ImFontAtlas + offset) | ||||||
|  | struct ImFontGlyphRangesBuilder;    // Helper to build glyph ranges from text/string data | ||||||
| struct ImColor;                     // Helper functions to create a color that can be converted to either u32 or float4 (*OBSOLETE* please avoid using) | struct ImColor;                     // Helper functions to create a color that can be converted to either u32 or float4 (*OBSOLETE* please avoid using) | ||||||
| #ifndef ImTextureID | #ifndef ImTextureID | ||||||
| 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) | 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) | ||||||
| @@ -112,8 +115,8 @@ struct ImGuiPlatformMonitor;        // Multi-viewport support: user-provided bou | |||||||
| struct ImGuiSizeCallbackData;       // Callback data when using SetNextWindowSizeConstraints() (rare/advanced use) | struct ImGuiSizeCallbackData;       // Callback data when using SetNextWindowSizeConstraints() (rare/advanced use) | ||||||
| struct ImGuiStorage;                // Helper for key->value storage | struct ImGuiStorage;                // Helper for key->value storage | ||||||
| struct ImGuiStyle;                  // Runtime data for styling/colors | struct ImGuiStyle;                  // Runtime data for styling/colors | ||||||
| struct ImGuiTextFilter;             // Helper to parse and apply text filters (e.g. "aaaaa[,bbbb][,ccccc]") |  | ||||||
| struct ImGuiTextBuffer;             // Helper to hold and append into a text buffer (~string builder) | struct ImGuiTextBuffer;             // Helper to hold and append into a text buffer (~string builder) | ||||||
|  | struct ImGuiTextFilter;             // Helper to parse and apply text filters (e.g. "aaaaa[,bbbb][,ccccc]") | ||||||
| struct ImGuiViewport;               // Viewport (generally ~1 per window to output to at the OS level. Need per-platform support to use multiple viewports) | struct ImGuiViewport;               // Viewport (generally ~1 per window to output to at the OS level. Need per-platform support to use multiple viewports) | ||||||
| struct ImGuiWindowClass;            // Window class (rare/advanced uses: provide hints to the platform back-end via altered viewport flags and parent/child info) | struct ImGuiWindowClass;            // Window class (rare/advanced uses: provide hints to the platform back-end via altered viewport flags and parent/child info) | ||||||
|  |  | ||||||
| @@ -844,8 +847,9 @@ enum ImGuiTabBarFlags_ | |||||||
|     ImGuiTabBarFlags_NoCloseWithMiddleMouseButton   = 1 << 2,   // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false. |     ImGuiTabBarFlags_NoCloseWithMiddleMouseButton   = 1 << 2,   // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false. | ||||||
|     ImGuiTabBarFlags_NoTabListPopupButton           = 1 << 3, |     ImGuiTabBarFlags_NoTabListPopupButton           = 1 << 3, | ||||||
|     ImGuiTabBarFlags_NoTabListScrollingButtons      = 1 << 4, |     ImGuiTabBarFlags_NoTabListScrollingButtons      = 1 << 4, | ||||||
|     ImGuiTabBarFlags_FittingPolicyResizeDown        = 1 << 5,   // Resize tabs when they don't fit |     ImGuiTabBarFlags_NoTooltip                      = 1 << 5,   // Disable tooltips when hovering a tab | ||||||
|     ImGuiTabBarFlags_FittingPolicyScroll            = 1 << 6,   // Add scroll buttons when tabs don't fit |     ImGuiTabBarFlags_FittingPolicyResizeDown        = 1 << 6,   // Resize tabs when they don't fit | ||||||
|  |     ImGuiTabBarFlags_FittingPolicyScroll            = 1 << 7,   // Add scroll buttons when tabs don't fit | ||||||
|     ImGuiTabBarFlags_FittingPolicyMask_             = ImGuiTabBarFlags_FittingPolicyResizeDown | ImGuiTabBarFlags_FittingPolicyScroll, |     ImGuiTabBarFlags_FittingPolicyMask_             = ImGuiTabBarFlags_FittingPolicyResizeDown | ImGuiTabBarFlags_FittingPolicyScroll, | ||||||
|     ImGuiTabBarFlags_FittingPolicyDefault_          = ImGuiTabBarFlags_FittingPolicyResizeDown |     ImGuiTabBarFlags_FittingPolicyDefault_          = ImGuiTabBarFlags_FittingPolicyResizeDown | ||||||
| };   | };   | ||||||
| @@ -1104,8 +1108,9 @@ enum ImGuiCol_ | |||||||
|  |  | ||||||
|     // Obsolete names (will be removed) |     // Obsolete names (will be removed) | ||||||
| #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | ||||||
|     , ImGuiCol_ChildWindowBg = ImGuiCol_ChildBg, ImGuiCol_Column = ImGuiCol_Separator, ImGuiCol_ColumnHovered = ImGuiCol_SeparatorHovered, ImGuiCol_ColumnActive = ImGuiCol_SeparatorActive |     , ImGuiCol_ModalWindowDarkening = ImGuiCol_ModalWindowDimBg                      // [renamed in 1.63] | ||||||
|     , ImGuiCol_ModalWindowDarkening = ImGuiCol_ModalWindowDimBg |     , ImGuiCol_ChildWindowBg = ImGuiCol_ChildBg                                      // [renamed in 1.53] | ||||||
|  |     , ImGuiCol_Column = ImGuiCol_Separator, ImGuiCol_ColumnHovered = ImGuiCol_SeparatorHovered, ImGuiCol_ColumnActive = ImGuiCol_SeparatorActive  // [renamed in 1.51] | ||||||
|     //ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered, // [unused since 1.60+] the close button now uses regular button colors. |     //ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered, // [unused since 1.60+] the close button now uses regular button colors. | ||||||
|     //ImGuiCol_ComboBg,                                                              // [unused since 1.53+] ComboBg has been merged with PopupBg, so a redirect isn't accurate. |     //ImGuiCol_ComboBg,                                                              // [unused since 1.53+] ComboBg has been merged with PopupBg, so a redirect isn't accurate. | ||||||
| #endif | #endif | ||||||
| @@ -1218,6 +1223,77 @@ enum ImGuiCond_ | |||||||
| #endif | #endif | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | //----------------------------------------------------------------------------- | ||||||
|  | // Helper: ImVector<> | ||||||
|  | // Lightweight std::vector<>-like class to avoid dragging dependencies (also: some implementations of STL with debug enabled are absurdly slow, we bypass it so our code runs fast in debug). | ||||||
|  | // You generally do NOT need to care or use this ever. But we need to make it available in imgui.h because some of our data structures are relying on it. | ||||||
|  | // Important: our implementation does NOT call C++ constructors/destructors, we treat everything as raw data! This is intentional but be extra mindful of that,  | ||||||
|  | // do NOT use this class as a std::vector replacement in your own code! | ||||||
|  | //----------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|  | template<typename T> | ||||||
|  | class ImVector | ||||||
|  | { | ||||||
|  | public: | ||||||
|  |     int                         Size; | ||||||
|  |     int                         Capacity; | ||||||
|  |     T*                          Data; | ||||||
|  |  | ||||||
|  |     typedef T                   value_type; | ||||||
|  |     typedef value_type*         iterator; | ||||||
|  |     typedef const value_type*   const_iterator; | ||||||
|  |  | ||||||
|  |     inline ImVector()           { Size = Capacity = 0; Data = NULL; } | ||||||
|  |     inline ~ImVector()          { if (Data) ImGui::MemFree(Data); } | ||||||
|  |     inline ImVector(const ImVector<T>& src)                     { Size = Capacity = 0; Data = NULL; operator=(src); } | ||||||
|  |     inline ImVector<T>& operator=(const ImVector<T>& src)       { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(value_type)); return *this; } | ||||||
|  |  | ||||||
|  |     inline bool                 empty() const                   { return Size == 0; } | ||||||
|  |     inline int                  size() const                    { return Size; } | ||||||
|  |     inline int                  capacity() const                { return Capacity; } | ||||||
|  |     inline value_type&          operator[](int i)               { IM_ASSERT(i < Size); return Data[i]; } | ||||||
|  |     inline const value_type&    operator[](int i) const         { IM_ASSERT(i < Size); return Data[i]; } | ||||||
|  |  | ||||||
|  |     inline void                 clear()                         { if (Data) { Size = Capacity = 0; ImGui::MemFree(Data); Data = NULL; } } | ||||||
|  |     inline iterator             begin()                         { return Data; } | ||||||
|  |     inline const_iterator       begin() const                   { return Data; } | ||||||
|  |     inline iterator             end()                           { return Data + Size; } | ||||||
|  |     inline const_iterator       end() const                     { return Data + Size; } | ||||||
|  |     inline value_type&          front()                         { IM_ASSERT(Size > 0); return Data[0]; } | ||||||
|  |     inline const value_type&    front() const                   { IM_ASSERT(Size > 0); return Data[0]; } | ||||||
|  |     inline value_type&          back()                          { IM_ASSERT(Size > 0); return Data[Size - 1]; } | ||||||
|  |     inline const value_type&    back() const                    { IM_ASSERT(Size > 0); return Data[Size - 1]; } | ||||||
|  |     inline void                 swap(ImVector<value_type>& rhs) { int rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; int rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; value_type* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; } | ||||||
|  |  | ||||||
|  |     inline int          _grow_capacity(int sz) const            { int new_capacity = Capacity ? (Capacity + Capacity/2) : 8; return new_capacity > sz ? new_capacity : sz; } | ||||||
|  |     inline void         resize(int new_size)                    { if (new_size > Capacity) reserve(_grow_capacity(new_size)); Size = new_size; } | ||||||
|  |     inline void         resize(int new_size,const value_type& v){ if (new_size > Capacity) reserve(_grow_capacity(new_size)); if (new_size > Size) for (int n = Size; n < new_size; n++) memcpy(&Data[n], &v, sizeof(v)); Size = new_size; } | ||||||
|  |     inline void         reserve(int new_capacity) | ||||||
|  |     { | ||||||
|  |         if (new_capacity <= Capacity) | ||||||
|  |             return; | ||||||
|  |         value_type* new_data = (value_type*)ImGui::MemAlloc((size_t)new_capacity * sizeof(value_type)); | ||||||
|  |         if (Data) | ||||||
|  |         { | ||||||
|  |             memcpy(new_data, Data, (size_t)Size * sizeof(value_type)); | ||||||
|  |             ImGui::MemFree(Data); | ||||||
|  |         } | ||||||
|  |         Data = new_data; | ||||||
|  |         Capacity = new_capacity; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     // NB: It is illegal to call push_back/push_front/insert with a reference pointing inside the ImVector data itself! e.g. v.push_back(v[10]) is forbidden. | ||||||
|  |     inline void         push_back(const value_type& v)                  { if (Size == Capacity) reserve(_grow_capacity(Size + 1)); memcpy(&Data[Size], &v, sizeof(v)); Size++; } | ||||||
|  |     inline void         pop_back()                                      { IM_ASSERT(Size > 0); Size--; } | ||||||
|  |     inline void         push_front(const value_type& v)                 { if (Size == 0) push_back(v); else insert(Data, v); } | ||||||
|  |     inline iterator     erase(const_iterator it)                        { IM_ASSERT(it >= Data && it < Data+Size); const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((size_t)Size - (size_t)off - 1) * sizeof(value_type)); Size--; return Data + off; } | ||||||
|  |     inline iterator     erase(const_iterator it, const_iterator it_last){ IM_ASSERT(it >= Data && it < Data+Size && it_last > it && it_last <= Data+Size); const ptrdiff_t count = it_last - it; const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + count, ((size_t)Size - (size_t)off - count) * sizeof(value_type)); Size -= (int)count; return Data + off; } | ||||||
|  |     inline iterator     erase_unsorted(const_iterator it)               { IM_ASSERT(it >= Data && it < Data+Size);  const ptrdiff_t off = it - Data; if (it < Data+Size-1) memcpy(Data + off, Data + Size - 1, sizeof(value_type)); Size--; return Data + off; } | ||||||
|  |     inline iterator     insert(const_iterator it, const value_type& v)  { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(_grow_capacity(Size + 1)); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(value_type)); memcpy(&Data[off], &v, sizeof(v)); Size++; return Data + off; } | ||||||
|  |     inline bool         contains(const value_type& v) const             { const T* data = Data;  const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; } | ||||||
|  |     inline int          index_from_pointer(const_iterator it) const     { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; return (int)off; } | ||||||
|  | }; | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| // ImGuiStyle | // ImGuiStyle | ||||||
| // You may modify the ImGui::GetStyle() main instance during initialization and before NewFrame(). | // You may modify the ImGui::GetStyle() main instance during initialization and before NewFrame(). | ||||||
| @@ -1339,7 +1415,7 @@ struct ImGuiIO | |||||||
|     // You can obtain the ImDrawData* by calling ImGui::GetDrawData() after Render(). See example applications if you are unsure of how to implement this. |     // You can obtain the ImDrawData* by calling ImGui::GetDrawData() after Render(). See example applications if you are unsure of how to implement this. | ||||||
|     void        (*RenderDrawListsFn)(ImDrawData* data); |     void        (*RenderDrawListsFn)(ImDrawData* data); | ||||||
| #else | #else | ||||||
|     // This is only here to keep ImGuiIO the same size, so that IMGUI_DISABLE_OBSOLETE_FUNCTIONS can exceptionally be used outside of imconfig.h. |     // This is only here to keep ImGuiIO the same size/layout, so that IMGUI_DISABLE_OBSOLETE_FUNCTIONS can exceptionally be used outside of imconfig.h. | ||||||
|     void*       RenderDrawListsFnUnused; |     void*       RenderDrawListsFnUnused; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| @@ -1357,13 +1433,12 @@ struct ImGuiIO | |||||||
|     bool        KeyAlt;                         // Keyboard modifier pressed: Alt |     bool        KeyAlt;                         // Keyboard modifier pressed: Alt | ||||||
|     bool        KeySuper;                       // Keyboard modifier pressed: Cmd/Super/Windows |     bool        KeySuper;                       // Keyboard modifier pressed: Cmd/Super/Windows | ||||||
|     bool        KeysDown[512];                  // Keyboard keys that are pressed (ideally left in the "native" order your engine has access to keyboard keys, so you can use your own defines/enums for keys). |     bool        KeysDown[512];                  // Keyboard keys that are pressed (ideally left in the "native" order your engine has access to keyboard keys, so you can use your own defines/enums for keys). | ||||||
|     ImWchar     InputCharacters[16+1];          // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper. |     float       NavInputs[ImGuiNavInput_COUNT]; // Gamepad inputs. Cleared back to zero by EndFrame(). Keyboard keys will be auto-mapped and be written here by NewFrame(). | ||||||
|     float       NavInputs[ImGuiNavInput_COUNT]; // Gamepad inputs (keyboard keys will be auto-mapped and be written here by ImGui::NewFrame, all values will be cleared back to zero in ImGui::EndFrame) |  | ||||||
|  |  | ||||||
|     // Functions |     // Functions | ||||||
|     IMGUI_API void  AddInputCharacter(ImWchar c);                       // Add new character into InputCharacters[] |     IMGUI_API void  AddInputCharacter(ImWchar c);               // Queue new character input  | ||||||
|     IMGUI_API void  AddInputCharactersUTF8(const char* utf8_chars);     // Add new characters into InputCharacters[] from an UTF-8 string |     IMGUI_API void  AddInputCharactersUTF8(const char* str);    // Queue new characters input from an UTF-8 string | ||||||
|     inline void     ClearInputCharacters() { InputCharacters[0] = 0; }  // Clear the text input buffer manually |     IMGUI_API void  ClearInputCharacters();                     // Clear the text input buffer manually | ||||||
|  |  | ||||||
|     //------------------------------------------------------------------ |     //------------------------------------------------------------------ | ||||||
|     // Output - Retrieve after calling NewFrame() |     // Output - Retrieve after calling NewFrame() | ||||||
| @@ -1403,6 +1478,7 @@ struct ImGuiIO | |||||||
|     float       KeysDownDurationPrev[512];      // Previous duration the key has been down |     float       KeysDownDurationPrev[512];      // Previous duration the key has been down | ||||||
|     float       NavInputsDownDuration[ImGuiNavInput_COUNT]; |     float       NavInputsDownDuration[ImGuiNavInput_COUNT]; | ||||||
|     float       NavInputsDownDurationPrev[ImGuiNavInput_COUNT]; |     float       NavInputsDownDurationPrev[ImGuiNavInput_COUNT]; | ||||||
|  |     ImVector<ImWchar> InputQueueCharacters;     // Queue of _characters_ input (obtained by platform back-end). Fill using AddInputCharacter() helper. | ||||||
|  |  | ||||||
|     IMGUI_API   ImGuiIO(); |     IMGUI_API   ImGuiIO(); | ||||||
| }; | }; | ||||||
| @@ -1493,6 +1569,7 @@ struct ImGuiWindowClass | |||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| // Obsolete functions (Will be removed! Read 'API BREAKING CHANGES' section in imgui.cpp for details) | // Obsolete functions (Will be removed! Read 'API BREAKING CHANGES' section in imgui.cpp for details) | ||||||
|  | // Please keep your copy of dear imgui up to date! Occasionally set '#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS' in imconfig.h to stay ahead. | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
|  |  | ||||||
| #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | ||||||
| @@ -1500,14 +1577,14 @@ namespace ImGui | |||||||
| { | { | ||||||
|     // OBSOLETED in 1.66 (from Sep 2018) |     // OBSOLETED in 1.66 (from Sep 2018) | ||||||
|     static inline void  SetScrollHere(float center_ratio=0.5f){ SetScrollHereY(center_ratio); } |     static inline void  SetScrollHere(float center_ratio=0.5f){ SetScrollHereY(center_ratio); } | ||||||
|     // OBSOLETED in 1.63 (from Aug 2018) |     // OBSOLETED in 1.63 (between Aug 2018 and Sept 2018) | ||||||
|     static inline bool  IsItemDeactivatedAfterChange()        { return IsItemDeactivatedAfterEdit(); } |     static inline bool  IsItemDeactivatedAfterChange()        { return IsItemDeactivatedAfterEdit(); } | ||||||
|     // OBSOLETED in 1.61 (from Apr 2018) |     // OBSOLETED in 1.61 (between Apr 2018 and Aug 2018) | ||||||
|     IMGUI_API bool      InputFloat(const char* label, float* v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags flags = 0); // Use the 'const char* format' version instead of 'decimal_precision'! |     IMGUI_API bool      InputFloat(const char* label, float* v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags flags = 0); // Use the 'const char* format' version instead of 'decimal_precision'! | ||||||
|     IMGUI_API bool      InputFloat2(const char* label, float v[2], int decimal_precision, ImGuiInputTextFlags flags = 0); |     IMGUI_API bool      InputFloat2(const char* label, float v[2], int decimal_precision, ImGuiInputTextFlags flags = 0); | ||||||
|     IMGUI_API bool      InputFloat3(const char* label, float v[3], int decimal_precision, ImGuiInputTextFlags flags = 0); |     IMGUI_API bool      InputFloat3(const char* label, float v[3], int decimal_precision, ImGuiInputTextFlags flags = 0); | ||||||
|     IMGUI_API bool      InputFloat4(const char* label, float v[4], int decimal_precision, ImGuiInputTextFlags flags = 0); |     IMGUI_API bool      InputFloat4(const char* label, float v[4], int decimal_precision, ImGuiInputTextFlags flags = 0); | ||||||
|     // OBSOLETED in 1.60 (from Dec 2017) |     // OBSOLETED in 1.60 (between Dec 2017 and Apr 2018) | ||||||
|     static inline bool  IsAnyWindowFocused()                  { return IsWindowFocused(ImGuiFocusedFlags_AnyWindow); } |     static inline bool  IsAnyWindowFocused()                  { return IsWindowFocused(ImGuiFocusedFlags_AnyWindow); } | ||||||
|     static inline bool  IsAnyWindowHovered()                  { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); } |     static inline bool  IsAnyWindowHovered()                  { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); } | ||||||
|     static inline ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = 0.f) { (void)on_edge; (void)outward; IM_ASSERT(0); return pos; } |     static inline ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = 0.f) { (void)on_edge; (void)outward; IM_ASSERT(0); return pos; } | ||||||
| @@ -1536,71 +1613,6 @@ typedef ImGuiInputTextCallbackData  ImGuiTextEditCallbackData; | |||||||
| // Helpers | // Helpers | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
|  |  | ||||||
| // Helper: 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). |  | ||||||
| // *Important* Our implementation does NOT call C++ constructors/destructors. This is intentional, we do not require it but you have to be mindful of that. Do _not_ use this class as a std::vector replacement in your code! |  | ||||||
| template<typename T> |  | ||||||
| class ImVector |  | ||||||
| { |  | ||||||
| public: |  | ||||||
|     int                         Size; |  | ||||||
|     int                         Capacity; |  | ||||||
|     T*                          Data; |  | ||||||
|  |  | ||||||
|     typedef T                   value_type; |  | ||||||
|     typedef value_type*         iterator; |  | ||||||
|     typedef const value_type*   const_iterator; |  | ||||||
|  |  | ||||||
|     inline ImVector()           { Size = Capacity = 0; Data = NULL; } |  | ||||||
|     inline ~ImVector()          { if (Data) ImGui::MemFree(Data); } |  | ||||||
|     inline ImVector(const ImVector<T>& src)                     { Size = Capacity = 0; Data = NULL; operator=(src); } |  | ||||||
|     inline ImVector<T>& operator=(const ImVector<T>& src)       { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(value_type)); return *this; } |  | ||||||
|  |  | ||||||
|     inline bool                 empty() const                   { return Size == 0; } |  | ||||||
|     inline int                  size() const                    { return Size; } |  | ||||||
|     inline int                  capacity() const                { return Capacity; } |  | ||||||
|     inline value_type&          operator[](int i)               { IM_ASSERT(i < Size); return Data[i]; } |  | ||||||
|     inline const value_type&    operator[](int i) const         { IM_ASSERT(i < Size); return Data[i]; } |  | ||||||
|  |  | ||||||
|     inline void                 clear()                         { if (Data) { Size = Capacity = 0; ImGui::MemFree(Data); Data = NULL; } } |  | ||||||
|     inline iterator             begin()                         { return Data; } |  | ||||||
|     inline const_iterator       begin() const                   { return Data; } |  | ||||||
|     inline iterator             end()                           { return Data + Size; } |  | ||||||
|     inline const_iterator       end() const                     { return Data + Size; } |  | ||||||
|     inline value_type&          front()                         { IM_ASSERT(Size > 0); return Data[0]; } |  | ||||||
|     inline const value_type&    front() const                   { IM_ASSERT(Size > 0); return Data[0]; } |  | ||||||
|     inline value_type&          back()                          { IM_ASSERT(Size > 0); return Data[Size - 1]; } |  | ||||||
|     inline const value_type&    back() const                    { IM_ASSERT(Size > 0); return Data[Size - 1]; } |  | ||||||
|     inline void                 swap(ImVector<value_type>& rhs) { int rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; int rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; value_type* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; } |  | ||||||
|  |  | ||||||
|     inline int          _grow_capacity(int sz) const            { int new_capacity = Capacity ? (Capacity + Capacity/2) : 8; return new_capacity > sz ? new_capacity : sz; } |  | ||||||
|     inline void         resize(int new_size)                    { if (new_size > Capacity) reserve(_grow_capacity(new_size)); Size = new_size; } |  | ||||||
|     inline void         resize(int new_size,const value_type& v){ if (new_size > Capacity) reserve(_grow_capacity(new_size)); if (new_size > Size) for (int n = Size; n < new_size; n++) memcpy(&Data[n], &v, sizeof(v)); Size = new_size; } |  | ||||||
|     inline void         reserve(int new_capacity) |  | ||||||
|     { |  | ||||||
|         if (new_capacity <= Capacity) |  | ||||||
|             return; |  | ||||||
|         value_type* new_data = (value_type*)ImGui::MemAlloc((size_t)new_capacity * sizeof(value_type)); |  | ||||||
|         if (Data) |  | ||||||
|         { |  | ||||||
|             memcpy(new_data, Data, (size_t)Size * sizeof(value_type)); |  | ||||||
|             ImGui::MemFree(Data); |  | ||||||
|         } |  | ||||||
|         Data = new_data; |  | ||||||
|         Capacity = new_capacity; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     // NB: It is illegal to call push_back/push_front/insert with a reference pointing inside the ImVector data itself! e.g. v.push_back(v[10]) is forbidden. |  | ||||||
|     inline void         push_back(const value_type& v)                  { if (Size == Capacity) reserve(_grow_capacity(Size + 1)); memcpy(&Data[Size], &v, sizeof(v)); Size++; } |  | ||||||
|     inline void         pop_back()                                      { IM_ASSERT(Size > 0); Size--; } |  | ||||||
|     inline void         push_front(const value_type& v)                 { if (Size == 0) push_back(v); else insert(Data, v); } |  | ||||||
|     inline iterator     erase(const_iterator it)                        { IM_ASSERT(it >= Data && it < Data+Size); const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((size_t)Size - (size_t)off - 1) * sizeof(value_type)); Size--; return Data + off; } |  | ||||||
|     inline iterator     erase(const_iterator it, const_iterator it_last){ IM_ASSERT(it >= Data && it < Data+Size && it_last > it && it_last <= Data+Size); const ptrdiff_t count = it_last - it; const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + count, ((size_t)Size - (size_t)off - count) * sizeof(value_type)); Size -= (int)count; return Data + off; } |  | ||||||
|     inline iterator     erase_unsorted(const_iterator it)               { IM_ASSERT(it >= Data && it < Data+Size);  const ptrdiff_t off = it - Data; if (it < Data+Size-1) memcpy(Data + off, Data + Size - 1, sizeof(value_type)); Size--; return Data + off; } |  | ||||||
|     inline iterator     insert(const_iterator it, const value_type& v)  { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(_grow_capacity(Size + 1)); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(value_type)); memcpy(&Data[off], &v, sizeof(v)); Size++; return Data + off; } |  | ||||||
|     inline bool         contains(const value_type& v) const             { const T* data = Data;  const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; } |  | ||||||
|     inline int          index_from_pointer(const_iterator it) const     { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; return (int)off; } |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| // Helper: IM_NEW(), IM_PLACEMENT_NEW(), IM_DELETE() macros to call MemAlloc + Placement New, Placement Delete + MemFree | // Helper: IM_NEW(), IM_PLACEMENT_NEW(), IM_DELETE() macros to call MemAlloc + Placement New, Placement Delete + MemFree | ||||||
| // We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax. | // We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax. | ||||||
| // Defining a custom placement new() with a dummy parameter allows us to bypass including <new> which on some platforms complains when user has disabled exceptions. | // Defining a custom placement new() with a dummy parameter allows us to bypass including <new> which on some platforms complains when user has disabled exceptions. | ||||||
| @@ -1621,8 +1633,8 @@ struct ImGuiOnceUponAFrame | |||||||
| }; | }; | ||||||
|  |  | ||||||
| // Helper: Macro for ImGuiOnceUponAFrame. Attention: The macro expands into 2 statement so make sure you don't use it within e.g. an if() statement without curly braces. | // Helper: Macro for ImGuiOnceUponAFrame. Attention: The macro expands into 2 statement so make sure you don't use it within e.g. an if() statement without curly braces. | ||||||
| #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS    // Will obsolete | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | ||||||
| #define IMGUI_ONCE_UPON_A_FRAME     static ImGuiOnceUponAFrame imgui_oaf; if (imgui_oaf) | #define IMGUI_ONCE_UPON_A_FRAME     static ImGuiOnceUponAFrame imgui_oaf; if (imgui_oaf)    // OBSOLETED in 1.51, will remove! | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| // Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" | // Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" | ||||||
| @@ -1982,7 +1994,7 @@ struct ImDrawData | |||||||
| }; | }; | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
| // Font API (ImFontConfig, ImFontGlyph, ImFontAtlasFlags, ImFontAtlas, ImFont) | // Font API (ImFontConfig, ImFontGlyph, ImFontAtlasFlags, ImFontAtlas, ImFontGlyphRangesBuilder, ImFont) | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
|  |  | ||||||
| struct ImFontConfig | struct ImFontConfig | ||||||
| @@ -2019,6 +2031,19 @@ struct ImFontGlyph | |||||||
|     float           U0, V0, U1, V1;     // Texture coordinates |     float           U0, V0, U1, V1;     // Texture coordinates | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | // Helper to build glyph ranges from text/string data. Feed your application strings/characters to it then call BuildRanges(). | ||||||
|  | struct ImFontGlyphRangesBuilder | ||||||
|  | { | ||||||
|  |     ImVector<unsigned char> UsedChars;  // Store 1-bit per Unicode code point (0=unused, 1=used) | ||||||
|  |     ImFontGlyphRangesBuilder()          { UsedChars.resize(0x10000 / 8); memset(UsedChars.Data, 0, 0x10000 / 8); } | ||||||
|  |     bool           GetBit(int n) const  { return (UsedChars[n >> 3] & (1 << (n & 7))) != 0; } | ||||||
|  |     void           SetBit(int n)        { UsedChars[n >> 3] |= 1 << (n & 7); }  // Set bit 'c' in the array | ||||||
|  |     void           AddChar(ImWchar c)   { SetBit(c); }                          // Add character | ||||||
|  |     IMGUI_API void AddText(const char* text, const char* text_end = NULL);      // Add string (each character of the UTF-8 string are added) | ||||||
|  |     IMGUI_API void AddRanges(const ImWchar* ranges);                            // Add ranges, e.g. builder.AddRanges(ImFontAtlas::GetGlyphRangesDefault()) to force add all of ASCII/Latin+Ext | ||||||
|  |     IMGUI_API void BuildRanges(ImVector<ImWchar>* out_ranges);                  // Output new ranges | ||||||
|  | }; | ||||||
|  |  | ||||||
| enum ImFontAtlasFlags_ | enum ImFontAtlasFlags_ | ||||||
| { | { | ||||||
|     ImFontAtlasFlags_None               = 0, |     ImFontAtlasFlags_None               = 0, | ||||||
| @@ -2075,7 +2100,7 @@ struct ImFontAtlas | |||||||
|  |  | ||||||
|     // Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list) |     // Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list) | ||||||
|     // NB: Make sure that your string are UTF-8 and NOT in your local code page. In C++11, you can create UTF-8 string literal using the u8"Hello world" syntax. See FAQ for details. |     // NB: Make sure that your string are UTF-8 and NOT in your local code page. In C++11, you can create UTF-8 string literal using the u8"Hello world" syntax. See FAQ for details. | ||||||
|     // NB: Consider using GlyphRangesBuilder to build glyph ranges from textual data. |     // NB: Consider using ImFontGlyphRangesBuilder to build glyph ranges from textual data. | ||||||
|     IMGUI_API const ImWchar*    GetGlyphRangesDefault();                // Basic Latin, Extended Latin |     IMGUI_API const ImWchar*    GetGlyphRangesDefault();                // Basic Latin, Extended Latin | ||||||
|     IMGUI_API const ImWchar*    GetGlyphRangesKorean();                 // Default + Korean characters |     IMGUI_API const ImWchar*    GetGlyphRangesKorean();                 // Default + Korean characters | ||||||
|     IMGUI_API const ImWchar*    GetGlyphRangesJapanese();               // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs |     IMGUI_API const ImWchar*    GetGlyphRangesJapanese();               // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs | ||||||
| @@ -2084,19 +2109,6 @@ struct ImFontAtlas | |||||||
|     IMGUI_API const ImWchar*    GetGlyphRangesCyrillic();               // Default + about 400 Cyrillic characters |     IMGUI_API const ImWchar*    GetGlyphRangesCyrillic();               // Default + about 400 Cyrillic characters | ||||||
|     IMGUI_API const ImWchar*    GetGlyphRangesThai();                   // Default + Thai characters |     IMGUI_API const ImWchar*    GetGlyphRangesThai();                   // Default + Thai characters | ||||||
|  |  | ||||||
|     // Helpers to build glyph ranges from text data. Feed your application strings/characters to it then call BuildRanges(). |  | ||||||
|     struct GlyphRangesBuilder |  | ||||||
|     { |  | ||||||
|         ImVector<unsigned char> UsedChars;  // Store 1-bit per Unicode code point (0=unused, 1=used) |  | ||||||
|         GlyphRangesBuilder()                { UsedChars.resize(0x10000 / 8); memset(UsedChars.Data, 0, 0x10000 / 8); } |  | ||||||
|         bool           GetBit(int n) const  { return (UsedChars[n >> 3] & (1 << (n & 7))) != 0; } |  | ||||||
|         void           SetBit(int n)        { UsedChars[n >> 3] |= 1 << (n & 7); }  // Set bit 'c' in the array |  | ||||||
|         void           AddChar(ImWchar c)   { SetBit(c); }                          // Add character |  | ||||||
|         IMGUI_API void AddText(const char* text, const char* text_end = NULL);      // Add string (each character of the UTF-8 string are added) |  | ||||||
|         IMGUI_API void AddRanges(const ImWchar* ranges);                            // Add ranges, e.g. builder.AddRanges(ImFontAtlas::GetGlyphRangesDefault()) to force add all of ASCII/Latin+Ext |  | ||||||
|         IMGUI_API void BuildRanges(ImVector<ImWchar>* out_ranges);                  // Output new ranges |  | ||||||
|     }; |  | ||||||
|  |  | ||||||
|     //------------------------------------------- |     //------------------------------------------- | ||||||
|     // Custom Rectangles/Glyphs API |     // Custom Rectangles/Glyphs API | ||||||
|     //------------------------------------------- |     //------------------------------------------- | ||||||
| @@ -2145,6 +2157,10 @@ struct ImFontAtlas | |||||||
|     ImVector<CustomRect>        CustomRects;        // Rectangles for packing custom texture data into the atlas. |     ImVector<CustomRect>        CustomRects;        // Rectangles for packing custom texture data into the atlas. | ||||||
|     ImVector<ImFontConfig>      ConfigData;         // Internal data |     ImVector<ImFontConfig>      ConfigData;         // Internal data | ||||||
|     int                         CustomRectIds[1];   // Identifiers of custom texture rectangle used by ImFontAtlas/ImDrawList |     int                         CustomRectIds[1];   // Identifiers of custom texture rectangle used by ImFontAtlas/ImDrawList | ||||||
|  |  | ||||||
|  | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS | ||||||
|  |     typedef ImFontGlyphRangesBuilder GlyphRangesBuilder; // OBSOLETE 1.67+ | ||||||
|  | #endif | ||||||
| }; | }; | ||||||
|  |  | ||||||
| // Font runtime data and rendering | // Font runtime data and rendering | ||||||
|   | |||||||
| @@ -3460,10 +3460,15 @@ struct ExampleAppLog | |||||||
| { | { | ||||||
|     ImGuiTextBuffer     Buf; |     ImGuiTextBuffer     Buf; | ||||||
|     ImGuiTextFilter     Filter; |     ImGuiTextFilter     Filter; | ||||||
|     ImVector<int>       LineOffsets;        // Index to lines offset |     ImVector<int>       LineOffsets;        // Index to lines offset. We maintain this with AddLog() calls, allowing us to have a random access on lines | ||||||
|     bool                ScrollToBottom; |     bool                ScrollToBottom; | ||||||
|  |  | ||||||
|     void    Clear()     { Buf.clear(); LineOffsets.clear(); } |     void    Clear()  | ||||||
|  |     {  | ||||||
|  |         Buf.clear();  | ||||||
|  |         LineOffsets.clear();  | ||||||
|  |         LineOffsets.push_back(0); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     void    AddLog(const char* fmt, ...) IM_FMTARGS(2) |     void    AddLog(const char* fmt, ...) IM_FMTARGS(2) | ||||||
|     { |     { | ||||||
| @@ -3474,13 +3479,12 @@ struct ExampleAppLog | |||||||
|         va_end(args); |         va_end(args); | ||||||
|         for (int new_size = Buf.size(); old_size < new_size; old_size++) |         for (int new_size = Buf.size(); old_size < new_size; old_size++) | ||||||
|             if (Buf[old_size] == '\n') |             if (Buf[old_size] == '\n') | ||||||
|                 LineOffsets.push_back(old_size); |                 LineOffsets.push_back(old_size + 1); | ||||||
|         ScrollToBottom = true; |         ScrollToBottom = true; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     void    Draw(const char* title, bool* p_open = NULL) |     void    Draw(const char* title, bool* p_open = NULL) | ||||||
|     { |     { | ||||||
|         ImGui::SetNextWindowSize(ImVec2(500,400), ImGuiCond_FirstUseEver); |  | ||||||
|         if (!ImGui::Begin(title, p_open)) |         if (!ImGui::Begin(title, p_open)) | ||||||
|         { |         { | ||||||
|             ImGui::End(); |             ImGui::End(); | ||||||
| @@ -3493,24 +3497,47 @@ struct ExampleAppLog | |||||||
|         Filter.Draw("Filter", -100.0f); |         Filter.Draw("Filter", -100.0f); | ||||||
|         ImGui::Separator(); |         ImGui::Separator(); | ||||||
|         ImGui::BeginChild("scrolling", ImVec2(0,0), false, ImGuiWindowFlags_HorizontalScrollbar); |         ImGui::BeginChild("scrolling", ImVec2(0,0), false, ImGuiWindowFlags_HorizontalScrollbar); | ||||||
|         if (copy) ImGui::LogToClipboard(); |         if (copy) | ||||||
|  |             ImGui::LogToClipboard(); | ||||||
|  |  | ||||||
|  |         ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); | ||||||
|  |         const char* buf = Buf.begin(); | ||||||
|  |         const char* buf_end = Buf.end(); | ||||||
|         if (Filter.IsActive()) |         if (Filter.IsActive()) | ||||||
|         { |         { | ||||||
|             const char* buf_begin = Buf.begin(); |             for (int line_no = 0; line_no < LineOffsets.Size; line_no++) | ||||||
|             const char* line = buf_begin; |  | ||||||
|             for (int line_no = 0; line != NULL; line_no++) |  | ||||||
|             { |             { | ||||||
|                 const char* line_end = (line_no < LineOffsets.Size) ? buf_begin + LineOffsets[line_no] : NULL; |                 const char* line_start = buf + LineOffsets[line_no]; | ||||||
|                 if (Filter.PassFilter(line, line_end)) |                 const char* line_end = (line_no + 1 < LineOffsets.Size) ? (buf + LineOffsets[line_no + 1] - 1) : buf_end; | ||||||
|                     ImGui::TextUnformatted(line, line_end); |                 if (Filter.PassFilter(line_start, line_end)) | ||||||
|                 line = line_end && line_end[1] ? line_end + 1 : NULL; |                     ImGui::TextUnformatted(line_start, line_end); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
|         { |         { | ||||||
|             ImGui::TextUnformatted(Buf.begin()); |             // The simplest and easy way to display the entire buffer: | ||||||
|  |             //   ImGui::TextUnformatted(buf_begin, buf_end);  | ||||||
|  |             // And it'll just work. TextUnformatted() has specialization for large blob of text and will fast-forward to skip non-visible lines. | ||||||
|  |             // Here we instead demonstrate using the clipper to only process lines that are within the visible area. | ||||||
|  |             // If you have tens of thousands of items and their processing cost is non-negligible, coarse clipping them on your side is recommended. | ||||||
|  |             // Using ImGuiListClipper requires A) random access into your data, and B) items all being the  same height,  | ||||||
|  |             // both of which we can handle since we an array pointing to the beginning of each line of text. | ||||||
|  |             // When using the filter (in the block of code above) we don't have random access into the data to display anymore, which is why we don't use the clipper. | ||||||
|  |             // Storing or skimming through the search result would make it possible (and would be recommended if you want to search through tens of thousands of entries) | ||||||
|  |             ImGuiListClipper clipper; | ||||||
|  |             clipper.Begin(LineOffsets.Size); | ||||||
|  |             while (clipper.Step()) | ||||||
|  |             { | ||||||
|  |                 for (int line_no = clipper.DisplayStart; line_no < clipper.DisplayEnd; line_no++) | ||||||
|  |                 { | ||||||
|  |                     const char* line_start = buf + LineOffsets[line_no]; | ||||||
|  |                     const char* line_end = (line_no + 1 < LineOffsets.Size) ? (buf + LineOffsets[line_no + 1] - 1) : buf_end; | ||||||
|  |                     ImGui::TextUnformatted(line_start, line_end); | ||||||
|                 } |                 } | ||||||
|  |             } | ||||||
|  |             clipper.End(); | ||||||
|  |         } | ||||||
|  |         ImGui::PopStyleVar(); | ||||||
|  |  | ||||||
|         if (ScrollToBottom) |         if (ScrollToBottom) | ||||||
|             ImGui::SetScrollHereY(1.0f); |             ImGui::SetScrollHereY(1.0f); | ||||||
| @@ -3525,15 +3552,23 @@ static void ShowExampleAppLog(bool* p_open) | |||||||
| { | { | ||||||
|     static ExampleAppLog log; |     static ExampleAppLog log; | ||||||
|  |  | ||||||
|     // Demo: add random items (unless Ctrl is held) |     // For the demo: add a debug button before the normal log window contents | ||||||
|     static double last_time = -1.0; |     // We take advantage of the fact that multiple calls to Begin()/End() are appending to the same window. | ||||||
|     double time = ImGui::GetTime(); |     ImGui::SetNextWindowSize(ImVec2(500, 400), ImGuiCond_FirstUseEver); | ||||||
|     if (time - last_time >= 0.20f && !ImGui::GetIO().KeyCtrl) |     ImGui::Begin("Example: Log", p_open); | ||||||
|  |     if (ImGui::SmallButton("Add 5 entries")) | ||||||
|     { |     { | ||||||
|         const char* random_words[] = { "system", "info", "warning", "error", "fatal", "notice", "log" }; |         static int counter = 0; | ||||||
|         log.AddLog("[%s] Hello, time is %.1f, frame count is %d\n", random_words[rand() % IM_ARRAYSIZE(random_words)], time, ImGui::GetFrameCount()); |         for (int n = 0; n < 5; n++) | ||||||
|         last_time = time; |         { | ||||||
|  |             const char* categories[3] = { "info", "warn", "error" }; | ||||||
|  |             const char* words[] = { "Bumfuzzled", "Cattywampus", "Snickersnee", "Abibliophobia", "Absquatulate", "Nincompoop", "Pauciloquent" }; | ||||||
|  |             log.AddLog("[%05d] [%s] Hello, current time is %.1f, here's a word: '%s'\n",  | ||||||
|  |                 ImGui::GetFrameCount(), categories[counter % IM_ARRAYSIZE(categories)], ImGui::GetTime(), words[counter % IM_ARRAYSIZE(words)]); | ||||||
|  |             counter++; | ||||||
|         } |         } | ||||||
|  |     } | ||||||
|  |     ImGui::End(); | ||||||
|  |  | ||||||
|     log.Draw("Example: Log", p_open); |     log.Draw("Example: Log", p_open); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -12,7 +12,8 @@ Index of this file: | |||||||
| // [SECTION] Helpers ShadeVertsXXX functions | // [SECTION] Helpers ShadeVertsXXX functions | ||||||
| // [SECTION] ImFontConfig | // [SECTION] ImFontConfig | ||||||
| // [SECTION] ImFontAtlas | // [SECTION] ImFontAtlas | ||||||
| // [SECTION] ImFontAtlas glyph ranges helpers + GlyphRangesBuilder | // [SECTION] ImFontAtlas glyph ranges helpers | ||||||
|  | // [SECTION] ImFontGlyphRangesBuilder | ||||||
| // [SECTION] ImFont | // [SECTION] ImFont | ||||||
| // [SECTION] Internal Render Helpers | // [SECTION] Internal Render Helpers | ||||||
| // [SECTION] Decompression code | // [SECTION] Decompression code | ||||||
| @@ -2098,7 +2099,7 @@ static void UnpackAccumulativeOffsetsIntoRanges(int base_codepoint, const short* | |||||||
| } | } | ||||||
|  |  | ||||||
| //------------------------------------------------------------------------- | //------------------------------------------------------------------------- | ||||||
| // [SECTION] ImFontAtlas glyph ranges helpers + GlyphRangesBuilder | // [SECTION] ImFontAtlas glyph ranges helpers | ||||||
| //------------------------------------------------------------------------- | //------------------------------------------------------------------------- | ||||||
|  |  | ||||||
| const ImWchar*  ImFontAtlas::GetGlyphRangesChineseSimplifiedCommon() | const ImWchar*  ImFontAtlas::GetGlyphRangesChineseSimplifiedCommon() | ||||||
| @@ -2106,7 +2107,7 @@ const ImWchar*  ImFontAtlas::GetGlyphRangesChineseSimplifiedCommon() | |||||||
|     // Store 2500 regularly used characters for Simplified Chinese. |     // Store 2500 regularly used characters for Simplified Chinese. | ||||||
|     // Sourced from https://zh.wiktionary.org/wiki/%E9%99%84%E5%BD%95:%E7%8E%B0%E4%BB%A3%E6%B1%89%E8%AF%AD%E5%B8%B8%E7%94%A8%E5%AD%97%E8%A1%A8 |     // Sourced from https://zh.wiktionary.org/wiki/%E9%99%84%E5%BD%95:%E7%8E%B0%E4%BB%A3%E6%B1%89%E8%AF%AD%E5%B8%B8%E7%94%A8%E5%AD%97%E8%A1%A8 | ||||||
|     // This table covers 97.97% of all characters used during the month in July, 1987. |     // This table covers 97.97% of all characters used during the month in July, 1987. | ||||||
|     // You can use ImFontAtlas::GlyphRangesBuilder to create your own ranges derived from this, by merging existing ranges or adding new characters. |     // You can use ImFontGlyphRangesBuilder to create your own ranges derived from this, by merging existing ranges or adding new characters. | ||||||
|     // (Stored as accumulative offsets from the initial unicode codepoint 0x4E00. This encoding is designed to helps us compact the source code size.) |     // (Stored as accumulative offsets from the initial unicode codepoint 0x4E00. This encoding is designed to helps us compact the source code size.) | ||||||
|     static const short accumulative_offsets_from_0x4E00[] = |     static const short accumulative_offsets_from_0x4E00[] = | ||||||
|     { |     { | ||||||
| @@ -2172,7 +2173,7 @@ const ImWchar*  ImFontAtlas::GetGlyphRangesJapanese() | |||||||
|     // 1946 common ideograms code points for Japanese |     // 1946 common ideograms code points for Japanese | ||||||
|     // Sourced from http://theinstructionlimit.com/common-kanji-character-ranges-for-xna-spritefont-rendering |     // Sourced from http://theinstructionlimit.com/common-kanji-character-ranges-for-xna-spritefont-rendering | ||||||
|     // FIXME: Source a list of the revised 2136 Joyo Kanji list from 2010 and rebuild this. |     // FIXME: Source a list of the revised 2136 Joyo Kanji list from 2010 and rebuild this. | ||||||
|     // You can use ImFontAtlas::GlyphRangesBuilder to create your own ranges derived from this, by merging existing ranges or adding new characters. |     // You can use ImFontGlyphRangesBuilder to create your own ranges derived from this, by merging existing ranges or adding new characters. | ||||||
|     // (Stored as accumulative offsets from the initial unicode codepoint 0x4E00. This encoding is designed to helps us compact the source code size.) |     // (Stored as accumulative offsets from the initial unicode codepoint 0x4E00. This encoding is designed to helps us compact the source code size.) | ||||||
|     static const short accumulative_offsets_from_0x4E00[] = |     static const short accumulative_offsets_from_0x4E00[] = | ||||||
|     { |     { | ||||||
| @@ -2250,7 +2251,11 @@ const ImWchar*  ImFontAtlas::GetGlyphRangesThai() | |||||||
|     return &ranges[0]; |     return &ranges[0]; | ||||||
| } | } | ||||||
|  |  | ||||||
| void ImFontAtlas::GlyphRangesBuilder::AddText(const char* text, const char* text_end) | //----------------------------------------------------------------------------- | ||||||
|  | // [SECTION] ImFontGlyphRangesBuilder | ||||||
|  | //----------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|  | void ImFontGlyphRangesBuilder::AddText(const char* text, const char* text_end) | ||||||
| { | { | ||||||
|     while (text_end ? (text < text_end) : *text) |     while (text_end ? (text < text_end) : *text) | ||||||
|     { |     { | ||||||
| @@ -2264,14 +2269,14 @@ void ImFontAtlas::GlyphRangesBuilder::AddText(const char* text, const char* text | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| void ImFontAtlas::GlyphRangesBuilder::AddRanges(const ImWchar* ranges) | void ImFontGlyphRangesBuilder::AddRanges(const ImWchar* ranges) | ||||||
| { | { | ||||||
|     for (; ranges[0]; ranges += 2) |     for (; ranges[0]; ranges += 2) | ||||||
|         for (ImWchar c = ranges[0]; c <= ranges[1]; c++) |         for (ImWchar c = ranges[0]; c <= ranges[1]; c++) | ||||||
|             AddChar(c); |             AddChar(c); | ||||||
| } | } | ||||||
|  |  | ||||||
| void ImFontAtlas::GlyphRangesBuilder::BuildRanges(ImVector<ImWchar>* out_ranges) | void ImFontGlyphRangesBuilder::BuildRanges(ImVector<ImWchar>* out_ranges) | ||||||
| { | { | ||||||
|     for (int n = 0; n < 0x10000; n++) |     for (int n = 0; n < 0x10000; n++) | ||||||
|         if (GetBit(n)) |         if (GetBit(n)) | ||||||
| @@ -2993,8 +2998,9 @@ void ImGui::RenderRectFilledWithHole(ImDrawList* draw_list, ImRect outer, ImRect | |||||||
| // FIXME: Rendering an ellipsis "..." is a surprisingly tricky problem for us... we cannot rely on font glyph having it,  | // FIXME: Rendering an ellipsis "..." is a surprisingly tricky problem for us... we cannot rely on font glyph having it,  | ||||||
| // and regular dot are typically too wide. If we render a dot/shape ourselves it comes with the risk that it wouldn't match  | // and regular dot are typically too wide. If we render a dot/shape ourselves it comes with the risk that it wouldn't match  | ||||||
| // the boldness or positioning of what the font uses... | // the boldness or positioning of what the font uses... | ||||||
| void ImGui::RenderPixelEllipsis(ImDrawList* draw_list, ImFont* font, ImVec2 pos, int count, ImU32 col) | void ImGui::RenderPixelEllipsis(ImDrawList* draw_list, ImVec2 pos, int count, ImU32 col) | ||||||
| { | { | ||||||
|  |     ImFont* font = draw_list->_Data->Font; | ||||||
|     pos.y += (float)(int)(font->DisplayOffset.y + font->Ascent + 0.5f - 1.0f); |     pos.y += (float)(int)(font->DisplayOffset.y + font->Ascent + 0.5f - 1.0f); | ||||||
|     for (int dot_n = 0; dot_n < count; dot_n++) |     for (int dot_n = 0; dot_n < count; dot_n++) | ||||||
|         draw_list->AddRectFilled(ImVec2(pos.x + dot_n * 2.0f, pos.y), ImVec2(pos.x + dot_n * 2.0f + 1.0f, pos.y + 1.0f), col); |         draw_list->AddRectFilled(ImVec2(pos.x + dot_n * 2.0f, pos.y), ImVec2(pos.x + dot_n * 2.0f + 1.0f, pos.y + 1.0f), col); | ||||||
|   | |||||||
| @@ -108,7 +108,7 @@ extern IMGUI_API ImGuiContext* GImGui;  // Current implicit ImGui context pointe | |||||||
| #define IM_NEWLINE      "\n" | #define IM_NEWLINE      "\n" | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #define IMGUI_DEBUG_LOG(FMT,...)        printf("[%05d] " FMT, GImGui->FrameCount, __VA_ARGS__) | #define IMGUI_DEBUG_LOG(_FMT,...)       printf("[%05d] " _FMT, GImGui->FrameCount, __VA_ARGS__) | ||||||
| #define IM_STATIC_ASSERT(_COND)         typedef char static_assertion_##__line__[(_COND)?1:-1] | #define IM_STATIC_ASSERT(_COND)         typedef char static_assertion_##__line__[(_COND)?1:-1] | ||||||
| #define IM_F32_TO_INT8_UNBOUND(_VAL)    ((int)((_VAL) * 255.0f + ((_VAL)>=0 ? 0.5f : -0.5f)))   // Unsaturated, for display purpose | #define IM_F32_TO_INT8_UNBOUND(_VAL)    ((int)((_VAL) * 255.0f + ((_VAL)>=0 ? 0.5f : -0.5f)))   // Unsaturated, for display purpose | ||||||
| #define IM_F32_TO_INT8_SAT(_VAL)        ((int)(ImSaturate(_VAL) * 255.0f + 0.5f))               // Saturated, always output 0..255 | #define IM_F32_TO_INT8_SAT(_VAL)        ((int)(ImSaturate(_VAL) * 255.0f + 0.5f))               // Saturated, always output 0..255 | ||||||
| @@ -1581,7 +1581,7 @@ namespace ImGui | |||||||
|     IMGUI_API void          RenderArrowDockMenu(ImDrawList* draw_list, ImVec2 p_min, float sz, ImU32 col); |     IMGUI_API void          RenderArrowDockMenu(ImDrawList* draw_list, ImVec2 p_min, float sz, ImU32 col); | ||||||
|     IMGUI_API void          RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding); |     IMGUI_API void          RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding); | ||||||
|     IMGUI_API void          RenderRectFilledWithHole(ImDrawList* draw_list, ImRect outer, ImRect inner, ImU32 col, float rounding); |     IMGUI_API void          RenderRectFilledWithHole(ImDrawList* draw_list, ImRect outer, ImRect inner, ImU32 col, float rounding); | ||||||
|     IMGUI_API void          RenderPixelEllipsis(ImDrawList* draw_list, ImFont* font, ImVec2 pos, int count, ImU32 col); |     IMGUI_API void          RenderPixelEllipsis(ImDrawList* draw_list, ImVec2 pos, int count, ImU32 col); | ||||||
|  |  | ||||||
|     // Widgets |     // Widgets | ||||||
|     IMGUI_API bool          ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0,0), ImGuiButtonFlags flags = 0); |     IMGUI_API bool          ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0,0), ImGuiButtonFlags flags = 0); | ||||||
|   | |||||||
| @@ -489,7 +489,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool | |||||||
|             // Set active id so it can be queried by user via IsItemActive(), equivalent of holding the mouse button. |             // Set active id so it can be queried by user via IsItemActive(), equivalent of holding the mouse button. | ||||||
|             g.NavActivateId = id; // This is so SetActiveId assign a Nav source |             g.NavActivateId = id; // This is so SetActiveId assign a Nav source | ||||||
|             SetActiveID(id, window); |             SetActiveID(id, window); | ||||||
|             if (!(flags & ImGuiButtonFlags_NoNavFocus)) |             if ((nav_activated_by_code || nav_activated_by_inputs) && !(flags & ImGuiButtonFlags_NoNavFocus)) | ||||||
|                 SetFocusID(id, window); |                 SetFocusID(id, window); | ||||||
|             g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right) | (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down); |             g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right) | (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down); | ||||||
|         } |         } | ||||||
| @@ -3158,7 +3158,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 | |||||||
|     IM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackCompletion) && (flags & ImGuiInputTextFlags_AllowTabInput))); // Can't use both together (they both use tab key) |     IM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackCompletion) && (flags & ImGuiInputTextFlags_AllowTabInput))); // Can't use both together (they both use tab key) | ||||||
|  |  | ||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     const ImGuiIO& io = g.IO; |     ImGuiIO& io = g.IO; | ||||||
|     const ImGuiStyle& style = g.Style; |     const ImGuiStyle& style = g.Style; | ||||||
|  |  | ||||||
|     const bool is_multiline = (flags & ImGuiInputTextFlags_Multiline) != 0; |     const bool is_multiline = (flags & ImGuiInputTextFlags_Multiline) != 0; | ||||||
| @@ -3343,22 +3343,22 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 | |||||||
|         if (edit_state.SelectedAllMouseLock && !io.MouseDown[0]) |         if (edit_state.SelectedAllMouseLock && !io.MouseDown[0]) | ||||||
|             edit_state.SelectedAllMouseLock = false; |             edit_state.SelectedAllMouseLock = false; | ||||||
|  |  | ||||||
|         if (io.InputCharacters[0]) |         if (io.InputQueueCharacters.Size > 0) | ||||||
|         { |         { | ||||||
|             // Process text input (before we check for Return because using some IME will effectively send a Return?) |             // Process text input (before we check for Return because using some IME will effectively send a Return?) | ||||||
|             // We ignore CTRL inputs, but need to allow ALT+CTRL as some keyboards (e.g. German) use AltGR (which _is_ Alt+Ctrl) to input certain characters. |             // We ignore CTRL inputs, but need to allow ALT+CTRL as some keyboards (e.g. German) use AltGR (which _is_ Alt+Ctrl) to input certain characters. | ||||||
|             bool ignore_inputs = (io.KeyCtrl && !io.KeyAlt) || (is_osx && io.KeySuper); |             bool ignore_inputs = (io.KeyCtrl && !io.KeyAlt) || (is_osx && io.KeySuper); | ||||||
|             if (!ignore_inputs && is_editable && !user_nav_input_start) |             if (!ignore_inputs && is_editable && !user_nav_input_start) | ||||||
|                 for (int n = 0; n < IM_ARRAYSIZE(io.InputCharacters) && io.InputCharacters[n]; n++) |                 for (int n = 0; n < io.InputQueueCharacters.Size; n++) | ||||||
|                 { |                 { | ||||||
|                     // Insert character if they pass filtering |                     // Insert character if they pass filtering | ||||||
|                     unsigned int c = (unsigned int)io.InputCharacters[n]; |                     unsigned int c = (unsigned int)io.InputQueueCharacters[n]; | ||||||
|                     if (InputTextFilterCharacter(&c, flags, callback, callback_user_data)) |                     if (InputTextFilterCharacter(&c, flags, callback, callback_user_data)) | ||||||
|                         edit_state.OnKeyPressed((int)c); |                         edit_state.OnKeyPressed((int)c); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|             // Consume characters |             // Consume characters | ||||||
|             memset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters)); |             io.InputQueueCharacters.resize(0); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -5885,7 +5885,7 @@ bool    ImGui::BeginTabBarEx(ImGuiTabBar* tab_bar, const ImRect& tab_bar_bb, ImG | |||||||
|     g.CurrentTabBar.push_back(tab_bar); |     g.CurrentTabBar.push_back(tab_bar); | ||||||
|     if (tab_bar->CurrFrameVisible == g.FrameCount) |     if (tab_bar->CurrFrameVisible == g.FrameCount) | ||||||
|     { |     { | ||||||
|         printf("[%05d] BeginTabBarEx already called this frame\n", g.FrameCount); |         //IMGUI_DEBUG_LOG("BeginTabBarEx already called this frame\n", g.FrameCount); | ||||||
|         //IM_ASSERT(0); |         //IM_ASSERT(0); | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
| @@ -6352,6 +6352,7 @@ void    ImGui::EndTabItem() | |||||||
|  |  | ||||||
|     IM_ASSERT(g.CurrentTabBar.Size > 0 && "Needs to be called between BeginTabBar() and EndTabBar()!"); |     IM_ASSERT(g.CurrentTabBar.Size > 0 && "Needs to be called between BeginTabBar() and EndTabBar()!"); | ||||||
|     ImGuiTabBar* tab_bar = g.CurrentTabBar.back(); |     ImGuiTabBar* tab_bar = g.CurrentTabBar.back(); | ||||||
|  |     IM_ASSERT(tab_bar->LastTabItemIdx >= 0 && "Needs to be called between BeginTabItem() and EndTabItem()"); | ||||||
|     ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx]; |     ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx]; | ||||||
|     if (!(tab->Flags & ImGuiTabItemFlags_NoPushId)) |     if (!(tab->Flags & ImGuiTabItemFlags_NoPushId)) | ||||||
|         g.CurrentWindow->IDStack.pop_back(); |         g.CurrentWindow->IDStack.pop_back(); | ||||||
| @@ -6581,6 +6582,7 @@ bool    ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, | |||||||
|  |  | ||||||
|     // Tooltip (FIXME: Won't work over the close button because ItemOverlap systems messes up with HoveredIdTimer) |     // Tooltip (FIXME: Won't work over the close button because ItemOverlap systems messes up with HoveredIdTimer) | ||||||
|     if (g.HoveredId == id && !held && g.HoveredIdNotActiveTimer > 0.50f) |     if (g.HoveredId == id && !held && g.HoveredIdNotActiveTimer > 0.50f) | ||||||
|  |         if (!(tab_bar->Flags & ImGuiTabBarFlags_NoTooltip)) | ||||||
|             SetTooltip("%.*s", (int)(FindRenderedTextEnd(label) - label), label); |             SetTooltip("%.*s", (int)(FindRenderedTextEnd(label) - label), label); | ||||||
|  |  | ||||||
|     return tab_contents_visible; |     return tab_contents_visible; | ||||||
| @@ -6710,7 +6712,7 @@ bool ImGui::TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb, | |||||||
|  |  | ||||||
|         const float ellipsis_x = text_pixel_clip_bb.Min.x + label_size_clipped_x + 1.0f; |         const float ellipsis_x = text_pixel_clip_bb.Min.x + label_size_clipped_x + 1.0f; | ||||||
|         if (!close_button_visible && ellipsis_x + ellipsis_width <= bb.Max.x) |         if (!close_button_visible && ellipsis_x + ellipsis_width <= bb.Max.x) | ||||||
|             RenderPixelEllipsis(draw_list, g.Font, ImVec2(ellipsis_x, text_pixel_clip_bb.Min.y), ellipsis_dot_count, GetColorU32(ImGuiCol_Text)); |             RenderPixelEllipsis(draw_list, ImVec2(ellipsis_x, text_pixel_clip_bb.Min.y), ellipsis_dot_count, GetColorU32(ImGuiCol_Text)); | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
|   | |||||||
| @@ -119,8 +119,8 @@ Mind the fact that some graphics drivers have texture size limitation. | |||||||
| If you are building a PC application, mind the fact that your users may use hardware with lower limitations than yours. | If you are building a PC application, mind the fact that your users may use hardware with lower limitations than yours. | ||||||
| Some solutions: | Some solutions: | ||||||
|  |  | ||||||
|  - 1) Reduce glyphs ranges by calculating them from source localization data. You can use ImFont::GlyphRangesBuilder for this purpose, |  - 1) Reduce glyphs ranges by calculating them from source localization data.  | ||||||
|    this will be the biggest win.  |    You can use ImFontGlyphRangesBuilder for this purpose, this will be the biggest win! | ||||||
|  - 2) You may reduce oversampling, e.g. config.OversampleH = config.OversampleV = 1, this will largely reduce your texture size. |  - 2) You may reduce oversampling, e.g. config.OversampleH = config.OversampleV = 1, this will largely reduce your texture size. | ||||||
|  - 3) Set io.Fonts.TexDesiredWidth to specify a texture width to minimize texture height (see comment in ImFontAtlas::Build function). |  - 3) Set io.Fonts.TexDesiredWidth to specify a texture width to minimize texture height (see comment in ImFontAtlas::Build function). | ||||||
|  - 4) Set io.Fonts.Flags |= ImFontAtlasFlags_NoPowerOfTwoHeight; to disable rounding the texture height to the next power of two. |  - 4) Set io.Fonts.Flags |= ImFontAtlasFlags_NoPowerOfTwoHeight; to disable rounding the texture height to the next power of two. | ||||||
| @@ -177,11 +177,11 @@ Also note that correct sRGB space blending will have an important effect on your | |||||||
|  BUILDING CUSTOM GLYPH RANGES |  BUILDING CUSTOM GLYPH RANGES | ||||||
| --------------------------------------- | --------------------------------------- | ||||||
|  |  | ||||||
| You can use the ImFontAtlas::GlyphRangesBuilder helper to create glyph ranges based on text input. | You can use the ImFontGlyphRangesBuilder helper to create glyph ranges based on text input. | ||||||
| For example: for a game where your script is known, if you can feed your entire script to it and only build the characters the game needs.  | For example: for a game where your script is known, if you can feed your entire script to it and only build the characters the game needs.  | ||||||
|  |  | ||||||
|   ImVector<ImWchar> ranges; |   ImVector<ImWchar> ranges; | ||||||
|   ImFontAtlas::GlyphRangesBuilder builder; |   ImFontGlyphRangesBuilder builder; | ||||||
|   builder.AddText("Hello world");                        // Add a string (here "Hello world" contains 7 unique characters) |   builder.AddText("Hello world");                        // Add a string (here "Hello world" contains 7 unique characters) | ||||||
|   builder.AddChar(0x7262);                               // Add a specific character |   builder.AddChar(0x7262);                               // Add a specific character | ||||||
|   builder.AddRanges(io.Fonts->GetGlyphRangesJapanese()); // Add one of the default ranges |   builder.AddRanges(io.Fonts->GetGlyphRangesJapanese()); // Add one of the default ranges | ||||||
|   | |||||||
| @@ -33,7 +33,7 @@ | |||||||
| </Type> | </Type> | ||||||
|  |  | ||||||
| <Type Name="ImGuiWindow"> | <Type Name="ImGuiWindow"> | ||||||
|   <DisplayString>{{Name={Name,s} Active {(Active||WasActive)?1:0,d} Child {(Flags & 0x01000000)?1:0,d} Popup {(Flags & 0x04000000)?1:0,d}}</DisplayString> |   <DisplayString>{{Name {Name,s} Active {(Active||WasActive)?1:0,d} Child {(Flags & 0x01000000)?1:0,d} Popup {(Flags & 0x04000000)?1:0,d} Hidden {(Hidden)?1:0,d}}</DisplayString> | ||||||
| </Type> | </Type> | ||||||
|    |    | ||||||
| </AutoVisualizer> | </AutoVisualizer> | ||||||
		Reference in New Issue
	
	Block a user