Sign in to follow this  
Ryuuke

How to dynamically resize the game and sprites depending on the resolution of the mobile device

Recommended Posts

Short answer is, yes.

 

Long one:

 

You must use Phaser scale methods, and also: Phaser.Device - see Rich post http://www.html5gamedevs.com/topic/2990-a-framework-approach-to-multi-screen-full-screen-development/?hl=device

 

And check this topics since there is my answer to the game scaling thing:

 

http://www.html5gamedevs.com/topic/1941-scale-to-fit-the-screen/?hl=%2Bscale+%2Bdisplay#entry13298

 

And check the search for adddtiional info cases about: display, game , scale:

 

http://www.html5gamedevs.com/index.php?app=core&module=search&do=search&fromMainBar=1

Share this post


Link to post
Share on other sites

Hi, 

 

I tried these two codes On iphone, and samsung galaxy S, the result is the same, and the game has not been resized.

this is part of my Boot class

create() {        this.stage.scale.pageAlignHorizontally = true;        this.input.maxPointers = 1;        this.stage.disableVisibilityChange = true;        if (!this.game.device.desktop) {            this.game.stage.scale.startFullScreen();            this.game.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL;            this.game.stage.scale.minWidth = 480;            this.game.stage.scale.minHeight = 260;            this.game.stage.scale.maxWidth = 1024;            this.game.stage.scale.maxHeight = 768;            this.game.stage.scale.forceLandscape = true;            this.game.stage.scale.setScreenSize(true);            this.game.stage.scale.setShowAll();            this.game.stage.scale.refresh();        }        this.game.state.start("Preloader");    }

and 

create() {        this.stage.scale.pageAlignHorizontally = true;        this.input.maxPointers = 1;        this.stage.disableVisibilityChange = true;        if (!this.game.device.desktop) {        }        this.game.state.start("Preloader");    }

I started the game with 480 320, this take a full screen on iphone, but 1/3 of the screen of samsung

 

EDIT 1: 

 

seems like cocoon js problem, it's strange, i tried it with cordova and it works like a charm, but i can't use it for game.

Do you know any other platform for build mobile html5 games?

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.