Sketchy Multi Viewports
This commit is contained in:
@@ -151,6 +151,8 @@ double Calculator::evaluate(std::string equation, std::unordered_map<char, std::
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string Calculator::calculate(std::string equation) {
|
||||
|
||||
@@ -17,7 +17,7 @@ class Calculator : public Archimedes::Module {
|
||||
|
||||
bool parenthesis = true;
|
||||
|
||||
bool graphing = false;
|
||||
//bool graphing = false;
|
||||
|
||||
void basicCalculator();
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -38,6 +38,8 @@ class ImguiModule : public Archimedes::Module {
|
||||
~ImguiModule();
|
||||
|
||||
void onLoad() override;
|
||||
|
||||
void run() override;
|
||||
|
||||
bool onEvent(const Archimedes::Event&) override;
|
||||
|
||||
|
||||
@@ -56,6 +56,8 @@ void MainGUI::run() {
|
||||
|
||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
|
||||
ImGui::End();
|
||||
|
||||
ImGui::ShowDemoWindow();
|
||||
} else {
|
||||
app->end();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user