mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Merge branch 'master' into viewport
# Conflicts: # examples/imgui_impl_dx10.cpp # examples/opengl2_example/imgui_impl_glfw_gl2.cpp # examples/opengl3_example/imgui_impl_glfw_gl3.cpp # examples/vulkan_example/main.cpp # imgui.h
This commit is contained in:
commit
56ad2a2d74
@ -37,10 +37,23 @@ HOW TO UPDATE?
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
VERSION 1.60 WIP (Latest, currently in development)
|
||||
VERSION 1.61 WIP
|
||||
|
||||
Breaking Changes:
|
||||
(IN PROGRESS, WILL ADD TO THIS LIST AS WE WORK ON 1.61)
|
||||
- ...
|
||||
|
||||
Other Changes:
|
||||
(IN PROGRESS, WILL ADD TO THIS LIST AS WE WORK ON 1.61)
|
||||
- ...
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
VERSION 1.60 (Released 2018-04-07)
|
||||
Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.60
|
||||
|
||||
The gamepad/keyboard navigation branch (which has been in the work since July 2016) has been merged.
|
||||
Gamepad/keyboard navigation is still marked as Beta and has to be enabled explicitely.
|
||||
Gamepad/keyboard navigation is still marked as Beta and has to be enabled explicitly.
|
||||
Various internal refactors have also been done, as part of the navigation work and as part of the upcoing viewport/docking work.
|
||||
|
||||
VIEWPORT BRANCH
|
||||
@ -75,45 +88,45 @@ VIEWPORT BRANCH
|
||||
- Internal: Settings: Added ReadCloseFn handler to be able to patch/alter a loaded object after all the fields are known.
|
||||
|
||||
Breaking Changes:
|
||||
(IN PROGRESS, WILL ADD TO THIS LIST AS WE WORK ON 1.60)
|
||||
|
||||
- Fonts: changed ImFont::DisplayOffset.y to defaults to 0 instead of +1. Fixed vertical rounding of Ascent/Descent to match TrueType renderer.
|
||||
If you were adding or subtracting to ImFont::DisplayOffset check if your fonts are correctly aligned vertically. (#1619)
|
||||
- BeginDragDropSource(): temporarily removed the optional mouse_button=0 parameter because it is not really usable in many situations at the moment.
|
||||
- Obsoleted the io.RenderDrawListsFn callback, you can call your graphics engine render function after ImGui::Render(). Use ImGui::GetDrawData() to retrieve the ImDrawData* to display.
|
||||
- Reorganized context handling to be more explicit, (#1599)
|
||||
- Obsoleted the io.RenderDrawListsFn callback, you can call your graphics engine render function after ImGui::Render().
|
||||
e.g. with example back-ends, call ImDrawData* draw_data = ImGui::GetDrawData(); ImGui_ImplXXXX_RenderDrawData(draw_data).
|
||||
- Reorganized context handling to be more explicit: (#1599)
|
||||
- YOU NOW NEED TO CALL ImGui::CreateContext() AT THE BEGINNING OF YOUR APP, AND CALL ImGui::DestroyContext() AT THE END.
|
||||
- removed Shutdown() function, as DestroyContext() serve this purpose.
|
||||
- removed Shutdown() function, as DestroyContext() serve this purpose. If you are using an old back-end from the examples/ folder, remove the line that calls Shutdown().
|
||||
- you may pass a ImFontAtlas* pointer to CreateContext() to share a font atlas between contexts. Otherwhise CreateContext() will create its own font atlas instance.
|
||||
- removed allocator parameters from CreateContext(), they are now setup with SetAllocatorFunctions(), and shared by all contexts.
|
||||
- removed the default global context and font atlas instance, which were confusing for users of DLL reloading and users of multiple contexts.
|
||||
- Moved sample TTF files from extra_fonts/ to misc/fonts/. If you loaded files directly from the imgui repo you may need to update your paths.
|
||||
- Renamed ImGuiStyleVar_Count_ to ImGuiStyleVar_COUNT and ImGuiMouseCursor_Count_ to ImGuiMouseCursor_COUNT for consistency with other public enums.
|
||||
- Fonts: Moved sample TTF files from extra_fonts/ to misc/fonts/. If you loaded files directly from the imgui repo you may need to update your paths.
|
||||
- Fonts: changed ImFont::DisplayOffset.y to defaults to 0 instead of +1. Fixed vertical rounding of Ascent/Descent to match TrueType renderer.
|
||||
If you were adding or subtracting (not assigning) to ImFont::DisplayOffset check if your fonts are correctly aligned vertically. (#1619)
|
||||
- BeginDragDropSource(): temporarily removed the optional mouse_button=0 parameter because it is not really usable in many situations at the moment.
|
||||
- Obsoleted IsAnyWindowHovered() in favor of IsWindowHovered(ImGuiHoveredFlags_AnyWindow). Kept redirection function (will obsolete).
|
||||
- Obsoleted IsAnyWindowFocused() in favor of IsWindowFocused(ImGuiFocusedFlags_AnyWindow). Kept redirection function (will obsolete).
|
||||
- Renamed io.WantMoveMouse to io.WantSetMousePos for consistency and ease of understanding (was added in 1.52, _not_ used by core, and honored by some binding ahead of merging the Nav branch).
|
||||
- Renamed io.WantMoveMouse to io.WantSetMousePos for consistency and ease of understanding (was added in 1.52, not used by core, and honored by some binding ahead of merging the Nav branch).
|
||||
- Removed ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered style colors as the closing cross uses regular button colors now.
|
||||
- Renamed ImGuiSizeConstraintCallback to ImGuiSizeCallback, ImGuiSizeConstraintCallbackData to ImGuiSizeCallbackData.
|
||||
- Removed CalcItemRectClosestPoint() which was weird and not really used by anyone except demo code. If you need it it's easy to replicate on your side.
|
||||
|
||||
Other Changes:
|
||||
(IN PROGRESS, WILL ADD TO THIS LIST AS WE WORK ON 1.60)
|
||||
|
||||
- Doc: Added a Changelog file in the repository to ease comparing versions (it goes back to dear imgui 1.48), until now it was only on GitHub.
|
||||
- Navigation: merged in the gamepad/keyboard navigation (about one million changes!). (#787, #323)
|
||||
- Navigation: merged in the gamepad/keyboard navigation (about a million changes!). (#787, #323)
|
||||
The initial focus was to support game controllers, but keyboard is becoming increasingly and decently usable.
|
||||
- To use Keyboard Navigation:
|
||||
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.KeyDown[] + io.KeyMap[] arrays.
|
||||
- When keyboard navigation is active (io.NavActive + ImGuiConfigFlags_NavEnableKeyboard), the io.WantCaptureKeyboard flag will be set.
|
||||
For more advanced uses, you may want to read from io.NavActive or io.NavVisible. Read imgui.cpp for more details.
|
||||
- To use Gamepad Navigation:
|
||||
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable.
|
||||
- Backend: Set io.BackendFlags |= ImGuiBackendFlags_HasGamepad + fill the io.NavInputs[] fields before calling NewFrame(). Note that io.NavInputs[] is cleared by EndFrame().
|
||||
- See https://github.com/ocornut/imgui/issues/1599 for recommended gamepad mapping.
|
||||
- Backend: Set io.BackendFlags |= ImGuiBackendFlags_HasGamepad + fill the io.NavInputs[] fields before calling NewFrame(). Read imgui.cpp for more details.
|
||||
- See https://github.com/ocornut/imgui/issues/1599 for recommended gamepad mapping or download PNG/PSD at http://goo.gl/9LgVZW
|
||||
- See 'enum ImGuiNavInput_' in imgui.h for a description of inputs. Read imgui.cpp for more details.
|
||||
- To use Keyboard Navigation:
|
||||
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.KeyDown[] + io.KeyMap[] arrays.
|
||||
- Basic controls: arrows to navigate, Alt to enter menus, Space to activate item, Enter to edit text, Escape to cancel/close, Ctrl-Tab to focus windows, etc.
|
||||
- When keyboard navigation is active (io.NavActive + ImGuiConfigFlags_NavEnableKeyboard), the io.WantCaptureKeyboard flag will be set.
|
||||
For more advanced uses, you may want to read from io.NavActive or io.NavVisible. Read imgui.cpp for more details.
|
||||
- Navigation: SetItemDefaultFocus() sets the navigation position in addition to scrolling. (#787)
|
||||
- Navigation: Added IsItemFocused(), added IsAnyItemFocused(). (#787)
|
||||
- Navigation: Added window flags: ImGuiWindowFlags_NoNav (ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus).
|
||||
- Navigation: Added window flags: ImGuiWindowFlags_NoNav (== ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus).
|
||||
- Navigation: Style: Added ImGuiCol_NavHighlight, ImGuiCol_NavWindowingHighlight colors. (#787)
|
||||
- Navigation: TreeNode: Added ImGuiTreeNodeFlags_NavLeftJumpsBackHere flag to allow Nav Left direction to jump back to parent tree node from any of its child. (#1079)
|
||||
- Navigation: IO: Added io.ConfigFlags (input), io.NavActive (output), io.NavVisible (output). (#787)
|
||||
@ -133,11 +146,10 @@ Other Changes:
|
||||
- IO: Added ImGuiKey_Insert, ImGuiKey_Space keys. Setup in all example bindings. (#1541)
|
||||
- IO: Added Horizontal Mouse Wheel support for horizontal scrolling. (#1463) [@tseeker]
|
||||
- IO: Added IsAnyMouseDown() helper which is helpful for bindings to handle mouse capturing.
|
||||
- Window: Clicking on a window with the ImGuiWIndowFlags_NoMove flags takes an ActiveId so we can't hover something else when dragging afterwards. (ref #1381, #1337)
|
||||
- Window: Clicking on a window with the ImGuiWIndowFlags_NoMove flags takes an ActiveId so we can't hover something else when dragging afterwards. (#1381, #1337)
|
||||
- Window: IsWindowHovered(): Added ImGuiHoveredFlags_AnyWindow, ImGuiFocusedFlags_AnyWindow flags (See Breaking Changes). Added to demo. (#1382)
|
||||
- Window: Added SetNextWindowBgAlpha() helper. Particularly helpul since the legacy 5-parameters version of Begin() has been marked as obsolete in 1.53. (#1567)
|
||||
- Window: Fixed SetNextWindowContentSize() with 0.0f on Y axis (or SetNextWindowContentWidth()) overwriting the contents size. Got broken on Dec 10 (1.53). (#1363)
|
||||
- Window: CloseButton: Fixed cross positioning being a little off.
|
||||
- ArrowButton: Added ArrowButton() given a cardinal direction (e.g. ImGuiDir_Left).
|
||||
- InputText: Added alternative clipboard shortcuts: Shift+Delete (cut), Ctrl+Insert (copy), Shift+Insert (paste). (#1541)
|
||||
- InputText: Fixed losing Cursor X position when clicking outside on an item that's submitted after the InputText(). It was only noticeable when restoring focus programmatically. (#1418, #1554)
|
||||
@ -146,7 +158,7 @@ Other Changes:
|
||||
- Style: Enable window border by default. (#707)
|
||||
- Style: Exposed ImGuiStyleVar_WindowTitleAlign, ImGuiStyleVar_ScrollbarSize, ImGuiStyleVar_ScrollbarRounding, ImGuiStyleVar_GrabRounding + added an assert to reduce accidental breakage. (#1181)
|
||||
- Style: Added style.MouseCursorScale help when using the software mouse cursor facility. (#939).
|
||||
- Style: Close button nows display a cross before hovering. Uses button colors for highlight when hovering. (#707)
|
||||
- Style: Close button nows display a cross before hovering. Fixed cross positioning being a little off. Uses button colors for highlight when hovering. (#707)
|
||||
- Popup: OpenPopup() Always reopen existing popup. (Removed imgui_internal.h's OpenPopupEx() which was used for this.) (#1497, #1533).
|
||||
- Popup: BeginPopupContextItem(), BeginPopupContextWindow(), BeginPopupContextVoid(), OpenPopupOnItemClick() all react on mouse release instead of mouse press. (~#439)
|
||||
- Popup: Better handling of user mistakenly calling OpenPopup() every frame (with reopen_existing option). The error will now be more visible and easier to understand. (#1497)
|
||||
@ -172,7 +184,7 @@ Other Changes:
|
||||
- Combo: Arrow button isn't displayed over frame background so its blended color matches other buttons. Left side of the button isn't rounded.
|
||||
- PlotLines: plot a flat line if scale_min==scale_max. (#1621)
|
||||
- Fonts: Changed DisplayOffset.y to defaults to 0 instead of +1. Fixed rounding of Ascent/Descent to match TrueType renderer.
|
||||
If you were adding or subtracting to ImFont::DisplayOffset check if your fonts are correctly aligned vertically. (#1619)
|
||||
If you were adding or subtracting (not assigning) to ImFont::DisplayOffset check if your fonts are correctly aligned vertically. (#1619)
|
||||
- Fonts: Updated stb_truetype from 1.14 to stb_truetype 1.19. (w/ include fix from some platforms #1622)
|
||||
- Fonts: Added optional FreeType rasterizer in misc/freetype. Moved from imgui_club repo. (#618) [@Vuhdo, @mikesart, @ocornut]
|
||||
- Fonts: Moved extra_fonts/ to misc/fonts/.
|
||||
@ -183,7 +195,7 @@ Other Changes:
|
||||
- ImFontAtlas: Added ImFontAtlasFlags_NoMouseCursors flag to disable baking software mouse cursors, mostly to save texture memory on very low end hardware. (#1613)
|
||||
- ImDrawList: Fixed AddRect() with antialiasing disabled (lower-right corner pixel was often missing, rounding looks a little better.) (#1646)
|
||||
- ImDrawList: Added CloneOutput() helper to facilitate the cloning of ImDrawData or ImDrawList for multi-threaded rendering.
|
||||
- Misc: Functions passed to libc qsort are explicitely marked cdecl to support compiling with vectorcall as the default calling convention. (#1230, #1611) [@RandyGaul]
|
||||
- Misc: Functions passed to libc qsort are explicitly marked cdecl to support compiling with vectorcall as the default calling convention. (#1230, #1611) [@RandyGaul]
|
||||
- Misc: ImVec2: added [] operator. This is becoming desirable for some code working of either axes independently. Better adding it sooner than later.
|
||||
- Misc: NewFrame(): Added an assert to detect incorrect filling of the io.KeyMap[] array earlier. (#1555)
|
||||
- Misc: Added IM_OFFSETOF() helper in imgui.h (previously was in imgui_internal.h)
|
||||
@ -192,7 +204,6 @@ Other Changes:
|
||||
- Misc: Added IMGUI_USER_CONFIG to define a custom configuration filename. (#255, #1573, #1144, #41)
|
||||
- Misc: Added IMGUI_STB_TRUETYPE_FILENAME and IMGUI_STB_RECT_PACK_FILENAME compile time directives to use another version of the stb_ files.
|
||||
- Misc: Updated stb_rect_pack from 0.10 to 0.11 (minor changes).
|
||||
- Misc: Added ImGuiConfigFlags_IsSRGB and ImGuiConfigFlags_IsTouchScreen user flags (for io.ConfigFlags).
|
||||
(Those flags are not used by ImGui itself, they only exists to make it easy for the engine/back-end to pass information to the application in a standard manner.)
|
||||
- Metrics: Added display of Columns state.
|
||||
- Demo: Improved Selectable() examples. (#1528)
|
||||
@ -203,6 +214,7 @@ Other Changes:
|
||||
- Examples: Using Dark theme by default. (#707). Tweaked demo code.
|
||||
- Examples: Added support for horizontal mouse wheel for API that allows it. (#1463) [@tseeker]
|
||||
- Examples: All examples now setup the io.BackendFlags to signify they can honor mouse cursors, gamepad, etc.
|
||||
- Examples: DirectX10: Fixed erroneous call to io.Fonts->ClearInputData() + ClearTexData() that was left in DX10 example but removed in 1.47 (Nov 2015) in every other back-ends. (#1733)
|
||||
- Examples: DirectX12: Added DirectX 12 example. (#301) [@jdm3]
|
||||
- Examples: OpenGL3+GLFW,SDL: Changed GLSL shader version from 330 to 150. (#1466, #1504)
|
||||
- Examples: OpenGL3+GLFW,SDL: Added a way to override the GLSL version string in the Init function. (#1466, #1504).
|
||||
@ -224,8 +236,7 @@ Other Changes:
|
||||
- Examples: Vulkan: Visual Studio: Added .vcxproj file.
|
||||
- Examples: Apple: Fixed filenames in OSX xcode project. Various other Mac friendly fixes. [@gerryhernandez etc.]
|
||||
- Examples: Visual Studio: Disabled extraneous function-level check in Release build.
|
||||
- Internals: Lots of refactoring!
|
||||
- Various minor fixes, tweaks, optimizations, comments.
|
||||
- Various fixes, tweaks, internal refactoring, optimizations, comments.
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
@ -590,7 +601,7 @@ Other Changes:
|
||||
- ImFont: Added GetGlyphRangesThai() helper. [@nProtect]
|
||||
- ImFont: CalcWordWrapPositionA() fixed font scaling with fallback character.
|
||||
- ImFont: Calculate and store the approximate texture surface to get an idea of how costly each source font is.
|
||||
- ImFontConfig: Added GlyphOffset to explicitely offset glyphs at font build time, useful for merged fonts. Removed MergeGlyphCenterV. (BREAKING API)
|
||||
- ImFontConfig: Added GlyphOffset to explicitly offset glyphs at font build time, useful for merged fonts. Removed MergeGlyphCenterV. (BREAKING API)
|
||||
- Clarified asserts in CheckStacksSize() when there is a stack mismatch.
|
||||
- Context: Support for #define-ing GImGui and IMGUI_SET_CURRENT_CONTEXT_FUNC to enable custom thread-based hackery (#586)
|
||||
- Updated stb_truetype.h to 1.14 (added OTF support, removed warnings). (#883, #976)
|
||||
@ -614,7 +625,7 @@ Other Changes:
|
||||
- Examples: OpenGL2: Uploading font texture as RGBA32 to increase compatibility with users shaders for beginners. (#824)
|
||||
- Examples: Vulkan: Countless fixes and improvements. (#785, #804, #910, #1017, #1039, #1041, #1042, #1043, #1080) [@martty, @Loftilus, @ParticlePeter, @SaschaWillems]
|
||||
- Examples: DirectX9/10/10: Only call SetCursor(NULL) is io.MouseDrawCursor is set. (#585, #909)
|
||||
- Examples: DirectX9: Explicitely setting viewport to match that other examples are doing. (#937)
|
||||
- Examples: DirectX9: Explicitly setting viewport to match that other examples are doing. (#937)
|
||||
- Examples: GLFW+OpenGL3: Fixed Shutdown() calling GL functions with NULL parameters if NewFrame was never called. (#800)
|
||||
- Examples: GLFW+OpenGL2: Renaming opengl_example/ to opengl2_example/ for clarity.
|
||||
- Examples: SDL+OpenGL: explicitly setting GL_UNPACK_ROW_LENGTH to reduce issues because SDL changes it. (#752)
|
||||
|
@ -96,7 +96,7 @@ Demo Binaries
|
||||
-------------
|
||||
|
||||
You should be able to build the examples from sources (tested on Windows/Mac/Linux). If you don't, let me know! If you want to have a quick look at some Dear ImGui features, you can download Windows binaries of the demo app here:
|
||||
- [imgui-demo-binaries-20180207.zip](http://www.miracleworld.net/imgui/binaries/imgui-demo-binaries-20180207.zip) (Windows binaries, Dear ImGui 1.60 WIP built 2018/01/07, 5 executables)
|
||||
- [imgui-demo-binaries-20180407.zip](http://www.miracleworld.net/imgui/binaries/imgui-demo-binaries-20180407.zip) (Windows binaries, Dear ImGui 1.60 built 2018/04/07, 5 executables)
|
||||
|
||||
The demo applications are unfortunately not yet DPI aware so expect some blurryness on a 4K screen. For DPI awareness you can load/reload your font at different scale, and scale your Style with `style.ScaleAllSizes()`.
|
||||
|
||||
|
@ -224,6 +224,7 @@ int main(int, char**)
|
||||
ImGui::DestroyContext();
|
||||
|
||||
CleanupDeviceD3D();
|
||||
DestroyWindow(hwnd);
|
||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
||||
|
||||
return 0;
|
||||
|
@ -242,6 +242,7 @@ int main(int, char**)
|
||||
ImGui::DestroyContext();
|
||||
|
||||
CleanupDeviceD3D();
|
||||
DestroyWindow(hwnd);
|
||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
||||
|
||||
return 0;
|
||||
|
@ -421,7 +421,9 @@ int main(int, char**)
|
||||
ImGui_ImplDX12_Shutdown();
|
||||
ImGui_ImplWin32_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
|
||||
CleanupDeviceD3D();
|
||||
DestroyWindow(hwnd);
|
||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
||||
|
||||
return 0;
|
||||
|
@ -192,6 +192,7 @@ int main(int, char**)
|
||||
|
||||
if (g_pd3dDevice) g_pd3dDevice->Release();
|
||||
if (pD3D) pD3D->Release();
|
||||
DestroyWindow(hwnd);
|
||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
||||
|
||||
return 0;
|
||||
|
@ -14,6 +14,7 @@
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||
// 2018-XX-XX: DirectX10: Offset projection matrix and clipping rectangle by draw_data->DisplayPos (which will be non-zero for multi-viewport applications).
|
||||
// 2018-04-09: Misc: Fixed erroneous call to io.Fonts->ClearInputData() + ClearTexData() that was left in DX10 example but removed in 1.47 (Nov 2015) on other back-ends.
|
||||
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplDX10_RenderDrawData() in the .h file so you can call it yourself.
|
||||
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
|
||||
// 2016-05-07: DirectX10: Disabling depth-write.
|
||||
|
@ -14,8 +14,8 @@
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||
// 2018-XX-XX: Inputs: Added support for mouse cursors, honoring ImGui::GetMouseCursor() value.
|
||||
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors flag + honor ImGuiConfigFlags_NoMouseCursorChange flag.
|
||||
// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value, passed to glfwSetCursor()).
|
||||
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
|
||||
// 2018-02-06: Inputs: Added mapping for ImGuiKey_Space.
|
||||
// 2018-01-25: Inputs: Added gamepad support if ImGuiConfigFlags_NavEnableGamepad is set.
|
||||
|
@ -132,6 +132,8 @@ int main(int, char**)
|
||||
ImGui_ImplOpenGL2_Shutdown();
|
||||
ImGui_ImplGlfw_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
|
||||
glfwDestroyWindow(window);
|
||||
glfwTerminate();
|
||||
|
||||
return 0;
|
||||
|
@ -139,6 +139,8 @@ int main(int, char**)
|
||||
ImGui_ImplOpenGL3_Shutdown();
|
||||
ImGui_ImplGlfw_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
|
||||
glfwDestroyWindow(window);
|
||||
glfwTerminate();
|
||||
|
||||
return 0;
|
||||
|
@ -496,6 +496,8 @@ int main(int, char**)
|
||||
ImGui_ImplGlfw_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
CleanupVulkan();
|
||||
|
||||
glfwDestroyWindow(window);
|
||||
glfwTerminate();
|
||||
|
||||
return 0;
|
||||
|
68
imgui.cpp
68
imgui.cpp
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.60 WIP
|
||||
// dear imgui, v1.61 WIP
|
||||
// (main code and documentation)
|
||||
|
||||
// Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code.
|
||||
@ -83,7 +83,7 @@
|
||||
- You can apply arithmetic operators +,*,/ on numerical values. Use +- to subtract (because - would set a negative value!)
|
||||
- Controls are automatically adjusted for OSX to match standard OSX text editing operations.
|
||||
- General Keyboard controls: enable with ImGuiConfigFlags_NavEnableKeyboard.
|
||||
- General Gamepad controls: enable with ImGuiConfigFlags_NavEnableGamepad. See suggested mappings in imgui.h ImGuiNavInput_ + download PNG/PSD at goo.gl/9LgVZW.
|
||||
- General Gamepad controls: enable with ImGuiConfigFlags_NavEnableGamepad. See suggested mappings in imgui.h ImGuiNavInput_ + download PNG/PSD at http://goo.gl/9LgVZW
|
||||
|
||||
|
||||
PROGRAMMER GUIDE
|
||||
@ -223,15 +223,6 @@
|
||||
|
||||
- The gamepad/keyboard navigation is in Beta. Ask questions and report issues at https://github.com/ocornut/imgui/issues/787
|
||||
- The initial focus was to support game controllers, but keyboard is becoming increasingly and decently usable.
|
||||
- Keyboard:
|
||||
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable.
|
||||
NewFrame() will automatically fill io.NavInputs[] based on your io.KeyDown[] + io.KeyMap[] arrays.
|
||||
- When keyboard navigation is active (io.NavActive + ImGuiConfigFlags_NavEnableKeyboard), the io.WantCaptureKeyboard flag
|
||||
will be set. For more advanced uses, you may want to read from:
|
||||
- io.NavActive: true when a window is focused and it doesn't have the ImGuiWindowFlags_NoNavInputs flag set.
|
||||
- io.NavVisible: true when the navigation cursor is visible (and usually goes false when mouse is used).
|
||||
- or query focus information with e.g. IsWindowFocused(), IsItemFocused() etc. functions.
|
||||
Please reach out if you think the game vs navigation input sharing could be improved.
|
||||
- Gamepad:
|
||||
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable.
|
||||
- Backend: Set io.BackendFlags |= ImGuiBackendFlags_HasGamepad + fill the io.NavInputs[] fields before calling NewFrame().
|
||||
@ -241,7 +232,16 @@
|
||||
- We uses a simple >0.0f test for activation testing, and won't attempt to test for a dead-zone.
|
||||
Your code will probably need to transform your raw inputs (such as e.g. remapping your 0.2..0.9 raw input range to 0.0..1.0 imgui range, etc.).
|
||||
- You can download PNG/PSD files depicting the gamepad controls for common controllers at: goo.gl/9LgVZW.
|
||||
- If you need to share inputs between your game and the imgui parts, the easiest approach is to go all-or-nothing, with a buttons combo to toggle the target.
|
||||
- If you need to share inputs between your game and the imgui parts, the easiest approach is to go all-or-nothing, with a buttons combo
|
||||
to toggle the target. Please reach out if you think the game vs navigation input sharing could be improved.
|
||||
- Keyboard:
|
||||
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable.
|
||||
NewFrame() will automatically fill io.NavInputs[] based on your io.KeyDown[] + io.KeyMap[] arrays.
|
||||
- When keyboard navigation is active (io.NavActive + ImGuiConfigFlags_NavEnableKeyboard), the io.WantCaptureKeyboard flag
|
||||
will be set. For more advanced uses, you may want to read from:
|
||||
- io.NavActive: true when a window is focused and it doesn't have the ImGuiWindowFlags_NoNavInputs flag set.
|
||||
- io.NavVisible: true when the navigation cursor is visible (and usually goes false when mouse is used).
|
||||
- or query focus information with e.g. IsWindowFocused(ImGuiFocusedFlags_AnyWindow), IsItemFocused() etc. functions.
|
||||
Please reach out if you think the game vs navigation input sharing could be improved.
|
||||
- Mouse:
|
||||
- PS4 users: Consider emulating a mouse cursor with DualShock4 touch pad or a spare analog stick as a mouse-emulation fallback.
|
||||
@ -1391,8 +1391,8 @@ ImU32 ImGui::GetColorU32(ImU32 col)
|
||||
float style_alpha = GImGui->Style.Alpha;
|
||||
if (style_alpha >= 1.0f)
|
||||
return col;
|
||||
int a = (col & IM_COL32_A_MASK) >> IM_COL32_A_SHIFT;
|
||||
a = (int)(a * style_alpha); // We don't need to clamp 0..255 because Style.Alpha is in 0..1 range.
|
||||
ImU32 a = (col & IM_COL32_A_MASK) >> IM_COL32_A_SHIFT;
|
||||
a = (ImU32)(a * style_alpha); // We don't need to clamp 0..255 because Style.Alpha is in 0..1 range.
|
||||
return (col & ~IM_COL32_A_MASK) | (a << IM_COL32_A_SHIFT);
|
||||
}
|
||||
|
||||
@ -1483,7 +1483,7 @@ void* ImFileLoadToMemory(const char* filename, const char* file_open_mode, int*
|
||||
}
|
||||
|
||||
int file_size = (int)file_size_signed;
|
||||
void* file_data = ImGui::MemAlloc(file_size + padding_bytes);
|
||||
void* file_data = ImGui::MemAlloc((size_t)(file_size + padding_bytes));
|
||||
if (file_data == NULL)
|
||||
{
|
||||
fclose(f);
|
||||
@ -1496,7 +1496,7 @@ void* ImFileLoadToMemory(const char* filename, const char* file_open_mode, int*
|
||||
return NULL;
|
||||
}
|
||||
if (padding_bytes > 0)
|
||||
memset((void *)(((char*)file_data) + file_size), 0, padding_bytes);
|
||||
memset((void *)(((char*)file_data) + file_size), 0, (size_t)padding_bytes);
|
||||
|
||||
fclose(f);
|
||||
if (out_file_size)
|
||||
@ -1783,7 +1783,7 @@ void ImGuiTextBuffer::appendfv(const char* fmt, va_list args)
|
||||
}
|
||||
|
||||
Buf.resize(needed_sz);
|
||||
ImFormatStringV(&Buf[write_off - 1], len + 1, fmt, args_copy);
|
||||
ImFormatStringV(&Buf[write_off - 1], (size_t)len + 1, fmt, args_copy);
|
||||
}
|
||||
|
||||
void ImGuiTextBuffer::appendf(const char* fmt, ...)
|
||||
@ -3881,7 +3881,7 @@ void ImGui::NewFrame()
|
||||
NewFrameUpdateMovingWindow();
|
||||
NewFrameUpdateHoveredWindowAndCaptureFlags();
|
||||
|
||||
if (ImGuiWindow* modal_window = GetFrontMostModalRootWindow())
|
||||
if (GetFrontMostModalRootWindow() != NULL)
|
||||
g.ModalWindowDarkeningRatio = ImMin(g.ModalWindowDarkeningRatio + g.IO.DeltaTime * 6.0f, 1.0f);
|
||||
else
|
||||
g.ModalWindowDarkeningRatio = 0.0f;
|
||||
@ -8560,32 +8560,6 @@ bool ImGui::CloseButton(ImGuiID id, const ImVec2& pos, float radius)
|
||||
return pressed;
|
||||
}
|
||||
|
||||
// [Internal]
|
||||
bool ImGui::ArrowButton(ImGuiID id, ImGuiDir dir, ImVec2 padding, ImGuiButtonFlags flags)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
|
||||
const ImGuiStyle& style = g.Style;
|
||||
|
||||
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(g.FontSize + padding.x * 2.0f, g.FontSize + padding.y * 2.0f));
|
||||
ItemSize(bb, style.FramePadding.y);
|
||||
if (!ItemAdd(bb, id))
|
||||
return false;
|
||||
|
||||
bool hovered, held;
|
||||
bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
|
||||
|
||||
const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
||||
RenderNavHighlight(bb, id);
|
||||
RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
|
||||
RenderArrow(bb.Min + padding, dir, 1.0f);
|
||||
|
||||
return pressed;
|
||||
}
|
||||
|
||||
void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col, const ImVec4& border_col)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
@ -9259,7 +9233,7 @@ static size_t GDataTypeSize[ImGuiDataType_COUNT] =
|
||||
// NB: This is _not_ a full expression evaluator. We should probably add one though..
|
||||
static bool DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* data_ptr, const char* scalar_format)
|
||||
{
|
||||
while (ImCharIsSpace(*buf))
|
||||
while (ImCharIsSpace((unsigned int)*buf))
|
||||
buf++;
|
||||
|
||||
// We don't support '-' op because it would conflict with inputing negative value.
|
||||
@ -9268,7 +9242,7 @@ static bool DataTypeApplyOpFromText(const char* buf, const char* initial_value_b
|
||||
if (op == '+' || op == '*' || op == '/')
|
||||
{
|
||||
buf++;
|
||||
while (ImCharIsSpace(*buf))
|
||||
while (ImCharIsSpace((unsigned int)*buf))
|
||||
buf++;
|
||||
}
|
||||
else
|
||||
@ -12505,7 +12479,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
||||
{
|
||||
value_changed = true;
|
||||
char* p = buf;
|
||||
while (*p == '#' || ImCharIsSpace(*p))
|
||||
while (*p == '#' || ImCharIsSpace((unsigned int)*p))
|
||||
p++;
|
||||
i[0] = i[1] = i[2] = i[3] = 0;
|
||||
if (alpha)
|
||||
|
8
imgui.h
8
imgui.h
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.60 WIP
|
||||
// dear imgui, v1.61 WIP
|
||||
// (headers)
|
||||
|
||||
// See imgui.cpp file for documentation.
|
||||
@ -21,7 +21,7 @@
|
||||
#include <stddef.h> // ptrdiff_t, NULL
|
||||
#include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp
|
||||
|
||||
#define IMGUI_VERSION "1.60 WIP"
|
||||
#define IMGUI_VERSION "1.61 WIP"
|
||||
#define IMGUI_HAS_VIEWPORT 1 // Viewport WIP branch
|
||||
|
||||
// Define attributes of all API symbols declarations, e.g. for DLL under Windows.
|
||||
@ -759,8 +759,8 @@ enum ImGuiKey_
|
||||
enum ImGuiNavInput_
|
||||
{
|
||||
// Gamepad Mapping
|
||||
ImGuiNavInput_Activate, // activate / open / toggle / tweak value // e.g. Circle (PS4), A (Xbox), A (Switch), Space (Keyboard)
|
||||
ImGuiNavInput_Cancel, // cancel / close / exit // e.g. Cross (PS4), B (Xbox), B (Switch), Escape (Keyboard)
|
||||
ImGuiNavInput_Activate, // activate / open / toggle / tweak value // e.g. Cross (PS4), A (Xbox), A (Switch), Space (Keyboard)
|
||||
ImGuiNavInput_Cancel, // cancel / close / exit // e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard)
|
||||
ImGuiNavInput_Input, // text input / on-screen keyboard // e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard)
|
||||
ImGuiNavInput_Menu, // tap: toggle menu / hold: focus, move, resize // e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard)
|
||||
ImGuiNavInput_DpadLeft, // move / tweak / resize window (w/ PadMenu) // e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard)
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.60 WIP
|
||||
// dear imgui, v1.61 WIP
|
||||
// (demo code)
|
||||
|
||||
// Message to the person tempted to delete this file when integrating ImGui into their code base:
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.60 WIP
|
||||
// dear imgui, v1.61 WIP
|
||||
// (drawing and font code)
|
||||
|
||||
// Contains implementation for
|
||||
@ -1640,6 +1640,7 @@ bool ImFontAtlas::GetMouseCursorTexData(ImGuiMouseCursor cursor_type, ImVec2* ou
|
||||
if (Flags & ImFontAtlasFlags_NoMouseCursors)
|
||||
return false;
|
||||
|
||||
IM_ASSERT(CustomRectIds[0] != -1);
|
||||
ImFontAtlas::CustomRect& r = CustomRects[CustomRectIds[0]];
|
||||
IM_ASSERT(r.ID == FONT_ATLAS_DEFAULT_TEX_DATA_ID);
|
||||
ImVec2 pos = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[cursor_type][0] + ImVec2((float)r.X, (float)r.Y);
|
||||
@ -2435,7 +2436,7 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons
|
||||
while (s < text_end)
|
||||
{
|
||||
const char c = *s;
|
||||
if (ImCharIsSpace(c)) { s++; } else if (c == '\n') { s++; break; } else { break; }
|
||||
if (ImCharIsSpace((unsigned int)c)) { s++; } else if (c == '\n') { s++; break; } else { break; }
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -2560,7 +2561,7 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
|
||||
while (s < text_end)
|
||||
{
|
||||
const char c = *s;
|
||||
if (ImCharIsSpace(c)) { s++; } else if (c == '\n') { s++; break; } else { break; }
|
||||
if (ImCharIsSpace((unsigned int)c)) { s++; } else if (c == '\n') { s++; break; } else { break; }
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.60 WIP
|
||||
// dear imgui, v1.61 WIP
|
||||
// (internals)
|
||||
|
||||
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
||||
@ -98,7 +98,7 @@ IMGUI_API int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, cons
|
||||
IMGUI_API ImU32 ImHash(const void* data, int data_size, ImU32 seed = 0); // Pass data_size==0 for zero-terminated strings
|
||||
IMGUI_API void* ImFileLoadToMemory(const char* filename, const char* file_open_mode, int* out_file_size = NULL, int padding_bytes = 0);
|
||||
IMGUI_API FILE* ImFileOpen(const char* filename, const char* file_open_mode);
|
||||
static inline bool ImCharIsSpace(int c) { return c == ' ' || c == '\t' || c == 0x3000; }
|
||||
static inline bool ImCharIsSpace(unsigned int c) { return c == ' ' || c == '\t' || c == 0x3000; }
|
||||
static inline bool ImIsPowerOfTwo(int v) { return v != 0 && (v & (v - 1)) == 0; }
|
||||
static inline int ImUpperPowerOfTwo(int v) { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; }
|
||||
|
||||
@ -1149,7 +1149,6 @@ namespace ImGui
|
||||
IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);
|
||||
IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0,0), ImGuiButtonFlags flags = 0);
|
||||
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos, float radius);
|
||||
IMGUI_API bool ArrowButton(ImGuiID id, ImGuiDir dir, ImVec2 padding, ImGuiButtonFlags flags = 0);
|
||||
|
||||
IMGUI_API bool SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags = 0);
|
||||
IMGUI_API bool SliderFloatN(const char* label, float* v, int components, float v_min, float v_max, const char* display_format, float power);
|
||||
|
Loading…
Reference in New Issue
Block a user