Sketchy Multi Viewports
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user