Add: RoundRectButton

This commit is contained in:
2018-05-01 19:14:06 +09:00
parent 581efd0777
commit eb4eafd7b5
9 changed files with 202 additions and 37 deletions
+38 -17
View File
@@ -1,38 +1,59 @@
/////////////////////////////
// Main game
var game = new Phaser.Game(1000, 800, Phaser.CANVAS, "Round rect image button test",
/**** Phaser3 *****
var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
physics: {
default: 'arcade',
arcade: {
gravity: { y: 200 }
}
},
scene: {
preload: preload,
create: create
}
};
var game = new Phaser.Game(config);
function preload() {
}
function create() {
console.log(game);
this.cameras.main.setBackgroundColor('#4d4d4d');
// game.stage.backgroundColor = '#4d4d4d';
// graphics = game.add.graphics(0, 0);
}
*/
var game = new Phaser.Game(1000, 800, Phaser.CANVAS, "RoundRectButton",
{preload:preload, create:create, update:update, render:render});
function preload() {
game.load.image('phaser', './image/phaser.png');
// game.load.image('phaser', '../../resources/image/phaser.png');
// game.load.spritesheet('button', './image/button_basic.png', 200, 100);
}
function create() {
var i = game.add.image(game.world.centerX, game.world.centerY + 70, 'phaser');
i.anchor.set(0.5);
// var i = game.add.image(game.world.centerX, game.world.centerY + 70, 'phaser');
// i.anchor.set(0.5);
game.stage.backgroundColor = '#4d4d4d';
graphics = game.add.graphics(0, 0);
new RoundRectButton(new RectSetting(200, 100));
let button = new RoundRectButton(new RectSetting(200, 100));
console.log(button);
}
function update() {
}
function render() {
// showDebugMessage();
}
/////////////////////////////
// custom methods
function showDebugMessage() {
// game.debug.text( "This is debug text 한글 " + spriteMushroom.x + ", " + spriteMushroom.y + ", highscore : " + highScore, 100, 380 );
}