diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/commands.xml b/code/ryzom/client/data/gamedev/interfaces_v3/commands.xml index 31a1a7099..6b45ec715 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/commands.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/commands.xml @@ -122,6 +122,8 @@ + + diff --git a/code/ryzom/client/src/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp index c21797def..14741b7ad 100644 --- a/code/ryzom/client/src/client_cfg.cpp +++ b/code/ryzom/client/src/client_cfg.cpp @@ -839,8 +839,7 @@ void CClientConfig::setValues() READ_FLOAT_FV(Gamma) // UI scaling READ_FLOAT_FV(InterfaceScale); - // 50% smaller / 2x bigger - clamp(ClientCfg.InterfaceScale, 0.5f, 2.0f); + clamp(ClientCfg.InterfaceScale, MIN_INTERFACE_SCALE, MAX_INTERFACE_SCALE); READ_BOOL_FV(BilinearUI); // 3D Driver varPtr = ClientCfg.ConfigFile.getVarPtr ("Driver3D"); diff --git a/code/ryzom/client/src/client_cfg.h b/code/ryzom/client/src/client_cfg.h index accc5ae1e..9b24f3058 100644 --- a/code/ryzom/client/src/client_cfg.h +++ b/code/ryzom/client/src/client_cfg.h @@ -46,6 +46,9 @@ using NLMISC::CVector; using NLMISC::CRGBA; using std::string; +// limits for UI scale +const float MIN_INTERFACE_SCALE = 0.8; +const float MAX_INTERFACE_SCALE = 2.0; //--------------------------------------------------- // CClientConfig : diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index 196b0a45e..f1b27bb46 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -3732,6 +3732,34 @@ class CHandlerGameConfigChangeScreenRatioCustom : public IActionHandler }; REGISTER_ACTION_HANDLER (CHandlerGameConfigChangeScreenRatioCustom, "game_config_change_screen_ratio_custom"); +// *************************************************************************** +class CHandlerSetInterfaceScale : public IActionHandler +{ + virtual void execute (CCtrlBase *pCaller, const string &Params) + { + std::string s; + s = getParam(Params, "scale"); + if (!s.empty()) { + float scale; + if (fromString(s, scale)) + { + if (scale >= MIN_INTERFACE_SCALE && scale <= MAX_INTERFACE_SCALE) + { + ClientCfg.InterfaceScale = scale; + ClientCfg.writeDouble("InterfaceScale", ClientCfg.InterfaceScale); + + ClientCfg.IsInvalidated = true; + return; + } + } + } + + ucstring help("/setuiscale "+toString("%.1f .. %.1f", MIN_INTERFACE_SCALE, MAX_INTERFACE_SCALE)); + CInterfaceManager::getInstance()->displaySystemInfo(help); + } +}; +REGISTER_ACTION_HANDLER (CHandlerSetInterfaceScale, "set_ui_scale"); + // *************************************************************************** class CHandlerGameMissionAbandon : public IActionHandler diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 221ae0671..a63d4b5ac 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -2038,8 +2038,7 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera) _CurrentPlayerCharac[i] = node ? node->getValue32() : 0; } - // update value change from ingame config window - // must update it here, right before widget manager checks it + // scale must be updated right before widget manager checks it if (_InterfaceScaleChanged) { CViewRenderer::getInstance()->setInterfaceScale(_InterfaceScale); @@ -2916,7 +2915,6 @@ NLMISC_COMMAND(loadui, "Load an interface file", "") return result; } - // *************************************************************************** void CInterfaceManager::displayWebWindow(const string & name, const string & url) {