#include "control/input_manager.hpp"
#include "gui/menu.hpp"
#include "gui/menu_manager.hpp"
+#include "scripting/scripting.hpp"
#include "scripting/squirrel_util.hpp"
#include "scripting/time_scheduler.hpp"
#include "supertux/console.hpp"
#include "supertux/constants.hpp"
#include "supertux/gameconfig.hpp"
+#include "supertux/game_session.hpp"
#include "supertux/globals.hpp"
#include "supertux/main.hpp"
#include "supertux/menu/menu_storage.hpp"
assert(!m_screen_stack.empty());
static Uint32 fps_ticks = SDL_GetTicks();
- static int frame_count = 0;
m_screen_stack.back()->draw(context);
m_menu_manager->draw(context);
m_screen_fade->draw(context);
}
- Console::instance->draw(context);
+ Console::current()->draw(context);
if (g_config->show_fps)
{
/* Calculate frames per second */
if (g_config->show_fps)
{
+ static int frame_count = 0;
++frame_count;
if (SDL_GetTicks() - fps_ticks >= 500)
void
ScreenManager::update_gamelogic(float elapsed_time)
{
- scripting::update_debugger();
+ scripting::Scripting::current()->update_debugger();
scripting::TimeScheduler::instance->update(game_time);
if (!m_screen_stack.empty())
m_screen_fade->update(elapsed_time);
}
- Console::instance->update(elapsed_time);
+ Console::current()->update(elapsed_time);
}
void
ScreenManager::process_events()
{
- g_input_manager->update();
+ InputManager::current()->update();
SDL_Event event;
while (SDL_PollEvent(&event))
{
- g_input_manager->process_event(event);
+ InputManager::current()->process_event(event);
m_menu_manager->event(event);
switch(event.window.event)
{
case SDL_WINDOWEVENT_RESIZED:
- Renderer::instance()->resize(event.window.data1,
- event.window.data2);
+ VideoSystem::current()->resize(event.window.data1,
+ event.window.data2);
m_menu_manager->on_window_resize();
break;
+
+ case SDL_WINDOWEVENT_FOCUS_LOST:
+ if(GameSession::current() != NULL &&
+ GameSession::current()->is_active())
+ {
+ GameSession::current()->toggle_pause();
+ }
+ break;
}
break;
else if (event.key.keysym.sym == SDLK_F11)
{
g_config->use_fullscreen = !g_config->use_fullscreen;
- Renderer::instance()->apply_config();
+ VideoSystem::current()->apply_config();
m_menu_manager->on_window_resize();
}
else if (event.key.keysym.sym == SDLK_PRINTSCREEN ||
else if (event.key.keysym.sym == SDLK_F1 &&
event.key.keysym.mod & KMOD_CTRL)
{
- Console::instance->toggle();
+ Console::current()->toggle();
g_config->console_enabled = true;
g_config->save();
}
+ else if (event.key.keysym.sym == SDLK_F2 &&
+ event.key.keysym.mod & KMOD_CTRL)
+ {
+ g_config->developer_mode = !g_config->developer_mode;
+ log_info << "developer mode: " << g_config->developer_mode << std::endl;
+ }
break;
}
}
draw(context);
}
- sound_manager->update();
+ SoundManager::current()->update();
handle_screen_switch();
}