mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Removed leftover KeepAliveID() call in GetIDWithSeed() variant. (#5181) + doc tweaks.
This commit is contained in:
parent
e346059eef
commit
cb56b0b238
@ -43,6 +43,8 @@ Breaking changes:
|
|||||||
automatically handling event capture. Examples that are using the OSX backend have removed
|
automatically handling event capture. Examples that are using the OSX backend have removed
|
||||||
all the now-unnecessary calls to ImGui_ImplOSX_HandleEvent(), applications can do as well.
|
all the now-unnecessary calls to ImGui_ImplOSX_HandleEvent(), applications can do as well.
|
||||||
[@stuartcarnie] (#4821)
|
[@stuartcarnie] (#4821)
|
||||||
|
- Internals: calling ButtonBehavior() without calling ItemAdd() now requires a KeepAliveID().
|
||||||
|
This is because the KeepAliveID() call was moved from GetID() to ItemAdd()). (#5181)
|
||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
|
@ -17,56 +17,60 @@ You can find Windows binaries for some of those example applications at:
|
|||||||
|
|
||||||
Integration in a typical existing application, should take <20 lines when using standard backends.
|
Integration in a typical existing application, should take <20 lines when using standard backends.
|
||||||
|
|
||||||
At initialization:
|
```cpp
|
||||||
call ImGui::CreateContext()
|
At initialization:
|
||||||
call ImGui_ImplXXXX_Init() for each backend.
|
call ImGui::CreateContext()
|
||||||
|
call ImGui_ImplXXXX_Init() for each backend.
|
||||||
|
|
||||||
At the beginning of your frame:
|
At the beginning of your frame:
|
||||||
call ImGui_ImplXXXX_NewFrame() for each backend.
|
call ImGui_ImplXXXX_NewFrame() for each backend.
|
||||||
call ImGui::NewFrame()
|
call ImGui::NewFrame()
|
||||||
|
|
||||||
At the end of your frame:
|
At the end of your frame:
|
||||||
call ImGui::Render()
|
call ImGui::Render()
|
||||||
call ImGui_ImplXXXX_RenderDrawData() for your Renderer backend.
|
call ImGui_ImplXXXX_RenderDrawData() for your Renderer backend.
|
||||||
|
|
||||||
At shutdown:
|
At shutdown:
|
||||||
call ImGui_ImplXXXX_Shutdown() for each backend.
|
call ImGui_ImplXXXX_Shutdown() for each backend.
|
||||||
call ImGui::DestroyContext()
|
call ImGui::DestroyContext()
|
||||||
|
```
|
||||||
|
|
||||||
Example (using [backends/imgui_impl_win32.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_win32.cpp) + [backends/imgui_impl_dx11.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_dx11.cpp)):
|
Example (using [backends/imgui_impl_win32.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_win32.cpp) + [backends/imgui_impl_dx11.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_dx11.cpp)):
|
||||||
|
|
||||||
// Create a Dear ImGui context, setup some options
|
```cpp
|
||||||
ImGui::CreateContext();
|
// Create a Dear ImGui context, setup some options
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGui::CreateContext();
|
||||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable some options
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable some options
|
||||||
|
|
||||||
// Initialize Platform + Renderer backends (here: using imgui_impl_win32.cpp + imgui_impl_dx11.cpp)
|
// Initialize Platform + Renderer backends (here: using imgui_impl_win32.cpp + imgui_impl_dx11.cpp)
|
||||||
ImGui_ImplWin32_Init(my_hwnd);
|
ImGui_ImplWin32_Init(my_hwnd);
|
||||||
ImGui_ImplDX11_Init(my_d3d_device, my_d3d_device_context);
|
ImGui_ImplDX11_Init(my_d3d_device, my_d3d_device_context);
|
||||||
|
|
||||||
// Application main loop
|
// Application main loop
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
// Beginning of frame: update Renderer + Platform backend, start Dear ImGui frame
|
// Beginning of frame: update Renderer + Platform backend, start Dear ImGui frame
|
||||||
ImGui_ImplDX11_NewFrame();
|
ImGui_ImplDX11_NewFrame();
|
||||||
ImGui_ImplWin32_NewFrame();
|
ImGui_ImplWin32_NewFrame();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
// Any application code here
|
// Any application code here
|
||||||
ImGui::Text("Hello, world!");
|
ImGui::Text("Hello, world!");
|
||||||
|
|
||||||
// End of frame: render Dear ImGui
|
// End of frame: render Dear ImGui
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
|
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
|
||||||
|
|
||||||
// Swap
|
// Swap
|
||||||
g_pSwapChain->Present(1, 0);
|
g_pSwapChain->Present(1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shutdown
|
// Shutdown
|
||||||
ImGui_ImplDX11_Shutdown();
|
ImGui_ImplDX11_Shutdown();
|
||||||
ImGui_ImplWin32_Shutdown();
|
ImGui_ImplWin32_Shutdown();
|
||||||
ImGui::DestroyContext();
|
ImGui::DestroyContext();
|
||||||
|
```
|
||||||
|
|
||||||
Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
|
Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
|
||||||
Please read the comments and instruction at the top of each file.
|
Please read the comments and instruction at the top of each file.
|
||||||
|
@ -400,7 +400,7 @@ CODE
|
|||||||
- 2022/01/10 (1.87) - inputs: reworked keyboard IO. Removed io.KeyMap[], io.KeysDown[] in favor of calling io.AddKeyEvent(). Removed GetKeyIndex(), now unecessary. All IsKeyXXX() functions now take ImGuiKey values. All features are still functional until IMGUI_DISABLE_OBSOLETE_KEYIO is defined. Read Changelog and Release Notes for details.
|
- 2022/01/10 (1.87) - inputs: reworked keyboard IO. Removed io.KeyMap[], io.KeysDown[] in favor of calling io.AddKeyEvent(). Removed GetKeyIndex(), now unecessary. All IsKeyXXX() functions now take ImGuiKey values. All features are still functional until IMGUI_DISABLE_OBSOLETE_KEYIO is defined. Read Changelog and Release Notes for details.
|
||||||
- IsKeyPressed(MY_NATIVE_KEY_XXX) -> use IsKeyPressed(ImGuiKey_XXX)
|
- IsKeyPressed(MY_NATIVE_KEY_XXX) -> use IsKeyPressed(ImGuiKey_XXX)
|
||||||
- IsKeyPressed(GetKeyIndex(ImGuiKey_XXX)) -> use IsKeyPressed(ImGuiKey_XXX)
|
- IsKeyPressed(GetKeyIndex(ImGuiKey_XXX)) -> use IsKeyPressed(ImGuiKey_XXX)
|
||||||
- Backend writing to io.KeyMap[],io.KeysDown[] -> backend should call io.AddKeyEvent()
|
- Backend writing to io.KeyMap[],io.KeysDown[] -> backend should call io.AddKeyEvent() (+ call io.SetKeyEventNativeData() if you want legacy user code to stil function with legacy key codes).
|
||||||
- Backend writing to io.KeyCtrl, io.KeyShift.. -> backend should call io.AddKeyEvent() with ImGuiKey_ModXXX values. *IF YOU PULLED CODE BETWEEN 2021/01/10 and 2021/01/27: We used to have a io.AddKeyModsEvent() function which was now replaced by io.AddKeyEvent() with ImGuiKey_ModXXX values.*
|
- Backend writing to io.KeyCtrl, io.KeyShift.. -> backend should call io.AddKeyEvent() with ImGuiKey_ModXXX values. *IF YOU PULLED CODE BETWEEN 2021/01/10 and 2021/01/27: We used to have a io.AddKeyModsEvent() function which was now replaced by io.AddKeyEvent() with ImGuiKey_ModXXX values.*
|
||||||
- one case won't work with backward compatibility: if your custom backend used ImGuiKey as mock native indices (e.g. "io.KeyMap[ImGuiKey_A] = ImGuiKey_A") because those values are now larger than the legacy KeyDown[] array. Will assert.
|
- one case won't work with backward compatibility: if your custom backend used ImGuiKey as mock native indices (e.g. "io.KeyMap[ImGuiKey_A] = ImGuiKey_A") because those values are now larger than the legacy KeyDown[] array. Will assert.
|
||||||
- inputs: added ImGuiKey_ModCtrl/ImGuiKey_ModShift/ImGuiKey_ModAlt/ImGuiKey_ModSuper values to submit keyboard modifiers using io.AddKeyEvent(), instead of writing directly to io.KeyCtrl, io.KeyShift, io.KeyAlt, io.KeySuper.
|
- inputs: added ImGuiKey_ModCtrl/ImGuiKey_ModShift/ImGuiKey_ModAlt/ImGuiKey_ModSuper values to submit keyboard modifiers using io.AddKeyEvent(), instead of writing directly to io.KeyCtrl, io.KeyShift, io.KeyAlt, io.KeySuper.
|
||||||
@ -7439,7 +7439,6 @@ void ImGui::PushOverrideID(ImGuiID id)
|
|||||||
ImGuiID ImGui::GetIDWithSeed(const char* str, const char* str_end, ImGuiID seed)
|
ImGuiID ImGui::GetIDWithSeed(const char* str, const char* str_end, ImGuiID seed)
|
||||||
{
|
{
|
||||||
ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed);
|
ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed);
|
||||||
KeepAliveID(id);
|
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (g.DebugHookIdInfo == id)
|
if (g.DebugHookIdInfo == id)
|
||||||
DebugHookIdInfo(id, ImGuiDataType_String, str, str_end);
|
DebugHookIdInfo(id, ImGuiDataType_String, str, str_end);
|
||||||
|
Loading…
Reference in New Issue
Block a user