Wx In Non-Wx Applications

From WxWiki
Jump to: navigation, search

You can initialise wxWidgets from non-wxWidgets applications. You should look at the headers and not the docs for these functions, they are mostly internal and so far we have not decided yet what the best API would be for them so they are not documented.

In short you should use wxInitialize and wxUninitialize with a message loop in between, instead of just calling wxEntry. Indeed wxEntry basically calls wxEntryStart, then runs the MainLoop and calls wxEntryCleanup when the loop exits. wxInitialize and wxUninitialize will respectively call wxEntryStart and wxEntryCleanup.

Note that wxEntry has some tweaks with wxMSW. You should look at init.cpp to have an idea of what to do in addition to wxInitialize.

If you want to combine wxWidgets and SDL, look at http://code.technoplaza.net/wx-sdl/ -- but a couple of notes: if you want your app to be portable, you will need to provide your own main() function, and you will need to call SDL_Init before creating your window.