Skip to content

Commit

Permalink
Renamed MenuManager::recalc_pos() -> MenuManager::on_window_resize() …
Browse files Browse the repository at this point in the history
…and Menu::update() -> Menu::process_input()
  • Loading branch information
Grumbel committed Aug 10, 2014
1 parent 3748bff commit d1c49ba
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/gui/menu.cpp
Expand Up @@ -174,7 +174,7 @@ Menu::clear()

/* Process actions done on the menu */
void
Menu::update()
Menu::process_input()
{
int menu_height = (int) get_height();
if (menu_height > SCREEN_HEIGHT)
Expand Down Expand Up @@ -321,7 +321,7 @@ Menu::update()
case MN_TEXTFIELD:
case MN_NUMFIELD:
menuaction = MENU_ACTION_DOWN;
update();
process_input();
break;

case MN_BACK:
Expand Down
2 changes: 1 addition & 1 deletion src/gui/menu.hpp
Expand Up @@ -69,7 +69,7 @@ class Menu

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() {}
Expand Down
6 changes: 3 additions & 3 deletions src/gui/menu_manager.cpp
Expand Up @@ -150,11 +150,11 @@ MenuManager::refresh()
}

void
MenuManager::update()
MenuManager::process_input()
{
if (current())
{
current()->update();
current()->process_input();
}
}

Expand Down Expand Up @@ -274,7 +274,7 @@ MenuManager::clear_menu_stack()
}

void
MenuManager::recalc_pos()
MenuManager::on_window_resize()
{
for(auto i = m_menu_stack.begin(); i != m_menu_stack.end(); ++i)
{
Expand Down
4 changes: 2 additions & 2 deletions src/gui/menu_manager.hpp
Expand Up @@ -45,7 +45,7 @@ class MenuManager
~MenuManager();

void event(const SDL_Event& event);
void update();
void process_input();
void refresh();

void draw(DrawingContext& context);
Expand All @@ -58,7 +58,7 @@ class MenuManager
void pop_menu();
void clear_menu_stack();

void recalc_pos();
void on_window_resize();
bool is_active() const
{
return !m_menu_stack.empty();
Expand Down
8 changes: 4 additions & 4 deletions src/supertux/menu/options_menu.cpp
Expand Up @@ -215,13 +215,13 @@ OptionsMenu::menu_action(MenuItem* item)
{
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
{
Expand All @@ -240,7 +240,7 @@ OptionsMenu::menu_action(MenuItem* item)
g_config->magnification /= 100.0f;
}
Renderer::instance()->apply_config();
MenuManager::instance().recalc_pos();
MenuManager::instance().on_window_resize();
break;

case MNID_FULLSCREEN_RESOLUTION:
Expand Down Expand Up @@ -269,7 +269,7 @@ OptionsMenu::menu_action(MenuItem* item)
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;
Expand Down
6 changes: 3 additions & 3 deletions src/supertux/screen_manager.cpp
Expand Up @@ -174,7 +174,7 @@ ScreenManager::update_gamelogic(float elapsed_time)
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);
Expand Down Expand Up @@ -203,7 +203,7 @@ ScreenManager::process_events()
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;
Expand All @@ -217,7 +217,7 @@ ScreenManager::process_events()
{
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)
Expand Down

0 comments on commit d1c49ba

Please sign in to comment.