#include class window : public mx::mxWnd { public: window() : mxWnd(640, 480, 0) { // init code here } virtual void eventPassed(SDL_Event &e) { switch(e.type) { case SDL_QUIT: quit(); break; } if(e.type == SDL_KEYDOWN && e.key.keysym.sym == SDLK_ESCAPE) quit(); } virtual void renderScreen() { // draw here SDL_FillRect(front, 0, SDL_MapRGB(front, 255,255,255)); front.Flip(); } }; int main(int argc, char **argv) { try { window w; return w.messageLoop(); } catch(mx::mxException &e) { e.printError(std::cerr); } catch(std::exception &e) { std::cerr << e.what() << "\n"; } catch(...) { std::cout << "unhandled exception\n"; } return EXIT_FAILURE; }