Changed: Move ui scale limits to client cfg

--HG--
branch : develop
This commit is contained in:
Nimetu 2019-01-05 22:05:49 +02:00
parent ef1977330b
commit 09cb6f56dd
5 changed files with 33 additions and 8 deletions

View file

@ -320,6 +320,12 @@ CameraSpeedMin = 2.0;
CameraSpeedMax = 100.0; CameraSpeedMax = 100.0;
CameraResetSpeed = 10.0; // Speed in radian/s 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 // Default values for map
MaxMapScale = 2.0; MaxMapScale = 2.0;
R2EDMaxMapScale = 8.0; R2EDMaxMapScale = 8.0;

View file

@ -876,10 +876,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" />
@ -3091,6 +3098,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"

View file

@ -301,6 +301,9 @@ CClientConfig::CClientConfig()
Gamma = 0.f; // Default Monitor Gamma. Gamma = 0.f; // Default Monitor Gamma.
InterfaceScale = 1.0f; // Resize UI InterfaceScale = 1.0f; // Resize UI
InterfaceScale_min = 0.8f;
InterfaceScale_max = 2.0f;
InterfaceScale_step = 0.05;
BilinearUI = false; BilinearUI = false;
VREnable = false; VREnable = false;
@ -843,7 +846,10 @@ void CClientConfig::setValues()
READ_FLOAT_FV(Gamma) READ_FLOAT_FV(Gamma)
// UI scaling // UI scaling
READ_FLOAT_FV(InterfaceScale); 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); READ_BOOL_FV(BilinearUI);
// 3D Driver // 3D Driver
varPtr = ClientCfg.ConfigFile.getVarPtr ("Driver3D"); varPtr = ClientCfg.ConfigFile.getVarPtr ("Driver3D");

View file

@ -46,10 +46,6 @@ using NLMISC::CVector;
using NLMISC::CRGBA; using NLMISC::CRGBA;
using std::string; using std::string;
// limits for UI scale
const float MIN_INTERFACE_SCALE = 0.8;
const float MAX_INTERFACE_SCALE = 2.0;
//--------------------------------------------------- //---------------------------------------------------
// CClientConfig : // CClientConfig :
// Struct to manage a config file for the client. // Struct to manage a config file for the client.
@ -151,6 +147,9 @@ struct CClientConfig
// UI scaling // UI scaling
float InterfaceScale; float InterfaceScale;
float InterfaceScale_min;
float InterfaceScale_max;
float InterfaceScale_step;
bool BilinearUI; bool BilinearUI;
// VR // VR

View file

@ -3743,7 +3743,7 @@ class CHandlerSetInterfaceScale : public IActionHandler
float scale; float scale;
if (fromString(s, 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.InterfaceScale = scale;
ClientCfg.writeDouble("InterfaceScale", ClientCfg.InterfaceScale); 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); CInterfaceManager::getInstance()->displaySystemInfo(help);
} }
}; };