Commit graph

94 commits

Author SHA1 Message Date
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
photonstorm
26a89f0b84 New build files with tilemap callback fixes in. 2014-03-24 01:39:09 +00:00
photonstorm
e1c98ba617 You can now create multiple blank layers in a Tilemap. 2014-03-23 23:58:01 +00:00
Richard Davey
eddf1edead Tilemap updates 2014-03-23 10:35:31 +00:00
photonstorm
539d70d581 Testing multi layer blank map updates. 2014-03-22 08:33:38 +00:00
photonstorm
0fa54b0b24 TileSprites now emit outOfBounds and enterBounds events accordingly.
TileSprites working with physics bodies again.
2014-03-21 18:04:24 +00:00
photonstorm
0e29bd4300 Tile Collision Callbacks working properly. CSV / Blank map examples added. Multiple tilesets per map working again. That's it folks! 2014-03-14 04:21:56 +00:00
photonstorm
f3ff9c197f Fixed all the tilemap examples. 2014-03-14 03:26:06 +00:00
photonstorm
017a017b96 TilemapLayer.getRayCastTiles will let you get all tiles that hit the given line for further processing.
Fixed Tilemap collision. Added new TILE_BIAS const to aid with fast/small sprites.
2014-03-14 02:33:58 +00:00
photonstorm
f678d1fd31 Line now has x, y, width, height, top, bottom, left and right properties, so you can effectively get its bounds. 2014-03-14 00:19:45 +00:00
photonstorm
5297497632 Tilemap collision finally getting closer. 2014-03-13 22:49:08 +00:00
photonstorm
e955145707 Added p2 kill and reset test + nearing completion on tilemap collision. 2014-03-13 21:14:18 +00:00
photonstorm
c8e63582a4 Lots of small tweaks to pass jshint. 2014-03-13 16:49:52 +00:00
photonstorm
3e93f24583 New split physics system is implemented. Still tidying-up, but ArcadePhysics, P2 and Ninja Physics are in and configured. Lots more examples required, and tilemap collision mostly broken in Arcade at the moment. Time to implement in Ninja. 2014-03-06 06:29:19 +00:00
photonstorm
5a6ae5f696 Tilemap.putTile now correctly re-calculates the collision data based on the new collideIndexes array (fixes #371)
Tilemap.putTile can now insert a tile into a null/blank area of the map (before it could only replace existing tiles)
2014-03-04 03:08:35 +00:00
photonstorm
d8f5832fa2 Completely empty Tilemaps can now be created. This allows for dynamic map generation at runtime.
Loads of updates across most the Tilemap files. Not finished yet, still CSV loading to do and a multi-tileset issue to resolve, but it's a lot more flexible now.
2014-03-03 05:19:46 +00:00
photonstorm
418a161b46 Testing webgl debug overlay. 2014-03-02 20:51:44 +00:00
photonstorm
09d4a35b7f Fixed issue where Phaser.Canvas.create would always make a screencanvas for CocoonJS, but that should only happen once. New parameter toggles it. 2014-02-28 03:55:06 +00:00
photonstorm
994eaff92b StateManager fixes for when you change state in the create function.
TilemapLayer update for WebGL.
2014-02-26 00:58:19 +00:00
photonstorm
0896c2fac7 Updating copyright year and README. 2014-02-05 16:54:59 +00:00
photonstorm
45b6d5a741 Removed: Debug.renderSpriteTouching, Debug.renderLocalTransformInfo, Debug.renderWorldTransformInfo, Debug.renderSpriteCollision and Debug.dumpLinkedList.
Debug.renderPhysicsBody(body, color) is extremely useful for debugging the new physics bodies. Will draw the outline + points in the color given.
Debug.renderBodyInfo(sprite, x, y, color) will display lots of Sprite body data.
2014-01-31 05:42:20 +00:00
photonstorm
13a86765cb Phaser.CANVAS_PX_ROUND is a boolean. If 'true' the Canvas renderer will Math.floor() all coordinates before drawImage, stopping pixel interpolation. Defaults to false.
Phaser.CANVAS_CLEAR_RECT is a boolean. If 'true' (the default) it will context.clearRect() every frame. If false this is skipped (useful if you know you don't need it)
Collision now works between Sprites positioned via sprite.x/y, sprite.body.x/y or sprite.body.velocity.
If you are tweening a sprite and still want physics collision, set `sprite.body.moves = false` otherwise it will fight against the tween motion.
2014-01-31 04:14:02 +00:00
photonstorm
68b7d22e0d Fixed issue with the camera being slightly out of sync with 'fixedToCamera' sprites. Also fixed 'jitter' issue with camera targets. 2014-01-31 03:32:12 +00:00
photonstorm
6e4e99f436 Added Game Update loop step debugging - has proved utterly invaluable! Resolved camera jitter issues, gravity / downward force on tile/boundary issues and most tilemap collision issues. 2014-01-31 02:06:45 +00:00
photonstorm
651858372c Added Game core loop stepping support. Super-useful for debugging, and helped me track down the issue with jittery physics collision. Double-win! 2014-01-29 17:10:13 +00:00
photonstorm
bd66be1804 Updated Tilemap classes and further tests. 2014-01-14 22:34:41 +00:00