I am using latest phaser.
I want to know how it's possible to have full screen.
var config = {
type: Phaser.WEBGL,
scale: {
mode: Phaser.Scale.Fit,
autoCenter: Phaser.Scale.CENTER_BOTH,
parent: parentDiv,
width: 1920,
height: 1080
},
parent: parentDiv,
};
If i use this config and set the style (width:100%, height:100%)
to the parent div, what happens is the game is still not shown on the whole screen. It's shown in the middle. Is this a correct behaviour? I want my game to have full screen for all screen sizes.
Any idea ? is this a good practice? I don't want to use custom functions for that.
I am using latest phaser.
I want to know how it's possible to have full screen.
var config = {
type: Phaser.WEBGL,
scale: {
mode: Phaser.Scale.Fit,
autoCenter: Phaser.Scale.CENTER_BOTH,
parent: parentDiv,
width: 1920,
height: 1080
},
parent: parentDiv,
};
If i use this config and set the style (width:100%, height:100%)
to the parent div, what happens is the game is still not shown on the whole screen. It's shown in the middle. Is this a correct behaviour? I want my game to have full screen for all screen sizes.
Any idea ? is this a good practice? I don't want to use custom functions for that.
Share Improve this question edited Sep 13, 2020 at 23:54 James Skemp 8,6019 gold badges70 silver badges112 bronze badges asked Mar 9, 2020 at 18:12 Nika KurashviliNika Kurashvili 6,48410 gold badges73 silver badges152 bronze badges 2-
How are you defining the
parentDiv
variable? – brae Commented Mar 10, 2020 at 15:04 - Does this answer your question? How do I scale the scene to fullscreen? – James Skemp Commented Sep 13, 2020 at 23:54
1 Answer
Reset to default 5You could do:
//…
width: window.innerWidth,
height: window.innerHeight,
//…
This will set your game screen width to the entire width of the window, and the same for the height (essentially it makes your game full-screen no matter what the window dimensions are.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745572704a4633777.html
评论列表(0条)