Added: Scaling options to client config
--HG-- branch : experimental-ui-scaling
This commit is contained in:
parent
cf357edcb9
commit
b474f39970
8 changed files with 54 additions and 2 deletions
|
@ -878,10 +878,17 @@
|
||||||
posparent="lum"
|
posparent="lum"
|
||||||
x="0"
|
x="0"
|
||||||
y="-2" />
|
y="-2" />
|
||||||
|
<instance template="tgcw_scrollbarfloat"
|
||||||
|
id="scale"
|
||||||
|
text="uiInterfaceScale"
|
||||||
|
posref="BL TL"
|
||||||
|
posparent="gam"
|
||||||
|
x="0"
|
||||||
|
y="-2" />
|
||||||
<instance template="tgcw_checkbox"
|
<instance template="tgcw_checkbox"
|
||||||
id="waitvbl"
|
id="waitvbl"
|
||||||
text="uiWaitVBL"
|
text="uiWaitVBL"
|
||||||
posparent="gam"
|
posparent="scale"
|
||||||
posref="BL TL"
|
posref="BL TL"
|
||||||
x="-20"
|
x="-20"
|
||||||
y="-28" />
|
y="-28" />
|
||||||
|
@ -3086,6 +3093,13 @@
|
||||||
realtime="true"
|
realtime="true"
|
||||||
widget="sbfloat"
|
widget="sbfloat"
|
||||||
link="Gamma" />
|
link="Gamma" />
|
||||||
|
<param ui="general:scale:c"
|
||||||
|
type="cfg"
|
||||||
|
realtime="false"
|
||||||
|
ui_view="general:scale:c_res"
|
||||||
|
ui_decimal="2"
|
||||||
|
widget="sbfloat"
|
||||||
|
link="InterfaceScale" />
|
||||||
<param ui="general:waitvbl:c"
|
<param ui="general:waitvbl:c"
|
||||||
type="cfg"
|
type="cfg"
|
||||||
realtime="true"
|
realtime="true"
|
||||||
|
|
|
@ -300,6 +300,8 @@ CClientConfig::CClientConfig()
|
||||||
Luminosity = 0.f; // Default Monitor Luminosity.
|
Luminosity = 0.f; // Default Monitor Luminosity.
|
||||||
Gamma = 0.f; // Default Monitor Gamma.
|
Gamma = 0.f; // Default Monitor Gamma.
|
||||||
|
|
||||||
|
InterfaceScale = 1.0f; // Resize UI
|
||||||
|
|
||||||
VREnable = false;
|
VREnable = false;
|
||||||
VRDisplayDevice = "Auto";
|
VRDisplayDevice = "Auto";
|
||||||
VRDisplayDeviceId = "";
|
VRDisplayDeviceId = "";
|
||||||
|
@ -833,6 +835,10 @@ void CClientConfig::setValues()
|
||||||
READ_FLOAT_FV(Luminosity)
|
READ_FLOAT_FV(Luminosity)
|
||||||
// Gamma
|
// Gamma
|
||||||
READ_FLOAT_FV(Gamma)
|
READ_FLOAT_FV(Gamma)
|
||||||
|
// UI scaling
|
||||||
|
READ_FLOAT_FV(InterfaceScale);
|
||||||
|
// 50% smaller / 2x bigger
|
||||||
|
clamp(ClientCfg.InterfaceScale, 0.5f, 2.0f);
|
||||||
// 3D Driver
|
// 3D Driver
|
||||||
varPtr = ClientCfg.ConfigFile.getVarPtr ("Driver3D");
|
varPtr = ClientCfg.ConfigFile.getVarPtr ("Driver3D");
|
||||||
if (varPtr)
|
if (varPtr)
|
||||||
|
|
|
@ -146,6 +146,9 @@ struct CClientConfig
|
||||||
/// Monitor Gamma [-1 ~ 1], default 0
|
/// Monitor Gamma [-1 ~ 1], default 0
|
||||||
float Gamma;
|
float Gamma;
|
||||||
|
|
||||||
|
// UI scaling
|
||||||
|
float InterfaceScale;
|
||||||
|
|
||||||
// VR
|
// VR
|
||||||
bool VREnable;
|
bool VREnable;
|
||||||
std::string VRDisplayDevice;
|
std::string VRDisplayDevice;
|
||||||
|
|
|
@ -227,6 +227,9 @@ void connectionRestoreVideoMode ()
|
||||||
SetMouseCursor ();
|
SetMouseCursor ();
|
||||||
SetMouseSpeed (ClientCfg.CursorSpeed);
|
SetMouseSpeed (ClientCfg.CursorSpeed);
|
||||||
SetMouseAcceleration (ClientCfg.CursorAcceleration);
|
SetMouseAcceleration (ClientCfg.CursorAcceleration);
|
||||||
|
|
||||||
|
// Restore user UI scaling
|
||||||
|
CViewRenderer::getInstance()->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;
|
firstConnection = false;
|
||||||
|
|
||||||
|
// Restore user UI scaling
|
||||||
|
CViewRenderer::getInstance()->setInterfaceScale(ClientCfg.InterfaceScale);
|
||||||
|
|
||||||
// Disable inputs
|
// Disable inputs
|
||||||
Actions.enable(false);
|
Actions.enable(false);
|
||||||
EditActions.enable(false);
|
EditActions.enable(false);
|
||||||
|
@ -586,6 +594,9 @@ bool reconnection()
|
||||||
InterfaceState = globalMenu();
|
InterfaceState = globalMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Restore user UI scaling
|
||||||
|
CViewRenderer::getInstance()->setInterfaceScale(ClientCfg.InterfaceScale);
|
||||||
|
|
||||||
// Disable inputs
|
// Disable inputs
|
||||||
Actions.enable(false);
|
Actions.enable(false);
|
||||||
EditActions.enable(false);
|
EditActions.enable(false);
|
||||||
|
|
|
@ -1316,6 +1316,7 @@ void prelogInit()
|
||||||
|
|
||||||
|
|
||||||
CInterfaceManager::getInstance();
|
CInterfaceManager::getInstance();
|
||||||
|
CViewRenderer::getInstance()->setInterfaceScale(1.0f, 1024, 768);
|
||||||
|
|
||||||
// Yoyo: initialize NOW the InputHandler for Event filtering.
|
// Yoyo: initialize NOW the InputHandler for Event filtering.
|
||||||
CInputHandlerManager *InputHandlerManager = CInputHandlerManager::getInstance();
|
CInputHandlerManager *InputHandlerManager = CInputHandlerManager::getInstance();
|
||||||
|
|
|
@ -475,6 +475,8 @@ CInterfaceManager::CInterfaceManager()
|
||||||
interfaceLinkUpdater = new CInterfaceLink::CInterfaceLinkUpdater();
|
interfaceLinkUpdater = new CInterfaceLink::CInterfaceLinkUpdater();
|
||||||
_ScreenW = _ScreenH = 0;
|
_ScreenW = _ScreenH = 0;
|
||||||
_LastInGameScreenW = _LastInGameScreenH = 0;
|
_LastInGameScreenW = _LastInGameScreenH = 0;
|
||||||
|
_InterfaceScaleChanged = false;
|
||||||
|
_InterfaceScale = 1.0f;
|
||||||
_DescTextTarget = NULL;
|
_DescTextTarget = NULL;
|
||||||
_ConfigLoaded = false;
|
_ConfigLoaded = false;
|
||||||
_LogState = false;
|
_LogState = false;
|
||||||
|
@ -1984,6 +1986,14 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
|
||||||
_CurrentPlayerCharac[i] = node ? node->getValue32() : 0;
|
_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 );
|
CWidgetManager::getInstance()->drawViews( camera );
|
||||||
|
|
||||||
// flush obs
|
// flush obs
|
||||||
|
|
|
@ -543,6 +543,7 @@ public:
|
||||||
NLMISC::CCDBNodeLeaf *_DB_UI_DUMMY_FACTION_TYPE;
|
NLMISC::CCDBNodeLeaf *_DB_UI_DUMMY_FACTION_TYPE;
|
||||||
|
|
||||||
void updateDesktops( uint32 newScreenW, uint32 newScreenH );
|
void updateDesktops( uint32 newScreenW, uint32 newScreenH );
|
||||||
|
void setInterfaceScale( float scale ) { _InterfaceScaleChanged = true; _InterfaceScale = scale; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -581,6 +582,8 @@ private:
|
||||||
|
|
||||||
uint32 _ScreenW, _ScreenH; // Change res detection
|
uint32 _ScreenW, _ScreenH; // Change res detection
|
||||||
sint32 _LastInGameScreenW, _LastInGameScreenH; // Resolution used for last InGame interface
|
sint32 _LastInGameScreenW, _LastInGameScreenH; // Resolution used for last InGame interface
|
||||||
|
float _InterfaceScale;
|
||||||
|
bool _InterfaceScaleChanged;
|
||||||
|
|
||||||
// Modes
|
// Modes
|
||||||
CInterfaceConfig::CDesktopImage _Modes[MAX_NUM_MODES];
|
CInterfaceConfig::CDesktopImage _Modes[MAX_NUM_MODES];
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "sound_manager.h"
|
#include "sound_manager.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
|
#include "interface_v3/interface_manager.h"
|
||||||
|
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
using namespace NL3D;
|
using namespace NL3D;
|
||||||
|
@ -100,6 +101,9 @@ void updateFromClientCfg()
|
||||||
Driver->forceTextureResize(1);
|
Driver->forceTextureResize(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ClientCfg.InterfaceScale != LastClientCfg.InterfaceScale)
|
||||||
|
CInterfaceManager::getInstance()->setInterfaceScale(ClientCfg.InterfaceScale);
|
||||||
|
|
||||||
//---------------------------------------------------
|
//---------------------------------------------------
|
||||||
if (ClientCfg.WaitVBL != LastClientCfg.WaitVBL)
|
if (ClientCfg.WaitVBL != LastClientCfg.WaitVBL)
|
||||||
{
|
{
|
||||||
|
@ -395,4 +399,4 @@ void updateFromClientCfg()
|
||||||
LastClientCfg = ClientCfg;
|
LastClientCfg = ClientCfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* end of file */
|
/* end of file */
|
||||||
|
|
Loading…
Reference in a new issue