Add: Google webfonts

This commit is contained in:
2019-07-21 00:08:24 +09:00
parent 841afa6c1c
commit 72a8a39770
4 changed files with 420 additions and 241 deletions
+22 -1
View File
@@ -3,10 +3,31 @@
var CONTENT_ID = "MainMenu";
var game = new Phaser.Game(
GAME_SCREEN_SIZE.x, GAME_SCREEN_SIZE.y,
Phaser.CANVAS, CONTENT_ID
);
game.state.add('MainMenu', MainMenu);
WebFontConfig = {
// 'active' means all requested fonts have finished loading
// We set a 1 second delay before calling 'createText'.
// For some reason if we don't the browser cannot render the text the first time it's created.
active: function() { game.time.events.add(Phaser.Timer.SECOND * 0, fontLoaded, this); },
// The Google Fonts we want to load (specify as many as you like in the array)
google: {
families: ['Nanum Gothic', 'Nanum Gothic Coding', 'Nanum Brush Script']
// families: ['Nanum Brush Script']
}
};
var mainMenu = new MainMenu();
game.state.add('MainMenu', mainMenu);
game.state.start('MainMenu');
function fontLoaded() {
console.log("fontLoaded #1");
mainMenu.fontLoaded();
}