Changed: Move ui scale limits to client cfg
--HG-- branch : develop
This commit is contained in:
parent
ef1977330b
commit
09cb6f56dd
5 changed files with 33 additions and 8 deletions
|
@ -320,6 +320,12 @@ CameraSpeedMin = 2.0;
|
|||
CameraSpeedMax = 100.0;
|
||||
CameraResetSpeed = 10.0; // Speed in radian/s
|
||||
|
||||
// Values for UI Scale
|
||||
InterfaceScale = 1.0;
|
||||
InterfaceScale_min = 0.8;
|
||||
InterfaceScale_max = 2.0;
|
||||
InterfaceScale_step = 0.05;
|
||||
|
||||
// Default values for map
|
||||
MaxMapScale = 2.0;
|
||||
R2EDMaxMapScale = 8.0;
|
||||
|
|
|
@ -876,10 +876,17 @@
|
|||
posparent="lum"
|
||||
x="0"
|
||||
y="-2" />
|
||||
<instance template="tgcw_scrollbarfloat"
|
||||
id="scale"
|
||||
text="uiInterfaceScale"
|
||||
posref="BL TL"
|
||||
posparent="gam"
|
||||
x="0"
|
||||
y="-2" />
|
||||
<instance template="tgcw_checkbox"
|
||||
id="waitvbl"
|
||||
text="uiWaitVBL"
|
||||
posparent="gam"
|
||||
posparent="scale"
|
||||
posref="BL TL"
|
||||
x="-20"
|
||||
y="-28" />
|
||||
|
@ -3091,6 +3098,13 @@
|
|||
realtime="true"
|
||||
widget="sbfloat"
|
||||
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"
|
||||
type="cfg"
|
||||
realtime="true"
|
||||
|
|
|
@ -301,6 +301,9 @@ CClientConfig::CClientConfig()
|
|||
Gamma = 0.f; // Default Monitor Gamma.
|
||||
|
||||
InterfaceScale = 1.0f; // Resize UI
|
||||
InterfaceScale_min = 0.8f;
|
||||
InterfaceScale_max = 2.0f;
|
||||
InterfaceScale_step = 0.05;
|
||||
BilinearUI = false;
|
||||
|
||||
VREnable = false;
|
||||
|
@ -843,7 +846,10 @@ void CClientConfig::setValues()
|
|||
READ_FLOAT_FV(Gamma)
|
||||
// UI scaling
|
||||
READ_FLOAT_FV(InterfaceScale);
|
||||
clamp(ClientCfg.InterfaceScale, MIN_INTERFACE_SCALE, MAX_INTERFACE_SCALE);
|
||||
READ_FLOAT_FV(InterfaceScale_min);
|
||||
READ_FLOAT_FV(InterfaceScale_max);
|
||||
READ_FLOAT_FV(InterfaceScale_step);
|
||||
clamp(ClientCfg.InterfaceScale, ClientCfg.InterfaceScale_min, ClientCfg.InterfaceScale_max);
|
||||
READ_BOOL_FV(BilinearUI);
|
||||
// 3D Driver
|
||||
varPtr = ClientCfg.ConfigFile.getVarPtr ("Driver3D");
|
||||
|
|
|
@ -46,10 +46,6 @@ 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 :
|
||||
// Struct to manage a config file for the client.
|
||||
|
@ -151,6 +147,9 @@ struct CClientConfig
|
|||
|
||||
// UI scaling
|
||||
float InterfaceScale;
|
||||
float InterfaceScale_min;
|
||||
float InterfaceScale_max;
|
||||
float InterfaceScale_step;
|
||||
bool BilinearUI;
|
||||
|
||||
// VR
|
||||
|
|
|
@ -3743,7 +3743,7 @@ class CHandlerSetInterfaceScale : public IActionHandler
|
|||
float scale;
|
||||
if (fromString(s, scale))
|
||||
{
|
||||
if (scale >= MIN_INTERFACE_SCALE && scale <= MAX_INTERFACE_SCALE)
|
||||
if (scale >= ClientCfg.InterfaceScale_min && scale <= ClientCfg.InterfaceScale_max)
|
||||
{
|
||||
ClientCfg.InterfaceScale = scale;
|
||||
ClientCfg.writeDouble("InterfaceScale", ClientCfg.InterfaceScale);
|
||||
|
@ -3754,7 +3754,7 @@ class CHandlerSetInterfaceScale : public IActionHandler
|
|||
}
|
||||
}
|
||||
|
||||
ucstring help("/setuiscale "+toString("%.1f .. %.1f", MIN_INTERFACE_SCALE, MAX_INTERFACE_SCALE));
|
||||
ucstring help("/setuiscale "+toString("%.1f .. %.1f", ClientCfg.InterfaceScale_min, ClientCfg.InterfaceScale_max));
|
||||
CInterfaceManager::getInstance()->displaySystemInfo(help);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue