v0.3.1: overhauled font system, now only uses 2 bitmaps with one used in most cases.
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
@ -110,11 +110,8 @@ public class Assets {
|
||||||
public static final String BUFFS_LARGE = "large_buffs.png";
|
public static final String BUFFS_LARGE = "large_buffs.png";
|
||||||
public static final String SPELL_ICONS = "spell_icons.png";
|
public static final String SPELL_ICONS = "spell_icons.png";
|
||||||
|
|
||||||
public static final String FONTS1X = "font1x.png";
|
public static final String PIXELFONT = "pixel_font.png";
|
||||||
public static final String FONTS15X = "font15x.png";
|
public static final String FONT = "font.png";
|
||||||
public static final String FONTS2X = "font2x.png";
|
|
||||||
public static final String FONTS25X = "font25x.png";
|
|
||||||
public static final String FONTS3X = "font3x.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";
|
||||||
|
|
|
@ -25,6 +25,7 @@ import javax.microedition.khronos.opengles.GL10;
|
||||||
import android.opengl.GLES20;
|
import android.opengl.GLES20;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||||
|
import com.watabou.glwrap.Texture;
|
||||||
import com.watabou.input.Touchscreen;
|
import com.watabou.input.Touchscreen;
|
||||||
import com.watabou.noosa.BitmapText;
|
import com.watabou.noosa.BitmapText;
|
||||||
import com.watabou.noosa.BitmapText.Font;
|
import com.watabou.noosa.BitmapText.Font;
|
||||||
|
@ -56,11 +57,9 @@ public class PixelScene extends Scene {
|
||||||
|
|
||||||
public static Camera uiCamera;
|
public static Camera uiCamera;
|
||||||
|
|
||||||
public static BitmapText.Font font1x;
|
public static BitmapText.Font pixelFont;
|
||||||
public static BitmapText.Font font15x;
|
public static BitmapText.Font fontLinear;
|
||||||
public static BitmapText.Font font2x;
|
public static BitmapText.Font fontNearest;
|
||||||
public static BitmapText.Font font25x;
|
|
||||||
public static BitmapText.Font font3x;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
|
@ -101,37 +100,22 @@ public class PixelScene extends Scene {
|
||||||
uiCamera = Camera.createFullscreen( uiZoom );
|
uiCamera = Camera.createFullscreen( uiZoom );
|
||||||
Camera.add( uiCamera );
|
Camera.add( uiCamera );
|
||||||
|
|
||||||
if (font1x == null) {
|
if (pixelFont == null) {
|
||||||
|
|
||||||
// 3x5 (6)
|
// 3x5 (6)
|
||||||
font1x = Font.colorMarked(
|
pixelFont = Font.colorMarked(
|
||||||
BitmapCache.get( Assets.FONTS1X ), 0x00000000, BitmapText.Font.LATIN_FULL );
|
BitmapCache.get( Assets.PIXELFONT), 0x00000000, BitmapText.Font.LATIN_FULL );
|
||||||
font1x.baseLine = 6;
|
pixelFont.baseLine = 6;
|
||||||
font1x.tracking = -1;
|
pixelFont.tracking = -1;
|
||||||
|
|
||||||
// 5x8 (10)
|
|
||||||
font15x = Font.colorMarked(
|
|
||||||
BitmapCache.get( Assets.FONTS15X ), 12, 0x00000000, BitmapText.Font.LATIN_FULL );
|
|
||||||
font15x.baseLine = 9;
|
|
||||||
font15x.tracking = -1;
|
|
||||||
|
|
||||||
// 6x10 (12)
|
|
||||||
font2x = Font.colorMarked(
|
|
||||||
BitmapCache.get( Assets.FONTS2X ), 14, 0x00000000, BitmapText.Font.LATIN_FULL );
|
|
||||||
font2x.baseLine = 11;
|
|
||||||
font2x.tracking = -1;
|
|
||||||
|
|
||||||
// 7x12 (15)
|
|
||||||
font25x = Font.colorMarked(
|
|
||||||
BitmapCache.get( Assets.FONTS25X ), 17, 0x00000000, BitmapText.Font.LATIN_FULL );
|
|
||||||
font25x.baseLine = 13;
|
|
||||||
font25x.tracking = -1;
|
|
||||||
|
|
||||||
// 9x15 (18)
|
// 9x15 (18)
|
||||||
font3x = Font.colorMarked(
|
fontLinear = Font.colorMarked(
|
||||||
BitmapCache.get( Assets.FONTS3X ), 22, 0x00000000, BitmapText.Font.LATIN_FULL );
|
BitmapCache.get( Assets.FONT), 22, 0x00000000, BitmapText.Font.LATIN_FULL );
|
||||||
font3x.baseLine = 17;
|
fontNearest = Font.colorMarked(
|
||||||
font3x.tracking = -2;
|
BitmapCache.get( "2", Assets.FONT), 22, 0x00000000, BitmapText.Font.LATIN_FULL );
|
||||||
|
fontLinear.baseLine = fontNearest.baseLine = 17;
|
||||||
|
fontLinear.tracking = fontNearest.tracking = -2;
|
||||||
|
fontLinear.texture.filter(Texture.LINEAR, Texture.LINEAR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,47 +136,19 @@ public class PixelScene extends Scene {
|
||||||
|
|
||||||
float pt = size * zoom;
|
float pt = size * zoom;
|
||||||
|
|
||||||
if (pt >= 19) {
|
if (pt >= 38){
|
||||||
|
|
||||||
scale = pt / 19;
|
font = fontNearest;
|
||||||
if (1.5 <= scale && scale < 2) {
|
scale = pt / 19f;
|
||||||
font = font25x;
|
|
||||||
scale = (int)(pt / 14);
|
|
||||||
} else if (1.25 <= scale && scale < 1.5) {
|
|
||||||
font = font2x;
|
|
||||||
scale = (int)(pt / 12);
|
|
||||||
} else {
|
|
||||||
font = font3x;
|
|
||||||
|
|
||||||
//at this point non integer scale values don't cause visual problems
|
|
||||||
if (scale < 2.25f)
|
|
||||||
scale = (int)scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (pt >= 14) {
|
|
||||||
|
|
||||||
scale = pt / 14;
|
|
||||||
font = font25x;
|
|
||||||
scale = (int)scale;
|
|
||||||
|
|
||||||
} else if (pt >= 12) {
|
} else if (pt >= 12) {
|
||||||
|
|
||||||
scale = pt / 12;
|
font = fontLinear;
|
||||||
font = font2x;
|
scale = pt / 19f;
|
||||||
scale = (int)scale;
|
|
||||||
|
|
||||||
|
|
||||||
} else if (pt >= 10) {
|
|
||||||
|
|
||||||
scale = pt / 10;
|
|
||||||
font = font15x;
|
|
||||||
scale = (int)scale;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
font = pixelFont;
|
||||||
font = font1x;
|
scale = 1f;
|
||||||
scale = Math.max( 1, (int)(pt / 7) );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scale /= zoom;
|
scale /= zoom;
|
||||||
|
|
|
@ -240,14 +240,14 @@ public class RankingsScene extends PixelScene {
|
||||||
shield = new ItemSprite( ItemSpriteSheet.TOMB, null );
|
shield = new ItemSprite( ItemSpriteSheet.TOMB, null );
|
||||||
add( shield );
|
add( shield );
|
||||||
|
|
||||||
position = new BitmapText( PixelScene.font1x );
|
position = new BitmapText( PixelScene.pixelFont);
|
||||||
position.alpha(0.8f);
|
position.alpha(0.8f);
|
||||||
add( position );
|
add( position );
|
||||||
|
|
||||||
desc = createMultiline( 7 );
|
desc = createMultiline( 7 );
|
||||||
add( desc );
|
add( desc );
|
||||||
|
|
||||||
depth = new BitmapText( PixelScene.font1x );
|
depth = new BitmapText( PixelScene.pixelFont);
|
||||||
depth.alpha(0.8f);
|
depth.alpha(0.8f);
|
||||||
|
|
||||||
steps = new Image();
|
steps = new Image();
|
||||||
|
@ -255,7 +255,7 @@ public class RankingsScene extends PixelScene {
|
||||||
classIcon = new Image();
|
classIcon = new Image();
|
||||||
add( classIcon );
|
add( classIcon );
|
||||||
|
|
||||||
level = new BitmapText( PixelScene.font1x );
|
level = new BitmapText( PixelScene.pixelFont);
|
||||||
level.alpha(0.8f);
|
level.alpha(0.8f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ public class TitleScene extends PixelScene {
|
||||||
btnHighscores.setPos( w / 2, btnPlay.top() );
|
btnHighscores.setPos( w / 2, btnPlay.top() );
|
||||||
}
|
}
|
||||||
|
|
||||||
BitmapText version = new BitmapText( "v " + Game.version + "", font1x );
|
BitmapText version = new BitmapText( "v " + Game.version + "", pixelFont);
|
||||||
version.measure();
|
version.measure();
|
||||||
version.hardlight( 0xCCCCCC );
|
version.hardlight( 0xCCCCCC );
|
||||||
version.x = w - version.width();
|
version.x = w - version.width();
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class DangerIndicator extends Tag {
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
super.createChildren();
|
super.createChildren();
|
||||||
|
|
||||||
number = new BitmapText( PixelScene.font1x );
|
number = new BitmapText( PixelScene.pixelFont);
|
||||||
add( number );
|
add( number );
|
||||||
|
|
||||||
icon = Icons.SKULL.get();
|
icon = Icons.SKULL.get();
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class GoldIndicator extends Component {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
tf = new BitmapText( PixelScene.font1x );
|
tf = new BitmapText( PixelScene.pixelFont);
|
||||||
tf.hardlight( 0xFFFF00 );
|
tf.hardlight( 0xFFFF00 );
|
||||||
add( tf );
|
add( tf );
|
||||||
|
|
||||||
|
|
|
@ -99,13 +99,13 @@ public class ItemSlot extends Button {
|
||||||
icon = new ItemSprite();
|
icon = new ItemSprite();
|
||||||
add( icon );
|
add( icon );
|
||||||
|
|
||||||
topLeft = new BitmapText( PixelScene.font1x );
|
topLeft = new BitmapText( PixelScene.pixelFont);
|
||||||
add( topLeft );
|
add( topLeft );
|
||||||
|
|
||||||
topRight = new BitmapText( PixelScene.font1x );
|
topRight = new BitmapText( PixelScene.pixelFont);
|
||||||
add( topRight );
|
add( topRight );
|
||||||
|
|
||||||
bottomRight = new BitmapText( PixelScene.font1x );
|
bottomRight = new BitmapText( PixelScene.pixelFont);
|
||||||
add( bottomRight );
|
add( bottomRight );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,17 +104,17 @@ public class StatusPane extends Component {
|
||||||
exp = new Image( Assets.XP_BAR );
|
exp = new Image( Assets.XP_BAR );
|
||||||
add( exp );
|
add( exp );
|
||||||
|
|
||||||
level = new BitmapText( PixelScene.font1x );
|
level = new BitmapText( PixelScene.pixelFont);
|
||||||
level.hardlight( 0xFFEBA4 );
|
level.hardlight( 0xFFEBA4 );
|
||||||
add( level );
|
add( level );
|
||||||
|
|
||||||
depth = new BitmapText( Integer.toString( Dungeon.depth ), PixelScene.font1x );
|
depth = new BitmapText( Integer.toString( Dungeon.depth ), PixelScene.pixelFont);
|
||||||
depth.hardlight( 0xCACFC2 );
|
depth.hardlight( 0xCACFC2 );
|
||||||
depth.measure();
|
depth.measure();
|
||||||
add( depth );
|
add( depth );
|
||||||
|
|
||||||
Dungeon.hero.belongings.countIronKeys();
|
Dungeon.hero.belongings.countIronKeys();
|
||||||
keys = new BitmapText( PixelScene.font1x );
|
keys = new BitmapText( PixelScene.pixelFont);
|
||||||
keys.hardlight( 0xCACFC2 );
|
keys.hardlight( 0xCACFC2 );
|
||||||
add( keys );
|
add( keys );
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class WndJournal extends Window {
|
||||||
feature = PixelScene.createText( 9 );
|
feature = PixelScene.createText( 9 );
|
||||||
add( feature );
|
add( feature );
|
||||||
|
|
||||||
depth = new BitmapText( PixelScene.font1x );
|
depth = new BitmapText( PixelScene.pixelFont);
|
||||||
add( depth );
|
add( depth );
|
||||||
|
|
||||||
icon = Icons.get( Icons.DEPTH );
|
icon = Icons.get( Icons.DEPTH );
|
||||||
|
|