// ---------------------------------------------------------------------------- // void MainMenuScreen::init() { Screen::init(); m_user_id = getWidget<ButtonWidget>("user-id"); assert(m_user_id); // reset in case we're coming back from a race StateManager::get()->resetActivePlayers(); input_manager->getDeviceManager()->setAssignMode(NO_ASSIGN); input_manager->getDeviceManager()->setSinglePlayer( NULL ); input_manager->setMasterPlayerOnly(false); // Avoid incorrect behaviour in certain race circumstances: // If a multi-player game is played with two keyboards, the 2nd // player selects his kart last, and only the keyboard is used // to select all other settings - then if the next time the kart // selection screen comes up, the default device will still be // the 2nd player. So if the first player presses 'select', it // will instead add a second player (so basically the key // binding for the second player become the default, so pressing // select will add a new player). See bug 3090931 // To avoid this, we will clean the last used device, making // the key bindings for the first player the default again. input_manager->getDeviceManager()->clearLatestUsedDevice(); if (addons_manager->isLoading()) { IconButtonWidget* w = getWidget<IconButtonWidget>("addons"); w->setDeactivated(); w->resetAllBadges(); w->setBadge(LOADING_BADGE); } m_online = getWidget<IconButtonWidget>("online"); if(!m_enable_online) m_online->setDeactivated(); LabelWidget* w = getWidget<LabelWidget>("info_addons"); const core::stringw &news_text = NewsManager::get()->getNextNewsMessage(); w->setText(news_text, true); w->update(0.01f); RibbonWidget* r = getWidget<RibbonWidget>("menu_bottomrow"); // FIXME: why do I need to do this manually ((IconButtonWidget*)r->getChildren().get(0))->unfocused(PLAYER_ID_GAME_MASTER, NULL); ((IconButtonWidget*)r->getChildren().get(1))->unfocused(PLAYER_ID_GAME_MASTER, NULL); ((IconButtonWidget*)r->getChildren().get(2))->unfocused(PLAYER_ID_GAME_MASTER, NULL); r = getWidget<RibbonWidget>("menu_toprow"); r->setFocusForPlayer(PLAYER_ID_GAME_MASTER); DemoWorld::resetIdleTime(); #if _IRR_MATERIAL_MAX_TEXTURES_ < 8 getWidget<IconButtonWidget>("logo")->setImage("gui/logo_broken.png", IconButtonWidget::ICON_PATH_TYPE_RELATIVE); #endif } // init
// ----------------------------------------------------------------------------- void EditGPScreen::init() { if (m_action.empty()) { LabelWidget* header = getWidget<LabelWidget>("title"); assert(header != NULL); header->setText(m_gp->getName(), true); IconButtonWidget* button = getWidget<IconButtonWidget>("save"); assert(button != NULL); button->setDeactivated(); loadList(0); setModified(false); } else { EditTrackScreen* edit = EditTrackScreen::getInstance(); assert(edit != NULL); if (edit->getResult()) { if (m_action == "add") { m_gp->addTrack(edit->getTrack(), edit->getLaps(), edit->getReverse(), m_selected); setSelected(m_selected + 1); } else if (m_action == "edit") { m_gp->editTrack(m_selected, edit->getTrack(), edit->getLaps(), edit->getReverse()); } setModified(true); } loadList(m_selected); m_action.clear(); } }