Skip to content

Instantly share code, notes, and snippets.

private boolean isShowing;
private final int maxChecks = 3;
private int currentChecks = 0;
protected void onCreate(Bundle savedInstanceState) {
//...
startChecking();
}
private void startChecking(){
// Set up scaling stuff. It's highly recommended that you copy this code to save yourself some headaches!
this.game.scale.scaleMode = Phaser.ScaleManager.USER_SCALE;
this.game.scale.pageAlignHorizontally = true;
this.game.scale.pageAlignVertically = true;
this.game.scale.forceOrientation(true, false);
// Scaling function that is called on resize or orientation change!
this.scalingFunction = function(self) {
self.scaleFactor = Math.min(window.innerWidth / self.game.width, window.innerHeight / self.game.height);
self.game.scale.setUserScale(self.scaleFactor, self.scaleFactor);