Sign in to follow this  
NRJ

How to make phaser game full screen?

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. 

Share this post


Link to post
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.

Share this post


Link to post
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. 

Share this post


Link to post
Share on other sites
1 hour ago, prob said:

You could also set it up as a Progressive Web App, without Cordova, and hide the browser UI.

I will take a look at this, thanks. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.