diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/game_config.xml b/code/ryzom/client/data/gamedev/interfaces_v3/game_config.xml index 38e63cb24..001d2be1d 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/game_config.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/game_config.xml @@ -878,10 +878,17 @@ posparent="lum" x="0" y="-2" /> + @@ -3086,6 +3093,13 @@ realtime="true" widget="sbfloat" link="Gamma" /> + setInterfaceScale(ClientCfg.InterfaceScale); } @@ -290,6 +293,8 @@ void setOutGameFullScreen() */ } + // Enable auto scaling in login window + CViewRenderer::getInstance()->setInterfaceScale(1.0f, 1024, 768); } @@ -454,6 +459,9 @@ bool connection (const string &cookie, const string &fsaddr) firstConnection = false; + // Restore user UI scaling + CViewRenderer::getInstance()->setInterfaceScale(ClientCfg.InterfaceScale); + // Disable inputs Actions.enable(false); EditActions.enable(false); @@ -586,6 +594,9 @@ bool reconnection() InterfaceState = globalMenu(); } + // Restore user UI scaling + CViewRenderer::getInstance()->setInterfaceScale(ClientCfg.InterfaceScale); + // Disable inputs Actions.enable(false); EditActions.enable(false); diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index 7b1ca728f..8105d9351 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -1316,6 +1316,7 @@ void prelogInit() CInterfaceManager::getInstance(); + CViewRenderer::getInstance()->setInterfaceScale(1.0f, 1024, 768); // Yoyo: initialize NOW the InputHandler for Event filtering. CInputHandlerManager *InputHandlerManager = CInputHandlerManager::getInstance(); diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 3e2a0ba0e..802f98c70 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -475,6 +475,8 @@ CInterfaceManager::CInterfaceManager() interfaceLinkUpdater = new CInterfaceLink::CInterfaceLinkUpdater(); _ScreenW = _ScreenH = 0; _LastInGameScreenW = _LastInGameScreenH = 0; + _InterfaceScaleChanged = false; + _InterfaceScale = 1.0f; _DescTextTarget = NULL; _ConfigLoaded = false; _LogState = false; @@ -1984,6 +1986,14 @@ 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 + if (_InterfaceScaleChanged) + { + CViewRenderer::getInstance()->setInterfaceScale(_InterfaceScale); + _InterfaceScaleChanged = false; + } + CWidgetManager::getInstance()->drawViews( camera ); // flush obs diff --git a/code/ryzom/client/src/interface_v3/interface_manager.h b/code/ryzom/client/src/interface_v3/interface_manager.h index 6025868e5..c5c641033 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.h +++ b/code/ryzom/client/src/interface_v3/interface_manager.h @@ -543,6 +543,7 @@ public: NLMISC::CCDBNodeLeaf *_DB_UI_DUMMY_FACTION_TYPE; void updateDesktops( uint32 newScreenW, uint32 newScreenH ); + void setInterfaceScale( float scale ) { _InterfaceScaleChanged = true; _InterfaceScale = scale; } private: @@ -581,6 +582,8 @@ private: uint32 _ScreenW, _ScreenH; // Change res detection sint32 _LastInGameScreenW, _LastInGameScreenH; // Resolution used for last InGame interface + float _InterfaceScale; + bool _InterfaceScaleChanged; // Modes CInterfaceConfig::CDesktopImage _Modes[MAX_NUM_MODES]; diff --git a/code/ryzom/client/src/main_loop_utilities.cpp b/code/ryzom/client/src/main_loop_utilities.cpp index 415764bfa..e62c033e4 100644 --- a/code/ryzom/client/src/main_loop_utilities.cpp +++ b/code/ryzom/client/src/main_loop_utilities.cpp @@ -36,6 +36,7 @@ #include "input.h" #include "sound_manager.h" #include "camera.h" +#include "interface_v3/interface_manager.h" using namespace NLMISC; using namespace NL3D; @@ -100,6 +101,9 @@ void updateFromClientCfg() Driver->forceTextureResize(1); } + if (ClientCfg.InterfaceScale != LastClientCfg.InterfaceScale) + CInterfaceManager::getInstance()->setInterfaceScale(ClientCfg.InterfaceScale); + //--------------------------------------------------- if (ClientCfg.WaitVBL != LastClientCfg.WaitVBL) { @@ -395,4 +399,4 @@ void updateFromClientCfg() LastClientCfg = ClientCfg; } -/* end of file */ \ No newline at end of file +/* end of file */