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

    bool found = false;
    for (int l=0; l<GFX_LEVEL_AMOUNT; l++)
    {
        if (GFX_PRESETS[l].animatedCharacters == UserConfigParams::m_show_steering_animations &&
                GFX_PRESETS[l].animatedScenery == UserConfigParams::m_graphical_effects &&
                GFX_PRESETS[l].anisotropy == UserConfigParams::m_anisotropic &&
                GFX_PRESETS[l].bloom == UserConfigParams::m_bloom &&
                GFX_PRESETS[l].glow == UserConfigParams::m_glow &&
                GFX_PRESETS[l].lights == UserConfigParams::m_dynamic_lights &&
                GFX_PRESETS[l].lightshaft == UserConfigParams::m_light_shaft &&
                GFX_PRESETS[l].mlaa == UserConfigParams::m_mlaa &&
                GFX_PRESETS[l].motionblur == UserConfigParams::m_motionblur &&
                //GFX_PRESETS[l].shaders == UserConfigParams::m_pixel_shaders
                GFX_PRESETS[l].shadows == UserConfigParams::m_shadows_resolution &&
                GFX_PRESETS[l].ssao == UserConfigParams::m_ssao &&
                GFX_PRESETS[l].weather == UserConfigParams::m_weather_effects &&
                GFX_PRESETS[l].dof == UserConfigParams::m_dof &&
                GFX_PRESETS[l].global_illumination == UserConfigParams::m_gi &&
                GFX_PRESETS[l].degraded_ibl == UserConfigParams::m_degraded_IBL &&
                GFX_PRESETS[l].hd_textures == (UserConfigParams::m_high_definition_textures & 0x01))
        {
            gfx->setValue(l + 1);
            found = true;
            break;
        }
    }

    if (!found)
    {
        //I18N: custom video settings
        gfx->setCustomText( _("Custom") );
    }

    updateTooltip();
}
Exemple #2
0
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]);
    }

    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)
    list_widget->setActive(StateManager::get()->getGameState() != GUIEngine::INGAME_MENU);

}   // init
Exemple #3
0
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