Fix scaling of all other default.png text.

This commit is contained in:
UnknownShadow200 2016-04-20 11:19:37 +10:00
parent a8cd79abcd
commit 3b5f676a7a
6 changed files with 19 additions and 10 deletions

View File

@ -229,20 +229,28 @@ namespace ClassicalSharp {
}
public void ReducePadding( ref Texture tex, int point ) {
ReducePadding( ref tex, point, 4 );
}
public void ReducePadding( ref int height, int point ) {
ReducePadding( ref height, point, 4 );
}
public void ReducePadding( ref Texture tex, int point, int scale ) {
if( !UseBitmappedChat ) return;
point = AdjTextSize( point );
int padding = (tex.Height - point) / 4;
int padding = (tex.Height - point) / scale;
float vAdj = (float)padding / Utils.NextPowerOf2( tex.Height );
tex.V1 += vAdj; tex.V2 -= vAdj;
tex.Height -= padding * 2;
}
public void ReducePadding( ref int height, int point ) {
public void ReducePadding( ref int height, int point, int scale ) {
if( !UseBitmappedChat ) return;
point = AdjTextSize( point );
int padding = (height - point) / 4;
int padding = (height - point) / scale;
height -= padding * 2;
}
}

View File

@ -90,7 +90,7 @@ namespace ClassicalSharp.Gui {
public override void Init() {
font = new Font( game.FontName, 14 );
posFont = new Font( game.FontName, 13, FontStyle.Italic );
posFont = new Font( game.FontName, 14, FontStyle.Italic );
game.Events.ChatFontChanged += ChatFontChanged;
fpsText = new ChatTextWidget( game, font );

View File

@ -84,7 +84,8 @@ namespace ClassicalSharp.Gui {
}
public override void Init() {
playerFont = new Font( game.FontName, 16 );
int size = game.Drawer2D.UseBitmappedChat ? 16 : 11;
playerFont = new Font( game.FontName, size );
chat = new ChatScreen( game );
chat.Init();
hotbar = new BlockHotbarWidget( game );

View File

@ -131,7 +131,7 @@ namespace ClassicalSharp.Gui {
void AddPlayerInfo( PlayerInfo pInfo, int index ) {
DrawTextArgs args = new DrawTextArgs( pInfo.ColouredName, font, false );
Texture tex = game.Drawer2D.MakeChatTextTexture( ref args, 0, 0 );
game.Drawer2D.ReducePadding( ref tex, Utils.Floor( font.Size ) );
game.Drawer2D.ReducePadding( ref tex, Utils.Floor( font.Size ), 3 );
if( index < 0 ) {
info[namesCount] = pInfo;

View File

@ -10,7 +10,7 @@ namespace ClassicalSharp.Gui {
public ExtPlayerListWidget( Game game, Font font ) : base( game, font ) {
textures = new Texture[512];
titleFont = new Font( game.FontName, 16, FontStyle.Underline );
titleFont = new Font( game.FontName, font.Size, FontStyle.Underline );
}
PlayerInfo[] info = new PlayerInfo[512];
@ -119,7 +119,7 @@ namespace ClassicalSharp.Gui {
void AddPlayerInfo( CpeListInfo player, int index ) {
DrawTextArgs args = new DrawTextArgs( player.ListName, font, true );
Texture tex = game.Drawer2D.MakeChatTextTexture( ref args, 0, 0 );
game.Drawer2D.ReducePadding( ref tex, Utils.Floor( font.Size ) );
game.Drawer2D.ReducePadding( ref tex, Utils.Floor( font.Size ), 3 );
if( index < 0 ) {
info[namesCount] = new PlayerInfo( player );
@ -164,7 +164,7 @@ namespace ClassicalSharp.Gui {
void AddGroup( string group, ref int index ) {
DrawTextArgs args = new DrawTextArgs( group, titleFont, true );
Texture tex = game.Drawer2D.MakeChatTextTexture( ref args, 0, 0 );
game.Drawer2D.ReducePadding( ref tex, Utils.Floor( titleFont.Size ) );
game.Drawer2D.ReducePadding( ref tex, Utils.Floor( titleFont.Size ), 3 );
PlayerInfo pInfo = new PlayerInfo( group );
PushDown( info, index, pInfo );

View File

@ -65,7 +65,7 @@ namespace ClassicalSharp.Gui {
void AddPlayerInfo( Player player ) {
DrawTextArgs args = new DrawTextArgs( player.DisplayName, font, true );
Texture tex = game.Drawer2D.MakeChatTextTexture( ref args, 0, 0 );
game.Drawer2D.ReducePadding( ref tex, Utils.Floor( font.Size ) );
game.Drawer2D.ReducePadding( ref tex, Utils.Floor( font.Size ), 3 );
info[namesCount] = new PlayerInfo( player );
textures[namesCount] = tex;