Sketchy Multi Viewports

This commit is contained in:
2026-02-05 23:59:11 -06:00
parent 8581589bfe
commit 8b0192c9b8
8 changed files with 61 additions and 15 deletions

View File

@@ -52,7 +52,7 @@ void ImguiModule::onLoad() {
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Enable Multi-Viewport / Platform Windows
#ifdef CUSTOMFONT
io.Fonts->AddFontFromFileTTF(STRINGIZE_VALUE_OF(CUSTOMFONT), 13.0f);
#endif
@@ -60,6 +60,18 @@ void ImguiModule::onLoad() {
ImGui::StyleColorsDark();
//ImGui::StyleColorsLight();
// Setup scaling
ImGuiStyle& style = ImGui::GetStyle();
io.ConfigDpiScaleFonts = true; // [Experimental] Automatically overwrite style.FontScaleDpi in Begin() when Monitor DPI changes. This will scale fonts but _NOT_ scale sizes/padding for now.
io.ConfigDpiScaleViewports = true; // [Experimental] Scale Dear ImGui and Platform Windows when Monitor DPI changes.
// When viewports are enabled we tweak WindowRounding/WindowBg so platform windows can look identical to regular ones.
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
{
style.WindowRounding = 0.0f;
style.Colors[ImGuiCol_WindowBg].w = 1.0f;
}
// Setup Platform/Renderer backends
if(!windowInit())
std::cout << "windowInit failed\n";
@@ -73,9 +85,12 @@ void ImguiModule::onLoad() {
rendererRenderDrawData();
rendererNewFrame();
windowNewFrame();
ImGui::NewFrame();
if(ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable) {
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindowsDefault();
window->getWindowImpl().restoreContext();
}
});
rcmd_it = --wm->getRenderer()->getCmdList().end()++;
@@ -92,9 +107,14 @@ void ImguiModule::onLoad() {
rendererNewFrame();
windowNewFrame();
ImGui::NewFrame();
}
void ImguiModule::run() {
rendererNewFrame();
windowNewFrame();
ImGui::NewFrame();
};
bool ImguiModule::onEvent(const Archimedes::Event &e) {
return false;

View File

@@ -38,6 +38,8 @@ class ImguiModule : public Archimedes::Module {
~ImguiModule();
void onLoad() override;
void run() override;
bool onEvent(const Archimedes::Event&) override;