It is a perfectly working code on Windows (10 and 11), but has two major issues (and one minor) on Linux (Fedora 35 and Ubuntu 20.04.4 LTS (Focal Fossa) in my case).
I'm using wxWidgets 3.0.5 and SDL2 2.0.22 on all platforms.
On Linux I use gcc 11.2
On Windows I use cl 19.33
In both case I compile for x64
I'm using CMake 3.8 to build and C++17 as language version
GetSize problem
Code: Select all
MainFrame* frame = new MainFrame("wxWidgets/SDL2");
frame->Maximize(true);
frame->Show(true);
wxSize size = frame->GetSize();
int multiplier = std::min(size.x / 320, size.y / 200);
frame->SDLPanel->SetSize(multiplier * 320, multiplier * 200);
frame->SDLPanel->CenterOnParent();
Event loop
Both wxWidgets and SDL2 part of the code runs an event loop. On Windows they work both perfectly, but on Linux SDL2 never gets a single event.
It seems that on Linux the events are all consumed by wxWidgets. To test it I made a version (not included here) where I use SDL_PumpEvents from within wxWidgets' event loop to force the event reaching SDL2. While this works fairly good I still wondering about the differences of platforms...