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.
You 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With