void MEditor::closeWindow(MWindow * window) { MGUI_closeWindow(window); }
// window events void winEvents(MWindow *rootWindow, MWIN_EVENT_TYPE event) { //MLOG(6, "Window Event : " << event); MEngine *engine = MEngine::getInstance(); switch (event) { case MWIN_EVENT_CREATE: { sys = new MGUIContext(); engine->setSystemContext(sys); // create a rendering context render = new MGLContext(); engine->setRenderingContext(render); // create a input context input = new MInput(); engine->setInputContext(input); // create a physics context physics = new MBulletContext(); engine->setPhysicsContext(physics); // create a renderer renderer = new MStandardRenderer(); engine->setRenderer(renderer); // create a level level = new MLevel(); engine->setLevel(level); // create a game game = new MyGame(); // MyGame engine->setGame(game); game->begin(); } break; case MWIN_EVENT_CLOSE: { MGUI_closeWindow(rootWindow); } break; case MWIN_EVENT_DESTROY: { game->end(); SAFE_DELETE(level); SAFE_DELETE(game); SAFE_DELETE(renderer); SAFE_DELETE(render); SAFE_DELETE(input); SAFE_DELETE(physics); SAFE_DELETE(sys); } break; default: break; } }