I have this line of code.
const width = this.cameras.main.width;
const height = this.cameras.main.height;
let loadingText = this.make.text({
x: width / 2,
y: height / 2 - 50,
text: 'Loading...',
style: {
font: '20px monospace',
fill: '#ffffff'
}
});
loadingText.setOrigin(0.5, 0.5);
So this means that before the actual game starts, i have a loader which shows loading
text. Now, the thing is this works well if the user opened the game in portrait mode. But let’s imagine that while loading...
text appearing and user opened it in portrait mode, he decided to change the orientation to landscape before the game got loaded. What’s gonna happen is loading
is gonna end up in a very bad places. I am putting two images. just remember that user opened the app in portrait mode first and while the loading text is appearing, he quickly changed the portrait to landscape and this is how the text ends up.
The thing is in Phaser 2, I am a noob, i just found this on one of the phaser 2 games, there was this function
Phaser.World.prototype.displayObjectUpdateTransform = function() {
// console.log(PIXI.DisplayObject.prototype.updateTransform, " rotation");
// console.log(this, " this");
// console.log(game.camera);
if(!game.scale.correct) {
this.x = game.camera.y + game.width;
this.y = -game.camera.x;
// console.log(Phaser.Math.degToRad(Phaser.Math.wrapAngle(90)));
this.rotation = Phaser.Math.degToRad(Phaser.Math.wrapAngle(90));
} else {
this.x = -game.camera.x;
this.y = -game.camera.y;
this.rotation = 0;
}
PIXI.DisplayObject.prototype.updateTransform.call(this);
}
and i am sure this code is exactly what solves the problem , but in phaser 3 , there’s nothing like that. So what do I have to do in this case so that text appears great? Any ideas?