/* Process actions done on the menu */
void
-Menu::update()
+Menu::process_input()
{
int menu_height = (int) get_height();
if (menu_height > SCREEN_HEIGHT)
case MN_TEXTFIELD:
case MN_NUMFIELD:
menuaction = MENU_ACTION_DOWN;
- update();
+ process_input();
break;
case MN_BACK:
virtual void menu_action(MenuItem* item);
- void update();
+ void process_input();
/** Perform actions to bring the menu up to date with configuration changes */
virtual void refresh() {}
}
void
-MenuManager::update()
+MenuManager::process_input()
{
if (current())
{
- current()->update();
+ current()->process_input();
}
}
}
void
-MenuManager::recalc_pos()
+MenuManager::on_window_resize()
{
for(auto i = m_menu_stack.begin(); i != m_menu_stack.end(); ++i)
{
~MenuManager();
void event(const SDL_Event& event);
- void update();
+ void process_input();
void refresh();
void draw(DrawingContext& context);
void pop_menu();
void clear_menu_stack();
- void recalc_pos();
+ void on_window_resize();
bool is_active() const
{
return !m_menu_stack.empty();
{
g_config->aspect_size = Size(0, 0); // Magic values
Renderer::instance()->apply_config();
- MenuManager::instance().recalc_pos();
+ MenuManager::instance().on_window_resize();
}
else if (sscanf(item->list[item->selected].c_str(), "%d:%d",
&g_config->aspect_size.width, &g_config->aspect_size.height) == 2)
{
Renderer::instance()->apply_config();
- MenuManager::instance().recalc_pos();
+ MenuManager::instance().on_window_resize();
}
else
{
g_config->magnification /= 100.0f;
}
Renderer::instance()->apply_config();
- MenuManager::instance().recalc_pos();
+ MenuManager::instance().on_window_resize();
break;
case MNID_FULLSCREEN_RESOLUTION:
if(g_config->use_fullscreen != is_toggled(MNID_FULLSCREEN)) {
g_config->use_fullscreen = !g_config->use_fullscreen;
Renderer::instance()->apply_config();
- MenuManager::instance().recalc_pos();
+ MenuManager::instance().on_window_resize();
g_config->save();
}
break;
scripting::update_debugger();
scripting::TimeScheduler::instance->update(game_time);
current_screen->update(elapsed_time);
- m_menu_manager->update();
+ m_menu_manager->process_input();
if(screen_fade.get() != NULL)
screen_fade->update(elapsed_time);
Console::instance->update(elapsed_time);
case SDL_WINDOWEVENT_RESIZED:
Renderer::instance()->resize(event.window.data1,
event.window.data2);
- m_menu_manager->recalc_pos();
+ m_menu_manager->on_window_resize();
break;
}
break;
{
g_config->use_fullscreen = !g_config->use_fullscreen;
Renderer::instance()->apply_config();
- m_menu_manager->recalc_pos();
+ m_menu_manager->on_window_resize();
}
else if (event.key.keysym.sym == SDLK_PRINTSCREEN ||
event.key.keysym.sym == SDLK_F12)