mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-11 19:39:29 +08:00
Viewports, DPI: Renamed config flags. (#1542)
This commit is contained in:
parent
0d5042f0f3
commit
7ddc22b326
@ -117,8 +117,8 @@ int main(int, char**)
|
||||
// Setup ImGui binding
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_EnableViewports;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarIconsForViewports;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsNoTaskBarIcons;
|
||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||
|
||||
ImGui_ImplWin32_Init(hwnd);
|
||||
@ -209,7 +209,7 @@ int main(int, char**)
|
||||
ImGui_ImplDX10_RenderDrawData(ImGui::GetDrawData());
|
||||
|
||||
// Update and Render additional Platform Windows
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
|
@ -97,7 +97,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
case WM_DPICHANGED:
|
||||
if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_EnableDpiScaleViewports)
|
||||
if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_DpiEnableScaleViewports)
|
||||
{
|
||||
//const int dpi = HIWORD(wParam);
|
||||
//printf("WM_DPICHANGED to %d (%.0f%%)\n", dpi, (float)dpi / 96.0f * 100.0f);
|
||||
@ -133,10 +133,10 @@ int main(int, char**)
|
||||
// Setup ImGui binding
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_EnableViewports;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_EnableDpiScaleFonts;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_EnableDpiScaleViewports;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarIconsForViewports;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsNoTaskBarIcons;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_DpiEnableScaleFonts;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_DpiEnableScaleViewports;
|
||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||
|
||||
ImGui_ImplWin32_Init(hwnd);
|
||||
@ -227,7 +227,7 @@ int main(int, char**)
|
||||
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
|
||||
|
||||
// Update and Render additional Platform Windows
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
|
@ -289,7 +289,7 @@ int main(int, char**)
|
||||
// Setup ImGui binding
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_EnableViewports;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||
|
||||
ImGui_ImplWin32_Init(hwnd);
|
||||
@ -402,7 +402,7 @@ int main(int, char**)
|
||||
g_pd3dCommandQueue->ExecuteCommandLists(1, (ID3D12CommandList* const*)&g_pd3dCommandList);
|
||||
|
||||
// Update and Render additional Platform Windows
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
// Implemented features:
|
||||
// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
|
||||
// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
||||
@ -484,7 +484,7 @@ bool ImGui_ImplDX10_Init(ID3D10Device* device)
|
||||
// Setup back-end capabilities flags
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplDX10_InitPlatformInterface();
|
||||
return true;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
// Implemented features:
|
||||
// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
|
||||
// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
// Implemented features:
|
||||
// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
|
||||
// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
||||
@ -491,7 +491,7 @@ bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_co
|
||||
// Setup back-end capabilities flags
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplDX11_InitPlatformInterface();
|
||||
return true;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
// Implemented features:
|
||||
// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
|
||||
// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
||||
|
@ -608,7 +608,7 @@ bool ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FO
|
||||
// FIXME-VIEWPORT: Actually unfinshed..
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplDX12_InitPlatformInterface();
|
||||
|
||||
return true;
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
// Implemented features:
|
||||
// [X] Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
||||
// [X] Multi-viewport windows (when ImGuiConfigFlags_EnableViewports is enabled).
|
||||
// [X] Multi-viewport windows (when ImGuiConfigFlags_ViewportsEnable is enabled).
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
||||
@ -170,7 +170,7 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw
|
||||
// Our mouse update function expect PlatformHandle to be filled for the main viewport
|
||||
ImGuiViewport* main_viewport = ImGui::GetMainViewport();
|
||||
main_viewport->PlatformHandle = (void*)g_Window;
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplGlfw_InitPlatformInterface();
|
||||
|
||||
g_ClientApi = client_api;
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
// Implemented features:
|
||||
// [X] Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
||||
// [X] Multi-viewport windows (when ImGuiConfigFlags_EnableViewports is enabled).
|
||||
// [X] Multi-viewport windows (when ImGuiConfigFlags_ViewportsEnable is enabled).
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
// Implemented features:
|
||||
// [X] User texture binding. Use 'GLUint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
|
||||
// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
|
||||
|
||||
// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
||||
// **Prefer using the code in imgui_impl_opengl3.cpp**
|
||||
@ -51,7 +51,7 @@ bool ImGui_ImplOpenGL2_Init()
|
||||
// Setup back-end capabilities flags
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplOpenGL2_InitPlatformInterface();
|
||||
return true;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
// Implemented features:
|
||||
// [X] User texture binding. Use 'GLUint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
|
||||
// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
|
||||
|
||||
// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
||||
// **Prefer using the code in imgui_impl_opengl3.cpp**
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
// Implemented features:
|
||||
// [X] User texture binding. Use 'GLUint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
|
||||
// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
|
||||
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
@ -53,7 +53,7 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
||||
// Setup back-end capabilities flags
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplOpenGL3_InitPlatformInterface();
|
||||
return true;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
// Implemented features:
|
||||
// [X] User texture binding. Use 'GLUint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
|
||||
// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
|
||||
|
||||
IMGUI_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL);
|
||||
IMGUI_API void ImGui_ImplOpenGL3_Shutdown();
|
||||
|
@ -3,7 +3,7 @@
|
||||
// (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Multi-viewport windows (when ImGuiConfigFlags_EnableViewports is enabled).
|
||||
// [X] Multi-viewport windows (when ImGuiConfigFlags_ViewportsEnable is enabled).
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
||||
@ -178,7 +178,7 @@ bool ImGui_ImplSDL2_Init(SDL_Window* window, void* sdl_gl_context)
|
||||
|
||||
// We need SDL_CaptureMouse(), SDL_GetGlobalMouseState() from SDL 2.0.4+ to support multiple viewports.
|
||||
// We left the call to ImGui_ImplSDL2_InitPlatformInterface() outside of #ifdef to avoid unused-function warnings.
|
||||
if ((io.ConfigFlags & ImGuiConfigFlags_EnableViewports) && (io.BackendFlags & ImGuiBackendFlags_PlatformHasViewports))
|
||||
if ((io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) && (io.BackendFlags & ImGuiBackendFlags_PlatformHasViewports))
|
||||
ImGui_ImplSDL2_InitPlatformInterface(window, sdl_gl_context);
|
||||
|
||||
return true;
|
||||
|
@ -3,7 +3,7 @@
|
||||
// (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Multi-viewport windows (when ImGuiConfigFlags_EnableViewports is enabled).
|
||||
// [X] Multi-viewport windows (when ImGuiConfigFlags_ViewportsEnable is enabled).
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
// Missing features:
|
||||
// [ ] User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914
|
||||
// [ ] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled). WORK-IN-PROGRESS.
|
||||
// [ ] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled). WORK-IN-PROGRESS.
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||
// If you use this binding you'll need to call 5 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXX_CreateFontsTexture(), ImGui_ImplXXXX_NewFrame(), ImGui_ImplXXXX_Render() and ImGui_ImplXXXX_Shutdown().
|
||||
@ -718,7 +718,7 @@ bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info, VkRenderPass rend
|
||||
// Setup back-end capabilities flags
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplVulkan_InitPlatformInterface();
|
||||
|
||||
return true;
|
||||
@ -1221,7 +1221,7 @@ static void ImGui_ImplVulkan_SwapBuffers(ImGuiViewport* viewport, void*)
|
||||
void ImGui_ImplVulkan_InitPlatformInterface()
|
||||
{
|
||||
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
|
||||
if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
IM_ASSERT(platform_io.Platform_CreateVkSurface != NULL && "Platform needs to setup the CreateVkSurface handler.");
|
||||
platform_io.Renderer_CreateWindow = ImGui_ImplVulkan_CreateWindow;
|
||||
platform_io.Renderer_DestroyWindow = ImGui_ImplVulkan_DestroyWindow;
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
// Missing features:
|
||||
// [ ] User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914
|
||||
// [ ] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled). WORK-IN-PROGRESS.
|
||||
// [ ] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled). WORK-IN-PROGRESS.
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||
// If you use this binding you'll need to call 5 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXX_CreateFontsTexture(), ImGui_ImplXXXX_NewFrame(), ImGui_ImplXXXX_Render() and ImGui_ImplXXXX_Shutdown().
|
||||
|
@ -50,7 +50,7 @@ bool ImGui_ImplWin32_Init(void* hwnd)
|
||||
g_hWnd = (HWND)hwnd;
|
||||
ImGuiViewport* main_viewport = ImGui::GetMainViewport();
|
||||
main_viewport->PlatformHandle = (void*)g_hWnd;
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplWin32_InitPlatformInterface();
|
||||
|
||||
// Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array that we will update during the application lifetime.
|
||||
|
@ -30,8 +30,8 @@ int main(int, char**)
|
||||
// Setup ImGui binding
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_EnableViewports;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarIconsForViewports;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsNoTaskBarIcons;
|
||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||
ImGui_ImplGlfw_InitForOpenGL(window, true);
|
||||
ImGui_ImplOpenGL2_Init();
|
||||
@ -118,7 +118,7 @@ int main(int, char**)
|
||||
ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData());
|
||||
|
||||
// Update and Render additional Platform Windows
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
|
@ -35,8 +35,8 @@ int main(int, char**)
|
||||
// Setup ImGui binding
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_EnableViewports;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarIconsForViewports;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsNoTaskBarIcons;
|
||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
||||
|
||||
@ -125,7 +125,7 @@ int main(int, char**)
|
||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||
|
||||
// Update and Render additional Platform Windows
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
|
@ -37,8 +37,8 @@ int main(int, char**)
|
||||
// Setup ImGui binding
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_EnableViewports;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarIconsForViewports;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsNoTaskBarIcons;
|
||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||
|
||||
ImGui_ImplSDL2_Init(window, gl_context);
|
||||
@ -133,7 +133,7 @@ int main(int, char**)
|
||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||
|
||||
// Update and Render additional Platform Windows
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
|
@ -334,8 +334,8 @@ int main(int, char**)
|
||||
// Setup ImGui binding
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_EnableViewports;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarIconsForViewports;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsNoTaskBarIcons;
|
||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||
|
||||
// Setup SDL binding
|
||||
@ -470,7 +470,7 @@ int main(int, char**)
|
||||
FrameRender(wd);
|
||||
|
||||
// Update and Render additional Platform Windows
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
|
@ -346,8 +346,8 @@ int main(int, char**)
|
||||
// Setup ImGui binding
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_EnableViewports;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NoTaskBarIconsForViewports;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsNoTaskBarIcons;
|
||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||
|
||||
// Setup GLFW binding
|
||||
@ -480,7 +480,7 @@ int main(int, char**)
|
||||
FrameRender(wd);
|
||||
|
||||
// Update and Render additional Platform Windows
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
|
22
imgui.cpp
22
imgui.cpp
@ -3291,7 +3291,7 @@ static void ImGui::NewFrameUpdateMovingWindowDropViewport(ImGuiWindow* window)
|
||||
// On release we either drop window over an existing viewport or create a new one
|
||||
// (We convert position from one viewport space to another, which is unnecessary at the moment but allows us to have viewport overlapping in term of imgui position)
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_EnableViewports))
|
||||
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_ViewportsEnable))
|
||||
return;
|
||||
|
||||
ImRect mouse_viewport_rect = g.MousePosViewport->GetRect();
|
||||
@ -3441,7 +3441,7 @@ static void ImGui::UpdateViewports()
|
||||
if (viewport->DpiScale != 0.0f && new_dpi_scale != viewport->DpiScale)
|
||||
{
|
||||
float scale_factor = new_dpi_scale / viewport->DpiScale;
|
||||
if (g.IO.ConfigFlags & ImGuiConfigFlags_EnableDpiScaleViewports)
|
||||
if (g.IO.ConfigFlags & ImGuiConfigFlags_DpiEnableScaleViewports)
|
||||
ScaleWindowsInViewport(viewport, scale_factor);
|
||||
//if (viewport == GetMainViewport())
|
||||
// g.PlatformInterface.SetWindowSize(viewport, viewport->Size * scale_factor);
|
||||
@ -3457,11 +3457,11 @@ static void ImGui::UpdateViewports()
|
||||
ImGuiViewportP* main_viewport = g.Viewports[0];
|
||||
IM_ASSERT(main_viewport->ID == IMGUI_VIEWPORT_DEFAULT_ID);
|
||||
ImVec2 main_viewport_platform_pos = ImVec2(0.0f, 0.0f);
|
||||
if ((g.IO.ConfigFlags & ImGuiConfigFlags_EnableViewports))
|
||||
if ((g.IO.ConfigFlags & ImGuiConfigFlags_ViewportsEnable))
|
||||
main_viewport_platform_pos = g.PlatformIO.Platform_GetWindowPos(main_viewport);
|
||||
Viewport(NULL, IMGUI_VIEWPORT_DEFAULT_ID, ImGuiViewportFlags_CanHostOtherWindows, main_viewport_platform_pos, g.IO.DisplaySize);
|
||||
|
||||
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_EnableViewports))
|
||||
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_ViewportsEnable))
|
||||
{
|
||||
g.MousePosViewport = g.MousePosPrevViewport = main_viewport;
|
||||
return;
|
||||
@ -3527,7 +3527,7 @@ void ImGui::UpdatePlatformWindows()
|
||||
IM_ASSERT(g.FrameCountEnded == g.FrameCount && "Forgot to call Render() or EndFrame() before UpdatePlatformWindows()?");
|
||||
IM_ASSERT(g.FrameCountPlatformEnded < g.FrameCount);
|
||||
g.FrameCountPlatformEnded = g.FrameCount;
|
||||
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_EnableViewports))
|
||||
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_ViewportsEnable))
|
||||
return;
|
||||
|
||||
// Create/resize/destroy platform windows to match each active viewport. Update the user-facing list.
|
||||
@ -3552,7 +3552,7 @@ void ImGui::UpdatePlatformWindows()
|
||||
// Update ImGuiViewportFlags_NoTaskBarIcon flag
|
||||
if (viewport->Window != NULL)
|
||||
{
|
||||
bool no_task_bar_icon = (g.IO.ConfigFlags & ImGuiConfigFlags_NoTaskBarIconsForViewports) != 0 || (viewport->Window->Flags & (ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup)) != 0;
|
||||
bool no_task_bar_icon = (g.IO.ConfigFlags & ImGuiConfigFlags_ViewportsNoTaskBarIcons) != 0 || (viewport->Window->Flags & (ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup)) != 0;
|
||||
viewport->Flags = no_task_bar_icon ? (viewport->Flags | ImGuiViewportFlags_NoTaskBarIcon) : (viewport->Flags & ~ImGuiViewportFlags_NoTaskBarIcon);
|
||||
}
|
||||
|
||||
@ -3619,7 +3619,7 @@ void ImGui::UpdatePlatformWindows()
|
||||
//
|
||||
void ImGui::RenderPlatformWindowsDefault(void* platform_render_arg, void* renderer_render_arg)
|
||||
{
|
||||
if (!(ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_EnableViewports))
|
||||
if (!(ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable))
|
||||
return;
|
||||
|
||||
// Skip the main viewport (index 0), which is always fully handled by the application!
|
||||
@ -3780,7 +3780,7 @@ void ImGui::NewFrame()
|
||||
IM_ASSERT(g.IO.KeyMap[ImGuiKey_Space] != -1 && "ImGuiKey_Space is not mapped, required for keyboard navigation.");
|
||||
|
||||
// Perform simple checks for multi-viewport and platform windows support
|
||||
if (g.IO.ConfigFlags & ImGuiConfigFlags_EnableViewports)
|
||||
if (g.IO.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
if ((g.IO.BackendFlags & ImGuiBackendFlags_PlatformHasViewports) && (g.IO.BackendFlags & ImGuiBackendFlags_RendererHasViewports))
|
||||
{
|
||||
@ -3795,7 +3795,7 @@ void ImGui::NewFrame()
|
||||
else
|
||||
{
|
||||
// Disable feature, our back-ends do not support it
|
||||
g.IO.ConfigFlags &= ~ImGuiConfigFlags_EnableViewports;
|
||||
g.IO.ConfigFlags &= ~ImGuiConfigFlags_ViewportsEnable;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6088,7 +6088,7 @@ static void ImGui::UpdateSelectWindowViewport(ImGuiWindow* window)
|
||||
|
||||
// Restore main viewport if multi-viewport is not supported by the back-end
|
||||
ImGuiViewportP* main_viewport = g.Viewports[0];
|
||||
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_EnableViewports))
|
||||
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_ViewportsEnable))
|
||||
{
|
||||
window->Viewport = main_viewport;
|
||||
window->ViewportId = main_viewport->ID;
|
||||
@ -6475,7 +6475,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
|
||||
UpdateSelectWindowViewport(window);
|
||||
SetCurrentViewport(window->Viewport);
|
||||
window->FontDpiScale = (g.IO.ConfigFlags & ImGuiConfigFlags_EnableDpiScaleFonts) ? window->Viewport->DpiScale : 1.0f;
|
||||
window->FontDpiScale = (g.IO.ConfigFlags & ImGuiConfigFlags_DpiEnableScaleFonts) ? window->Viewport->DpiScale : 1.0f;
|
||||
SetCurrentWindow(window);
|
||||
flags = window->Flags;
|
||||
|
||||
|
14
imgui.h
14
imgui.h
@ -798,10 +798,10 @@ enum ImGuiConfigFlags_
|
||||
ImGuiConfigFlags_NoMouseCursorChange = 1 << 5, // Instruct back-end to not alter mouse cursor shape and visibility.
|
||||
|
||||
// [BETA] Viewports
|
||||
ImGuiConfigFlags_EnableViewports = 1 << 10, // Viewport enable flags (require both ImGuiConfigFlags_PlatformHasViewports + ImGuiConfigFlags_RendererHasViewports set by the respective back-ends)
|
||||
ImGuiConfigFlags_EnableDpiScaleViewports = 1 << 11,
|
||||
ImGuiConfigFlags_EnableDpiScaleFonts = 1 << 12,
|
||||
ImGuiConfigFlags_NoTaskBarIconsForViewports = 1 << 13,
|
||||
ImGuiConfigFlags_ViewportsEnable = 1 << 10, // Viewport enable flags (require both ImGuiConfigFlags_PlatformHasViewports + ImGuiConfigFlags_RendererHasViewports set by the respective back-ends)
|
||||
ImGuiConfigFlags_ViewportsNoTaskBarIcons = 1 << 11, // Disable task bars icons for all secondary viewports (will set ImGuiViewportFlags_NoTaskBarIcon on them)
|
||||
ImGuiConfigFlags_DpiEnableScaleViewports = 1 << 12,
|
||||
ImGuiConfigFlags_DpiEnableScaleFonts = 1 << 13,
|
||||
|
||||
// User storage (to allow your back-end/engine to communicate to code that may be shared between multiple projects. Those flags are not used by core ImGui)
|
||||
ImGuiConfigFlags_IsSRGB = 1 << 20, // Application is SRGB-aware.
|
||||
@ -1875,8 +1875,8 @@ struct ImFont
|
||||
// - if you are new to dear imgui and trying to integrate it into your engine, you should probably ignore this for now.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// (Optional) Setup required only if (io.ConfigFlags & ImGuiConfigFlags_EnableViewports) is enabled
|
||||
// This is designed so we can mix and match two imgui_impl_xxxx files, one for the Platform (~ Windowing), one for Renderer.
|
||||
// (Optional) Setup required only if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) is enabled
|
||||
// This is designed so we can mix and match two imgui_impl_xxxx files, one for the Platform (~window handling), one for Renderer.
|
||||
// Custom engine back-ends will often provide both Platform and Renderer interfaces and thus may not need to use all functions.
|
||||
// Platform functions are typically called before their Renderer counterpart, apart from Destroy which are called the other way.
|
||||
// RenderPlatformWindowsDefault() basically iterate secondary viewports and call Platform+Renderer's RenderWindow then Platform+Renderer's SwapBuffers,
|
||||
@ -1924,7 +1924,7 @@ enum ImGuiViewportFlags_
|
||||
ImGuiViewportFlags_NoDecoration = 1 << 0, // Platform Window: Disable platform title bar, borders, etc.
|
||||
ImGuiViewportFlags_NoFocusOnAppearing = 1 << 1, // Platform Window: Don't take focus when created.
|
||||
ImGuiViewportFlags_NoInputs = 1 << 2, // Platform Window: Make mouse pass through so we can drag this window while peaking behind it.
|
||||
ImGuiViewportFlags_NoTaskBarIcon = 1 << 3, // Platform Window: Disable platform task bar icon (for popups, menus, or all windows if ImGuiConfigFlags_NoTaskBarIconsForViewports if set)
|
||||
ImGuiViewportFlags_NoTaskBarIcon = 1 << 3, // Platform Window: Disable platform task bar icon (for popups, menus, or all windows if ImGuiConfigFlags_ViewportsNoTaskBarIcons if set)
|
||||
ImGuiViewportFlags_NoRendererClear = 1 << 4 // Platform Window: Renderer doesn't need to clear the framebuffer ahead.
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user