Commit graph

199 commits

Author SHA1 Message Date
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
photonstorm
f4eff6359c Added isArray check. 2015-03-05 14:02:24 +00:00
photonstorm
364f3b3cb8 Formatting. 2015-03-05 14:02:04 +00: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
Michael Zekoff
510353f6fb Fix row/col count formula.
This fixes the rendering issue for tilesets with margin/spacing
as described in photonstorm/phaser#1641.
2015-02-26 04:34:41 +00: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
daf8440247 Tile.properties is now unique to that specific Tile, and not a reference to the Tileset index bound properties object. Tile.properties can now be modified freely without impacting other tiles sharing the same id (#1254) 2015-02-11 21:40:37 +00:00
photonstorm
29fd37aed7 Formatting update. 2015-02-11 05:19:00 +00:00
Mika Turunen
be3edd8437 Now the backwards compatibility is not broken
As implementation is leaning on 0.11.0 feature of Tiled, I made sure the earlier Tiled files that might be used are not going to break from this. Defaulting to empty string if the .type property is not defined by Tiled (for Tiled < 0.11.0), otherwise we use the provided value.
2015-02-10 14:54:14 +02:00
Mika Turunen
8a197b6023 Read ObjectLayer Objects .type property for Tiles
Why isn't the .type already read from the objects details as it's there? Latest release version of Tiled 0.11.0 has this field for Objects and it's quite extensively used by other frameworks.

Well, I need this and I suppose there are other people too who might be interested in having this in here too. Currently I go around this by creating a custom property of "type" and setting my value on it but that's just extremely silly.
2015-02-10 11:05:28 +02: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
photonstorm
35a04b2f1e TilemapParser now supports Tiled 0.11 version maps which includes the rotation property on all Object types.
Tilemap.createFromObjects now checks for a `rotation` property on the Object and if present will set it as the Sprite.angle (#1433)
2015-02-08 23:25:41 +00:00
photonstorm
6d86952f98 JSDoc fix. 2015-02-08 21:57:09 +00:00
emailto@niklasberg.se
a0ea73a4cd Support for tiles rotated and/or flipped in Tiled 2015-02-08 21:21:39 +01: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
photonstorm
6d967b6545 Error in diffX and diffY calculation in Tilemap.paste (thanks @amelia410 #1446) 2015-01-20 10:49:15 +00: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
Paul
0ad21e3c84 Merge remote-tracking branch 'upstream/dev' into wip-tilelayer-safaribug 2014-12-30 23:07:55 -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-reilly
ce603c3510 TilemapParser: fixed check for image collection 2014-12-10 22:42:17 +00: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
Paul
47c49b18cf Tilemap - Tiled image size calculation
Addresses https://github.com/photonstorm/phaser/issues/1371 - where Tiled
used floor calculations and Phaser used round calculations.

There are no breaking changes with the demos; however, if there was code
that relied on behavior that _deviated_ from the defactor Tilemap behavior
then may be prone to "incorrect results" if using tileset images that are
not correctly aligned to tilesize multiples.

This also adds/corrects some warnings:
- A warning when the tileset size is not an even multiple (it was
  suppressed due to using `round` prior to the checks.
- A warning if loading an image changes the cols/rows of a Tileset
- A specific warning for Tileset Image Collections which are not yet
  supported
2014-11-26 19:50:07 -08:00
photonstorm
a2aa987920 jshint fixes 2014-11-11 01:09:57 +00:00
photonstorm
a2b7d339a2 Tilemap.createFromTiles will convert all tiles matching the given tile index (or an array of indexes) into Sprites. You can optionally then replace these tiles if you wish. This is perfect for games when you want to turn specific tiles into Sprites for extra control. The Sprites have an optional properties object which they can be populated with. 2014-11-11 01:05:59 +00: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
96fd0ade74 JSDoc fixes. 2014-10-21 22:43:42 +01:00
photonstorm
5e734a6bb6 Pixi v2 UV update fixes. 2014-10-17 16:52:47 +01:00