Game Scaling/Resizing Example (v3)

Hope you’ll find a solution that fits your needs.

Hi, I use this to resize/scale my game which should be played in landscape mode. And everything works fine if you start the game in landscape mode, but if you start it in portrait mode then switch to landscape, the game does not look good. I tested on simulator and real mobile devices. What’s wrong here?
I tried to call resize function on “orientationchange”, but it does not resize the game.

this.scale.on("orientationchange", function(orientation) {
    resize();
});

My code does not take into account the screen orientation. Instead it resizes on every resize event of the window.

Are you making a native app or just in the browser?

Does my example game work on your devices?

My game will be available in browser only, but I cannot force players to start in landscape mode, right, or there is a way to do it? Your example works but it is a specific game, and it’s only important to display a small area around a player. Also, I don’t use typescript. I copied your scale code to my game.js and everything is perfect except screen orientation.

start the game in landscape

start the game in portrait switch to landscape

Could it be a simple css error?

Do all buttons have relative values?

Does it work if you test it in the browser and resize the window? (Just like in my video)

Can you publish your code on github?

Here is a my scaling examples on Phaser CE


Is there a phaser 3 version of your engine?