Close #40 : Integrated gothic bitmap font and added helpers for it
This commit is contained in:
BIN
moonlight/gfx/ui/font-16px.png
Normal file
BIN
moonlight/gfx/ui/font-16px.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 96 KiB |
BIN
moonlight/gfx/ui/font-32px.png
Normal file
BIN
moonlight/gfx/ui/font-32px.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 170 KiB |
BIN
moonlight/gfx/ui/font-8px.png
Normal file
BIN
moonlight/gfx/ui/font-8px.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
@@ -4,6 +4,10 @@ SCREEN_HEIGHT = 480;
|
||||
SCREEN_OFFSET_RECENTLYSTOLEN = new Phaser.Point(240, SCREEN_HEIGHT - 32);
|
||||
RECENTLYSTOLEN_MAX = 5;
|
||||
|
||||
FONTSIZE_SMALL = 8;
|
||||
FONTSIZE_MEDIUM = 16;
|
||||
FONTSIZE_LARGE = 32;
|
||||
|
||||
SPEED_WALKING = 8;
|
||||
SPEED_RUNNING = 14;
|
||||
|
||||
|
||||
@@ -572,20 +572,36 @@ var StartScreen = function(game) {
|
||||
|
||||
StartScreen.prototype.create = function()
|
||||
{
|
||||
this.startGameButton = game.add.button((640 / 2) - (224/2),
|
||||
this.labeltext = bitmapText("(C) 2014 Andrew Kesterson - http://akesterson.itch.io/",
|
||||
FONTSIZE_SMALL);
|
||||
this.linkButton = game.add.button(game.world.centerX,
|
||||
460,
|
||||
this.labeltext,
|
||||
this.linkClicked,
|
||||
this);
|
||||
this.linkButton.anchor.setTo(0.5, 0.5);
|
||||
|
||||
this.startGameButton = game.add.button(game.world.centerX,
|
||||
100,
|
||||
'newgamebtn',
|
||||
this.startGameClicked,
|
||||
this,
|
||||
1,
|
||||
0);
|
||||
this.creditsButton = game.add.button((640 / 2) - (182/2),
|
||||
this.startGameButton.anchor.setTo(0.5, 0.5);
|
||||
this.creditsButton = game.add.button(game.world.centerX,
|
||||
200,
|
||||
'creditsbtn',
|
||||
this.creditsClicked,
|
||||
this,
|
||||
1,
|
||||
0);
|
||||
this.creditsButton.anchor.setTo(0.5, 0.5);
|
||||
}
|
||||
|
||||
StartScreen.prototype.linkClicked = function()
|
||||
{
|
||||
window.open("http://akesterson.itch.io/");
|
||||
}
|
||||
|
||||
StartScreen.prototype.startGameClicked = function()
|
||||
|
||||
@@ -147,6 +147,18 @@ var moonlightSettings = {
|
||||
}
|
||||
],
|
||||
'images': [
|
||||
{
|
||||
'name': 'font-32px',
|
||||
'path': 'gfx/ui/font-32px.png'
|
||||
},
|
||||
{
|
||||
'name': 'font-16px',
|
||||
'path': 'gfx/ui/font-16px.png'
|
||||
},
|
||||
{
|
||||
'name': 'font-8px',
|
||||
'path': 'gfx/ui/font-8px.png'
|
||||
},
|
||||
{
|
||||
'name': 'gameover',
|
||||
'path': 'gfx/ui/gameover.png'
|
||||
|
||||
@@ -478,3 +478,22 @@ function setConversation(obj1, obj2)
|
||||
finisher.clearWordBubble(false);
|
||||
starter.enableWordBubble();
|
||||
}
|
||||
|
||||
function textImage(x, y, str, size, align)
|
||||
{
|
||||
var text = bitmapText(str, size, align);
|
||||
return game.add.image(x, y, text);
|
||||
}
|
||||
|
||||
function bitmapText(str, size, align)
|
||||
{
|
||||
size = ( typeof size == 'undefined' ? FONTSIZE_SMALL : size);
|
||||
align = ( typeof align == 'undefined' ? Phaser.RetroFont.ALIGN_LEFT : align );
|
||||
var textobj = game.add.retroFont('font-' + size + 'px',
|
||||
size,
|
||||
size * 2,
|
||||
Phaser.RetroFont.TEXT_SET1,
|
||||
16);
|
||||
textobj.setText(str, true, 0, 0, align, true);
|
||||
return textobj;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user