MainMenu Class Reference

#include <main_menu.hpp>

Inherits Menu.

List of all members.

Public Member Functions

 MainMenu ()
void check_menu ()

Private Member Functions

 MainMenu (const MainMenu &)
MainMenuoperator= (const MainMenu &)

Private Attributes

std::auto_ptr< AddonMenum_addon_menu
std::auto_ptr< ContribMenum_contrib_menu
std::auto_ptr< Worldm_main_world


Detailed Description

Definition at line 36 of file main_menu.hpp.


Constructor & Destructor Documentation

MainMenu::MainMenu (  ) 

Definition at line 33 of file main_menu.cpp.

References _(), Menu::add_entry(), Menu::add_submenu(), MenuStorage::get_options_menu(), MNID_ADDONS, MNID_CREDITS, MNID_LEVELS_CONTRIB, MNID_QUITMAINMENU, MNID_STARTGAME, SCREEN_HEIGHT, SCREEN_WIDTH, and Menu::set_pos().

00033                    :
00034   m_addon_menu(),
00035   m_contrib_menu(),
00036   m_main_world()
00037 {
00038   set_pos(SCREEN_WIDTH/2, SCREEN_HEIGHT/2 + 35);
00039   add_entry(MNID_STARTGAME, _("Start Game"));
00040   add_entry(MNID_LEVELS_CONTRIB, _("Contrib Levels"));
00041   add_entry(MNID_ADDONS, _("Add-ons"));
00042   add_submenu(_("Options"), MenuStorage::get_options_menu());
00043   add_entry(MNID_CREDITS, _("Credits"));
00044   add_entry(MNID_QUITMAINMENU, _("Quit"));
00045 }

MainMenu::MainMenu ( const MainMenu  )  [private]


Member Function Documentation

void MainMenu::check_menu (  )  [virtual]

Implements Menu.

Definition at line 48 of file main_menu.cpp.

References Menu::check(), g_screen_manager, m_addon_menu, m_contrib_menu, m_main_world, MNID_ADDONS, MNID_CREDITS, MNID_LEVELS_CONTRIB, MNID_QUITMAINMENU, MNID_STARTGAME, MenuManager::push_current(), ScreenManager::push_screen(), ScreenManager::quit(), MenuManager::set_current(), sound_manager, TitleScreen::start_game(), and SoundManager::stop_music().

00049 {
00050   switch (check())
00051   {
00052     case MNID_STARTGAME:
00053       if (m_main_world.get() == NULL)
00054       {
00055         m_main_world.reset(new World());
00056         m_main_world->load("levels/world1/info");
00057       }
00058       TitleScreen::start_game(m_main_world.get());
00059       break;
00060 
00061     case MNID_LEVELS_CONTRIB:
00062       // Contrib Menu
00063       m_contrib_menu.reset(new ContribMenu());
00064       MenuManager::push_current(m_contrib_menu.get());
00065       break;
00066 
00067     case MNID_ADDONS:
00068       // Add-ons Menu
00069       m_addon_menu.reset(new AddonMenu());
00070       MenuManager::push_current(m_addon_menu.get());
00071       break;
00072 
00073     case MNID_CREDITS:
00074       MenuManager::set_current(NULL);
00075       g_screen_manager->push_screen(new TextScroller("credits.txt"),
00076                                     new FadeOut(0.5));
00077       break;
00078 
00079     case MNID_QUITMAINMENU:
00080       g_screen_manager->quit(new FadeOut(0.25));
00081       sound_manager->stop_music(0.25);
00082       break;
00083   }
00084 }

MainMenu& MainMenu::operator= ( const MainMenu  )  [private]


Member Data Documentation

std::auto_ptr<AddonMenu> MainMenu::m_addon_menu [private]

Definition at line 39 of file main_menu.hpp.

Referenced by check_menu().

std::auto_ptr<ContribMenu> MainMenu::m_contrib_menu [private]

Definition at line 40 of file main_menu.hpp.

Referenced by check_menu().

std::auto_ptr<World> MainMenu::m_main_world [private]

Definition at line 41 of file main_menu.hpp.

Referenced by check_menu().


The documentation for this class was generated from the following files:
Generated on Mon Jun 9 03:38:32 2014 for SuperTux by  doxygen 1.5.1