mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-22 09:09:18 +01:00
Create GamePad window at correct size (#1247)
Don't change the size on canvas initialization
This commit is contained in:
parent
aefbb918be
commit
64b0b85ed5
@ -20,18 +20,24 @@
|
|||||||
|
|
||||||
extern WindowInfo g_window_info;
|
extern WindowInfo g_window_info;
|
||||||
|
|
||||||
|
#define PAD_MIN_WIDTH 320
|
||||||
|
#define PAD_MIN_HEIGHT 180
|
||||||
|
|
||||||
PadViewFrame::PadViewFrame(wxFrame* parent)
|
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);
|
gui_initHandleContextFromWxWidgetsWindow(g_window_info.window_pad, this);
|
||||||
|
|
||||||
SetIcon(wxICON(M_WND_ICON128));
|
SetIcon(wxICON(M_WND_ICON128));
|
||||||
wxWindow::EnableTouchEvents(wxTOUCH_PAN_GESTURES);
|
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 });
|
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)
|
if (g_window_info.pad_maximized)
|
||||||
Maximize();
|
Maximize();
|
||||||
@ -72,7 +78,7 @@ void PadViewFrame::InitializeRenderCanvas()
|
|||||||
m_render_canvas = GLCanvas_Create(this, wxSize(854, 480), false);
|
m_render_canvas = GLCanvas_Create(this, wxSize(854, 480), false);
|
||||||
sizer->Add(m_render_canvas, 1, wxEXPAND, 0, nullptr);
|
sizer->Add(m_render_canvas, 1, wxEXPAND, 0, nullptr);
|
||||||
}
|
}
|
||||||
SetSizerAndFit(sizer);
|
SetSizer(sizer);
|
||||||
Layout();
|
Layout();
|
||||||
|
|
||||||
m_render_canvas->Bind(wxEVT_KEY_UP, &PadViewFrame::OnKeyUp, this);
|
m_render_canvas->Bind(wxEVT_KEY_UP, &PadViewFrame::OnKeyUp, this);
|
||||||
|
Loading…
Reference in New Issue
Block a user