Sign in to follow this  
samme

How is game.resolution supposed to work?

Recommended Posts

Sprites in particular.

With game.resolution = 2, everything looks correct to me except the sprite dimensions: they should be 64 × 64 game pixels, just like the sprite's texture, but instead they're 128 × 128 game pixels. The texture fills only a quarter of the sprite.

 

Share this post


Link to post
Share on other sites

That looks like a bug to me and happens with < 1.0 resolutions as well.

@samme Why do you want to use a resolution greater than 1.0? I can't see any point going above that scale because you're not taking advantage of the whole canvas.

On the other hand, 0.5 = each sprite pixel takes 4 screen pixels and so forth. This runs a lot faster on the GPU and is how I can get my game to run at 60fps on devices with slower graphics cards :-)

Something cool I found: You can dynamically change the resolution without reloading the game by directly modifying this._game.renderer.resolution (reading the docs of Phaser.Game says it's read only and can only be set via the configuration object, see https://github.com/photonstorm/phaser/commit/74eeddf956963bff2b1b03a8ab5b7563d25cb818)

Edit: More info here https://github.com/photonstorm/phaser/issues/2946

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.