本文整理汇总了C++中SpinnerWidget::getValue方法的典型用法代码示例。如果您正苦于以下问题:C++ SpinnerWidget::getValue方法的具体用法?C++ SpinnerWidget::getValue怎么用?C++ SpinnerWidget::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpinnerWidget
的用法示例。
在下文中一共展示了SpinnerWidget::getValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eventCallback
// -----------------------------------------------------------------------------
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();
}
}
示例2: eventCallback
void RaceSetupScreen::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
if (name == "difficulty")
{
RibbonWidget* w = dynamic_cast<RibbonWidget*>(widget);
assert(w != NULL);
const std::string& selection = w->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selection == "novice")
{
UserConfigParams::m_difficulty = RaceManager::DIFFICULTY_EASY;
race_manager->setDifficulty(RaceManager::DIFFICULTY_EASY);
}
else if (selection == "intermediate")
{
UserConfigParams::m_difficulty = RaceManager::DIFFICULTY_MEDIUM;
race_manager->setDifficulty(RaceManager::DIFFICULTY_MEDIUM);
}
else if (selection == "expert")
{
UserConfigParams::m_difficulty = RaceManager::DIFFICULTY_HARD;
race_manager->setDifficulty(RaceManager::DIFFICULTY_HARD);
}
}
else if (name == "gamemode")
{
DynamicRibbonWidget* w = dynamic_cast<DynamicRibbonWidget*>(widget);
const std::string& selectedMode = w->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selectedMode == IDENT_STD)
{
race_manager->setMinorMode(RaceManager::MINOR_MODE_NORMAL_RACE);
UserConfigParams::m_game_mode = CONFIG_CODE_NORMAL;
StateManager::get()->pushScreen( TracksScreen::getInstance() );
}
else if (selectedMode == IDENT_TTRIAL)
{
race_manager->setMinorMode(RaceManager::MINOR_MODE_TIME_TRIAL);
UserConfigParams::m_game_mode = CONFIG_CODE_TIMETRIAL;
StateManager::get()->pushScreen( TracksScreen::getInstance() );
}
else if (selectedMode == IDENT_FTL)
{
// Make sure there are at least three karts, otherwise FTL doesn't
if(race_manager->getNumberOfKarts()<3)
race_manager->setNumKarts(3);
race_manager->setMinorMode(RaceManager::MINOR_MODE_FOLLOW_LEADER);
UserConfigParams::m_game_mode = CONFIG_CODE_FTL;
StateManager::get()->pushScreen( TracksScreen::getInstance() );
}
else if (selectedMode == IDENT_STRIKES)
{
race_manager->setMinorMode(RaceManager::MINOR_MODE_3_STRIKES);
UserConfigParams::m_game_mode = CONFIG_CODE_3STRIKES;
race_manager->setNumKarts( race_manager->getNumLocalPlayers() ); // no AI karts;
StateManager::get()->pushScreen( ArenasScreen::getInstance() );
}
else if (selectedMode == "locked")
{
unlock_manager->playLockSound();
}
}
else if (name == "aikartamount")
{
SpinnerWidget* w = dynamic_cast<SpinnerWidget*>(widget);
race_manager->setNumKarts( race_manager->getNumLocalPlayers() + w->getValue() );
UserConfigParams::m_num_karts = race_manager->getNumLocalPlayers() + w->getValue();
}
else if (name == "back")
{
StateManager::get()->escapePressed();
}
}
示例3: eventCallback
void OptionsScreenAudio::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
if (name == "options_choice")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
if (selection == "tab_audio") StateManager::get()->replaceTopMostScreen(OptionsScreenAudio::getInstance());
else if (selection == "tab_video") StateManager::get()->replaceTopMostScreen(OptionsScreenVideo::getInstance());
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
else if (selection == "tab_ui") StateManager::get()->replaceTopMostScreen(OptionsScreenUI::getInstance());
}
else if(name == "back")
{
StateManager::get()->escapePressed();
}
else if(name == "music_volume")
{
SpinnerWidget* w = dynamic_cast<SpinnerWidget*>(widget);
assert(w != NULL);
music_manager->setMasterMusicVolume( w->getValue()/10.0f );
}
else if(name == "sfx_volume")
{
static SFXBase* sample_sound = NULL;
SpinnerWidget* w = dynamic_cast<SpinnerWidget*>(widget);
assert(w != NULL);
if (sample_sound == NULL) sample_sound = sfx_manager->createSoundSource( "pre_start_race" );
sample_sound->volume(1);
sfx_manager->setMasterSFXVolume( w->getValue()/10.0f );
UserConfigParams::m_sfx_volume = w->getValue()/10.0f;
// play a sample sound to show the user what this volume is like
sample_sound->play();
}
else if(name == "music_enabled")
{
CheckBoxWidget* w = dynamic_cast<CheckBoxWidget*>(widget);
UserConfigParams::m_music = w->getState();
std::cout << "music state is now " << (bool)UserConfigParams::m_music << std::endl;
if(w->getState() == false)
music_manager->stopMusic();
else
music_manager->startMusic(music_manager->getCurrentMusic());
}
else if(name == "sfx_enabled")
{
CheckBoxWidget* w = dynamic_cast<CheckBoxWidget*>(widget);
UserConfigParams::m_sfx = w->getState();
sfx_manager->soundToggled(UserConfigParams::m_sfx);
if (UserConfigParams::m_sfx)
{
sfx_manager->quickSound("horn");
}
}
} // eventCallback