working on the highscore screen

This commit is contained in:
Ruben Müller 2013-05-16 22:27:15 +02:00
parent a0126a0148
commit cfd4bb887c
4 changed files with 7 additions and 3 deletions

View file

@ -116,6 +116,8 @@ ig.module(
response: 'json' response: 'json'
}, },
font: new ig.Font( 'media/lcddot.font.png' ), font: new ig.Font( 'media/lcddot.font.png' ),
fontSmall: new ig.Font( 'media/lcddot.small.font.png' ),
backgroundInput: new ig.Image('media/highscore_input_screen.png'),
background: new ig.Image('media/highscore_screen.png'), background: new ig.Image('media/highscore_screen.png'),
nameField: null, nameField: null,
clearColor: null, clearColor: null,
@ -161,15 +163,17 @@ ig.module(
draw: function() { draw: function() {
ig.system.context.clearRect( 0 ,0, ig.system.realWidth, ig.system.realHeight ); ig.system.context.clearRect( 0 ,0, ig.system.realWidth, ig.system.realHeight );
this.parent(); this.parent();
this.background.draw(0, 0); if (this.nameField !== null) this.backgroundInput.draw(0, 0);
else this.background.draw(0, 0);
// Draw the current highscore if its loaded // Draw the current highscore if its loaded
if (ig.global.scores !== undefined) { if (ig.global.scores !== undefined) {
var ypos = 50; var ypos = 50;
for (var i=0; i<ig.global.scores.length; i++) { for (var i=0; i<ig.global.scores.length; i++) {
var score = ig.global.scores[i]; var score = ig.global.scores[i];
this.font.draw(score.Score.score + ' ' + score.Player.username, 50, ypos, ig.Font.ALIGN.LEFT); this.fontSmall.draw(score.Score.score + ' ' + score.Player.username, 50, ypos, ig.Font.ALIGN.RIGHT);
ypos += 50; this.fontSmall.draw(score.Score.score + ' ' + score.Player.username, 50, ypos, ig.Font.ALIGN.LEFT);
ypos += 30;
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 KiB

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB