Jump to content

Search the Community

Showing results for tags 'fullScreenChange'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. When game goes fullscren it alwas stretch the game to width: 100% and height 100% and I don't think that this always sutes the needs: So I tried some changes to: fullScreenChange /** * Called automatically when the browser enters of leaves full screen mode. * @method Phaser.StageScaleMode#fullScreenChange * @param {Event} event - The fullscreenchange event * @protected */ fullScreenChange: function (event) { if (this.isFullScreen) { //this.game.stage.canvas.style['width'] = '100%'; //this.game.stage.canvas.style['height'] = '100%'; //this.game.stage.canvas.style['width'] = screen.width + 'px'; //this.game.stage.canvas.style['height'] = screen.height + 'px'; if(this.game.stage.scaleMode == Phaser.StageScaleMode.EXACT_FIT) { //what was default till now this.game.stage.canvas.style['width'] = '100%'; this.game.stage.canvas.style['height'] = '100%'; this.setMaximum(); this.game.input.scale.setTo(this.game.width / this.width, this.game.height / this.height); this.aspectRatio = this.width / this.height; this.scaleFactor.x = this.game.width / this.width; this.scaleFactor.y = this.game.height / this.height; } else if (this.game.stage.scaleMode == Phaser.StageScaleMode.NO_SCALE) { //no scale black strips around the display //if the screen size is bigger than the game size //do nothing } else if (this.game.stage.scaleMode == Phaser.StageScaleMode.SHOW_ALL) { //preserve aspect ratio, horizontal black lines or vertical black lines this.game.stage.scale.setShowAll(); this.game.stage.scale.refresh(); } } else { this.game.stage.canvas.style['width'] = this.game.width + 'px'; this.game.stage.canvas.style['height'] = this.game.height + 'px'; this.width = this._width; this.height = this._height; this.game.input.scale.setTo(this.game.width / this.width, this.game.height / this.height); this.aspectRatio = this.width / this.height; this.scaleFactor.x = this.game.width / this.width; this.scaleFactor.y = this.game.height / this.height; } }With this code there are checks and when you go fullscreen you can still preserve you game aspect ratio: for example a 800 x 600 game and maximize visible area. Also you can choose NO_SCALE and if the game size is lower than the screen resolution for example 400 x 600 game on almost any display will be centered in the full screen. So what is your vision about how the full screen should work... and is there other way of going full screen a preserving aspect ratio ?
×
×
  • Create New...