本文整理汇总了C++中SpinnerWidget类的典型用法代码示例。如果您正苦于以下问题:C++ SpinnerWidget类的具体用法?C++ SpinnerWidget怎么用?C++ SpinnerWidget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SpinnerWidget类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _
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
示例2: ModalDialog
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);
}
示例3: assert
// -----------------------------------------------------------------------------
void EditTrackScreen::selectTrack(const std::string& id)
{
DynamicRibbonWidget* tracks = getWidget<DynamicRibbonWidget>("tracks");
assert(tracks != NULL);
LabelWidget* selected_track = getWidget<LabelWidget>("selected_track");
assert(selected_track != NULL);
SpinnerWidget* laps = getWidget<SpinnerWidget>("laps");
assert(laps != NULL);
LabelWidget* label_reverse = getWidget<LabelWidget>("reverse_label");
assert(label_reverse != NULL);
CheckBoxWidget* reverse = getWidget<CheckBoxWidget>("reverse");
assert(reverse != NULL);
ButtonWidget* ok_button = getWidget<ButtonWidget>("ok");
assert(ok_button != NULL);
m_track = track_manager->getTrack(id);
if (m_track != NULL)
{
tracks->setSelection(m_track->getIdent(), PLAYER_ID_GAME_MASTER, true);
selected_track->setText(m_track->getName(), true);
laps->setValue(m_laps);
reverse->setVisible(m_track->reverseAvailable());
label_reverse->setVisible(m_track->reverseAvailable());
ok_button->setActivated();
}
else
{
tracks->setSelection("", PLAYER_ID_GAME_MASTER, true);
selected_track->setText(_("Select a track"), true);
// We can't set a better default for number of laps. On the other
// hand, if a track is selected, the number of laps will be updated.
laps->setValue(3);
reverse->setVisible(true);
reverse->setState(false);
ok_button->setDeactivated();
}
}
示例4: init
// -----------------------------------------------------------------------------
void SoccerSetupScreen::init()
{
m_schedule_continue = false;
Screen::init();
if (UserConfigParams::m_num_goals <= 0)
UserConfigParams::m_num_goals = 3;
if (UserConfigParams::m_soccer_time_limit <= 0)
UserConfigParams::m_soccer_time_limit = 3;
SpinnerWidget* goalamount = getWidget<SpinnerWidget>("goalamount");
goalamount->setValue(UserConfigParams::m_num_goals);
goalamount->setActive(!UserConfigParams::m_soccer_use_time_limit);
SpinnerWidget* timeAmount = getWidget<SpinnerWidget>("timeamount");
timeAmount->setValue(UserConfigParams::m_soccer_time_limit);
timeAmount->setActive(UserConfigParams::m_soccer_use_time_limit);
CheckBoxWidget* timeEnabled = getWidget<CheckBoxWidget>("time_enabled");
timeEnabled->setState(UserConfigParams::m_soccer_use_time_limit);
// Set focus on "continue"
ButtonWidget* bt_continue = getWidget<ButtonWidget>("continue");
bt_continue->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
// We need players to be able to choose their teams
input_manager->setMasterPlayerOnly(false);
// This flag will cause that a 'fire' event will be mapped to 'select' (if
// 'fire' is not assigned to a GUI event). This is done to support the old
// way of player joining by pressing 'fire' instead of 'select'.
input_manager->getDeviceManager()->mapFireToSelect(true);
} // init
示例5: init
// -----------------------------------------------------------------------------
void SoccerSetupScreen::init()
{
m_schedule_continue = false;
Screen::init();
// TODO: remember in config.xml the last number of goals
if (UserConfigParams::m_soccer_time_limit <= 0)
UserConfigParams::m_soccer_time_limit = 3;
SpinnerWidget* goalamount = getWidget<SpinnerWidget>("goalamount");
goalamount->setValue(3);
goalamount->setActivated();
SpinnerWidget* timeAmount = getWidget<SpinnerWidget>("timeamount");
timeAmount->setValue(UserConfigParams::m_soccer_time_limit);
timeAmount->setDeactivated();
CheckBoxWidget* timeEnabled = getWidget<CheckBoxWidget>("time_enabled");
timeEnabled->setState(false);
// Set focus on "continue"
ButtonWidget* bt_continue = getWidget<ButtonWidget>("continue");
bt_continue->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
// We need players to be able to choose their teams
input_manager->setMasterPlayerOnly(false);
} // init
示例6: if
// -----------------------------------------------------------------------------
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();
}
}
示例7: assert
void RaceSetupScreen::onGameModeChanged()
{
DynamicRibbonWidget* w2 = getWidget<DynamicRibbonWidget>("gamemode");
assert( w2 != NULL );
std::string gamemode_str = w2->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (gamemode_str == "locked") return;
RaceManager::MinorRaceModeType gamemode =
RaceManager::getModeIDFromInternalName(gamemode_str);
// deactivate the AI karts count widget for modes for which we have no AI
SpinnerWidget* kartamount = getWidget<SpinnerWidget>("aikartamount");
if (!RaceManager::hasAI(gamemode))
{
kartamount->setDeactivated();
}
else
{
kartamount->setActivated();
}
}
示例8: _
void CustomVideoSettingsDialog::beforeAddingWidgets()
{
getWidget<CheckBoxWidget>("anim_gfx")->setState( UserConfigParams::m_graphical_effects );
getWidget<CheckBoxWidget>("weather_gfx")->setState( UserConfigParams::m_weather_effects );
getWidget<CheckBoxWidget>("ubo")->setState(!UserConfigParams::m_ubo_disabled);
getWidget<CheckBoxWidget>("dof")->setState(UserConfigParams::m_dof);
getWidget<CheckBoxWidget>("hd-textures")->setState(UserConfigParams::m_high_definition_textures);
SpinnerWidget* kart_anim = getWidget<SpinnerWidget>("steering_animations");
kart_anim->addLabel( _("Disabled") ); // 0
//I18N: animations setting (only karts with human players are animated)
kart_anim->addLabel( _("Human players only") ); // 1
//I18N: animations setting (all karts are animated)
kart_anim->addLabel( _("Enabled for all") ); // 2
kart_anim->setValue( UserConfigParams::m_show_steering_animations );
SpinnerWidget* filtering = getWidget<SpinnerWidget>("filtering");
int value = 0;
if (UserConfigParams::m_anisotropic == 2) value = 2;
else if (UserConfigParams::m_anisotropic == 4) value = 3;
else if (UserConfigParams::m_anisotropic == 8) value = 4;
else if (UserConfigParams::m_anisotropic == 16) value = 5;
else if (UserConfigParams::m_trilinear) value = 1;
filtering->addLabel( _("Bilinear") ); // 0
filtering->addLabel( _("Trilinear") ); // 1
filtering->addLabel( _("Anisotropic x2") ); // 2
filtering->addLabel( _("Anisotropic x4") ); // 3
filtering->addLabel( _("Anisotropic x8") ); // 4
filtering->addLabel( _("Anisotropic x16") ); // 5
filtering->setValue( value );
SpinnerWidget* shadows = getWidget<SpinnerWidget>("shadows");
shadows->addLabel( _("Disabled") ); // 0
shadows->addLabel( _("low") ); // 1
shadows->addLabel( _("high") ); // 2
shadows->setValue( UserConfigParams::m_shadows );
getWidget<CheckBoxWidget>("dynamiclight")->setState(UserConfigParams::m_dynamic_lights);
getWidget<CheckBoxWidget>("lightshaft")->setState(UserConfigParams::m_light_shaft);
getWidget<CheckBoxWidget>("motionblur")->setState(UserConfigParams::m_motionblur);
getWidget<CheckBoxWidget>("mlaa")->setState(UserConfigParams::m_mlaa);
getWidget<CheckBoxWidget>("glow")->setState(UserConfigParams::m_glow);
getWidget<CheckBoxWidget>("ssao")->setState(UserConfigParams::m_ssao);
getWidget<CheckBoxWidget>("bloom")->setState(UserConfigParams::m_bloom);
getWidget<CheckBoxWidget>("texture_compression")->setState(UserConfigParams::m_texture_compression);
}
示例9: if
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