All Projects → samme → phaser-plugin-game-scale

samme / phaser-plugin-game-scale

Licence: other
Scale or resize the game canvas. Phaser v3.15 only

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to phaser-plugin-game-scale

phaser-ui-comps
Phaser 3 UI Components built by Adobe Animate
Stars: ✭ 60 (+71.43%)
Mutual labels:  phaser, phaser-plugin, phaser3
phaser3-simple-rpg
A simple Phaser3 RPG using Typescript ⚔️
Stars: ✭ 80 (+128.57%)
Mutual labels:  phaser, phaser3
phaser-plugin-advanced-timing
Shows FPS, frame intervals, and performance info. Phaser 2/CE
Stars: ✭ 25 (-28.57%)
Mutual labels:  phaser, phaser-plugin
phaser3-faq
A guide to Phaser 3
Stars: ✭ 69 (+97.14%)
Mutual labels:  phaser, phaser3
template
使用 phaser3 + es6 + webpack4.8.1 配置开发游戏(基本模版)
Stars: ✭ 12 (-65.71%)
Mutual labels:  phaser, phaser3
Cavemen-GGJ2019
A multiplayer survival game developed during Global Game Jam 2019.
Stars: ✭ 21 (-40%)
Mutual labels:  phaser, phaser3
phaser3-webpack-es6-dev-starter
Development set up for Phaser 3, Webpack, and ES6.
Stars: ✭ 44 (+25.71%)
Mutual labels:  phaser, phaser3
phaser3-typescript-starter-kit
This repository contains the code necessary to start making a game in Phaser 3 using TypeScript.
Stars: ✭ 94 (+168.57%)
Mutual labels:  phaser, phaser3
phaser-plugin-scene-graph
Prints the display tree. Phaser 2/CE
Stars: ✭ 32 (-8.57%)
Mutual labels:  phaser, phaser-plugin
Opensc2k
OpenSC2K - An Open Source remake of Sim City 2000 by Maxis
Stars: ✭ 4,753 (+13480%)
Mutual labels:  phaser, phaser3
phaser-responsive
Adds a set of responsive objects to Phaser that can be pinned to
Stars: ✭ 25 (-28.57%)
Mutual labels:  phaser, phaser-plugin
craft
Phaser Library with utility chainable functions
Stars: ✭ 27 (-22.86%)
Mutual labels:  phaser, phaser-plugin
phaser-nineslice
NineSlice plugin for Phaser!
Stars: ✭ 52 (+48.57%)
Mutual labels:  phaser, phaser-plugin
phaser-3-palette-swapping-example
Example of using palette swapping on a spritesheet in Phaser 3.
Stars: ✭ 32 (-8.57%)
Mutual labels:  phaser, phaser3
phaser-super-storage
A cross platform storage plugin for Phaser
Stars: ✭ 49 (+40%)
Mutual labels:  phaser, phaser-plugin
phaser-plugin-debug-arcade-physics
Draws properties of Arcade Physics bodies. Phaser 2/CE
Stars: ✭ 18 (-48.57%)
Mutual labels:  phaser, phaser-plugin
mmo-arch
Base Architecture for creating scalable games using microservices through Angular, Phaser, NestJS, NATS, and MySQL
Stars: ✭ 25 (-28.57%)
Mutual labels:  phaser, phaser3
phaser-jam-template
A Phaser Template to kick off your Game Jam with everything you need. Typescript, code quality, building for itch, various input methods, examples, bootloader, preloader, main game, end screen, credits screen and license screen.
Stars: ✭ 18 (-48.57%)
Mutual labels:  phaser, phaser3
phaser-parcel
A Phaser 3 game template using Parcel bundler
Stars: ✭ 64 (+82.86%)
Mutual labels:  phaser, phaser3
phaser-particle-editor-plugin
This plugin creates particles based on JSON data generated by Phaser Particle Editor
Stars: ✭ 28 (-20%)
Mutual labels:  phaser, phaser-plugin

Phaser 3 Game Scale Plugin

Scale or resize the game canvas. Demo

This is for Phaser v3.15 (or earlier) only. Since Phaser 3.16 use the Scale Manager instead.

Modes

  • fit — scale the canvas up or down to fit the container, and within min/max lengths (if set).
  • resize — change the game dimensions to fit the container, and within min/max lengths (if set).
  • resize-and-fit — resize within min/max lengths, then scale the canvas to fit any remaining space within the container.
  • none — set the canvas scale to 100%.

The default mode is fit.

Use

new Phaser.Game({
  // ...
  plugins: {
    global: [{
      key: 'GameScalePlugin',
      plugin: Phaser.Plugins.GameScalePlugin,
      mapping: 'gameScale',
      data: {/* See 'Configuration' */}
    }]
  }
  // ...
});

If you're using ES6 modules, you can use the default export instead:

import GameScalePlugin from 'phaser-plugin-game-scale';

new Phaser.Game({
  // ...
  plugins: {
    global: [{
      key: 'GameScalePlugin',
      plugin: GameScalePlugin,
      mapping: 'gameScale',
      data: {/* See 'Configuration' */}
    }]
  }
  // ...
});

Set the scale mode:

// Within a scene:
this.gameScale.setMode('resize');

Listen to a scene's resize event to react to game size changes.

See the examples for details.

Configuration

These are the default settings:

{
  debounce: false,
  debounceDelay: 50,   // Debounce interval, in ms
  maxHeight: Infinity,
  maxWidth: Infinity,
  minHeight: 0,
  minWidth: 0,
  mode: 'fit',
  resizeCameras: true, // Resize each scene camera when resizing the game
  snap: null,          // Snap interval, in px
}
// Within a scene:
this.gameScale.configure({/* … */});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].