Add fullscreen support to Atlas

Add a fullscreen toggle to the View menu and with a global hotkey,
reusing the default one from the main game.

Unlike the current implementation this one doesn't need the game canvas
to be focused and also works on GTK.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser
2026-07-11 12:30:18 +02:00
parent 3c8b7dfa7a
commit 309ed5ef28
2 changed files with 8 additions and 10 deletions
@@ -202,16 +202,6 @@ private:
return;
}
// Alt+enter toggles fullscreen
if (evt.GetKeyCode() == WXK_RETURN && wxGetKeyState(WXK_ALT))
{
if (m_ScenarioEditor.IsFullScreen())
m_ScenarioEditor.ShowFullScreen(false);
else
m_ScenarioEditor.ShowFullScreen(true, wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION);
return;
}
if (evt.GetKeyCode() == 'c')
{
POST_MESSAGE(CameraReset, ());
@@ -520,6 +510,8 @@ ScenarioEditor::ScenarioEditor(wxWindow* parent)
menuView->AppendCheckItem(ID_Wireframe, _("&Wireframe"));
menuView->AppendCheckItem(ID_SmoothFramerate, _("Smooth framerate"));
menuView->AppendCheckItem(ID_BirdsEyeView, _("&Birds Eye View\tCtrl+B"));
auto* fullscreenItem = menuView->AppendCheckItem(wxID_ANY, _("&Fullscreen\tAlt+Enter"));
this->Bind(wxEVT_MENU, [this, fullscreenItem](auto&){ SetFullscreen(fullscreenItem->IsChecked()); });
menuView->Append(ID_CameraReset, _("&Reset camera"));
}
@@ -1006,6 +998,11 @@ void ScenarioEditor::OnBirdsEyeView(wxCommandEvent& event)
POST_MESSAGE(SetBirdsEyeView, (event.IsChecked()));
}
void ScenarioEditor::SetFullscreen(const bool enabled)
{
ShowFullScreen(enabled, wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION);
}
void ScenarioEditor::OnDumpState(wxCommandEvent& event)
{
wxDateTime time = wxDateTime::Now();
@@ -62,6 +62,7 @@ public:
void OnWireframe(wxCommandEvent& event);
void OnSmoothFramerate(wxCommandEvent& event);
void OnBirdsEyeView(wxCommandEvent& event);
void SetFullscreen(const bool enabled);
void OnCameraReset(wxCommandEvent& event);
void OnMessageTrace(wxCommandEvent& event);