diff --git a/ClassicalSharp/2D/Drawing/IDrawer2D.TextMC.cs b/ClassicalSharp/2D/Drawing/IDrawer2D.TextMC.cs index c5568579e..aaa55cf49 100644 --- a/ClassicalSharp/2D/Drawing/IDrawer2D.TextMC.cs +++ b/ClassicalSharp/2D/Drawing/IDrawer2D.TextMC.cs @@ -144,10 +144,11 @@ namespace ClassicalSharp { void DrawUnderline( FastBitmap dst, int x, int yOffset, ref DrawTextArgs args, bool shadowCol ) { int point = Utils.Floor( args.Font.Size ); - int height = PtToPx( point, boxSize ); + int padding = CellSize( point ) - AdjTextSize( point ); + int height = AdjTextSize( point ) + Utils.CeilDiv(padding, 2); int offset = ShadowOffset( args.Font.Size ); - int col = FastColour.White.ToArgb(); + int col = FastColour.White.ToArgb(); string text = args.Text; if( args.UseShadow ) height += offset; int startX = x; diff --git a/ClassicalSharp/2D/Screens/HudScreen.cs b/ClassicalSharp/2D/Screens/HudScreen.cs index c7939c6b9..3e6b43c75 100644 --- a/ClassicalSharp/2D/Screens/HudScreen.cs +++ b/ClassicalSharp/2D/Screens/HudScreen.cs @@ -84,7 +84,7 @@ namespace ClassicalSharp.Gui { } public override void Init() { - playerFont = new Font( game.FontName, 12 ); + playerFont = new Font( game.FontName, 14 ); chat = new ChatScreen( game ); chat.Init(); hotbar = new BlockHotbarWidget( game ); diff --git a/ClassicalSharp/2D/Texture.cs b/ClassicalSharp/2D/Texture.cs index b3f720a9f..3b0f08319 100644 --- a/ClassicalSharp/2D/Texture.cs +++ b/ClassicalSharp/2D/Texture.cs @@ -16,15 +16,18 @@ namespace ClassicalSharp { public Rectangle Bounds { get { return new Rectangle( X1, Y1, Width, Height ); } } - public Texture( int id, int x, int y, int width, int height, float u2, float v2 ) + public Texture( int id, int x, int y, int width, int height, + float u2, float v2 ) : this( id, x, y, width, height, 0, u2, 0, v2 ) { } - public Texture( int id, int x, int y, int width, int height, TextureRec rec ) + public Texture( int id, int x, int y, int width, int height, + TextureRec rec ) : this( id, x, y, width, height, rec.U1, rec.U2, rec.V1, rec.V2 ) { } - public Texture( int id, int x, int y, int width, int height, float u1, float u2, float v1, float v2 ) { + public Texture( int id, int x, int y, int width, int height, + float u1, float u2, float v1, float v2 ) { ID = id; X1 = x; Y1 = y; Width = width; Height = height; diff --git a/ClassicalSharp/2D/Widgets/Chat/TextGroupWidget.Formatter.cs b/ClassicalSharp/2D/Widgets/Chat/TextGroupWidget.Formatter.cs index 09a36230d..70d2bdcb6 100644 --- a/ClassicalSharp/2D/Widgets/Chat/TextGroupWidget.Formatter.cs +++ b/ClassicalSharp/2D/Widgets/Chat/TextGroupWidget.Formatter.cs @@ -16,6 +16,8 @@ namespace ClassicalSharp.Gui { if( !String.IsNullOrEmpty( text ) ) { Texture tex = NextToken( text, 0, ref prevFlags ) == -1 ? DrawSimple( ref args ) : DrawAdvanced( ref args, index, text ); + ReducePadding( ref tex, Utils.Floor( args.Font.Size ) ); + tex.X1 = CalcOffset( game.Width, tex.Width, XOffset, HorizontalAnchor ); tex.Y1 = CalcY( index, tex.Height ); Textures[index] = tex; @@ -29,6 +31,15 @@ namespace ClassicalSharp.Gui { UpdateDimensions(); } + void ReducePadding( ref Texture tex, int point ) { + int padding = tex.Height - Utils.Floor( font.Size ); + padding /= 4; + float vAdj = (float)padding / Utils.NextPowerOf2( tex.Height ); + + tex.V1 += vAdj; tex.V2 -= vAdj; + tex.Height -= padding * 2; + } + Texture DrawSimple( ref DrawTextArgs args ) { return game.Drawer2D.MakeChatTextTexture( ref args, 0, 0 ); } @@ -104,10 +115,10 @@ namespace ClassicalSharp.Gui { return data; } - void UpdatePreviousUrls( int i, string url ) { + void UpdatePreviousUrls( int i, string url ) { while( i >= 0 && linkData[i].urls != null && (linkData[i].flags & LinkFlags.Continue) != 0 ) { linkData[i].LastUrl = url; - if( linkData[i].urls.Length > 2 || (linkData[i].flags & LinkFlags.NewLink) != 0 ) + if( linkData[i].urls.Length > 2 || (linkData[i].flags & LinkFlags.NewLink) != 0 ) break; i--; } @@ -137,7 +148,7 @@ namespace ClassicalSharp.Gui { return 2; } - prevFlags = 0; + prevFlags = 0; int nextHttp = line.IndexOf( "http://", start ); int nextHttps = line.IndexOf( "https://", start ); return nextHttp == -1 ? nextHttps : nextHttp; @@ -172,7 +183,7 @@ namespace ClassicalSharp.Gui { urls[index] = part; } - public string LastUrl { + public string LastUrl { get { return urls[parts.Length - 1]; } set { urls[parts.Length - 1] = value; } } diff --git a/ClassicalSharp/2D/Widgets/PlayerList/PlayerListWidget.cs b/ClassicalSharp/2D/Widgets/PlayerList/PlayerListWidget.cs index f7cc24b08..4f9e918c4 100644 --- a/ClassicalSharp/2D/Widgets/PlayerList/PlayerListWidget.cs +++ b/ClassicalSharp/2D/Widgets/PlayerList/PlayerListWidget.cs @@ -35,9 +35,8 @@ namespace ClassicalSharp.Gui { api.Texturing = true; for( int i = 0; i < namesCount; i++ ) { Texture texture = textures[i]; - if( texture.IsValid ) { + if( texture.IsValid ) texture.Render( api ); - } } }