Skip to content

Commit 85c0bb7

Browse files
committed
Add colors demo
1 parent 5f17f59 commit 85c0bb7

2 files changed

Lines changed: 81 additions & 0 deletions

File tree

demo/demo-colors.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="initial-scale=1">
7+
<style>
8+
html,
9+
body {
10+
height: 100%;
11+
}
12+
13+
body {
14+
margin: 0;
15+
padding: 0;
16+
font: caption;
17+
}
18+
19+
canvas {
20+
display: block;
21+
}
22+
</style>
23+
<title>Demo of Phaser 3 Debug Game Scale Plugin</title>
24+
</head>
25+
26+
<body>
27+
<script defer src="../node_modules/phaser/dist/phaser.js"></script>
28+
<script defer src="../dist/phaser-plugin-debug-game-scale.umd.js"></script>
29+
<script defer src="./demo-colors.js"></script>
30+
</body>
31+
32+
</html>

demo/demo-colors.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
const scene = {
2+
init: function () {
3+
const cat = [
4+
'....443...443.',
5+
'...4433..4433.',
6+
'..44333.48333.',
7+
'88888888244444',
8+
'44444444433333',
9+
'44444444433333',
10+
'44044404433333',
11+
'44488844433333',
12+
'44400044433333',
13+
'44F202F4433333',
14+
'44202024433333',
15+
'44F222F4433333',
16+
'44444444433333',
17+
'4433...4433.33',
18+
'4433...4433.33'
19+
];
20+
21+
this.textures.generate('cat', { data: cat, pixelWidth: 10 });
22+
},
23+
24+
create: function () {
25+
const { centerX, centerY, width, height } = this.cameras.default;
26+
27+
this.add.image(centerX, centerY, 'cat');
28+
this.add.image(0, 0, 'cat').setOrigin(0, 0);
29+
this.add.image(width, height, 'cat').setOrigin(1, 1);
30+
31+
this.input.on('pointerup', function () {
32+
this.scale.startFullscreen();
33+
}, this);
34+
}
35+
};
36+
37+
new Phaser.Game({
38+
type: Phaser.CANVAS,
39+
backgroundColor: 0xB2DCEF,
40+
plugins: {
41+
global: [
42+
{ key: 'PhaserDebugGameScalePlugin', plugin: PhaserDebugGameScalePlugin, start: true, data: { color: 'black', shadowColor: 'white', font: '24px ui-rounded', lineHeight: 32, width: 1024, height: 256 } }
43+
]
44+
},
45+
scale: {
46+
mode: Phaser.Scale.FIT
47+
},
48+
scene: scene
49+
});

0 commit comments

Comments
 (0)