+void
+MainLoop::update_gamelogic(float elapsed_time)
+{
+ Scripting::update_debugger();
+ Scripting::TimeScheduler::instance->update(game_time);
+ current_screen->update(elapsed_time);
+ if(screen_fade.get() != NULL)
+ screen_fade->update(elapsed_time);
+ Console::instance->update(elapsed_time);
+}
+
+void
+MainLoop::process_events()
+{
+ main_controller->update();
+ SDL_Event event;
+ while(SDL_PollEvent(&event)) {
+ main_controller->process_event(event);
+ if(Menu::current() != NULL)
+ Menu::current()->event(event);
+ if(event.type == SDL_QUIT)
+ quit();
+ else if (event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_F11) {
+ config->use_fullscreen = !config->use_fullscreen;
+ init_video();
+ }
+ else if (event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_PRINT) {
+ take_screenshot();
+ }
+ }
+}
+
+void
+MainLoop::handle_screen_switch()
+{
+ while( (next_screen.get() != NULL || nextpop) &&
+ (screen_fade.get() == NULL || screen_fade->done())) {
+ if(current_screen.get() != NULL) {
+ current_screen->leave();
+ }
+
+ if(nextpop) {
+ if(screen_stack.empty()) {
+ running = false;