admin管理员组文章数量:1431420
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.
本文标签: javascripthow to do full screen for phaser 3Stack Overflow
版权声明:本文标题:javascript - how to do full screen for phaser 3 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745572703a2664143.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论