v0.3.1b: updated font scaling to be less blurry

This commit is contained in:
Evan Debenham 2015-09-03 01:51:01 -04:00
parent f531879f51
commit d29c9995a5
5 changed files with 22 additions and 14 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

BIN
assets/font1x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
assets/font2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -111,7 +111,8 @@ public class Assets {
public static final String SPELL_ICONS = "spell_icons.png"; public static final String SPELL_ICONS = "spell_icons.png";
public static final String PIXELFONT = "pixel_font.png"; public static final String PIXELFONT = "pixel_font.png";
public static final String FONT = "font.png"; public static final String FONT1X = "font1x.png";
public static final String FONT2X = "font2x.png";
public static final String THEME = "theme.mp3"; public static final String THEME = "theme.mp3";
public static final String TUNE = "game.mp3"; public static final String TUNE = "game.mp3";

View File

@ -57,9 +57,11 @@ public class PixelScene extends Scene {
public static Camera uiCamera; public static Camera uiCamera;
//stylized pixel font
public static BitmapText.Font pixelFont; public static BitmapText.Font pixelFont;
public static BitmapText.Font fontLinear; //These represent various mipmaps of the same font
public static BitmapText.Font fontNearest; public static BitmapText.Font font1x;
public static BitmapText.Font font2x;
@Override @Override
public void create() { public void create() {
@ -108,13 +110,18 @@ public class PixelScene extends Scene {
pixelFont.tracking = -1; pixelFont.tracking = -1;
// 9x15 (18) // 9x15 (18)
fontLinear = Font.colorMarked( font1x = Font.colorMarked(
BitmapCache.get( Assets.FONT), 22, 0x00000000, BitmapText.Font.LATIN_FULL ); BitmapCache.get( Assets.FONT1X), 22, 0x00000000, BitmapText.Font.LATIN_FULL );
fontNearest = Font.colorMarked( font1x.baseLine = 17;
BitmapCache.get( "2", Assets.FONT), 22, 0x00000000, BitmapText.Font.LATIN_FULL ); font1x.tracking = -2;
fontLinear.baseLine = fontNearest.baseLine = 17; font1x.texture.filter(Texture.LINEAR, Texture.LINEAR);
fontLinear.tracking = fontNearest.tracking = -2;
fontLinear.texture.filter(Texture.LINEAR, Texture.LINEAR); //font1x double scaled
font2x = Font.colorMarked(
BitmapCache.get( Assets.FONT2X), 44, 0x00000000, BitmapText.Font.LATIN_FULL );
font2x.baseLine = 38;
font2x.tracking = -4;
font2x.texture.filter(Texture.LINEAR, Texture.NEAREST);
} }
} }
@ -135,14 +142,14 @@ public class PixelScene extends Scene {
float pt = size * zoom; float pt = size * zoom;
if (pt >= 38){ if (pt >= 25) {
font = fontNearest; font = font2x;
scale = pt / 19f; scale = pt / 38f;
} else if (pt >= 12) { } else if (pt >= 12) {
font = fontLinear; font = font1x;
scale = pt / 19f; scale = pt / 19f;
} else { } else {