Used dimbo font

This commit is contained in:
Thomas Forgione 2018-08-22 16:18:37 +02:00
parent 174a7bac42
commit 9b8fbf3a3f
No known key found for this signature in database
GPG Key ID: 203DAEA747F48F41
3 changed files with 11 additions and 7 deletions

View File

@ -20,7 +20,7 @@ class Menu extends Screen {
} }
drawTitle() { drawTitle() {
this.context.font = "50px Arial"; this.context.font = "50px Dimbo";
this.context.stokeStyle = 'rgb(0, 0, 0)'; this.context.stokeStyle = 'rgb(0, 0, 0)';
this.context.fillStyle = 'rgb(255, 255, 255)'; this.context.fillStyle = 'rgb(255, 255, 255)';
@ -33,7 +33,7 @@ class Menu extends Screen {
} }
drawMenu() { drawMenu() {
this.context.font = "30px Arial"; this.context.font = "30px Dimbo";
this.context.fillStyle = 'rgb(255, 255, 255)'; this.context.fillStyle = 'rgb(255, 255, 255)';
let text = "New Game"; let text = "New Game";
@ -63,7 +63,7 @@ class Menu extends Screen {
} }
newGameBox() { newGameBox() {
this.context.font = "30px Arial"; this.context.font = "30px Dimbo";
let text = "New Game"; let text = "New Game";
let size = this.context.measureText(text); let size = this.context.measureText(text);
let offset = (this.width() - size.width) / 2; let offset = (this.width() - size.width) / 2;
@ -77,7 +77,7 @@ class Menu extends Screen {
} }
exitBox() { exitBox() {
this.context.font = "30px Arial"; this.context.font = "30px Dimbo";
let text = "Exit"; let text = "Exit";
let size = this.context.measureText(text); let size = this.context.measureText(text);
let offset = (this.width() - size.width) / 2; let offset = (this.width() - size.width) / 2;

View File

@ -182,7 +182,7 @@ class Scene extends Screen {
this.context.restore(); this.context.restore();
this.context.font = "15px Arial"; this.context.font = "15px Dimbo";
this.context.fillStyle = "rgb(255, 255, 255)"; this.context.fillStyle = "rgb(255, 255, 255)";
this.context.fillText("High score: " + Math.floor(100 * this.currentMaxHeight), 0, height - 5); this.context.fillText("High score: " + Math.floor(100 * this.currentMaxHeight), 0, height - 5);
} }
@ -215,7 +215,7 @@ class Scene extends Screen {
drawHud() { drawHud() {
// Draw scores // Draw scores
let fontSize = 20; let fontSize = 20;
this.context.font = fontSize + "px Arial"; this.context.font = fontSize + "px Dimbo";
this.context.fillStyle = 'rgb(255, 255, 255)'; this.context.fillStyle = 'rgb(255, 255, 255)';
this.context.fillText("Score: " + Math.floor(100 * this.currentHeight), 0, 20); this.context.fillText("Score: " + Math.floor(100 * this.currentHeight), 0, 20);
@ -248,7 +248,7 @@ class Scene extends Screen {
if (this.status === Status.Paused || this.status === Status.Waking) { if (this.status === Status.Paused || this.status === Status.Waking) {
let fontSize = 50; let fontSize = 50;
this.context.font = fontSize + "px Arial"; this.context.font = fontSize + "px Dimbo";
this.context.beginPath(); this.context.beginPath();
this.context.rect(0, 0, this.width(), this.height()); this.context.rect(0, 0, this.width(), this.height());

View File

@ -4,6 +4,10 @@
<title>Escalator</title> <title>Escalator</title>
<meta charset="utf-8" /> <meta charset="utf-8" />
<style> <style>
@font-face {
font-family: 'Dimbo';
src: url('fonts/dimbo_r.ttf');
}
* { padding: 0; margin: 0; } * { padding: 0; margin: 0; }
canvas { display: block; margin: 0 auto; } canvas { display: block; margin: 0 auto; }
</style> </style>