当前位置: 首页>>代码示例>>C++>>正文


C++ SpinnerWidget::getValue方法代码示例

本文整理汇总了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();
    }
}
开发者ID:shantanusingh10,项目名称:stk-code,代码行数:40,代码来源:edit_track_screen.cpp

示例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();
    }
}
开发者ID:kiennguyen1994,项目名称:game-programming-cse-hcmut-2012,代码行数:74,代码来源:race_setup_screen.cpp

示例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
开发者ID:jeremiejig,项目名称:paf-autostereoscopie-2014,代码行数:64,代码来源:options_screen_audio.cpp


注:本文中的SpinnerWidget::getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。