Skip to content

Commit

Permalink
Create GamePad window at correct size (#1247)
Browse files Browse the repository at this point in the history
Don't change the size on canvas initialization
  • Loading branch information
ColinKinloch committed Jun 29, 2024
1 parent aefbb91 commit 64b0b85
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/gui/PadViewFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,24 @@

extern WindowInfo g_window_info;

#define PAD_MIN_WIDTH 320
#define PAD_MIN_HEIGHT 180

PadViewFrame::PadViewFrame(wxFrame* parent)
: wxFrame(nullptr, wxID_ANY, _("GamePad View"), wxDefaultPosition, wxSize(854, 480), wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxCLOSE_BOX | wxWANTS_CHARS)
: wxFrame(nullptr, wxID_ANY, _("GamePad View"), wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxCLOSE_BOX | wxWANTS_CHARS)
{
gui_initHandleContextFromWxWidgetsWindow(g_window_info.window_pad, this);

SetIcon(wxICON(M_WND_ICON128));
wxWindow::EnableTouchEvents(wxTOUCH_PAN_GESTURES);

SetMinClientSize({ 320, 180 });
SetMinClientSize({ PAD_MIN_WIDTH, PAD_MIN_HEIGHT });

SetPosition({ g_window_info.restored_pad_x, g_window_info.restored_pad_y });
SetSize({ g_window_info.restored_pad_width, g_window_info.restored_pad_height });
if (g_window_info.restored_pad_width >= PAD_MIN_WIDTH && g_window_info.restored_pad_height >= PAD_MIN_HEIGHT)
SetClientSize({ g_window_info.restored_pad_width, g_window_info.restored_pad_height });
else
SetClientSize(wxSize(854, 480));

if (g_window_info.pad_maximized)
Maximize();
Expand Down Expand Up @@ -72,7 +78,7 @@ void PadViewFrame::InitializeRenderCanvas()
m_render_canvas = GLCanvas_Create(this, wxSize(854, 480), false);
sizer->Add(m_render_canvas, 1, wxEXPAND, 0, nullptr);
}
SetSizerAndFit(sizer);
SetSizer(sizer);
Layout();

m_render_canvas->Bind(wxEVT_KEY_UP, &PadViewFrame::OnKeyUp, this);
Expand Down

0 comments on commit 64b0b85

Please sign in to comment.