mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-22 17:32:19 -05:00
Add multiviewport support for SDL (#1275)
This commit is contained in:
parent
d735616020
commit
70d7d66d0c
@ -41,8 +41,10 @@
|
||||
|
||||
#if __APPLE__
|
||||
#include <SDL_hints.h>
|
||||
#include <SDL_video.h>
|
||||
#else
|
||||
#include <SDL2/SDL_hints.h>
|
||||
#include <SDL2/SDL_video.h>
|
||||
#endif
|
||||
|
||||
#ifdef __SWITCH__
|
||||
@ -337,6 +339,8 @@ namespace SohImGui {
|
||||
switch (impl.backend) {
|
||||
case Backend::DX11:
|
||||
return true;
|
||||
case Backend::SDL:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -2398,8 +2402,18 @@ namespace SohImGui {
|
||||
ImGui::Render();
|
||||
ImGuiRenderDrawData(ImGui::GetDrawData());
|
||||
if (UseViewports()) {
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
if (impl.backend == Backend::SDL) {
|
||||
SDL_Window* backup_current_window = SDL_GL_GetCurrentWindow();
|
||||
SDL_GLContext backup_current_context = SDL_GL_GetCurrentContext();
|
||||
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
|
||||
SDL_GL_MakeCurrent(backup_current_window, backup_current_context);
|
||||
} else {
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,6 +189,7 @@ static void gfx_sdl_init(const char *game_name, bool start_in_fullscreen, uint32
|
||||
}
|
||||
#endif
|
||||
|
||||
SDL_GL_MakeCurrent(wnd, ctx);
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
|
||||
SohImGui::WindowImpl window_impl;
|
||||
|
Loading…
Reference in New Issue
Block a user