// ---------------------------------------------------------------------------- // 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 AddonsLoading::doUninstall() { delete m_download_request; m_download_request = NULL; bool error = !addons_manager->uninstall(m_addon); if(error) { Log::warn("Addons", "Directory '%s' can not be removed.", m_addon.getDataDir().c_str()); Log::warn("Addons", "Please remove this directory manually."); core::stringw msg = StringUtils::insertValues(_("Problems removing the addon '%s'."), core::stringw(m_addon.getName().c_str())); getWidget<BubbleWidget>("description")->setText(msg.c_str()); } if(error) { m_progress->setVisible(false); RibbonWidget* r = getWidget<RibbonWidget>("actions"); r->setVisible(true); IconButtonWidget *u = getWidget<IconButtonWidget> ("uninstall" ); u->setLabel(_("Try again")); } else { // The list of the addon screen needs to be updated to correctly // display the newly (un)installed addon. AddonsScreen::getInstance()->loadList(); dismiss(); } } // doUninstall
// ---------------------------------------------------------------------------- void CreateServerScreen::init() { Screen::init(); DemoWorld::resetIdleTime(); m_info_widget->setText("", false); LabelWidget *title = getWidget<LabelWidget>("title"); title->setText(NetworkConfig::get()->isLAN() ? _("Create LAN Server") : _("Create Server") , false); // I18n: Name of the server. %s is either the online or local user name m_name_widget->setText(_("%s's server", NetworkConfig::get()->isLAN() ? PlayerManager::getCurrentPlayer()->getName() : PlayerManager::getCurrentOnlineUserName() ) ); // -- Difficulty RibbonWidget* difficulty = getWidget<RibbonWidget>("difficulty"); assert(difficulty != NULL); difficulty->setSelection(UserConfigParams::m_difficulty, PLAYER_ID_GAME_MASTER); // -- Game modes RibbonWidget* gamemode = getWidget<RibbonWidget>("gamemode"); assert(gamemode != NULL); gamemode->setSelection(0, PLAYER_ID_GAME_MASTER); } // init
// ---------------------------------------------------------------------------- void MessageDialog::loadedFromFile() { LabelWidget* message = getWidget<LabelWidget>("title"); message->setText( m_msg, false ); RibbonWidget* ribbon = getWidget<RibbonWidget>("buttons"); ribbon->setFocusForPlayer(PLAYER_ID_GAME_MASTER); // If the dialog is a simple 'OK' dialog, then hide the "Yes" button and // change "Cancel" to "OK" if (m_type == MessageDialog::MESSAGE_DIALOG_OK) { IconButtonWidget* yesbtn = getWidget<IconButtonWidget>("cancel"); yesbtn->setVisible(false); IconButtonWidget* cancelbtn = getWidget<IconButtonWidget>("confirm"); cancelbtn->setText(_("OK")); cancelbtn->setFocusForPlayer(PLAYER_ID_GAME_MASTER); } else if (m_type == MessageDialog::MESSAGE_DIALOG_YESNO) { IconButtonWidget* cancelbtn = getWidget<IconButtonWidget>("cancel"); cancelbtn->setText(_("No")); if(m_focus_on_cancel) cancelbtn->setFocusForPlayer(PLAYER_ID_GAME_MASTER); } else if (m_type == MessageDialog::MESSAGE_DIALOG_OK_CANCEL) { // In case of a OK_CANCEL dialog, change the text from 'Yes' to 'Ok' IconButtonWidget* yesbtn = getWidget<IconButtonWidget>("confirm"); yesbtn->setText(_("OK")); IconButtonWidget* cancelbtn = getWidget<IconButtonWidget>("cancel"); if (m_focus_on_cancel) cancelbtn->setFocusForPlayer(PLAYER_ID_GAME_MASTER); } }
GUIEngine::EventPropagation MessageDialog::processEvent(const std::string& eventSource) { RibbonWidget* ribbon = getWidget<RibbonWidget>(eventSource.c_str()); if (ribbon->getSelectionIDString(PLAYER_ID_GAME_MASTER) == "cancel") { if (m_listener == NULL) { ModalDialog::dismiss(); } else { m_listener->onCancel(); } return GUIEngine::EVENT_BLOCK; } else if (ribbon->getSelectionIDString(PLAYER_ID_GAME_MASTER) == "confirm") { if (m_listener == NULL) { ModalDialog::dismiss(); } else { m_listener->onConfirm(); } return GUIEngine::EVENT_BLOCK; } return GUIEngine::EVENT_LET; }
void HelpScreen3::init() { Screen::init(); RibbonWidget* w = this->getWidget<RibbonWidget>("category"); if (w != NULL) w->select( "page3", PLAYER_ID_GAME_MASTER ); } // init
void TracksScreen::beforeAddingWidget() { Screen::init(); RibbonWidget* tabs = getWidget<RibbonWidget>("trackgroups"); tabs->clearAllChildren(); const std::vector<std::string>& groups = track_manager->getAllTrackGroups(); const int group_amount = (int)groups.size(); if (group_amount > 1) { //I18N: name of the tab that will show tracks from all groups tabs->addTextChild( _("All"), ALL_TRACK_GROUPS_ID ); } // Make group names being picked up by gettext #define FOR_GETTEXT_ONLY(x) //I18N: track group name FOR_GETTEXT_ONLY( _("standard") ) //I18N: track group name FOR_GETTEXT_ONLY( _("Add-Ons") ) // add behind the other categories for (int n=0; n<group_amount; n++) tabs->addTextChild( _(groups[n].c_str()), groups[n] ); DynamicRibbonWidget* tracks_widget = getWidget<DynamicRibbonWidget>("tracks"); tracks_widget->setItemCountHint( (int)track_manager->getNumberOfTracks()+1 ); } // beforeAddingWidget
/** Called when the asynchronous download of the addon finished. */ void AddonsLoading::doInstall() { delete m_download_request; m_download_request = NULL; assert(!m_addon.isInstalled() || m_addon.needsUpdate()); bool error = !addons_manager->install(m_addon); if(error) { core::stringw msg = StringUtils::insertValues( _("Problems installing the addon '%s'."), core::stringw(m_addon.getName().c_str())); getWidget<BubbleWidget>("description")->setText(msg.c_str()); } if(error) { m_progress->setVisible(false); RibbonWidget* r = getWidget<RibbonWidget>("actions"); r->setVisible(true); m_install_button->setLabel(_("Try again")); } else { // The list of the addon screen needs to be updated to correctly // display the newly (un)installed addon. AddonsScreen::getInstance()->loadList(); dismiss(); } track_manager->loadTrackList(); } // doInstall
const std::string& DynamicRibbonWidget::getSelectionIDString(const int playerID) { RibbonWidget* row = (RibbonWidget*)(m_rows.size() == 1 ? m_rows.get(0) : getSelectedRibbon(playerID)); if (row != NULL) return row->getSelectionIDString(playerID); static const std::string nothing = ""; return nothing; }
// ----------------------------------------------------------------------------- void GrandPrixEditorScreen::init() { RibbonWidget* tabs = getWidget<RibbonWidget>("gpgroups"); assert (tabs != NULL); tabs->select (StringUtils::toString(m_gpgroup), PLAYER_ID_GAME_MASTER); loadGPList(); setSelection(m_selection); }
irr::core::stringw DynamicRibbonWidget::getSelectionText(const int playerID) { RibbonWidget* row = (RibbonWidget*)(m_rows.size() == 1 ? m_rows.get(0) : getSelectedRibbon(playerID)); if (row != NULL) return row->getSelectionText(playerID); static const irr::core::stringw nothing = ""; return nothing; }
void ArenasScreen::beforeAddingWidget() { // Dynamically add tabs RibbonWidget* tabs = this->getWidget<RibbonWidget>("trackgroups"); assert( tabs != NULL ); tabs->clearAllChildren(); bool soccer_mode = race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER; const std::vector<std::string>& groups = track_manager->getAllArenaGroups(soccer_mode); const int group_amount = (int)groups.size(); if (group_amount > 1) { //I18N: name of the tab that will show arenas from all groups tabs->addTextChild( _("All"), ALL_ARENA_GROUPS_ID ); } // Make group names being picked up by gettext #define FOR_GETTEXT_ONLY(x) //I18N: arena group name FOR_GETTEXT_ONLY( _("standard") ) //I18N: arena group name FOR_GETTEXT_ONLY( _("Add-Ons") ) // add others after for (int n=0; n<group_amount; n++) { // try to translate the group name tabs->addTextChild( _(groups[n].c_str()), groups[n] ); } int num_of_arenas=0; for (unsigned int n=0; n<track_manager->getNumberOfTracks(); n++) //iterate through tracks to find how many are arenas { Track* temp = track_manager->getTrack(n); if (soccer_mode) { if(temp->isSoccer() && (temp->hasNavMesh() || race_manager->getNumLocalPlayers() > 1 || UserConfigParams::m_artist_debug_mode)) num_of_arenas++; } else { if(temp->isArena() && (temp->hasNavMesh() || race_manager->getNumLocalPlayers() > 1 || UserConfigParams::m_artist_debug_mode)) num_of_arenas++; } } DynamicRibbonWidget* tracks_widget = this->getWidget<DynamicRibbonWidget>("tracks"); assert( tracks_widget != NULL ); tracks_widget->setItemCountHint(num_of_arenas+1); //set the item hint to that number to prevent weird formatting }
/** Rebuild the list of tracks and GPs. This need to be recomputed e.g. to * take unlocked tracks into account. */ void TracksScreen::buildTrackList() { DynamicRibbonWidget* tracks_widget = this->getWidget<DynamicRibbonWidget>("tracks"); RibbonWidget* tabs = this->getWidget<RibbonWidget>("trackgroups"); // Reset track list everytime (accounts for locking changes, etc.) tracks_widget->clearItems(); m_random_track_list.clear(); const std::string& curr_group_name = tabs->getSelectionIDString(0); const int track_amount = (int)track_manager->getNumberOfTracks(); // First build a list of all tracks to be displayed // (e.g. exclude arenas, ...) PtrVector<Track, REF> tracks; for (int n = 0; n < track_amount; n++) { Track* curr = track_manager->getTrack(n); if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_EASTER_EGG && !curr->hasEasterEggs()) continue; if (curr->isArena() || curr->isSoccer()||curr->isInternal()) continue; if (curr_group_name != ALL_TRACK_GROUPS_ID && !curr->isInGroup(curr_group_name)) continue; tracks.push_back(curr); } // for n<track_amount tracks.insertionSort(); for (unsigned int i = 0; i < tracks.size(); i++) { Track *curr = tracks.get(i); if (PlayerManager::getCurrentPlayer()->isLocked(curr->getIdent())) { tracks_widget->addItem( _("Locked : solve active challenges to gain access to more!"), "locked", curr->getScreenshotFile(), LOCKED_BADGE, IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE); } else { tracks_widget->addItem(translations->fribidize(curr->getName()), curr->getIdent(), curr->getScreenshotFile(), 0, IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE); m_random_track_list.push_back(curr->getIdent()); } } tracks_widget->addItem(_("Random Track"), "random_track", "/gui/track_random.png", 0 /* no badge */, IconButtonWidget::ICON_PATH_TYPE_RELATIVE); tracks_widget->updateItemDisplay(); std::random_shuffle( m_random_track_list.begin(), m_random_track_list.end() ); } // buildTrackList
void HelpScreen1::init() { Screen::init(); RibbonWidget* w = this->getWidget<RibbonWidget>("category"); ButtonWidget* tutorial = getWidget<ButtonWidget>("startTutorial"); tutorial->setActive(StateManager::get()->getGameState() != GUIEngine::INGAME_MENU); if (w != NULL) w->select( "page1", PLAYER_ID_GAME_MASTER ); } //init
void HelpScreen5::init() { Screen::init(); RibbonWidget* w = this->getWidget<RibbonWidget>("category"); if (w != NULL) { w->setFocusForPlayer(PLAYER_ID_GAME_MASTER); w->select( "page5", PLAYER_ID_GAME_MASTER ); } } // init
// ----------------------------------------------------------------------------- void GrandPrixEditorScreen::beforeAddingWidget() { RibbonWidget* tabs = getWidget<RibbonWidget>("gpgroups"); assert (tabs != NULL); tabs->clearAllChildren(); for (int i = 0; i < GrandPrixData::GP_GROUP_COUNT; i++) { tabs->addTextChild(getGroupName((enum GrandPrixData::GPGroupType)i), StringUtils::toString(i)); } }
void MainMenuScreen::loadedFromFile() { LabelWidget* w = getWidget<LabelWidget>("info_addons"); w->setScrollSpeed(15); #if DEBUG_MENU_ITEM != 1 RibbonWidget* rw = getWidget<RibbonWidget>("menu_bottomrow"); rw->removeChildNamed("test_gpwin"); rw->removeChildNamed("test_gplose"); rw->removeChildNamed("test_unlocked"); rw->removeChildNamed("test_unlocked2"); #endif } // loadedFromFile
// ---------------------------------------------------------------------------- void GPInfoScreen::beforeAddingWidget() { bool random = m_gp.isRandomGP(); if (!random) { // Check if there is a saved GP: SavedGrandPrix* saved_gp = SavedGrandPrix::getSavedGP( StateManager::get()->getActivePlayerProfile(0)->getUniqueID(), m_gp.getId(), race_manager->getNumLocalPlayers()); int tracks = m_gp.getTrackNames().size(); bool continue_visible = saved_gp && saved_gp->getNextTrack() > 0 && saved_gp->getNextTrack() < tracks; RibbonWidget* ribbonButtons = getWidget<RibbonWidget>("buttons"); int id_continue_button = ribbonButtons->findItemNamed("continue"); ribbonButtons->setItemVisible(id_continue_button, continue_visible); ribbonButtons->setLabel(id_continue_button, _("Continue saved GP")); } else { RibbonWidget* ribbonButtons = getWidget<RibbonWidget>("buttons"); int id_continue_button = ribbonButtons->findItemNamed("continue"); ribbonButtons->setItemVisible(id_continue_button, true); ribbonButtons->setLabel(id_continue_button, _("Reload")); } }
// ----------------------------------------------------------------------------- EventPropagation DynamicRibbonWidget::leftPressed(const int playerID) { if (m_deactivated) return EVENT_LET; RibbonWidget* w = getSelectedRibbon(playerID); if (w != NULL) { updateLabel(); propagateSelection(); for_var_in (DynamicRibbonHoverListener*, listener, m_hover_listeners) { listener->onSelectionChanged(this, w->getSelectionIDString(playerID), w->getSelectionText(playerID), playerID); }
// ----------------------------------------------------------------------------- void EditTrackScreen::beforeAddingWidget() { RibbonWidget* tabs = getWidget<RibbonWidget>("trackgroups"); assert (tabs != NULL); tabs->clearAllChildren(); const std::vector<std::string>& groups = track_manager->getAllTrackGroups(); if (groups.size() > 1) { tabs->addTextChild(_("All"), ALL_TRACKS_GROUP_ID); for (unsigned int i = 0; i < groups.size(); i++) tabs->addTextChild(_(groups[i].c_str()), groups[i]); } }
// ---------------------------------------------------------------------------- void ServerConfigurationDialog::init() { ModalDialog::init(); RibbonWidget* difficulty = getWidget<RibbonWidget>("difficulty"); assert(difficulty != NULL); difficulty->setSelection((int)race_manager->getDifficulty(), PLAYER_ID_GAME_MASTER); RibbonWidget* gamemode = getWidget<RibbonWidget>("gamemode"); assert(gamemode != NULL); gamemode->setSelection(m_prev_mode, PLAYER_ID_GAME_MASTER); updateMoreOption(m_prev_mode); m_options_widget->setFocusForPlayer(PLAYER_ID_GAME_MASTER); m_options_widget->select("cancel", PLAYER_ID_GAME_MASTER); } // init
void ArenasScreen::beforeAddingWidget() { // Dynamically add tabs RibbonWidget* tabs = this->getWidget<RibbonWidget>("trackgroups"); assert( tabs != NULL ); tabs->clearAllChildren(); const std::vector<std::string>& groups = track_manager->getAllArenaGroups(); const int group_amount = groups.size(); if (group_amount > 1) { //I18N: name of the tab that will show arenas from all groups tabs->addTextChild( _("All"), ALL_ARENA_GROUPS_ID ); } // Make group names being picked up by gettext #define FOR_GETTEXT_ONLY(x) //I18N: arena group name FOR_GETTEXT_ONLY( _("standard") ) //I18N: arena group name FOR_GETTEXT_ONLY( _("Add-Ons") ) // add others after for (int n=0; n<group_amount; n++) { // try to translate the group name tabs->addTextChild( _(groups[n].c_str()), groups[n] ); } int num_of_arenas=0; for (unsigned int n=0; n<track_manager->getNumberOfTracks(); n++) //iterate through tracks to find how many are arenas { Track* temp = track_manager->getTrack(n); if (temp->isArena()){ num_of_arenas++; } } DynamicRibbonWidget* tracks_widget = this->getWidget<DynamicRibbonWidget>("tracks"); assert( tracks_widget != NULL ); tracks_widget->setItemCountHint(num_of_arenas); //set the item hint to that number to prevent weird formatting }
/** Process input events. * \event_source name of the widget that triggered the event. */ EventPropagation RegistrationDialog::processEvent(const std::string& event_source) { if (event_source == "options") { RibbonWidget *rib = getWidget<RibbonWidget>("options"); std::string s = rib->getSelectionIDString(PLAYER_ID_GAME_MASTER); if(s=="accept") { Screen *s = GUIEngine::getCurrentScreen(); RegisterScreen *r = dynamic_cast<RegisterScreen*>(s); assert(r); r->acceptTerms(); } // If it's not accept, it's cancel - anyway, close dialog ModalDialog::dismiss(); return EVENT_BLOCK; } return EVENT_LET; } // processEvent
StoryModeNewDialog::StoryModeNewDialog(const float w, const float h) : ModalDialog(w, h) { loadFromFile("story_mode_new.stkgui"); SpinnerWidget* ident = getWidget<SpinnerWidget>("identity"); const int playerAmount = UserConfigParams::m_all_players.size(); ident->setMax(playerAmount - 1); for(int n=0; n<playerAmount; n++) { ident->addLabel( translations->fribidize(UserConfigParams::m_all_players[n].getName()) ); } RibbonWidget* difficulty = getWidget<RibbonWidget>("difficulty"); difficulty->setSelection( 1 /* medium */, PLAYER_ID_GAME_MASTER ); ident->setFocusForPlayer(PLAYER_ID_GAME_MASTER); }
void KartSelectionScreen::beforeAddingWidget() { // Dynamically add tabs RibbonWidget* tabs = getWidget<RibbonWidget>("kartgroups"); assert( tabs != NULL ); m_last_widget = tabs; tabs->clearAllChildren(); const std::vector<std::string>& groups = kart_properties_manager->getAllGroups(); const int group_amount = (int)groups.size(); // add all group first if (group_amount > 1) { //I18N: name of the tab that will show tracks from all groups tabs->addTextChild( _("All") , ALL_KART_GROUPS_ID); } // Make group names being picked up by gettext #define FOR_GETTEXT_ONLY(x) //I18N: kart group name FOR_GETTEXT_ONLY( _("standard") ) //I18N: kart group name FOR_GETTEXT_ONLY( _("Add-Ons") ) // add others after for (int n=0; n<group_amount; n++) { // try to translate group names tabs->addTextChild( _(groups[n].c_str()) , groups[n]); } // for n<group_amount DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts"); assert( w != NULL ); w->setItemCountHint( kart_properties_manager->getNumberOfKarts() ); } // beforeAddingWidget
// ----------------------------------------------------------------------------- void LoginScreen::init() { Screen::init(); // Make sure this tab is actually focused. RibbonWidget* tabs = this->getWidget<RibbonWidget>("login_tabs"); if (tabs) tabs->select( "tab_login", PLAYER_ID_GAME_MASTER ); TextBoxWidget *password_widget = getWidget<TextBoxWidget>("password"); password_widget->setPasswordBox(true,L'*'); m_options_widget = getWidget<RibbonWidget>("options"); assert(m_options_widget); m_options_widget->setActivated(); m_info_widget = getWidget<LabelWidget>("info"); assert(m_info_widget != NULL); m_success = false; // As default don't select 'remember' getWidget<CheckBoxWidget>("remember")->setState(false); } // init
void MainMenuScreen::loadedFromFile() { LabelWidget* w = getWidget<LabelWidget>("info_addons"); w->setScrollSpeed(15); RibbonWidget* rw_top = getWidget<RibbonWidget>("menu_toprow"); assert(rw_top != NULL); if (track_manager->getTrack("overworld") == NULL || track_manager->getTrack("introcutscene") == NULL || track_manager->getTrack("introcutscene2") == NULL) { rw_top->removeChildNamed("story"); } #if DEBUG_MENU_ITEM != 1 RibbonWidget* rw = getWidget<RibbonWidget>("menu_bottomrow"); rw->removeChildNamed("test_gpwin"); rw->removeChildNamed("test_gplose"); rw->removeChildNamed("test_unlocked"); rw->removeChildNamed("test_unlocked2"); rw->removeChildNamed("test_intro"); rw->removeChildNamed("test_outro"); #endif } // loadedFromFile
void OptionsScreenAudio::init() { Screen::init(); RibbonWidget* ribbon = this->getWidget<RibbonWidget>("options_choice"); if (ribbon != NULL) ribbon->select( "tab_audio", PLAYER_ID_GAME_MASTER ); ribbon->getRibbonChildren()[0].setTooltip( _("Graphics") ); ribbon->getRibbonChildren()[2].setTooltip( _("User Interface") ); ribbon->getRibbonChildren()[3].setTooltip( _("Players") ); ribbon->getRibbonChildren()[4].setTooltip( _("Controls") ); // ---- sfx volume SpinnerWidget* gauge = this->getWidget<SpinnerWidget>("sfx_volume"); assert(gauge != NULL); gauge->setValue( (int)(sfx_manager->getMasterSFXVolume()*10.0f) ); gauge = this->getWidget<SpinnerWidget>("music_volume"); assert(gauge != NULL); gauge->setValue( (int)(music_manager->getMasterMusicVolume()*10.f) ); // ---- music volume CheckBoxWidget* sfx = this->getWidget<CheckBoxWidget>("sfx_enabled"); CheckBoxWidget* music = this->getWidget<CheckBoxWidget>("music_enabled"); // ---- audio enables/disables sfx->setState( UserConfigParams::m_sfx ); music->setState( UserConfigParams::m_music ); } // init
// ----------------------------------------------------------------------------- void OptionsScreenInput::init() { Screen::init(); RibbonWidget* tabBar = this->getWidget<RibbonWidget>("options_choice"); if (tabBar != NULL) tabBar->select( "tab_controls", PLAYER_ID_GAME_MASTER ); tabBar->getRibbonChildren()[0].setTooltip( _("Graphics") ); tabBar->getRibbonChildren()[1].setTooltip( _("Audio") ); tabBar->getRibbonChildren()[2].setTooltip( _("User Interface") ); tabBar->getRibbonChildren()[3].setTooltip( _("Players") ); /* DynamicRibbonWidget* devices = this->getWidget<DynamicRibbonWidget>("devices"); assert( devices != NULL ); */ buildDeviceList(); //devices->updateItemDisplay(); /* // trigger displaying bindings for default selected device const std::string name2("devices"); eventCallback(devices, name2, PLAYER_ID_GAME_MASTER); */ } // init
// ----------------------------------------------------------------------------- void EditTrackScreen::eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) { if (name == "ok") { m_result = true; StateManager::get()->popMenu(); } else if (name == "cancel") { m_result = false; StateManager::get()->popMenu(); } else if (name == "tracks") { DynamicRibbonWidget* tracks = getWidget<DynamicRibbonWidget>("tracks"); assert(tracks != NULL); selectTrack(tracks->getSelectionIDString(PLAYER_ID_GAME_MASTER)); } else if (name == "trackgroups") { RibbonWidget* tabs = getWidget<RibbonWidget>("trackgroups"); assert(tabs != NULL); m_track_group = tabs->getSelectionIDString(PLAYER_ID_GAME_MASTER); loadTrackList(); } else if (name == "laps") { SpinnerWidget* laps = getWidget<SpinnerWidget>("laps"); assert(laps != NULL); m_laps = laps->getValue(); } else if (name == "reverse") { CheckBoxWidget* reverse = getWidget<CheckBoxWidget>("reverse"); assert(reverse != NULL); m_reverse = reverse->getState(); } }