I'm basicly looking to get a native-like window GUI system into my OpenGL/Game. I need to display a single window to the user.
I'm looking into wxWidgets.
Because it works by "stealing" the WinMain/MainLoop, I'm trying to hack it so I can run its main loop on a separate thread.
Because I couldn't get its wxThread working well, I've done a "sample" with Windows Threads... but the initialization is still breaking on the wxWidgets internals...
Any feedback on this?
My code is this:
class MyApp: public wxApp
{
virtual bool OnInit();
};
DECLARE_APP(MyApp)
IMPLEMENT_APP_NO_MAIN(MyApp)
DWORD WINAPI MyThreadFunction( LPVOID lpParam )
{
wxApp* pApp = new MyApp();
wxApp::SetInstance(pApp);
int argc = 0; wxChar ** argv = NULL;
wxEntryStart(argc, argv);
pApp->CallOnInit();
pApp->OnRun();
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, wxCmdLineArgType lpCmdLine, int nCmdShow) {
DWORD id = 0;
CreateThread(NULL,0, MyThreadFunction,NULL, 0,&id);
assert(id != NULL);
return 0;
}
I've tried making the wxWidgets initialization code in the main thread, and only calling the CallOnInit() in the separate thread, but same result.