Cosmetic changes only.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10073 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
a145ec9c0f
commit
b5224f04eb
@ -44,38 +44,41 @@ using namespace GUIEngine;
|
||||
DEFINE_SCREEN_SINGLETON( OptionsScreenVideo );
|
||||
|
||||
// Look-up table for GFX levels
|
||||
const bool GFX [] = {false, true, true, true, true, true, true};
|
||||
const int GFX_ANIM_KARTS [] = {0, 0, 1, 2, 2, 2, 2};
|
||||
const bool GFX_WEATHER [] = {false, false, false, false, true, true, true};
|
||||
const bool GFX_ANTIALIAS [] = {false, false, false, false, false, true, true};
|
||||
const bool GFX_POSTPROCESSING [] = {false, false, false, false, false, false, true};
|
||||
const bool GFX [] = {false, true, true, true, true, true, true};
|
||||
const int GFX_ANIM_KARTS[] = {0, 0, 1, 2, 2, 2, 2};
|
||||
const bool GFX_WEATHER [] = {false, false, false, false, true, true, true};
|
||||
const bool GFX_ANTIALIAS [] = {false, false, false, false, false, true, true};
|
||||
const bool GFX_POSTPROCESSING[] =
|
||||
{false, false, false, false, false, false, true};
|
||||
const int GFX_LEVEL_AMOUNT = 7;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
OptionsScreenVideo::OptionsScreenVideo() : Screen("options_video.stkgui")
|
||||
{
|
||||
m_inited = false;
|
||||
} // OptionsScreenVideo
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void OptionsScreenVideo::loadedFromFile()
|
||||
{
|
||||
m_inited = false;
|
||||
|
||||
|
||||
GUIEngine::SpinnerWidget* gfx = this->getWidget<GUIEngine::SpinnerWidget>("gfx_level");
|
||||
gfx->m_properties[GUIEngine::PROP_MAX_VALUE] = StringUtils::toString(GFX_LEVEL_AMOUNT);
|
||||
GUIEngine::SpinnerWidget* gfx =
|
||||
getWidget<GUIEngine::SpinnerWidget>("gfx_level");
|
||||
gfx->m_properties[GUIEngine::PROP_MAX_VALUE] =
|
||||
StringUtils::toString(GFX_LEVEL_AMOUNT);
|
||||
|
||||
} // loadedFromFile
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void OptionsScreenVideo::init()
|
||||
{
|
||||
Screen::init();
|
||||
RibbonWidget* ribbon = this->getWidget<RibbonWidget>("options_choice");
|
||||
RibbonWidget* ribbon = getWidget<RibbonWidget>("options_choice");
|
||||
if (ribbon != NULL) ribbon->select( "tab_video", PLAYER_ID_GAME_MASTER );
|
||||
|
||||
ribbon->getRibbonChildren()[1].setTooltip( _("Audio") );
|
||||
@ -83,27 +86,31 @@ void OptionsScreenVideo::init()
|
||||
ribbon->getRibbonChildren()[3].setTooltip( _("Players") );
|
||||
ribbon->getRibbonChildren()[4].setTooltip( _("Controls") );
|
||||
|
||||
GUIEngine::ButtonWidget* applyBtn = this->getWidget<GUIEngine::ButtonWidget>("apply_resolution");
|
||||
GUIEngine::ButtonWidget* applyBtn =
|
||||
getWidget<GUIEngine::ButtonWidget>("apply_resolution");
|
||||
assert( applyBtn != NULL );
|
||||
|
||||
GUIEngine::SpinnerWidget* gfx = this->getWidget<GUIEngine::SpinnerWidget>("gfx_level");
|
||||
GUIEngine::SpinnerWidget* gfx =
|
||||
getWidget<GUIEngine::SpinnerWidget>("gfx_level");
|
||||
assert( gfx != NULL );
|
||||
|
||||
GUIEngine::CheckBoxWidget* vsync = this->getWidget<GUIEngine::CheckBoxWidget>("vsync");
|
||||
GUIEngine::CheckBoxWidget* vsync =
|
||||
getWidget<GUIEngine::CheckBoxWidget>("vsync");
|
||||
assert( vsync != NULL );
|
||||
vsync->setState( UserConfigParams::m_vsync );
|
||||
|
||||
GUIEngine::CheckBoxWidget* fbos = this->getWidget<GUIEngine::CheckBoxWidget>("fbos");
|
||||
GUIEngine::CheckBoxWidget* fbos =
|
||||
getWidget<GUIEngine::CheckBoxWidget>("fbos");
|
||||
assert( fbos != NULL );
|
||||
fbos->setState( UserConfigParams::m_fbo );
|
||||
|
||||
|
||||
// ---- video modes
|
||||
DynamicRibbonWidget* res = this->getWidget<DynamicRibbonWidget>("resolutions");
|
||||
DynamicRibbonWidget* res = getWidget<DynamicRibbonWidget>("resolutions");
|
||||
assert( res != NULL );
|
||||
|
||||
|
||||
CheckBoxWidget* full = this->getWidget<CheckBoxWidget>("fullscreen");
|
||||
CheckBoxWidget* full = getWidget<CheckBoxWidget>("fullscreen");
|
||||
assert( full != NULL );
|
||||
full->setState( UserConfigParams::m_fullscreen );
|
||||
|
||||
@ -127,7 +134,8 @@ void OptionsScreenVideo::init()
|
||||
|
||||
bool found_config_res = false;
|
||||
|
||||
// for some odd reason, irrlicht sometimes fails to report the good old standard resolutions
|
||||
// for some odd reason, irrlicht sometimes fails to report the good
|
||||
// old standard resolutions
|
||||
// those are always useful for windowed mode
|
||||
bool found_800_600 = false;
|
||||
bool found_1024_640 = false;
|
||||
@ -139,7 +147,8 @@ void OptionsScreenVideo::init()
|
||||
const int h = modes[n].getHeight();
|
||||
const float ratio = (float)w / h;
|
||||
|
||||
if (w == UserConfigParams::m_width && h == UserConfigParams::m_height)
|
||||
if (w == UserConfigParams::m_width &&
|
||||
h == UserConfigParams::m_height)
|
||||
{
|
||||
found_config_res = true;
|
||||
}
|
||||
@ -167,13 +176,20 @@ void OptionsScreenVideo::init()
|
||||
|
||||
#define ABOUT_EQUAL(a , b) (fabsf( a - b ) < 0.01)
|
||||
|
||||
if (ABOUT_EQUAL( ratio, (5.0f/4.0f) )) res->addItem(label, name, "/gui/screen54.png");
|
||||
else if (ABOUT_EQUAL( ratio, (4.0f/3.0f) )) res->addItem(label, name, "/gui/screen43.png");
|
||||
else if (ABOUT_EQUAL( ratio, (16.0f/10.0f))) res->addItem(label, name, "/gui/screen1610.png");
|
||||
else if (ABOUT_EQUAL( ratio, (5.0f/3.0f) )) res->addItem(label, name, "/gui/screen53.png");
|
||||
else if (ABOUT_EQUAL( ratio, (3.0f/2.0f) )) res->addItem(label, name, "/gui/screen32.png");
|
||||
else if (ABOUT_EQUAL( ratio, (16.0f/9.0f) )) res->addItem(label, name, "/gui/screen169.png");
|
||||
else res->addItem(label, name, "/gui/screen_other.png");
|
||||
if (ABOUT_EQUAL( ratio, (5.0f/4.0f) ))
|
||||
res->addItem(label, name, "/gui/screen54.png");
|
||||
else if (ABOUT_EQUAL( ratio, (4.0f/3.0f) ))
|
||||
res->addItem(label, name, "/gui/screen43.png");
|
||||
else if (ABOUT_EQUAL( ratio, (16.0f/10.0f)))
|
||||
res->addItem(label, name, "/gui/screen1610.png");
|
||||
else if (ABOUT_EQUAL( ratio, (5.0f/3.0f) ))
|
||||
res->addItem(label, name, "/gui/screen53.png");
|
||||
else if (ABOUT_EQUAL( ratio, (3.0f/2.0f) ))
|
||||
res->addItem(label, name, "/gui/screen32.png");
|
||||
else if (ABOUT_EQUAL( ratio, (16.0f/9.0f) ))
|
||||
res->addItem(label, name, "/gui/screen169.png");
|
||||
else
|
||||
res->addItem(label, name, "/gui/screen_other.png");
|
||||
#undef ABOUT_EQUAL
|
||||
} // next resolution
|
||||
|
||||
@ -206,13 +222,20 @@ void OptionsScreenVideo::init()
|
||||
|
||||
#define ABOUT_EQUAL(a , b) (fabsf( a - b ) < 0.01)
|
||||
|
||||
if (ABOUT_EQUAL( ratio, (5.0f/4.0f) )) res->addItem(label, name, "/gui/screen54.png");
|
||||
else if (ABOUT_EQUAL( ratio, (4.0f/3.0f) )) res->addItem(label, name, "/gui/screen43.png");
|
||||
else if (ABOUT_EQUAL( ratio, (16.0f/10.0f))) res->addItem(label, name, "/gui/screen1610.png");
|
||||
else if (ABOUT_EQUAL( ratio, (5.0f/3.0f) )) res->addItem(label, name, "/gui/screen53.png");
|
||||
else if (ABOUT_EQUAL( ratio, (3.0f/2.0f) )) res->addItem(label, name, "/gui/screen32.png");
|
||||
else if (ABOUT_EQUAL( ratio, (16.0f/9.0f) )) res->addItem(label, name, "/gui/screen169.png");
|
||||
else res->addItem(label, name, "/gui/screen_other.png");
|
||||
if (ABOUT_EQUAL( ratio, (5.0f/4.0f) ))
|
||||
res->addItem(label, name, "/gui/screen54.png");
|
||||
else if (ABOUT_EQUAL( ratio, (4.0f/3.0f) ))
|
||||
res->addItem(label, name, "/gui/screen43.png");
|
||||
else if (ABOUT_EQUAL( ratio, (16.0f/10.0f) ))
|
||||
res->addItem(label, name, "/gui/screen1610.png");
|
||||
else if (ABOUT_EQUAL( ratio, (5.0f/3.0f) ))
|
||||
res->addItem(label, name, "/gui/screen53.png");
|
||||
else if (ABOUT_EQUAL( ratio, (3.0f/2.0f) ))
|
||||
res->addItem(label, name, "/gui/screen32.png");
|
||||
else if (ABOUT_EQUAL( ratio, (16.0f/9.0f) ))
|
||||
res->addItem(label, name, "/gui/screen169.png");
|
||||
else
|
||||
res->addItem(label, name, "/gui/screen_other.png");
|
||||
#undef ABOUT_EQUAL
|
||||
}
|
||||
|
||||
@ -235,27 +258,30 @@ void OptionsScreenVideo::init()
|
||||
|
||||
// ---- select current resolution every time
|
||||
char searching_for[32];
|
||||
snprintf(searching_for, 32, "%ix%i", (int)UserConfigParams::m_width, (int)UserConfigParams::m_height);
|
||||
snprintf(searching_for, 32, "%ix%i", (int)UserConfigParams::m_width,
|
||||
(int)UserConfigParams::m_height);
|
||||
|
||||
|
||||
if (res->setSelection(searching_for, PLAYER_ID_GAME_MASTER, false /* focus it */, true /* even if deactivated */))
|
||||
if (res->setSelection(searching_for, PLAYER_ID_GAME_MASTER,
|
||||
false /* focus it */, true /* even if deactivated*/))
|
||||
{
|
||||
// ok found
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "[OptionsScreenVideo] Cannot find resolution '" << searching_for << "'\n";
|
||||
std::cerr << "[OptionsScreenVideo] Cannot find resolution '"
|
||||
<< searching_for << "'\n";
|
||||
}
|
||||
|
||||
|
||||
// --- set gfx settings values
|
||||
for (int l=0; l<GFX_LEVEL_AMOUNT; l++)
|
||||
{
|
||||
if (UserConfigParams::m_show_steering_animations == GFX_ANIM_KARTS[l] &&
|
||||
if (UserConfigParams::m_show_steering_animations == GFX_ANIM_KARTS[l]&&
|
||||
UserConfigParams::m_graphical_effects == GFX[l] &&
|
||||
UserConfigParams::m_weather_effects == GFX_WEATHER[l] &&
|
||||
UserConfigParams::m_fullscreen_antialiasing == GFX_ANTIALIAS[l] &&
|
||||
UserConfigParams::m_postprocess_enabled == GFX_POSTPROCESSING[l])
|
||||
UserConfigParams::m_postprocess_enabled == GFX_POSTPROCESSING[l])
|
||||
{
|
||||
gfx->setValue(l+1);
|
||||
break;
|
||||
@ -264,7 +290,8 @@ void OptionsScreenVideo::init()
|
||||
|
||||
|
||||
// ---- forbid changing resolution or animation settings from in-game
|
||||
// (we need to disable them last because some items can't be edited when disabled)
|
||||
// (we need to disable them last because some items can't be edited when
|
||||
// disabled)
|
||||
if (StateManager::get()->getGameState() == GUIEngine::INGAME_MENU)
|
||||
{
|
||||
res->setDeactivated();
|
||||
@ -277,18 +304,21 @@ void OptionsScreenVideo::init()
|
||||
updateTooltip();
|
||||
} // init
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void OptionsScreenVideo::updateTooltip()
|
||||
{
|
||||
GUIEngine::SpinnerWidget* gfx = this->getWidget<GUIEngine::SpinnerWidget>("gfx_level");
|
||||
GUIEngine::SpinnerWidget* gfx =
|
||||
getWidget<GUIEngine::SpinnerWidget>("gfx_level");
|
||||
assert( gfx != NULL );
|
||||
|
||||
core::stringw tooltip;
|
||||
|
||||
//I18N: in the graphical options tooltip; indicates a graphical feature is enabled
|
||||
//I18N: in the graphical options tooltip;
|
||||
// indicates a graphical feature is enabled
|
||||
core::stringw enabled = _LTR("Enabled");
|
||||
//I18N: in the graphical options tooltip; indicates a graphical feature is disabled
|
||||
//I18N: in the graphical options tooltip;
|
||||
// indicates a graphical feature is disabled
|
||||
core::stringw disabled = _LTR("Disabled");
|
||||
//I18N: if all kart animations are enabled
|
||||
core::stringw all = _LTR("All");
|
||||
@ -298,32 +328,49 @@ void OptionsScreenVideo::updateTooltip()
|
||||
core::stringw none = _LTR("None");
|
||||
|
||||
//I18N: in graphical options
|
||||
tooltip = _("Animated Scenery : %s", UserConfigParams::m_graphical_effects ? enabled : disabled);
|
||||
tooltip = _("Animated Scenery : %s",
|
||||
UserConfigParams::m_graphical_effects ? enabled : disabled);
|
||||
//I18N: in graphical options
|
||||
tooltip = tooltip + L"\n" + _("Weather Effects : %s", UserConfigParams::m_weather_effects ? enabled : disabled);
|
||||
tooltip = tooltip + L"\n" + _("Weather Effects : %s",
|
||||
UserConfigParams::m_weather_effects ? enabled : disabled);
|
||||
//I18N: in graphical options
|
||||
tooltip = tooltip + L"\n" + _("Animated Characters : %s", UserConfigParams::m_show_steering_animations == 2 ? all :
|
||||
(UserConfigParams::m_show_steering_animations == 1 ? me : none));
|
||||
tooltip = tooltip + L"\n" + _("Animated Characters : %s",
|
||||
UserConfigParams::m_show_steering_animations == 2
|
||||
? all
|
||||
: (UserConfigParams::m_show_steering_animations == 1 ? me : none));
|
||||
//I18N: in graphical options
|
||||
tooltip = tooltip + L"\n" + _("Anti-aliasing (requires restart) : %s", UserConfigParams::m_fullscreen_antialiasing ? enabled : disabled);
|
||||
tooltip = tooltip + L"\n" + _("Anti-aliasing (requires restart) : %s",
|
||||
UserConfigParams::m_fullscreen_antialiasing ? enabled : disabled);
|
||||
//I18N: in graphical options
|
||||
tooltip = tooltip + L"\n" + _("Post-processing (motion blur) : %s", UserConfigParams::m_postprocess_enabled ? enabled : disabled);
|
||||
tooltip = tooltip + L"\n" + _("Post-processing (motion blur) : %s",
|
||||
UserConfigParams::m_postprocess_enabled ? enabled : disabled);
|
||||
gfx->setTooltip(tooltip);
|
||||
}
|
||||
} // updateTooltip
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name, const int playerID)
|
||||
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).c_str();
|
||||
std::string selection =
|
||||
((RibbonWidget*)widget)
|
||||
->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||
|
||||
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());
|
||||
Screen *screen = NULL;
|
||||
if (selection == "tab_audio")
|
||||
screen = OptionsScreenAudio::getInstance();
|
||||
else if (selection == "tab_video")
|
||||
screen = OptionsScreenVideo::getInstance();
|
||||
else if (selection == "tab_players")
|
||||
screen = OptionsScreenPlayers::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")
|
||||
{
|
||||
@ -333,19 +380,21 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
|
||||
{
|
||||
using namespace GUIEngine;
|
||||
|
||||
DynamicRibbonWidget* w1 = this->getWidget<DynamicRibbonWidget>("resolutions");
|
||||
DynamicRibbonWidget* w1=getWidget<DynamicRibbonWidget>("resolutions");
|
||||
assert(w1 != NULL);
|
||||
|
||||
const std::string& res = w1->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||
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)
|
||||
{
|
||||
std::cerr << "Failed to decode resolution : " << res.c_str() << std::endl;
|
||||
std::cerr << "Failed to decode resolution : " << res.c_str()
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
CheckBoxWidget* w2 = this->getWidget<CheckBoxWidget>("fullscreen");
|
||||
CheckBoxWidget* w2 = getWidget<CheckBoxWidget>("fullscreen");
|
||||
assert(w2 != NULL);
|
||||
|
||||
|
||||
@ -353,7 +402,8 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
|
||||
}
|
||||
else if (name == "gfx_level")
|
||||
{
|
||||
GUIEngine::SpinnerWidget* gfx_level = this->getWidget<GUIEngine::SpinnerWidget>("gfx_level");
|
||||
GUIEngine::SpinnerWidget* gfx_level =
|
||||
getWidget<GUIEngine::SpinnerWidget>("gfx_level");
|
||||
assert( gfx_level != NULL );
|
||||
|
||||
const int level = gfx_level->getValue();
|
||||
@ -362,26 +412,28 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
|
||||
UserConfigParams::m_graphical_effects = GFX[level-1];
|
||||
UserConfigParams::m_weather_effects = GFX_WEATHER[level-1];
|
||||
UserConfigParams::m_fullscreen_antialiasing = GFX_ANTIALIAS[level-1];
|
||||
UserConfigParams::m_postprocess_enabled = GFX_POSTPROCESSING[level-1];
|
||||
UserConfigParams::m_postprocess_enabled = GFX_POSTPROCESSING[level-1];
|
||||
|
||||
updateTooltip();
|
||||
}
|
||||
else if (name == "vsync")
|
||||
{
|
||||
GUIEngine::CheckBoxWidget* vsync = this->getWidget<GUIEngine::CheckBoxWidget>("vsync");
|
||||
GUIEngine::CheckBoxWidget* vsync =
|
||||
getWidget<GUIEngine::CheckBoxWidget>("vsync");
|
||||
assert( vsync != NULL );
|
||||
UserConfigParams::m_vsync = vsync->getState();
|
||||
}
|
||||
else if (name == "fbos")
|
||||
{
|
||||
GUIEngine::CheckBoxWidget* fbos = this->getWidget<GUIEngine::CheckBoxWidget>("fbos");
|
||||
GUIEngine::CheckBoxWidget* fbos =
|
||||
getWidget<GUIEngine::CheckBoxWidget>("fbos");
|
||||
assert( fbos != NULL );
|
||||
UserConfigParams::m_fbo = fbos->getState();
|
||||
}
|
||||
|
||||
} // eventCallback
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void OptionsScreenVideo::tearDown()
|
||||
{
|
||||
@ -390,12 +442,12 @@ void OptionsScreenVideo::tearDown()
|
||||
user_config->saveConfig();
|
||||
} // tearDown
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void OptionsScreenVideo::unloaded()
|
||||
{
|
||||
m_inited = false;
|
||||
} // unloaded
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user