MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / MenuModeMain

Method MenuModeMain

source/modes/MenuModeMain.cpp:72–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70} // namespace
71
72MenuModeMain::MenuModeMain(ModeManager *modeManager):
73 AbstractApplicationMode(modeManager, ModeManager::MENU_MAIN),
74 mSettings(SettingsWindow(getModeManager().getGui().getGuiSheet(Gui::mainMenu)))
75{
76 CEGUI::Window* rootWin = getModeManager().getGui().getGuiSheet(Gui::mainMenu);
77 OD_ASSERT_TRUE(rootWin != nullptr);
78
79 connectModeChangeEvent(BUTTON_START_REPLAY, AbstractModeManager::ModeType::MENU_REPLAY);
80
81 addEventConnection(
82 rootWin->getChild(BUTTON_QUIT)->subscribeEvent(
83 CEGUI::PushButton::EventClicked,
84 CEGUI::Event::Subscriber(&MenuModeMain::quitButtonPressed, this)
85 )
86 );
87
88 addEventConnection(
89 rootWin->getChild(BUTTON_SETTINGS)->subscribeEvent(
90 CEGUI::PushButton::EventClicked,
91 CEGUI::Event::Subscriber(&MenuModeMain::toggleSettings, this)
92 )
93 );
94
95 // Skirmish & sub-menu events
96 addEventConnection(
97 rootWin->getChild(BUTTON_SKIRMISH)->subscribeEvent(
98 CEGUI::PushButton::EventClicked,
99 CEGUI::Event::Subscriber(&MenuModeMain::toggleSkirmishSubMenu, this)
100 )
101 );
102 CEGUI::Window* skirmishWin = rootWin->getChild(WINDOW_SKIRMISH);
103 OD_ASSERT_TRUE(skirmishWin != nullptr);
104 connectModeChangeEvent(skirmishWin->getChild(BUTTON_START_SKIRMISH),
105 AbstractModeManager::ModeType::MENU_SKIRMISH);
106 connectModeChangeEvent(skirmishWin->getChild(BUTTON_LOAD_SKIRMISH),
107 AbstractModeManager::ModeType::MENU_LOAD_SAVEDGAME);
108
109 // Multiplayer & sub-menu events
110 addEventConnection(
111 rootWin->getChild(BUTTON_MULTIPLAYER)->subscribeEvent(
112 CEGUI::PushButton::EventClicked,
113 CEGUI::Event::Subscriber(&MenuModeMain::toggleMultiplayerSubMenu, this)
114 )
115 );
116 CEGUI::Window* multiplayerWin = rootWin->getChild(WINDOW_MULTIPLAYER);
117 OD_ASSERT_TRUE(multiplayerWin != nullptr);
118 connectModeChangeEvent(multiplayerWin->getChild(BUTTON_MASTERSERVER_JOIN),
119 AbstractModeManager::ModeType::MENU_MASTERSERVER_JOIN);
120 connectModeChangeEvent(multiplayerWin->getChild(BUTTON_MASTERSERVER_HOST),
121 AbstractModeManager::ModeType::MENU_MASTERSERVER_HOST);
122 connectModeChangeEvent(multiplayerWin->getChild(BUTTON_MULTIPLAYER_JOIN),
123 AbstractModeManager::ModeType::MENU_MULTIPLAYER_CLIENT);
124 connectModeChangeEvent(multiplayerWin->getChild(BUTTON_MULTIPLAYER_HOST),
125 AbstractModeManager::ModeType::MENU_MULTIPLAYER_SERVER);
126
127 // Editor & sub-menu events
128 addEventConnection(
129 rootWin->getChild(BUTTON_MAPEDITOR)->subscribeEvent(

Callers

nothing calls this directly

Calls 2

SettingsWindowClass · 0.85
getGuiSheetMethod · 0.80

Tested by

no test coverage detected