You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using Phaser.Scale.RESIZE, for a pixelart game, that fills the browser window size, and scales to a fixed game size. (in this case, 144 by 256).
On PC and android, the code is fine. the gameContainer group is centered in the screen.
On iOS, the gameContainer is pushed down by a margin, and the pixel aspect ratio is squashed vertically slightly. the code doesn't add a margin.
To address the issue of inconsistent scaling and margins on iOS, follow these steps:
Check Scale Mode: Ensure you are using the correct scale mode. In your game configuration, set scale.mode to Phaser.Scale.RESIZE.
Adjust Centering: Verify the centering constants in /src/scale/const/CENTER_CONST.js. Use Phaser.Scale.Center.CENTER_BOTH to center the game canvas both horizontally and vertically.
Handle Resize Event: Listen for the resize event in your game and adjust the game container accordingly. Use the RESIZE event from /src/scale/events/RESIZE_EVENT.js.
this.scale.on('resize',(gameSize,baseSize,displaySize,previousWidth,previousHeight)=>{// Adjust gameContainer position and scaling here});
Check for iOS Specific Issues: Add specific handling for iOS devices if necessary. You can detect iOS using user-agent strings and apply specific styles or adjustments.
Update Phaser Version: Ensure you are using the latest version of Phaser, as there have been updates and bug fixes related to the Scale Manager. Refer to the changelog in /changelog/3.60/ScaleManager.md for details.
These steps should help resolve the margin and scaling issues on iOS.
HawkenKing
changed the title
iOS adds margin and scaling that is not consistent with results on android and on pc
iOS displays autoCenter: Phaser.Scale.CENTER_BOTH in a way not consistent with results on android and on pc
Jul 15, 2024
Hi @HawkenKing. Thanks for submitting this issue. We have fixed this and pushed it to the master branch. It will be part of the next release. Do test it out and let us know if you encounter any issues.
Version
Description
Using Phaser.Scale.RESIZE, for a pixelart game, that fills the browser window size, and scales to a fixed game size. (in this case, 144 by 256).
On PC and android, the code is fine. the gameContainer group is centered in the screen.
On iOS, the gameContainer is pushed down by a margin, and the pixel aspect ratio is squashed vertically slightly. the code doesn't add a margin.
Example Test Code
https://phaser.io/sandbox/A3KSEgq7
Additional Information
tested on iPhone 12
The text was updated successfully, but these errors were encountered: