projects
/
supertux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3370e84
)
Cleaned up some function names in MenuManager
author
Ingo Ruhnke
<grumbel@gmail.com>
Fri, 8 Aug 2014 18:14:53 +0000
(20:14 +0200)
committer
Ingo Ruhnke
<grumbel@gmail.com>
Fri, 8 Aug 2014 19:34:53 +0000
(21:34 +0200)
src/control/keyboard_manager.cpp
patch
|
blob
|
history
src/gui/menu.cpp
patch
|
blob
|
history
src/gui/menu_manager.hpp
patch
|
blob
|
history
src/supertux/game_session.cpp
patch
|
blob
|
history
src/supertux/screen_manager.cpp
patch
|
blob
|
history
src/supertux/title_screen.cpp
patch
|
blob
|
history
src/worldmap/worldmap.cpp
patch
|
blob
|
history
diff --git
a/src/control/keyboard_manager.cpp
b/src/control/keyboard_manager.cpp
index
d53ed39
..
c6b3b1b
100644
(file)
--- a/
src/control/keyboard_manager.cpp
+++ b/
src/control/keyboard_manager.cpp
@@
-76,7
+76,7
@@
KeyboardManager::process_key_event(const SDL_KeyboardEvent& event)
// if console is open: send key there
process_console_key_event(event);
}
// if console is open: send key there
process_console_key_event(event);
}
- else if (MenuManager::instance().
current
())
+ else if (MenuManager::instance().
is_active
())
{
// if menu mode: send key there
process_menu_key_event(event);
{
// if menu mode: send key there
process_menu_key_event(event);
diff --git
a/src/gui/menu.cpp
b/src/gui/menu.cpp
index
240f2fa
..
5c0a1dc
100644
(file)
--- a/
src/gui/menu.cpp
+++ b/
src/gui/menu.cpp
@@
-69,10
+69,10
@@
Menu::~Menu()
{
MenuManager::instance().m_all_menus.remove(this);
{
MenuManager::instance().m_all_menus.remove(this);
- if (MenuManager::instance().
current()
== this)
+ if (MenuManager::instance().
m_current
== this)
MenuManager::instance().m_current = nullptr;
MenuManager::instance().m_current = nullptr;
- if (MenuManager::instance().
get_previous()
== this)
+ if (MenuManager::instance().
m_previous
== this)
MenuManager::instance().m_previous = nullptr;
}
MenuManager::instance().m_previous = nullptr;
}
@@
-630,13
+630,13
@@
Menu::draw(DrawingContext& context)
{
if (close)
{
{
if (close)
{
- menu_width
= (MenuManager::instance().current()->get_width() * (1.0f - effect_progress))
;
- menu_height
= (MenuManager::instance().current()->get_height() * (1.0f - effect_progress))
;
+ menu_width
*= 1.0f - effect_progress
;
+ menu_height
*= 1.0f - effect_progress
;
}
}
- else if (MenuManager::instance().
get_previous()
)
+ else if (MenuManager::instance().
m_previous
)
{
{
- menu_width = (menu_width * effect_progress) + (MenuManager::instance().
get_previous()
->get_width() * (1.0f - effect_progress));
- menu_height = (menu_height * effect_progress) + (MenuManager::instance().
get_previous()
->get_height() * (1.0f - effect_progress));
+ menu_width = (menu_width * effect_progress) + (MenuManager::instance().
m_previous
->get_width() * (1.0f - effect_progress));
+ menu_height = (menu_height * effect_progress) + (MenuManager::instance().
m_previous
->get_height() * (1.0f - effect_progress));
//std::cout << effect_progress << " " << this << " " << last_menus.back() << std::endl;
}
else
//std::cout << effect_progress << " " << this << " " << last_menus.back() << std::endl;
}
else
diff --git
a/src/gui/menu_manager.hpp
b/src/gui/menu_manager.hpp
index
a390c6f
..
d601ae2
100644
(file)
--- a/
src/gui/menu_manager.hpp
+++ b/
src/gui/menu_manager.hpp
@@
-52,15
+52,15
@@
public:
void recalc_pos();
void recalc_pos();
- Menu* get_previous()
+ /** Return the current active menu or NULL if none is active */
+ Menu* current() const
{
{
- return m_
previous
;
+ return m_
current
;
}
}
- /** Return the current active menu or NULL if none is active */
- Menu* current()
+ bool is_active() const
{
{
- return m_current;
+ return m_current
!= nullptr
;
}
private:
}
private:
diff --git
a/src/supertux/game_session.cpp
b/src/supertux/game_session.cpp
index
f6bd71a
..
86cc2bc
100644
(file)
--- a/
src/supertux/game_session.cpp
+++ b/
src/supertux/game_session.cpp
@@
-436,7
+436,7
@@
GameSession::update(float elapsed_time)
}
// Unpause the game if the menu has been closed
}
// Unpause the game if the menu has been closed
- if (game_pause && !MenuManager::instance().
current
()) {
+ if (game_pause && !MenuManager::instance().
is_active
()) {
g_screen_manager->set_speed(speed_before_pause);
game_pause = false;
}
g_screen_manager->set_speed(speed_before_pause);
game_pause = false;
}
diff --git
a/src/supertux/screen_manager.cpp
b/src/supertux/screen_manager.cpp
index
49468c2
..
4b7661b
100644
(file)
--- a/
src/supertux/screen_manager.cpp
+++ b/
src/supertux/screen_manager.cpp
@@
-139,8
+139,8
@@
ScreenManager::draw(DrawingContext& context)
static int frame_count = 0;
current_screen->draw(context);
static int frame_count = 0;
current_screen->draw(context);
- if(
MenuManager::instance().
current() != NULL)
-
MenuManager::instance().
current()->draw(context);
+ if(
m_menu_manager->
current() != NULL)
+
m_menu_manager->
current()->draw(context);
if(screen_fade.get() != NULL)
screen_fade->draw(context);
Console::instance->draw(context);
if(screen_fade.get() != NULL)
screen_fade->draw(context);
Console::instance->draw(context);
@@
-175,8
+175,8
@@
ScreenManager::update_gamelogic(float elapsed_time)
scripting::update_debugger();
scripting::TimeScheduler::instance->update(game_time);
current_screen->update(elapsed_time);
scripting::update_debugger();
scripting::TimeScheduler::instance->update(game_time);
current_screen->update(elapsed_time);
- if (
MenuManager::instance().
current() != NULL)
-
MenuManager::instance().
current()->update();
+ if (
m_menu_manager->
current() != NULL)
+
m_menu_manager->
current()->update();
if(screen_fade.get() != NULL)
screen_fade->update(elapsed_time);
Console::instance->update(elapsed_time);
if(screen_fade.get() != NULL)
screen_fade->update(elapsed_time);
Console::instance->update(elapsed_time);
@@
-191,8
+191,8
@@
ScreenManager::process_events()
{
g_input_manager->process_event(event);
{
g_input_manager->process_event(event);
- if(
MenuManager::instance().
current() != NULL)
-
MenuManager::instance().
current()->event(event);
+ if(
m_menu_manager->
current() != NULL)
+
m_menu_manager->
current()->event(event);
switch(event.type)
{
switch(event.type)
{
@@
-206,7
+206,7
@@
ScreenManager::process_events()
case SDL_WINDOWEVENT_RESIZED:
Renderer::instance()->resize(event.window.data1,
event.window.data2);
case SDL_WINDOWEVENT_RESIZED:
Renderer::instance()->resize(event.window.data1,
event.window.data2);
-
MenuManager::instance().
recalc_pos();
+
m_menu_manager->
recalc_pos();
break;
}
break;
break;
}
break;
@@
-220,7
+220,7
@@
ScreenManager::process_events()
{
g_config->use_fullscreen = !g_config->use_fullscreen;
Renderer::instance()->apply_config();
{
g_config->use_fullscreen = !g_config->use_fullscreen;
Renderer::instance()->apply_config();
-
MenuManager::instance().
recalc_pos();
+
m_menu_manager->
recalc_pos();
}
else if (event.key.keysym.sym == SDLK_PRINTSCREEN ||
event.key.keysym.sym == SDLK_F12)
}
else if (event.key.keysym.sym == SDLK_PRINTSCREEN ||
event.key.keysym.sym == SDLK_F12)
diff --git
a/src/supertux/title_screen.cpp
b/src/supertux/title_screen.cpp
index
bea6547
..
03201fe
100644
(file)
--- a/
src/supertux/title_screen.cpp
+++ b/
src/supertux/title_screen.cpp
@@
-167,7
+167,7
@@
TitleScreen::update(float elapsed_time)
// reopen menu if user closed it (so that the app doesn't close when user
// accidently hit ESC)
// reopen menu if user closed it (so that the app doesn't close when user
// accidently hit ESC)
- if(
MenuManager::instance().current() == 0
&& g_screen_manager->has_no_pending_fadeout())
+ if(
!MenuManager::instance().is_active()
&& g_screen_manager->has_no_pending_fadeout())
{
MenuManager::instance().set_current(main_menu.get());
}
{
MenuManager::instance().set_current(main_menu.get());
}
diff --git
a/src/worldmap/worldmap.cpp
b/src/worldmap/worldmap.cpp
index
c21fc07
..
01fce1d
100644
(file)
--- a/
src/worldmap/worldmap.cpp
+++ b/
src/worldmap/worldmap.cpp
@@
-406,7
+406,7
@@
void
WorldMap::on_escape_press()
{
// Show or hide the menu
WorldMap::on_escape_press()
{
// Show or hide the menu
- if(!MenuManager::instance().
current
()) {
+ if(!MenuManager::instance().
is_active
()) {
MenuManager::instance().set_current(worldmap_menu.get());
tux->set_direction(D_NONE); // stop tux movement when menu is called
} else {
MenuManager::instance().set_current(worldmap_menu.get());
tux->set_direction(D_NONE); // stop tux movement when menu is called
} else {