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


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

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


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

示例1: eventCallback

void OptionsScreenVideo::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 == "custom")
    {
        new CustomVideoSettingsDialog(0.8f, 0.9f);
    }
    else if(name == "apply_resolution")
    {
        using namespace GUIEngine;

        DynamicRibbonWidget* w1=getWidget<DynamicRibbonWidget>("resolutions");
        assert(w1 != NULL);

        const std::string& res =
            w1->getSelectionIDString(PLAYER_ID_GAME_MASTER);

        int w = -1, h = -1;
        if (sscanf(res.c_str(), "%ix%i", &w, &h) != 2 || w == -1 || h == -1)
        {
            Log::error("OptionsScreenVideo", "Failed to decode resolution %s", res.c_str());
            return;
        }

        CheckBoxWidget* w2 = getWidget<CheckBoxWidget>("fullscreen");
        assert(w2 != NULL);


        irr_driver->changeResolution(w, h, w2->getState());
    }
    else if (name == "gfx_level")
    {
        GUIEngine::SpinnerWidget* gfx_level =
            getWidget<GUIEngine::SpinnerWidget>("gfx_level");
        assert( gfx_level != NULL );

        const int level = gfx_level->getValue() - 1;

        UserConfigParams::m_show_steering_animations = GFX_PRESETS[level].animatedCharacters;
        UserConfigParams::m_graphical_effects = GFX_PRESETS[level].animatedScenery;
        UserConfigParams::m_anisotropic = GFX_PRESETS[level].anisotropy;
        UserConfigParams::m_bloom = GFX_PRESETS[level].bloom;
        UserConfigParams::m_glow = GFX_PRESETS[level].glow;
        UserConfigParams::m_dynamic_lights = GFX_PRESETS[level].lights;
        UserConfigParams::m_light_shaft = GFX_PRESETS[level].lightshaft;
        UserConfigParams::m_mlaa = GFX_PRESETS[level].mlaa;
        UserConfigParams::m_motionblur = GFX_PRESETS[level].motionblur;
        //UserConfigParams::m_pixel_shaders = GFX_PRESETS[level].shaders;
        UserConfigParams::m_shadows = GFX_PRESETS[level].shadows;
        UserConfigParams::m_ssao = GFX_PRESETS[level].ssao;
        UserConfigParams::m_weather_effects = GFX_PRESETS[level].weather;
        UserConfigParams::m_dof = GFX_PRESETS[level].dof;
        UserConfigParams::m_gi = GFX_PRESETS[level].global_illumination;

        updateGfxSlider();
    }
    else if (name == "vsync")
    {
        GUIEngine::CheckBoxWidget* vsync =
            getWidget<GUIEngine::CheckBoxWidget>("vsync");
        assert( vsync != NULL );
        UserConfigParams::m_vsync = vsync->getState();
    }
    else if (name == "rememberWinpos")
    {
        CheckBoxWidget* rememberWinpos = getWidget<CheckBoxWidget>("rememberWinpos");
        UserConfigParams::m_remember_window_location = rememberWinpos->getState();
    }
    else if (name == "fullscreen")
    {
        CheckBoxWidget* fullscreen = getWidget<CheckBoxWidget>("fullscreen");
        CheckBoxWidget* rememberWinpos = getWidget<CheckBoxWidget>("rememberWinpos");

        if (fullscreen->getState()) rememberWinpos->setDeactivated();
        else rememberWinpos->setActivated();
    }
}   // eventCallback
开发者ID:kapilkd13,项目名称:stk-code,代码行数:99,代码来源:options_screen_video.cpp

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