Jump to content

How to make phaser game full screen?


NRJ
 Share

Recommended Posts

Hello everyone, I am new to phaser,can anybody provide me a simple example on how to make the game occupy the full width and height of the mobile screen(not the inner width and height of the browser, completely full screen). 

I am currently using Phaser3.14. 

Link to comment
Share on other sites

I would guess if you make a mobile game you should consider doing it with the native code of your wrapper application.
For example cordova's, cocoons, PhoneGap API - you can set it fullscreen. Same for any other Wrapper.

That way your game just have to have the full resolution as you already know via innerWidth / height.
It should not be phasers part to set fullscreen, by using a wrapper.
If you like to scale up your game, you can set dimension in the initial game config. And then use resolution and a zoom factor :)
 

class Game extends Phaser.Game {
	constructor() {
		super({
			type: Phaser.WEBGL,
			width: 800,
			height: 480,
			scene: [Scene1],
			resolution: 1, //<- resolution
			pixelArt: true,
			antialias: false,
			backgroundColor: '#000000',
			zoom: 1, //<- zoom
			physics: {
				default: 'arcade',
				arcade: {
					gravity: {
						x: 0,
						y: 290
					},
					debug: false
				}
			}
		});
	}
}



I hope I did understand what you were asking for and this will help you.

Link to comment
Share on other sites

13 hours ago, s4m_ur4i said:

For example cordova's, cocoons, PhoneGap API - you can set it fullscreen. Same for any other Wrapper.

I will take a look at these options, thanks. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...