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


C++ CheckBoxWidget::setState方法代码示例

本文整理汇总了C++中CheckBoxWidget::setState方法的典型用法代码示例。如果您正苦于以下问题:C++ CheckBoxWidget::setState方法的具体用法?C++ CheckBoxWidget::setState怎么用?C++ CheckBoxWidget::setState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CheckBoxWidget的用法示例。


在下文中一共展示了CheckBoxWidget::setState方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

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

示例2: 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
开发者ID:toymak3r,项目名称:Beyond-The-Mirror---Weird-Rancing-Game,代码行数:36,代码来源:soccer_setup_screen.cpp

示例3: 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
开发者ID:hiker,项目名称:stk-code,代码行数:30,代码来源:soccer_setup_screen.cpp

示例4: selectTrack

// -----------------------------------------------------------------------------
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();
    }
}
开发者ID:shantanusingh10,项目名称:stk-code,代码行数:44,代码来源:edit_track_screen.cpp

示例5: init

void StoryModeLobbyScreen::init()
{
    Screen::init();
    
    CheckBoxWidget* cb = getWidget<CheckBoxWidget>("rememberme");
    cb->setState(false);
    
    ListWidget* list = getWidget<ListWidget>("gameslots");
    list->clear();
    
    PtrVector<PlayerProfile>& players = UserConfigParams::m_all_players;
    
    if (UserConfigParams::m_default_player.toString().size() > 0)
    {
        for (int n=0; n<players.size(); n++)
        {
            if (players[n].getName() == UserConfigParams::m_default_player.toString())
            {
                unlock_manager->setCurrentSlot(players[n].getUniqueID());
                StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
                return;
            }
        }
    }
    
    for (int n=0; n<players.size(); n++)
    {
        if (players[n].isGuestAccount()) continue;
        
        // FIXME: we're using a trunacted ascii version of the player name as
        //        identifier, let's hope this causes no issues...
        list->addItem(core::stringc(players[n].getName().c_str()).c_str(),
                      players[n].getName() );
    }
    
    list->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
    list->setSelectionID(0);
    
}   // init
开发者ID:kiennguyen1994,项目名称:game-programming-cse-hcmut-2012,代码行数:39,代码来源:story_mode_lobby.cpp

示例6: init

// -----------------------------------------------------------------------------
void EditTrackScreen::init()
{
    RibbonWidget* tabs = getWidget<RibbonWidget>("trackgroups");
    assert (tabs != NULL);
    SpinnerWidget* laps = getWidget<SpinnerWidget>("laps");
    assert(laps != NULL);
    CheckBoxWidget* reverse = getWidget<CheckBoxWidget>("reverse");
    assert(reverse != NULL);

    if (m_track_group.empty())
        tabs->select (ALL_TRACKS_GROUP_ID, PLAYER_ID_GAME_MASTER);
    else
        tabs->select (m_track_group, PLAYER_ID_GAME_MASTER);
    laps->setValue(m_laps);
    reverse->setState(m_reverse);

    loadTrackList();
    if (m_track == NULL)
        selectTrack("");
    else
        selectTrack(m_track->getIdent());
}
开发者ID:shantanusingh10,项目名称:stk-code,代码行数:23,代码来源:edit_track_screen.cpp

示例7: eventCallback

void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
    if (name == "options_choice")
    {
        std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);

        Screen *screen = NULL;
        if (selection == "tab_audio")
            screen = OptionsScreenAudio::getInstance();
        else if (selection == "tab_video")
            screen = OptionsScreenVideo::getInstance();
        else if (selection == "tab_players")
            screen = TabbedUserScreen::getInstance();
        else if (selection == "tab_controls")
            screen = OptionsScreenInput::getInstance();
        //else if (selection == "tab_ui")
        //    screen = OptionsScreenUI::getInstance();
        if(screen)
            StateManager::get()->replaceTopMostScreen(screen);
    }
    else if(name == "back")
    {
        StateManager::get()->escapePressed();
    }
    else if (name == "skinchoice")
    {
        GUIEngine::SpinnerWidget* skinSelector = getWidget<GUIEngine::SpinnerWidget>("skinchoice");
        assert( skinSelector != NULL );

        const core::stringw selectedSkin = skinSelector->getStringValue();
        UserConfigParams::m_skin_file = core::stringc(selectedSkin.c_str()).c_str() + std::string(".stkskin");
        GUIEngine::reloadSkin();
    }
    else if (name == "showfps")
    {
        CheckBoxWidget* fps = getWidget<CheckBoxWidget>("showfps");
        assert( fps != NULL );
        UserConfigParams::m_display_fps = fps->getState();
    }
    else if (name=="enable-internet")
    {
        CheckBoxWidget* internet = getWidget<CheckBoxWidget>("enable-internet");
        assert( internet != NULL );
        UserConfigParams::m_internet_status =
            internet->getState() ? RequestManager::IPERM_ALLOWED
                                 : RequestManager::IPERM_NOT_ALLOWED;
        // If internet gets enabled, re-initialise the addon manager (which
        // happens in a separate thread) so that news.xml etc can be
        // downloaded if necessary.
        CheckBoxWidget *stats = getWidget<CheckBoxWidget>("enable-hw-report");
        LabelWidget *stats_label = getWidget<LabelWidget>("label-hw-report");
        if(internet->getState())
        {
            NewsManager::get()->init(false);
            stats->setVisible(true);
            stats_label->setVisible(true);
            stats->setState(UserConfigParams::m_hw_report_enable);
        }
        else
        {
            stats->setVisible(false);
            stats_label->setVisible(false);
            PlayerProfile* profile = PlayerManager::getCurrentPlayer();
            if (profile != NULL && profile->isLoggedIn())
                profile->requestSignOut();
        }
    }
    else if (name=="enable-hw-report")
    {
        CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
        UserConfigParams::m_hw_report_enable = stats->getState();
        if(stats->getState())
            HardwareStats::reportHardwareStats();
    }
    else if (name=="show-login")
    {
        CheckBoxWidget* show_login = getWidget<CheckBoxWidget>("show-login");
        assert( show_login != NULL );
        UserConfigParams::m_always_show_login_screen = show_login->getState();
    }
    else if (name=="perPlayerDifficulty")
    {
        CheckBoxWidget* difficulty = getWidget<CheckBoxWidget>("perPlayerDifficulty");
        assert( difficulty != NULL );
        UserConfigParams::m_per_player_difficulty = difficulty->getState();
    }
    else if (name == "language")
    {
        ListWidget* list_widget = getWidget<ListWidget>("language");
        std::string selection = list_widget->getSelectionInternalName();

        delete translations;

        if (selection == "system")
        {
#ifdef WIN32
            _putenv("LANGUAGE=");
#else
            unsetenv("LANGUAGE");
#endif
//.........这里部分代码省略.........
开发者ID:Benau,项目名称:stk-code,代码行数:101,代码来源:options_screen_ui.cpp

示例8: init

void OptionsScreenUI::init()
{
    Screen::init();
    RibbonWidget* ribbon = getWidget<RibbonWidget>("options_choice");
    assert(ribbon != NULL);
    ribbon->select( "tab_ui", PLAYER_ID_GAME_MASTER );

    ribbon->getRibbonChildren()[0].setTooltip( _("Graphics") );
    ribbon->getRibbonChildren()[1].setTooltip( _("Audio") );
    ribbon->getRibbonChildren()[3].setTooltip( _("Players") );
    ribbon->getRibbonChildren()[4].setTooltip( _("Controls") );

    GUIEngine::SpinnerWidget* skinSelector = getWidget<GUIEngine::SpinnerWidget>("skinchoice");
    assert( skinSelector != NULL );

    // ---- video modes

    CheckBoxWidget* fps = getWidget<CheckBoxWidget>("showfps");
    assert( fps != NULL );
    fps->setState( UserConfigParams::m_display_fps );
    CheckBoxWidget* news = getWidget<CheckBoxWidget>("enable-internet");
    assert( news != NULL );
    news->setState( UserConfigParams::m_internet_status
                                     ==RequestManager::IPERM_ALLOWED );
    CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
    assert( stats != NULL );
    LabelWidget *stats_label = getWidget<LabelWidget>("label-hw-report");
    assert( stats_label );
            stats->setState(UserConfigParams::m_hw_report_enable);

    if(news->getState())
    {
        stats_label->setVisible(true);
        stats->setVisible(true);
        stats->setState(UserConfigParams::m_hw_report_enable);
    }
    else
    {
        stats_label->setVisible(false);
        stats->setVisible(false);
    }
    CheckBoxWidget* difficulty = getWidget<CheckBoxWidget>("perPlayerDifficulty");
    assert( difficulty != NULL );
    difficulty->setState( UserConfigParams::m_per_player_difficulty );
    difficulty->setTooltip(_("In multiplayer mode, players can select handicapped (more difficult) profiles on the kart selection screen"));

    CheckBoxWidget* show_login = getWidget<CheckBoxWidget>("show-login");
    assert( show_login!= NULL );
    show_login->setState( UserConfigParams::m_always_show_login_screen);

    // --- select the right skin in the spinner
    bool currSkinFound = false;
    const int skinCount = (int) m_skins.size();
    for (int n=0; n<skinCount; n++)
    {
        const std::string skinFileName = StringUtils::getBasename(m_skins[n]);

        if (UserConfigParams::m_skin_file.c_str() == skinFileName)
        {
            skinSelector->setValue(n);
            currSkinFound = true;
            break;
        }
    }
    if (!currSkinFound)
    {
        Log::warn("OptionsScreenUI",
                  "Couldn't find current skin in the list of skins!");
        skinSelector->setValue(0);
        GUIEngine::reloadSkin();
    }

    // --- language
    ListWidget* list_widget = getWidget<ListWidget>("language");

    // I18N: in the language choice, to select the same language as the OS
    list_widget->addItem("system", _("System Language"));

    const std::vector<std::string>* lang_list = translations->getLanguageList();
    const int amount = (int)lang_list->size();

    // The names need to be sorted alphabetically. Store the 2-letter
    // language names in a mapping, to be able to get them from the
    // user visible full name.
    std::vector<core::stringw> nice_lang_list;
    std::map<core::stringw, std::string> nice_name_2_id;
    for (int n=0; n<amount; n++)
    {
        std::string code_name = (*lang_list)[n];
        std::string s_name = translations->getLocalizedName(code_name) +
         " (" + tinygettext::Language::from_name(code_name).get_language() + ")";
        core::stringw nice_name = translations->fribidize(StringUtils::utf8ToWide(s_name));
        nice_lang_list.push_back(nice_name);
        nice_name_2_id[nice_name] = code_name;
    }
    std::sort(nice_lang_list.begin(), nice_lang_list.end());
    for(unsigned int i=0; i<nice_lang_list.size(); i++)
    {
        list_widget->addItem(nice_name_2_id[nice_lang_list[i]],
                              nice_lang_list[i]);
//.........这里部分代码省略.........
开发者ID:Benau,项目名称:stk-code,代码行数:101,代码来源:options_screen_ui.cpp

示例9: init

void OptionsScreenUI::init()
{
    Screen::init();
    RibbonWidget* ribbon = getWidget<RibbonWidget>("options_choice");
    if (ribbon != NULL)  ribbon->select( "tab_ui", PLAYER_ID_GAME_MASTER );
    
    ribbon->getRibbonChildren()[0].setTooltip( _("Graphics") );
    ribbon->getRibbonChildren()[1].setTooltip( _("Audio") );
    ribbon->getRibbonChildren()[3].setTooltip( _("Players") );
    ribbon->getRibbonChildren()[4].setTooltip( _("Controls") );
    
    GUIEngine::SpinnerWidget* skinSelector = getWidget<GUIEngine::SpinnerWidget>("skinchoice");
    assert( skinSelector != NULL );

    // ---- video modes

    CheckBoxWidget* fps = getWidget<CheckBoxWidget>("showfps");
    assert( fps != NULL );
    fps->setState( UserConfigParams::m_display_fps );
    CheckBoxWidget* news = getWidget<CheckBoxWidget>("enable-internet");
    assert( news != NULL );
    news->setState( UserConfigParams::m_internet_status
                                            ==INetworkHttp::IPERM_ALLOWED );
    CheckBoxWidget* min_gui = getWidget<CheckBoxWidget>("minimal-racegui");
    assert( min_gui != NULL );
    min_gui->setState( UserConfigParams::m_minimal_race_gui);
    if (StateManager::get()->getGameState() == GUIEngine::INGAME_MENU)
        min_gui->setDeactivated();
    else
        min_gui->setActivated();

    
    // --- select the right skin in the spinner
    bool currSkinFound = false;
    const int skinCount = m_skins.size();
    for (int n=0; n<skinCount; n++)
    {
        const std::string skinFileName = StringUtils::getBasename(m_skins[n]);
        
        if (UserConfigParams::m_skin_file.c_str() == skinFileName)
        {
            skinSelector->setValue(n);
            currSkinFound = true;
            break;
        }
    }
    if (!currSkinFound)
    {
        std::cerr << "WARNING: couldn't find current skin in the list of skins!!\n";
        skinSelector->setValue(0);
        GUIEngine::reloadSkin();
    }
    
    // --- language
    ListWidget* list_widget = getWidget<ListWidget>("language");
    
    // I18N: in the language choice, to select the same language as the OS
    list_widget->addItem("system", _("System Language"));
    
    const std::vector<std::string>* lang_list = translations->getLanguageList();
    const int amount = lang_list->size();
    for (int n=0; n<amount; n++)
    {
        std::string code_name = (*lang_list)[n];
        std::string nice_name = tinygettext::Language::from_name(code_name.c_str()).get_name();
        list_widget->addItem(code_name, core::stringw(code_name.c_str()) + " (" +
                             nice_name.c_str() + ")");
    }
        
    list_widget->setSelectionID( list_widget->getItemID(UserConfigParams::m_language) );
    
    // Forbid changing language while in-game, since this crashes (changing the language involves
    // tearing down and rebuilding the menu stack. not good when in-game)
    if (StateManager::get()->getGameState() == GUIEngine::INGAME_MENU)
    {
        list_widget->setDeactivated();
    }
    else
    {
        list_widget->setActivated();
    }
    
}   // init
开发者ID:langresser,项目名称:stk,代码行数:83,代码来源:options_screen_ui.cpp

示例10: init

void OptionsScreenVideo::init()
{
    Screen::init();
    RibbonWidget* ribbon = getWidget<RibbonWidget>("options_choice");
    assert(ribbon != NULL);
    ribbon->select( "tab_video", PLAYER_ID_GAME_MASTER );

    ribbon->getRibbonChildren()[1].setTooltip( _("Audio") );
    ribbon->getRibbonChildren()[2].setTooltip( _("User Interface") );
    ribbon->getRibbonChildren()[3].setTooltip( _("Players") );
    ribbon->getRibbonChildren()[4].setTooltip( _("Controls") );

    GUIEngine::ButtonWidget* applyBtn =
        getWidget<GUIEngine::ButtonWidget>("apply_resolution");
    assert( applyBtn != NULL );

    GUIEngine::SpinnerWidget* gfx =
        getWidget<GUIEngine::SpinnerWidget>("gfx_level");
    assert( gfx != NULL );

    GUIEngine::CheckBoxWidget* vsync =
        getWidget<GUIEngine::CheckBoxWidget>("vsync");
    assert( vsync != NULL );
    vsync->setState( UserConfigParams::m_vsync );


    // ---- video modes
    DynamicRibbonWidget* res = getWidget<DynamicRibbonWidget>("resolutions");
    assert( res != NULL );


    CheckBoxWidget* full = getWidget<CheckBoxWidget>("fullscreen");
    assert( full != NULL );
    full->setState( UserConfigParams::m_fullscreen );

    CheckBoxWidget* rememberWinpos = getWidget<CheckBoxWidget>("rememberWinpos");
    rememberWinpos->setState(UserConfigParams::m_remember_window_location);

    rememberWinpos->setActive(UserConfigParams::m_fullscreen);

    // --- get resolution list from irrlicht the first time
    if (!m_inited)
    {
        res->clearItems();

        const std::vector<IrrDriver::VideoMode>& modes =
            irr_driver->getVideoModes();
        const int amount = (int)modes.size();

        std::vector<Resolution> resolutions;
        Resolution r;

        bool found_config_res = false;

        // for some odd reason, irrlicht sometimes fails to report the good
        // old standard resolutions
        // those are always useful for windowed mode
        bool found_1024_768 = false;

        for (int n=0; n<amount; n++)
        {
            r.width  = modes[n].getWidth();
            r.height = modes[n].getHeight();
            resolutions.push_back(r);

            if (r.width  == UserConfigParams::m_width &&
                    r.height == UserConfigParams::m_height)
            {
                found_config_res = true;
            }

            if (r.width == 1024 && r.height == 768)
            {
                found_1024_768 = true;
            }
        }

        if (!found_config_res)
        {
            r.width  = UserConfigParams::m_width;
            r.height = UserConfigParams::m_height;
            resolutions.push_back(r);

            if (r.width == 1024 && r.height == 768)
            {
                found_1024_768 = true;
            }
        } // next found resolution

        // Add default resolutions that were not found by irrlicht
        if (!found_1024_768)
        {
            r.width  = 1024;
            r.height = 768;
            resolutions.push_back(r);
        }

        // Sort resolutions by size
        std::sort(resolutions.begin(), resolutions.end());

//.........这里部分代码省略.........
开发者ID:jkassman,项目名称:stk-code,代码行数:101,代码来源:options_screen_video.cpp

示例11: init

void OptionsScreenVideo::init()
{
    Screen::init();
    RibbonWidget* ribbon = getWidget<RibbonWidget>("options_choice");
    if (ribbon != NULL)  ribbon->select( "tab_video", PLAYER_ID_GAME_MASTER );

    ribbon->getRibbonChildren()[1].setTooltip( _("Audio") );
    ribbon->getRibbonChildren()[2].setTooltip( _("User Interface") );
    ribbon->getRibbonChildren()[3].setTooltip( _("Players") );
    ribbon->getRibbonChildren()[4].setTooltip( _("Controls") );

    GUIEngine::ButtonWidget* applyBtn =
        getWidget<GUIEngine::ButtonWidget>("apply_resolution");
    assert( applyBtn != NULL );

    GUIEngine::SpinnerWidget* gfx =
        getWidget<GUIEngine::SpinnerWidget>("gfx_level");
    assert( gfx != NULL );

    GUIEngine::CheckBoxWidget* vsync =
        getWidget<GUIEngine::CheckBoxWidget>("vsync");
    assert( vsync != NULL );
    vsync->setState( UserConfigParams::m_vsync );


    // ---- video modes
    DynamicRibbonWidget* res = getWidget<DynamicRibbonWidget>("resolutions");
    assert( res != NULL );


    CheckBoxWidget* full = getWidget<CheckBoxWidget>("fullscreen");
    assert( full != NULL );
    full->setState( UserConfigParams::m_fullscreen );

    CheckBoxWidget* rememberWinpos = getWidget<CheckBoxWidget>("rememberWinpos");
    rememberWinpos->setState(UserConfigParams::m_remember_window_location);

    if (UserConfigParams::m_fullscreen) rememberWinpos->setDeactivated();
    else rememberWinpos->setActivated();


    // --- get resolution list from irrlicht the first time
    if (!m_inited)
    {
        res->clearItems();

        const std::vector<IrrDriver::VideoMode>& modes =
                                                irr_driver->getVideoModes();
        const int amount = (int)modes.size();

        bool found_config_res = false;

        // for some odd reason, irrlicht sometimes fails to report the good
        // old standard resolutions
        // those are always useful for windowed mode
        // allow 800x600 only for debug mode
#ifdef DEBUG
        bool found_800_600 = false;
#endif
        bool found_1024_640 = false;
        bool found_1024_768 = false;

        for (int n=0; n<amount; n++)
        {
            const int w = modes[n].getWidth();
            const int h = modes[n].getHeight();
            const float ratio = (float)w / h;

            if (w == UserConfigParams::m_width &&
                h == UserConfigParams::m_height)
            {
                found_config_res = true;
            }

            if (w == 800 && h == 600)
            {
#ifdef DEBUG
                found_800_600 = true;
#else
                continue;
#endif
            }
            else if (w == 1024 && h == 640)
            {
                found_1024_640 = true;
            }
            else if (w == 1024 && h == 768)
            {
                found_1024_768 = true;
            }

            char name[32];
            sprintf( name, "%ix%i", w, h );

            core::stringw label;
            label += w;
            label += L"\u00D7";
            label += h;

#define ABOUT_EQUAL(a , b) (fabsf( a - b ) < 0.01)
//.........这里部分代码省略.........
开发者ID:kapilkd13,项目名称:stk-code,代码行数:101,代码来源:options_screen_video.cpp


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