@@ -45,10 +45,14 @@ namespace OvEditor::Core
4545 SetSize ({ 1000 , 580 });
4646 SetPosition ({ 0 .f , 0 .f });
4747
48- auto & openProjectButton = CreateWidget<OvUI::Widgets::Buttons::Button>(" Open Project" );
49- auto & newProjectButton = CreateWidget<OvUI::Widgets::Buttons::Button>(" New Project" );
50- auto & pathField = CreateWidget<OvUI::Widgets::InputFields::InputText>(" " );
51- m_goButton = &CreateWidget<OvUI::Widgets::Buttons::Button>(" GO" );
48+ auto & actionBar = CreateWidget<OvUI::Widgets::Layout::Group>();
49+ actionBar.horizontal = true ;
50+ actionBar.stretchWidget = 2 ;
51+
52+ auto & openProjectButton = actionBar.CreateWidget <OvUI::Widgets::Buttons::Button>(" Open Project" );
53+ auto & newProjectButton = actionBar.CreateWidget <OvUI::Widgets::Buttons::Button>(" New Project" );
54+ auto & pathField = actionBar.CreateWidget <OvUI::Widgets::InputFields::InputText>(" " );
55+ m_goButton = &actionBar.CreateWidget <OvUI::Widgets::Buttons::Button>(" GO" );
5256
5357 pathField.ContentChangedEvent += [this , &pathField](std::string p_content) {
5458 pathField.content = std::filesystem::path{
@@ -118,7 +122,7 @@ namespace OvEditor::Core
118122
119123 auto & columns = CreateWidget<OvUI::Widgets::Layout::Columns<2 >>();
120124
121- columns.widths = { 750 , 500 };
125+ columns.widths = { - 1 , 0 };
122126
123127 // Sanitize the project registry before displaying it, so we avoid showing
124128 // corrupted/deleted projects.
@@ -162,11 +166,8 @@ namespace OvEditor::Core
162166 void Draw () override
163167 {
164168 ImGui::PushStyleVar (ImGuiStyleVar_WindowPadding, { 50 .f , 50 .f });
165- ImGui::PushStyleVar (ImGuiStyleVar_WindowRounding, 0 .f );
166-
167169 OvUI::Panels::PanelWindow::Draw ();
168-
169- ImGui::PopStyleVar (2 );
170+ ImGui::PopStyleVar (1 );
170171 }
171172
172173 private:
@@ -281,19 +282,43 @@ void OvEditor::Core::ProjectHub::SetupContext()
281282 /* Graphics context creation */
282283 m_driver = std::make_unique<OvRendering::Context::Driver>(OvRendering::Settings::DriverSettings{ false });
283284
284- m_uiManager = std::make_unique<OvUI::Core::UIManager>(m_window->GetGlfwWindow (),
285+ // DPI awareness BETA option
286+ const auto windowContentScale = m_window->GetContentScale ();
287+ const auto unifiedWindowContentScale = std::max (windowContentScale.first , windowContentScale.second );
288+
289+ if (!Settings::EditorSettings::BetaDpiAwarenessDialogPresented.Get () && unifiedWindowContentScale > 1 .0f )
290+ {
291+ Settings::EditorSettings::BetaDpiAwarenessDialogPresented.Set (true );
292+ const auto dpiAwarenessDialog = OvWindowing::Dialogs::MessageBox (
293+ " High DPI Monitor Detected" ,
294+ " Overload has detected that you might be running the editor from a high DPI monitor.\n\n "
295+ " Support for automatic DPI-scaling is currently in BETA and might result in weird spacings, "
296+ " icon sizes, layouts, and window sizes.\n\n "
297+ " Do you want to enable automatic DPI scaling anyway?\n\n "
298+ " (You can change this setting anytime from the menu bar: Settings > Appearance)" ,
299+ OvWindowing::Dialogs::MessageBox::EMessageType::QUESTION,
300+ OvWindowing::Dialogs::MessageBox::EButtonLayout::YES_NO
301+ );
302+ switch (dpiAwarenessDialog.GetUserAction ())
303+ {
304+ case OvWindowing::Dialogs::MessageBox::EUserAction::YES:
305+ Settings::EditorSettings::UIScale.Set (0 );
306+ default : break ;
307+ }
308+ }
309+
310+ m_uiManager = std::make_unique<OvUI::Core::UIManager>(
311+ *m_window,
285312 static_cast <OvUI::Styling::EStyle>(OvEditor::Settings::EditorSettings::ColorTheme.Get ())
286313 );
287314
288315 const auto fontPath = std::filesystem::current_path () / " Data" / " Editor" / " Fonts" / " Ruda-Bold.ttf" ;
289316
290- m_uiManager->LoadFont (std::string{ Settings::GetFontID (Settings::EFontSize::BIG) }, fontPath.string (), 20 );
291- m_uiManager->LoadFont (std::string{ Settings::GetFontID (Settings::EFontSize::MEDIUM) }, fontPath.string (), 18 );
292- m_uiManager->LoadFont (std::string{ Settings::GetFontID (Settings::EFontSize::SMALL) }, fontPath.string (), 16 );
293- m_uiManager->UseFont (std::string{ Settings::GetFontID (
294- static_cast <Settings::EFontSize>(Settings::EditorSettings::FontSize.Get ())
295- ) });
296-
317+ m_uiManager->LoadFont (" Ruda-Bold" , fontPath.string (), 18 );
318+ m_uiManager->UseFont (" Ruda-Bold" );
319+ const int uiScale = Settings::EditorSettings::UIScale.Get ();
320+ m_uiManager->SetScale (uiScale == 0 ? std::nullopt : std::make_optional (uiScale / 100 .0f ));
297321 m_uiManager->EnableEditorLayoutSave (false );
298322 m_uiManager->EnableDocking (false );
299323}
324+
0 commit comments