hackenstein Posted September 24, 2013 Share Posted September 24, 2013 I'm currently stuck trying to center my game in the browser window with phaser 1.0.5. It's probable that I am missing something very basic, as I have just started using phaser. I thought that Phaser.Canvas.setTransform should do the trick, but obviously not like that:<script type="text/javascript">(function () { var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update }); function preload() { game.load.image('logo', 'logo.png'); } var logo; function create() { logo = game.add.sprite(0, 0, 'logo'); Phaser.Canvas.setTransform(game.context, 100, 100, 0, 0, 0, 0); } function update() { }})();</script>Help would be greatly appreciated Link to comment Share on other sites More sharing options...
rich Posted September 24, 2013 Share Posted September 24, 2013 Canvas.setTransform is just for adjusting the canvas transform matrix, it won't have any impact on centering the game in the browser. For that you need to apply a suitable CSS style to the container your game lives inside. Link to comment Share on other sites More sharing options...
hackenstein Posted September 24, 2013 Author Share Posted September 24, 2013 Ahh ok, that I can do Link to comment Share on other sites More sharing options...
Recommended Posts