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