Commit graph

119 commits

Author SHA1 Message Date
Imanol Fernandez
e41dba7f0c Fix unmatched context.save() & context.restore() calls 2015-07-24 17:36:56 +02:00
photonstorm
f15fe6706c All undefined argument checks were changed from if (typeof x === 'undefined') to if (x === undefined) removing the typeof check and saving some bytes across the codebase in the process. 2015-07-22 10:37:15 +01:00
Richard Davey
06658fa1e0 TilemapLayer.resize allows you to resize a TilemapLayer. It will update the internal canvas object and corresponding texture dimensions (#1881) 2015-07-07 03:27:28 +01:00
Richard Davey
a1f618f54f Debugging tileset issue. 2015-07-07 02:18:53 +01:00
photonstorm
8919e4e128 Trying out resize method. 2015-07-02 17:19:57 +01:00
photonstorm
102c74e121 Deprecated the following:
* Camera.screenView
* ScaleManager.maxIterations
* ScaleManager.enterPortrait (see onOrientationChange)
* ScaleManager.enterLandscape (see onOrientationChange)
* ScaleManager.enterFullScreen (see onFullScreenChange)
* ScaleManager.leaveFullScreen (see onFullScreenChange)
* ScaleManager.fullScreenFailed (see onFullScreenError)
* ScaleManager.checkResize
* ScaleManager.checkOrientation
* ScaleManager.setScreenSize (see updateLayout)
* ScaleManager.setSize (see reflowCanvas)
* ScaleManager.checkOrientationState (see reflowCanvas)
* ScaleManager.orientation (see screenOrientation)
* Gamepad.disabled (see enabled)
* Input.currentPointers (see totalActivePointers)
* Input.disabled (see enabled)
* Keyboard.disabled (see enabled)
* Mouse.disabled (see enabled)
* Mouse.mouseMoveCallback (see Input.addMoveCallback)
* MSPointer.disabled (see enabled)
* Touch.disabled (see enabled)
* Cache.getUrl (see getURL)
* Math.truncate (see Math.trunc)
* Math.snapToInArray (see Phaser.ArrayUtils.findClosest)
* Math.interpolateFloat (see Math.linear)
* Math.normalizeLatitude (use Phaser.Math.clamp(lat, -90, 90))
* Math.normalizeLongitude (use Phaser.Math.wrap(lng, -180, 180))
* Math.chanceRoll (use Phaser.Utils.chanceRoll)
* Math.numberArray (use Phaser.ArrayUtils.numberArray)
* Math.numberArrayStep (use Phaser.ArrayUtils.numberArrayStep)
* Math.limitValue (use Phaser.Math.clamp)
* Math.randomSign (use Phaser.Utils.randomChoice(-1, 1))
* Math.angleLimit (use Phaser.Math.clamp)
* Math.getRandom (use Phaser.ArrayUtils.getRandomItem)
* Math.removeRandom (use Phaser.ArrayUtils.removeRandomItem)
* Math.floor (use Math.trunc)
* Math.ceil (use Phaser.Math.roundAwayFromZero)
* Math.shift (use Phaser.ArrayUtils.rotate)
* Math.shuffleArray (use Phaser.ArrayUtils.shuffle)
* Math.distanceRounded (do the rounding locally)
* Canvas.getOffset (see Phaser.DOM.getOffset)
* Canvas.getAspectRatio (see Phaser.DOM.getAspectRatio)
* TilemapLayer.tileColor (use TilemapLayer.debugSettings.missingImageFill)
* Phaser.ArrayList alias removed, now use Phaser.ArraySet
* Utils.transposeArray (see Phaser.ArrayUtils.transposeMatrix)
* Utils.rotateArray (see Phaser.ArrayUtils.rotateMatrix)
* Utils.shuffle (see Phaser.ArrayUtils.shuffle)
2015-06-17 03:14:31 +01:00
photonstorm
89c11b9d48 TilemapLayer swapped to use full Phaser.Sprite to allow for input events, bringToTop, etc. 2015-06-16 16:40:45 +01:00
photonstorm
7b011fe0d3 Fix #1742 2015-04-14 09:31:04 +01:00
photonstorm
7b8a430aac TilemapLayer docs incorrectly reported it as extending Phaser.Image, but it doesn't share the same components so has been updated.
TilemapLayer was missing the Input component (thanks @uhe1231 #1700)
2015-04-13 12:23:30 +01:00
photonstorm
1486e166bd Added physicsType property. 2015-03-23 15:04:27 +00:00
Paul
dcc83ec793 Tilemap renderer - context save/restore
- Added context save/restore; the secondary issue when the canvas
  is copied from later, and if any alpha is applied
2015-03-16 22:05:46 -07:00
Paul
54dba67f50 Tilemap rendering sets initial state better
- #1666 - previous alpha state could bleed through.
  Now the initial alpha and composite modes are set explicitly.
2015-03-16 21:35:39 -07:00
Paul
0e5272b217 Merge remote-tracking branch 'upstream/dev' into wip-components-toproto
Conflicts:
	src/gameobjects/Image.js
	src/gameobjects/Rope.js
	src/gameobjects/Sprite.js
	src/gameobjects/Text.js
	src/gameobjects/TileSprite.js
	src/gameobjects/components/Core.js
2015-02-28 15:51:47 -08:00
photonstorm
a69e53f901 Copyright date change. 2015-02-25 03:36:23 +00:00
photonstorm
c9939f8691 Tilemap fix #1635 2015-02-24 22:57:59 +00:00
Paul
4f747a1c00 Components - moving install to prototype
- This ensures the components are regsitered once per type
  instead of once per instance (which is duplicate work)
2015-02-22 20:44:11 -08:00
photonstorm
41e2fbff55 TilemapLayer no longer extends Image, but is a GameObject of its own. 2015-02-17 16:38:27 +00:00
photonstorm
8483eac6aa Removing all use of _cache from all Game Objects. 2015-02-16 17:22:51 +00:00
photonstorm
29fd37aed7 Formatting update. 2015-02-11 05:19:00 +00:00
Richard Davey
b66a0aa11a Merge pull request #1605 from mickez/tilemaplayer_scale
Added scaling capability to TilemapLayer
2015-02-09 20:02:48 +00:00
emailto@niklasberg.se
a70dd81a80 Support for tiles rotated and/or flipped in Tiled 2015-02-08 21:03:19 +01:00
Michael Rehn
bb2e263345 Changed to bracket on new line to follow the rest of the codes style 2015-02-07 21:31:17 +01:00
Michael Rehn
e600cb89b7 Added scaling capability to TilemapLayer via the setScale method 2015-02-07 19:48:44 +01:00
photonstorm
2ba6e0528e TilemapLayer.getTiles now returns a copy of the Tiles found by the method, rather than references to the original Tile objects, so you're free to modify them without corrupting the source (thanks @Leekao #1585) 2015-02-03 21:32:39 +00:00
Paul
ad9245caeb TilemapLayer - {missing changes} 2015-01-24 18:37:28 -08:00
Paul
818d5bcdcc Tilemaps - removed N-slice support
- Since N-slicing doesn't work in Safari, which is what the
  double-copy fix is for, it is simply removed.
2015-01-24 18:35:11 -08:00
Paul
4845c2054b TilemapLayer - quibbles
- Removed accidental change
2015-01-24 17:49:20 -08:00
Paul
11c78f11b0 TilemapLayer - Safari fix
- Changed default slice count to 1: this fixes yet another Safari-specific
  issue.
2015-01-24 17:43:08 -08:00
Paul
c361e6f535 TilemapLayer - fix for regression typo 2015-01-05 20:37:00 -08:00
Richard Davey
b4678b6b56 Merge pull request #1474 from nextht/remove-tw-and-th-init
Remove tw and th init
2015-01-05 11:15:28 +00:00
Paul
114d967272 TilemapLayer - quibbles
- Updated shiftCanvas usage for consistency with renderSetting access
2014-12-31 10:06:48 -08:00
Paul
76aa601d47 TilemapLayer rendering double-copy
- Memory optimization of delta-scroll shifting.
  - The copy canvas is shared between all TilemapLayers
  - The copy is done in segments to reduce the memory usage of the copy
  canvas. Currently this is a 1/4 ratio.

- Device has the feature (by browser) check to see if bitblt works
  - TilemapLayer will automatically enable the double-copy as needed
  - Device.whenReady can be used to override the device value
2014-12-31 09:54:37 -08:00
nextht
18b3a3cc5b Remove useless initilization for tw and th code
tw and th have been initialized twice, the first time is useless.
2014-12-20 17:45:27 +08:00
Paul
466b021ca0 TilemapLayer: Re-added secondary copy-canvas
- This change uses a secondary canvas and rectangle clearing instead of a
  'copy' composition on the same canvas. This should hopefully address
  the flickering issue in Safari and Safari Mobile
2014-12-12 00:26:49 -08:00
Paul
92a20a5f5f TileLayer - globalCompositionOperation set once
This might fix a safari issue; it also avoids repeatedly setting the
[same] composition operation and saving/loading context states.
2014-12-09 20:21:31 -08:00
photonstorm
347978679d docs update 2014-11-11 01:05:59 +00:00
photonstorm
6d8fb60f77 Removed TilemapLayer.index getter as it incorrectly refereneced a property that didn't exist, breaking most demos. Couldn't see an obvious reason for the getter so restored previous property and tested all examples, and all run now (and faster too thanks to the rest of the changes made in TilemapLayer). 2014-11-08 14:50:00 +00:00
Paul
03af5e1582 TilemapLayer/Tileset - Documentation consistency updates for Phaser 2014-10-30 02:00:20 -07:00
Paul
75f13cfe44 TilemapLayer / Tileset documentation to Phaser conventions
- Reverted @member to @property for uniformity
- Expanded some comments
2014-10-28 22:21:47 -07:00
Paul
ce2acdd54c TilemapLayer / Tileset
- Minor regression fix, increasing argument specifity/documentation
2014-10-25 22:17:31 -07:00
Paul
6108091035 Merge branch 'dev' of https://github.com/photonstorm/phaser into wip-tilelayer 2014-10-25 22:10:20 -07:00
Paul
22be4b0bf6 TilemapLayer / Tileset performance and documentation
TilemapLayer
 - Added "delta scroll rendering"
   - Enabled (by default) via `renderSettings.enableScrollDelta`
   - Dramatic CPU reduction: 30% to 2% scrolling 50x37 region
   - Side-effect: fixed some Chrome de-opt issues with `render`
   - Various rendering updates and removal of many `_mc` field
 - Made `index` a read-only propert that reflects the layer.index
 - Creates a local cache from tile index -> tileset, added `resetTilesetCache`
   - Also prevents crash when an index not associated with a tileset is
     used; see `missingImageOverfill`.
 - Various debug options moved to `debugSettings` and simplified; documentation updated.
   - Uses `debugSettings.missingImageOverfill` and `tileColor` (deprecated) to display invalid tileset images
 - Only change the context alpha when the tile alpha changes; in Chrome 38
   this removed a .5% penalty
 - Added `renderSettings` which controls misc. rendering/optimizations.
 - Updated documentation to @member, clarified

Tileset
 - Added `containsTileIndex` method to allow being queried if the specific tile index is handled/supported.
 - Uses a firstgid bias and interlacing to fit the data in single densely packed array.
 - Updated documentation to @member, clarified
2014-10-25 21:48:59 -07:00
Richard Davey
35c42e3073 Tilemaps in WebGL wouldn't update after the first frame due to a subtle change in how Pixi uploads new textures to the GPU. 2014-10-25 10:09:04 +01:00
photonstorm
5e734a6bb6 Pixi v2 UV update fixes. 2014-10-17 16:52:47 +01:00
photonstorm
2293b64c94 Removing debug / console.log output. 2014-07-09 05:49:13 +01:00
photonstorm
e923e230e0 TilemapLayers can now be used with an unbounded camera (a camera that can move beyond the world boundaries). Currently, when an unbounded camera moves outside of the world, tilemaps start acting weird because they only render themselves strictly within the world limits. With this change, the tilemap will continue scrolling and show empty space beyond its edge (thanks @jotson #851)
TilemapLayer.wrap property - if true the map is rendered as if it is on the surface of a toroid (donut) instead of a plane. This allows for games that seamlessly scroll from one edge to the opposite edge of the world without noticing the transition. Note that the World size must match the Map size (thanks @jotson #851)
2014-06-11 00:15:02 +01:00
John Watson
14e1f0fcc6 Render tilemap when camera outside of world bounds, layer wrapping
Prior to this change, TilemapLayers always restricted themselves to
rendering strictly within the world bounds. If the camera was allowed
to go beyond the world bounds, then the tilemap would appear to stop
scrolling once the camera hit the world edge. This allows the tilemap
to continue scrolling, showing empty space beyond the edge of the map.

Additionally, when the new "wrap" parameter is true, the tilemap will
render its opposite edge in the empty space. This simulates the map as
if it was the surface of a toroid (donut) rather than a flat plane.
2014-05-27 14:51:44 -07:00
photonstorm
65022ccc55 Blank Tilemaps no longer create null tiles, but instead create Tile objects with an index of -1 which can be replaced and updated like any other tile.
Tilemap.fill would throw an error if called on a blank tilemap full of null values (thanks @DrHackenstein, fix #761)
2014-04-28 02:42:38 +01:00
Christian Wesselhoeft
89a1639952 Fix jshint issues in src/tilemap 2014-03-25 14:56:04 -07:00
Christian Wesselhoeft
61f18b675c Trim trailing whitespace. 2014-03-25 14:56:04 -07:00