fix game panel size on wxGTK #325
On wxWidgets 3.1.2, which is what vcpkg uses (and we use vcpkg for Visual Studio) the wxEXPAND flag for the game area in the sizer throws an XRC error dialog, removing the flag works correctly on Windows, but not on wxGTK. As a workaround, do not use the wxEXPAND flag on Windows. TODO: with max zoom set, the game area is not centered vertically in wxGTK. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
f1ecd7c322
commit
a0283eadb6
|
@ -1034,7 +1034,16 @@ void GameArea::OnIdle(wxIdleEvent& event)
|
|||
|
||||
// add spacers on top and bottom to center panel vertically
|
||||
GetSizer()->Add(0, 0, 1, wxEXPAND);
|
||||
GetSizer()->Add(w, 0, gopts.retain_aspect ? (wxSHAPED | wxALIGN_CENTER) : wxEXPAND);
|
||||
|
||||
// On windows with the vcpkg version of wxWidgets which is 3.1.2, the
|
||||
// wxEXPAND flag throws an XRC error, but everything works fine without it.
|
||||
// On GTK however, the flag is necessary.
|
||||
#if defined(__WXMSW__)
|
||||
GetSizer()->Add(w, 0, gopts.retain_aspect ? (wxSHAPED | wxALIGN_CENTER_HORIZONTAL) : wxEXPAND);
|
||||
#else
|
||||
GetSizer()->Add(w, 0, gopts.retain_aspect ? (wxSHAPED | wxALIGN_CENTER_HORIZONTAL | wxEXPAND) : wxEXPAND);
|
||||
#endif
|
||||
|
||||
GetSizer()->Add(0, 0, 1, wxEXPAND);
|
||||
Layout();
|
||||
|
||||
|
|
Loading…
Reference in New Issue