JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//cdn.jsdelivr.net/phaser-ce/2.7.7/phaser.js"></script>
<div id="container"></div>
JavaScript
// window.devicePixelRatio
var devicePixelRatio = 2;
var game = new Phaser.Game({
parent: 'container',
resolution: devicePixelRatio,
width: 400,
height: 300,
});
var testSprite;
var testState = {
preload() {
game.load.baseURL = 'https://fakeimg.pl/';
game.load.crossOrigin = 'anonymous';
game.load.image('testSprite', '200x200/?text=@2x');
},
create: function() {
testSprite = game.add.sprite(0, 0, 'testSprite');
testSprite.x = 50;
testSprite.y = 50;
//
testSprite.inputEnabled = true;
testSprite.input.useHandCursor = true;
testSprite.events.onInputDown.add(function(){
}, this);
},
render() {
this.game.debug.spriteBounds(testSprite);
}
}
game.state.add('test', testState);
game.state.start('test');