Permalink
Browse files

Made the src/modes/ files use spaces.

  • Loading branch information...
Yohann Ferreira
Yohann Ferreira committed Oct 25, 2012
1 parent f0aeed4 commit 43fd8ee09f447c19f7568acfded0677603f7f78b
Showing with 1,198 additions and 1,179 deletions.
  1. +749 −747 src/modes/mode_bindings.cpp
  2. +216 −210 src/modes/mode_help_window.cpp
  3. +34 −31 src/modes/mode_help_window.h
  4. +123 −126 src/modes/pause.cpp
  5. +33 −31 src/modes/pause.h
  6. +26 −20 src/modes/scene.cpp
  7. +17 −14 src/modes/scene.h
View

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -22,7 +22,8 @@
#include "engine/video/text.h"
#include "common/gui/option.h"
-namespace hoa_mode_manager {
+namespace hoa_mode_manager
+{
/** ****************************************************************************
*** \brief Displays vital information to the player upon starting the game
@@ -39,52 +40,54 @@ namespace hoa_mode_manager {
*** the default keys and purposes, and footer text informing the player where
*** they can find more information.
*** *****************************************************************************/
-class HelpWindow {
+class HelpWindow
+{
public:
- HelpWindow();
+ HelpWindow();
- ~HelpWindow();
+ ~HelpWindow();
- //! \brief Updates the state of the welcome window and processes user input
- void Update();
+ //! \brief Updates the state of the welcome window and processes user input
+ void Update();
- //! \brief Draws the welcome window and its contents to the screen
- void Draw();
+ //! \brief Draws the welcome window and its contents to the screen
+ void Draw();
- //! \brief Activates and shows the welcome window
- void Show();
+ //! \brief Activates and shows the welcome window
+ void Show();
- //! \brief Deactivates and hides the welcome window
- void Hide();
+ //! \brief Deactivates and hides the welcome window
+ void Hide();
- //! \brief Returns true if the welcome window is currently active and visible
- bool IsActive() const
- { return _active; }
+ //! \brief Returns true if the welcome window is currently active and visible
+ bool IsActive() const {
+ return _active;
+ }
private:
- //! \brief Set to true when the window is active and should be visible on the screen
- bool _active;
+ //! \brief Set to true when the window is active and should be visible on the screen
+ bool _active;
- //! Window for the screen
- hoa_gui::MenuWindow _window;
+ //! Window for the screen
+ hoa_gui::MenuWindow _window;
- //! \brief Rendered text of the header string
- hoa_video::TextImage _text_header;
+ //! \brief Rendered text of the header string
+ hoa_video::TextImage _text_header;
- //! \brief An option box used as a header for the key table
- hoa_gui::OptionBox _key_table_header;
+ //! \brief An option box used as a header for the key table
+ hoa_gui::OptionBox _key_table_header;
- //! \brief Stores the text for default key mappings in a table format
- hoa_gui::OptionBox _key_table;
+ //! \brief Stores the text for default key mappings in a table format
+ hoa_gui::OptionBox _key_table;
- //! \brief Rendered text that tells the player how to move past the window
- hoa_video::TextImage _text_additional;
+ //! \brief Rendered text that tells the player how to move past the window
+ hoa_video::TextImage _text_additional;
- //! \brief Rendered text that tells the player how to move past the window
- hoa_video::TextImage _text_continue;
+ //! \brief Rendered text that tells the player how to move past the window
+ hoa_video::TextImage _text_continue;
- //! \brief Refresh the text shown according to the given game mode
- void _RefreshText();
+ //! \brief Refresh the text shown according to the given game mode
+ void _RefreshText();
}; // class HelpWindow
} // namespace hoa_mode_manager
View
@@ -29,7 +29,8 @@ using namespace hoa_input;
using namespace hoa_system;
using namespace hoa_boot;
-namespace hoa_pause {
+namespace hoa_pause
+{
bool PAUSE_DEBUG = false;
@@ -44,140 +45,136 @@ const uint8 QUIT_CANCEL = 2;
//@}
PauseMode::PauseMode(bool quit_state, bool pause_audio) :
- GameMode(),
- _quit_state(quit_state),
- _audio_paused(pause_audio),
- _dim_color(0.35f, 0.35f, 0.35f, 1.0f), // A grayish opaque color
- _option_selected(false)
+ GameMode(),
+ _quit_state(quit_state),
+ _audio_paused(pause_audio),
+ _dim_color(0.35f, 0.35f, 0.35f, 1.0f), // A grayish opaque color
+ _option_selected(false)
{
- mode_type = MODE_MANAGER_PAUSE_MODE;
-
- // Render the paused string in white text
- _paused_text.SetStyle(TextStyle("title28", Color::white, VIDEO_TEXT_SHADOW_BLACK));
- _paused_text.SetText(UTranslate("Paused"));
-
- // Initialize the quit options box
- _quit_options.SetPosition(512.0f, 384.0f);
- _quit_options.SetDimensions(750.0f, 50.0f, 3, 1, 3, 1);
- _quit_options.SetTextStyle(TextStyle("title24", Color::white, VIDEO_TEXT_SHADOW_BLACK));
-
- _quit_options.SetAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER);
- _quit_options.SetOptionAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER);
- _quit_options.SetSelectMode(VIDEO_SELECT_SINGLE);
- _quit_options.SetCursorOffset(-58.0f, 18.0f);
-
- _quit_options.AddOption(UTranslate("Quit Game"));
- _quit_options.AddOption(UTranslate("Quit to Main Menu"));
- _quit_options.AddOption(UTranslate("Cancel"));
- _quit_options.SetSelection(QUIT_CANCEL);
+ mode_type = MODE_MANAGER_PAUSE_MODE;
+
+ // Render the paused string in white text
+ _paused_text.SetStyle(TextStyle("title28", Color::white, VIDEO_TEXT_SHADOW_BLACK));
+ _paused_text.SetText(UTranslate("Paused"));
+
+ // Initialize the quit options box
+ _quit_options.SetPosition(512.0f, 384.0f);
+ _quit_options.SetDimensions(750.0f, 50.0f, 3, 1, 3, 1);
+ _quit_options.SetTextStyle(TextStyle("title24", Color::white, VIDEO_TEXT_SHADOW_BLACK));
+
+ _quit_options.SetAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER);
+ _quit_options.SetOptionAlignment(VIDEO_X_CENTER, VIDEO_Y_CENTER);
+ _quit_options.SetSelectMode(VIDEO_SELECT_SINGLE);
+ _quit_options.SetCursorOffset(-58.0f, 18.0f);
+
+ _quit_options.AddOption(UTranslate("Quit Game"));
+ _quit_options.AddOption(UTranslate("Quit to Main Menu"));
+ _quit_options.AddOption(UTranslate("Cancel"));
+ _quit_options.SetSelection(QUIT_CANCEL);
}
-PauseMode::~PauseMode() {
- if (_audio_paused)
- AudioManager->ResumeAudio();
+PauseMode::~PauseMode()
+{
+ if(_audio_paused)
+ AudioManager->ResumeAudio();
}
-void PauseMode::Reset() {
- if (_audio_paused)
- AudioManager->PauseAudio();
-
- // Save a copy of the current screen to use as the backdrop
- try {
- _screen_capture = VideoManager->CaptureScreen();
- }
- catch (const Exception& e) {
- IF_PRINT_WARNING(PAUSE_DEBUG) << e.ToString() << std::endl;
- }
-
- VideoManager->SetCoordSys(0.0f, VIDEO_STANDARD_RES_WIDTH, 0.0f, VIDEO_STANDARD_RES_HEIGHT);
- VideoManager->SetDrawFlags(VIDEO_BLEND, 0);
- VideoManager->DisableFadeEffect();
+void PauseMode::Reset()
+{
+ if(_audio_paused)
+ AudioManager->PauseAudio();
+
+ // Save a copy of the current screen to use as the backdrop
+ try {
+ _screen_capture = VideoManager->CaptureScreen();
+ } catch(const Exception &e) {
+ IF_PRINT_WARNING(PAUSE_DEBUG) << e.ToString() << std::endl;
+ }
+
+ VideoManager->SetCoordSys(0.0f, VIDEO_STANDARD_RES_WIDTH, 0.0f, VIDEO_STANDARD_RES_HEIGHT);
+ VideoManager->SetDrawFlags(VIDEO_BLEND, 0);
+ VideoManager->DisableFadeEffect();
}
-void PauseMode::Update() {
- // Don't eat up 100% of the CPU time while in pause mode
- SDL_Delay(50); // Puts the process to sleep for 50ms
-
- // If an option has been selected, don't handle input until it has finished.
- if (_option_selected)
- return;
-
- if (!_quit_state) {
- if (InputManager->QuitPress()) {
- _quit_state = true;
- return;
- }
- else if (InputManager->PausePress()) {
- _option_selected = true;
- ModeManager->Pop();
- return;
- }
- }
- else { // (_quit_state == true)
- _quit_options.Update();
-
- if (InputManager->QuitPress()) {
- _option_selected = true;
- ModeManager->Pop();
- return;
- }
- else if (InputManager->ConfirmPress()) {
- _option_selected = true;
- switch (_quit_options.GetSelection()) {
- case QUIT_CANCEL:
- ModeManager->Pop();
- break;
- case QUIT_TO_BOOT:
- // Disable potential previous effects
- VideoManager->DisableFadeEffect();
- ModeManager->PopAll();
-
- // This will permit the fade system to start updating again.
- mode_type = MODE_MANAGER_DUMMY_MODE;
-
- ModeManager->Push(new BootMode(), true, true);
- break;
- case QUIT_GAME:
- SystemManager->ExitGame();
- break;
- default:
- IF_PRINT_WARNING(PAUSE_DEBUG) << "unknown quit option selected: " << _quit_options.GetSelection() << std::endl;
- break;
- }
- return;
- }
- else if (InputManager->CancelPress()) {
- _option_selected =true;
- ModeManager->Pop();
- return;
- }
- else if (InputManager->LeftPress()) {
- _quit_options.InputLeft();
- }
- else if (InputManager->RightPress()) {
- _quit_options.InputRight();
- }
- }
+void PauseMode::Update()
+{
+ // Don't eat up 100% of the CPU time while in pause mode
+ SDL_Delay(50); // Puts the process to sleep for 50ms
+
+ // If an option has been selected, don't handle input until it has finished.
+ if(_option_selected)
+ return;
+
+ if(!_quit_state) {
+ if(InputManager->QuitPress()) {
+ _quit_state = true;
+ return;
+ } else if(InputManager->PausePress()) {
+ _option_selected = true;
+ ModeManager->Pop();
+ return;
+ }
+ } else { // (_quit_state == true)
+ _quit_options.Update();
+
+ if(InputManager->QuitPress()) {
+ _option_selected = true;
+ ModeManager->Pop();
+ return;
+ } else if(InputManager->ConfirmPress()) {
+ _option_selected = true;
+ switch(_quit_options.GetSelection()) {
+ case QUIT_CANCEL:
+ ModeManager->Pop();
+ break;
+ case QUIT_TO_BOOT:
+ // Disable potential previous effects
+ VideoManager->DisableFadeEffect();
+ ModeManager->PopAll();
+
+ // This will permit the fade system to start updating again.
+ mode_type = MODE_MANAGER_DUMMY_MODE;
+
+ ModeManager->Push(new BootMode(), true, true);
+ break;
+ case QUIT_GAME:
+ SystemManager->ExitGame();
+ break;
+ default:
+ IF_PRINT_WARNING(PAUSE_DEBUG) << "unknown quit option selected: " << _quit_options.GetSelection() << std::endl;
+ break;
+ }
+ return;
+ } else if(InputManager->CancelPress()) {
+ _option_selected = true;
+ ModeManager->Pop();
+ return;
+ } else if(InputManager->LeftPress()) {
+ _quit_options.InputLeft();
+ } else if(InputManager->RightPress()) {
+ _quit_options.InputRight();
+ }
+ }
} // void PauseMode::Update()
-void PauseMode::DrawPostEffects() {
- // Set the coordinate system for the background and draw
- VideoManager->SetCoordSys(0.0f, _screen_capture.GetWidth(), 0.0f, _screen_capture.GetHeight());
- VideoManager->SetDrawFlags(VIDEO_X_LEFT, VIDEO_Y_BOTTOM, 0);
- VideoManager->Move(0.0f, 0.0f);
- _screen_capture.Draw(_dim_color);
-
- // Re-set the coordinate system for everything else
- VideoManager->SetCoordSys(0.0f, VIDEO_STANDARD_RES_WIDTH, 0.0f, VIDEO_STANDARD_RES_HEIGHT);
- VideoManager->SetDrawFlags(VIDEO_X_CENTER, VIDEO_Y_CENTER, 0);
- VideoManager->Move(512.0f, 384.0f);
-
- if (!_quit_state) {
- _paused_text.Draw();
- }
- else {
- _quit_options.Draw();
- }
+void PauseMode::DrawPostEffects()
+{
+ // Set the coordinate system for the background and draw
+ VideoManager->SetCoordSys(0.0f, _screen_capture.GetWidth(), 0.0f, _screen_capture.GetHeight());
+ VideoManager->SetDrawFlags(VIDEO_X_LEFT, VIDEO_Y_BOTTOM, 0);
+ VideoManager->Move(0.0f, 0.0f);
+ _screen_capture.Draw(_dim_color);
+
+ // Re-set the coordinate system for everything else
+ VideoManager->SetCoordSys(0.0f, VIDEO_STANDARD_RES_WIDTH, 0.0f, VIDEO_STANDARD_RES_HEIGHT);
+ VideoManager->SetDrawFlags(VIDEO_X_CENTER, VIDEO_Y_CENTER, 0);
+ VideoManager->Move(512.0f, 384.0f);
+
+ if(!_quit_state) {
+ _paused_text.Draw();
+ } else {
+ _quit_options.Draw();
+ }
}
} // namespace hoa_pause
Oops, something went wrong.

0 comments on commit 43fd8ee

Please sign in to comment.