From 1bf578664df8055aea3f28a52c086947281619e5 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 23 Mar 2016 12:16:01 +1100 Subject: [PATCH] Scale gui elements in increments of 10. --- ClassicalSharp/Game/Game.Properties.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ClassicalSharp/Game/Game.Properties.cs b/ClassicalSharp/Game/Game.Properties.cs index 691488887..b1f434257 100644 --- a/ClassicalSharp/Game/Game.Properties.cs +++ b/ClassicalSharp/Game/Game.Properties.cs @@ -153,20 +153,22 @@ namespace ClassicalSharp { /// Calculates the amount that the hotbar widget should be scaled by when rendered. /// Affected by both the current resolution of the window, as well as the /// scaling specified by the user (field HotbarScale). - public float GuiHotbarScale { get { return MinWindowScale * HotbarScale; } } + public float GuiHotbarScale { get { return Scale( MinWindowScale * HotbarScale ); } } /// Calculates the amount that the block inventory menu should be scaled by when rendered. /// Affected by both the current resolution of the window, as well as the /// scaling specified by the user (field InventoryScale). - public float GuiInventoryScale { get { return MinWindowScale * InventoryScale; } } + public float GuiInventoryScale { get { return Scale( MinWindowScale * InventoryScale ); } } /// Calculates the amount that 2D chat widgets should be scaled by when rendered. /// Affected by both the current resolution of the window, as well as the /// scaling specified by the user (field ChatScale). - public float GuiChatScale { get { return (Height / 480f) * ChatScale; } } + public float GuiChatScale { get { return Scale( (Height / 480f) * ChatScale ); } } float MinWindowScale { get { return Math.Min( Width / 640f, Height / 480f ); } } + float Scale( float value ) { return (float)Math.Round( value * 10, MidpointRounding.AwayFromZero ) / 10; } + string defTexturePack = "default.zip"; /// Gets or sets the path of the default texture pack that should be used by the client. /// If the custom default texture pack specified by the user could not be found,