# HG changeset patch # User nemo # Date 1691714934 14400 # Node ID 8bb07b0f50ca3d1aca09682240c2c26c44d892a5 # Parent 2d9d07ccb8ef7064dbf026a4a4d777e914173ad5 add some round() so that the scale factor compiles at least with non-integer values diff -r 2d9d07ccb8ef -r 8bb07b0f50ca hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Sun Aug 06 18:24:39 2023 -0400 +++ b/hedgewars/uConsts.pas Thu Aug 10 20:48:54 2023 -0400 @@ -171,7 +171,7 @@ cVisibleWater : LongInt = 128; cTeamHealthWidth : LongInt = 128; - cTeamHealthHeight : LongInt = 19 * HDPIScaleFactor; + cTeamHealthHeight : LongInt = round(19 * HDPIScaleFactor); cGearContourThreshold : LongInt = 179; // if water opacity is higher than this, draw contour for some gears when in water cifRandomize = $00000001; @@ -221,8 +221,8 @@ cKbdMaxIndex = 65536;//need more room for the modifier keys // font stuff - cFontBorder = 2 * HDPIScaleFactor; - cFontPadding = 2 * HDPIScaleFactor; + cFontBorder = round(2 * HDPIScaleFactor); + cFontPadding = round(2 * HDPIScaleFactor); cDefaultBuildMaxDist = 256; // default max. building distance with girder/rubber cResurrectorDist = 100; // effect distance of resurrector diff -r 2d9d07ccb8ef -r 8bb07b0f50ca hedgewars/uRenderUtils.pas --- a/hedgewars/uRenderUtils.pas Sun Aug 06 18:24:39 2023 -0400 +++ b/hedgewars/uRenderUtils.pas Thu Aug 10 20:48:54 2023 -0400 @@ -115,7 +115,7 @@ clr: TSDL_Color; begin TTF_SizeUTF8(Fontz[Font].Handle, PChar(s), @w, @h); - if (maxLength > 0) and (w > maxLength * HDPIScaleFactor) then w := maxLength * HDPIScaleFactor; + if (maxLength > 0) and (w > round(maxLength * HDPIScaleFactor)) then w := round(maxLength * HDPIScaleFactor); finalRect.x:= X; finalRect.y:= Y; finalRect.w:= w + cFontBorder * 2 + cFontPadding * 2; @@ -385,7 +385,7 @@ font:= CheckCJKFont(s, font); w:= 0; h:= 0; // avoid compiler hints TTF_SizeUTF8(Fontz[font].Handle, PChar(s), @w, @h); - if (maxLength > 0) and (w > maxLength * HDPIScaleFactor) then w := maxLength * HDPIScaleFactor; + if (maxLength > 0) and (w > round(maxLength * HDPIScaleFactor)) then w := round(maxLength * HDPIScaleFactor); finalSurface:= SDL_CreateRGBSurface(SDL_SWSURFACE, w + cFontBorder*2 + cFontPadding*2, h + cFontBorder * 2, 32, RMask, GMask, BMask, AMask); diff -r 2d9d07ccb8ef -r 8bb07b0f50ca hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Sun Aug 06 18:24:39 2023 -0400 +++ b/hedgewars/uVariables.pas Thu Aug 10 20:48:54 2023 -0400 @@ -357,36 +357,36 @@ const FontzInit: array[THWFont] of THHFont = ( (Handle: nil; - Height: 12*HDPIScaleFactor; + Height: round(12*HDPIScaleFactor); style: TTF_STYLE_NORMAL; Name: 'DejaVuSans-Bold.ttf'), (Handle: nil; - Height: 24*HDPIScaleFactor; + Height: round(24*HDPIScaleFactor); style: TTF_STYLE_NORMAL; Name: 'DejaVuSans-Bold.ttf'), (Handle: nil; - Height: 10*HDPIScaleFactor; + Height: round(10*HDPIScaleFactor); style: TTF_STYLE_NORMAL; Name: 'DejaVuSans-Bold.ttf'), (Handle: nil; // fntChat - Height: 12*HDPIScaleFactor; + Height: round(12*HDPIScaleFactor); style: TTF_STYLE_NORMAL; Name: 'DejaVuSans-Bold.ttf') {$IFNDEF MOBILE}, // remove chinese fonts for now (Handle: nil; - Height: 12*HDPIScaleFactor; + Height: round(12*HDPIScaleFactor); style: TTF_STYLE_NORMAL; Name: 'wqy-zenhei.ttc'), (Handle: nil; - Height: 24*HDPIScaleFactor; + Height: round(24*HDPIScaleFactor); style: TTF_STYLE_NORMAL; Name: 'wqy-zenhei.ttc'), (Handle: nil; - Height: 10*HDPIScaleFactor; + Height: round(10*HDPIScaleFactor); style: TTF_STYLE_NORMAL; Name: 'wqy-zenhei.ttc'), (Handle: nil; // CJKfntChat - Height: 12*HDPIScaleFactor; + Height: round(12*HDPIScaleFactor); style: TTF_STYLE_NORMAL; Name: 'wqy-zenhei.ttc') {$ENDIF}