Sign in to follow this  
Will5

Facebook Instant Games scaling for mobile

Recommended Posts

This topic has been discussed many times here, but unfortunately no solution has worked for me.

I uploaded a game on Facebook Instant which works well on desktop but looks bad on mobile.

Initially, I was using the following code:

var game = new Phaser.Game(1080, 1920, Phaser.AUTO, null, {preload: preload, create: create, update: update});

This is the scale mode:

game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;

As you'd expect, I ended up with vertical white bars left and right.

After days of googling and testing, I tried many other solutions which did work. I even tried using window.devicePixelRatio but I had no luck; it seems as if this code was ignored on mobile.

I also tried the following but nothing worked:

var game = new Phaser.Game(1080, 1920, Phaser.AUTO, null, {preload: preload, create: create, update: update});
var game = new Phaser.Game(window.innerWidth * window.devicePixelRatio, window.innerHeight * window.devicePixelRatio, Phaser.AUTO, null, {preload: preload, create: create, update: update});

 

So before giving up, I thought I'd ask you guys for help.

Thanks in advance.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.