hedgewars/uVariables.pas
changeset 15665 63e2b7b2ec47
parent 15645 fb1f47e382d0
parent 15663 d92eeb468dad
child 15667 02042ee48fde
--- a/hedgewars/uVariables.pas	Tue Jun 30 23:25:52 2020 +0300
+++ b/hedgewars/uVariables.pas	Sat Jul 04 03:11:41 2020 +0200
@@ -141,6 +141,9 @@
     zoom             : GLfloat; // current zoom
     ZoomValue        : GLfloat; // aimed zoom
     UserZoom         : GLfloat; // user-chosen initial and default zoom
+    ChatScaleValue   : real;
+    cDefaultChatScale: real;
+    UIScaleValue     : real;
 
     cWaterLine       : LongInt;
     cGearScrEdgesDist: LongInt;
@@ -264,6 +267,8 @@
 
     // for tracking the limits of the visible grid based on cScaleFactor
     ViewLeftX, ViewRightX, ViewBottomY, ViewTopY, ViewWidth, ViewHeight: LongInt;
+    // for tracking the limits of the visible UI space based on cUIScaleFactor
+    UIWidth, UIHeight: LongInt;
 
     // for debugging the view limits visually
     cViewLimitsDebug: boolean;
@@ -360,6 +365,10 @@
             (Handle: nil;
             Height: 10*HDPIScaleFactor;
             style: TTF_STYLE_NORMAL;
+            Name: 'DejaVuSans-Bold.ttf'),
+            (Handle: nil; // fntChat
+            Height: 12*HDPIScaleFactor;
+            style: TTF_STYLE_NORMAL;
             Name: 'DejaVuSans-Bold.ttf')
             {$IFNDEF MOBILE}, // remove chinese fonts for now
             (Handle: nil;
@@ -373,6 +382,10 @@
             (Handle: nil;
             Height: 10*HDPIScaleFactor;
             style: TTF_STYLE_NORMAL;
+            Name: 'wqy-zenhei.ttc'),
+            (Handle: nil; // CJKfntChat
+            Height: 12*HDPIScaleFactor;
+            style: TTF_STYLE_NORMAL;
             Name: 'wqy-zenhei.ttc')
             {$ENDIF}
             );
@@ -2631,6 +2644,7 @@
     SyncTexture,
     ConfirmTexture: PTexture;
     cScaleFactor: GLfloat;
+    cUIScaleFactor: float;
     cStereoDepth: GLfloat;
     SupportNPOTT: Boolean;
     Step: LongInt;
@@ -2756,6 +2770,8 @@
     cAudioCodec        := '';
 {$ENDIF}
 
+    cDefaultChatScale:= 1.0;
+
     cTagsMask:= htTeamName or htName or htHealth;
     cPrevTagsMask:= cTagsMask;
 end;
@@ -2964,6 +2980,16 @@
     cExplosives     := 2;
 
     GameState       := Low(TGameState);
+    zoom            := cDefaultZoomLevel;
+    ZoomValue       := cDefaultZoomLevel;
+
+    if cDefaultChatScale < cMinChatScaleValue then
+        cDefaultChatScale := cMinChatScaleValue
+    else if cDefaultChatScale > cMaxChatScaleValue then
+        cDefaultChatScale := cMaxChatScaleValue;
+    ChatScaleValue  := cDefaultChatScale;
+    UIScaleValue    := cDefaultUIScaleLevel;
+
     WeaponTooltipTex:= nil;
     cLaserSighting  := false;
     cLaserSightingSniper := false;