Commit graph

149 commits

Author SHA1 Message Date
photonstorm
8dd3e06747 Loads of Cache optimisations and updates. 2015-07-15 15:00:21 +01:00
Richard Davey
d027bf8ba7 BitmapData.generateTexture will take a snapshot of the BitmapDatas canvas at that moment in time and convert it into an Image, which is then stored in the Phaser image Cache based on the key given. You can then use the new texture for any future sprites or texture based objects. 2015-07-09 00:19:07 +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
Richard Davey
a7a74550a5 Merge pull request #1837 from Feenposhleen/dev
JSON support for BitmapFont atlases
2015-06-17 01:49:23 +01:00
Richard Davey
560f98b40b Merge pull request #1828 from luckylooke/patch-2
docs: parameter description augmented
2015-06-17 01:41:25 +01:00
photonstorm
af42f5d4c9 Cache.getJSON has a new parameter: clone. If set it will return a clone of the object stored in the Cache rather than a reference to it. 2015-06-12 12:16:58 +01:00
Charlo
17a8116382 Added JSON support for BitmapFont 2015-06-06 12:35:08 +02:00
luckylooke
ee22bbbd05 docs: parameter description augmented
addTilemap 'url' parameter text augmented
2015-05-31 13:21:33 +02:00
photonstorm
9ee0de9192 Cache.addVideo allows you to add a loaded video into the Phaser Cache. This is called automatically by the Phaser Loader, but may be invoked directly as well.
Cache.checkVideoKey allows you to check if a video is stored in the cache based on the given key.

Cache.getVideo allows you to extract a video from the Cache based on its key. The video element itself (or the Blob is loaded with asBlob true) will be found in the `data` property of the returned object.

Cache.removeVideo will remove a video from the Cache based on the given key.
2015-05-03 13:53:03 +01:00
photonstorm
c6e9d7cad3 Removing PIXI.TextureCache calls as no longer used. 2015-04-27 16:22:35 +01:00
photonstorm
30450cb9bc Loader.atlas and Cache.addTextureAtlas will now automatically determine the format of the JSON data (array or hash) when added to the Cache. You no longer need to specify it explicitly if JSON, only if XML. 2015-04-23 02:35:09 +01:00
photonstorm
0ffa499bd0 Removed getJSON parse parameter. It's already parsed :) 2015-04-13 22:06:57 +01:00
photonstorm
e5f1f6f896 Cache.getPixiTexture will return a PIXI.Texture from the cache based on the given key. A PIXI Texture is created automatically for all images loaded and added to the cache.
Cache.getPixiBaseTexture will return a PIXI.BaseTexture from the cache based on the given key. A PIXI BaseTexture is created automatically for all images loaded and added to the cache.

Cache.getTexture has now been removed (it was deprecated several versions ago). Use Cache.getRenderTexture instead.

Cache.getJSON has a new optional parameter: `parse`. If `true` the method will pass the data through JSON.parse before returning it. The default is `false` to retain backwards compatibility.
2015-04-13 20:25:42 +01:00
photonstorm
a190823dad jsdoc fix. 2015-03-23 08:13:59 +00:00
photonstorm
a69e53f901 Copyright date change. 2015-02-25 03:36:23 +00:00
photonstorm
9879fc6387 If you load an image and provide a key that was already in-use in the Cache, then the old image is now destroyed (via Cache.removeImage) and the new image takes its place. 2015-02-18 16:58:08 +00:00
photonstorm
5967f01a49 jshint fix. 2015-02-11 16:57:24 +00:00
photonstorm
599bcf5f97 Loader.audiosprite has a new jsonData parameter. It allows you to pass a pre-existing JSON object (or a string which will be parsed as JSON) to use as the audiosprite data, instead of specifying a URL to a JSON file on the server (thanks @jounii #1447)
Loader.audiosprite has a new `autoDecode` parameter. If `true` the audio file will be decoded immediately upon load.
2015-02-11 16:16:58 +00:00
photonstorm
c42954ae59 Condensed Cache.destroy method. 2015-02-09 20:27:58 +00:00
Paul
dab8772de0 Documentation - consistency updates
- Updated `readOnly` doclet to `readonly`

- `array` refined to `type[]`, where such information was immediately
determinable.

- Updated {Any}/{*} to {any}; {...*} is standard exception

- Udated {Object} to {object}
2014-11-30 04:03:35 -08:00
Utkarsh Upadhyay
b084f42aa8 Fix documentation for Cache.addPhysicsData
The comment referred to the incorrect method name (`addTilemap` instead of `addPhysicsData`).
2014-11-16 15:01:23 +01:00
Janne Pulkkinen
3208e44d64 Make cache getters return null on missing entry
Some cache getters returned nothing on a missing entry (which is evaluated to undefined). 

This fixes the issue by making the getters return null, as is the case with other functions in Phaser.Cache.
2014-11-09 22:06:02 +02:00
Paul
f7f940d3da Cache: addBitmapData can auto-create FrameData, fixes 1294
- In the "Particle Class" demo there was no explicitly-created FrameData which cause issues later on.
  This cache updates ensures that FrameData will be automatically created for any added cached bitmap data, unless such is explicitly supplied or forbidden.
- Impact: low
  - AnimationManager.loadFrameData is called for all Sprites with BitmapData (except those with an explicit null FrameData) added to the cache
2014-11-07 00:08:54 -08:00
photonstorm
0f3cda0aed Cache.getRenderTexture will retrieve a RenderTexture that is stored in the Phaser Cache. This method replaces Cache.getTexture which is now deprecated.
Cache.autoResolveURL is a new boolean (default `false`) that automatically builds a cached map of all loaded assets vs. their absolute URLs, for use with Cache.getURL and Cache.checkURL. Note that in 2.1.3 and earlier this was enabled by default, but has since been moved behind this property which needs to be set to `true` *before* you load any assets to enable.

Cache._resolveUrl has been renamed to Cache._resolveURL internally and gained a new parameter. This method is a private internal one.

Cache.getUrl is deprecated. The same method is now available as Cache.getURL.

XML files weren't being added to the URL map.

Cache._resolveURL was causing a Sound double-load in Firefox and causing errors (thanks @domonyiv #1253)
2014-10-27 11:46:24 +00:00
photonstorm
474fd8e055 JSDoc fixes. 2014-10-21 23:08:16 +01:00
photonstorm
96fd0ade74 JSDoc fixes. 2014-10-21 22:43:42 +01:00
photonstorm
9140163c85 Fixed a reference error to the Loader.baseURL in Cache._resolveUrl method (thanks @neurofuzzy #1235) 2014-10-15 21:36:44 +01:00
Chad Engler
c21c0d5515 add url properties to destroy 2014-10-05 08:18:52 -07:00
Chad Engler
d9f477a086 add ability to get a cached resource by url 2014-10-04 20:48:21 -07:00
photonstorm
d65c526184 Cache.addBitmapData has a new parameter: frameData allowing you to pass a Phaser.FrameData object along with the BitmapData.
Cache.getFrameData has a new parameter: `map` which allows you to specify which cache to get the FrameData from, i.e. `Phaser.Cache.IMAGE` or `Phaser.Cache.BITMAPDATA`.
Sprite.loadTexture if given a BitmapData as the texture will now query the cache to see if it has any associated FrameData, and if so it will load that into the AnimationManager.
2014-10-01 03:10:13 +01:00
photonstorm
5980a3bdc6 Loader can now natively load XML files via load.xml. Once the XML file has loaded it is parsed via either DOMParser or ActiveXObject and then added to the Cache, where it can be retrieved via cache.getXML(key).
Cache now has support for XML files stored in their own container. You can add them with `cache.addXML` (typically this is done from the Loader automatically for you) and get them with `cache.getXML(key)`. There is also `cache.checkXMLKey(key)`, `cache.checkKeys` and `cache.removeXML(key)`.
2014-09-19 13:45:04 +01:00
photonstorm
20551f9129 Lots of jsdocs fixes ready for the new doc generator. 2014-09-16 17:35:08 +01:00
Richard Davey
cf363a56f1 Cache.removeImage has a new parameter: removeFromPixi which is true by default. It will remove the image from the Pixi BaseTextureCache as well as from the Phaser Cache. Set to false if you don't want the Pixi cache touched. 2014-09-16 12:20:03 +01:00
photonstorm
57295d7ac8 jsdoc fixes. 2014-09-15 13:51:17 +01:00
photonstorm
1f84024a3e Cache.getImage now returns null if no image was found. 2014-09-03 11:11:48 +01:00
photonstorm
05922d6fb0 Lots of fixes to the Image class to restore texture loading and fix cropping so it works exactly the same as the Sprite now. 2014-08-28 17:04:59 +01:00
photonstorm
6216cf578c BitmapFonts are now correctly added to the Cache._bitmapFont array and returned via Cache.getBitmapFont (thanks @prudolfs #1076) 2014-08-28 03:52:26 +01:00
Luc Bloom
0fc30e839e Removed some more checks 2014-07-22 10:42:47 +02:00
Luc Bloom
7f3b542fdd Removed the notion of Sprite Sheets vs single frame images
Instead of making a distinction between single frame images and Sprite
Sheets, I added a simple FrameData with one Frame to every image that
gets loaded. This way, a lot of the engine code can be simplified.

For instance, you can play animations on any Sprite without having to
check the “frame count” of its image anymore.

The engine doesn’t have to check for non-existing .frameData anymore.

An animation can keep on playing when an image happens to be set with 1
frame, continuing its animation when after that, another image is set
with multiple frames.

Think of it this way: an image with one frame is an animation of just
one frame.
2014-07-22 10:24:53 +02:00
photonstorm
22462566b4 Restored old Image object. 2014-07-11 18:02:40 +01:00
photonstorm
dd88f2a6e2 Fixed BitmapText parser. 2014-07-09 05:39:49 +01:00
photonstorm
58fc73348c The StateManager has a preRenderCallback option, which checks for a preRender function existing on the State, but it was never called. Have decided to add this in, so the core Game loop now calls state.preRender right before the renderer runs (thanks @AnderbergE #869) 2014-07-02 05:32:40 +01:00
Richard Davey
56d1cef1c8 Merge pull request #941 from kay-is/master
Changed a @method string
2014-06-24 22:39:55 +01:00
Kay Plößer
4b7698d3e1 Changed a @method string so the documentation method name matches the code method name. 2014-06-24 14:16:38 +02:00
photonstorm
7c7d9153e6 Sprite.crop (and Image.crop) has been completely overhauled. You can now crop animated sprites (sprite sheet and texture atlas), you can define the x/y crop offset and the crop rectangle is exposed in the Sprite.cropRect property.
Sprite.updateCrop is available if you wish to update an externally referenced crop rectangle.
Sprites and Images now have their own textures objects, they are no longer references to those stored in the global Pixi.TextureCache. This allows you to redefine the texture frame dynamically without messing up any other Sprites in your game, such as via cropping. They still share global Base Textures, so image references are kept to a minimum.
Sprite.resetFrame will revert the Sprites texture frame back to its defaults dimensions. This is called when you call Sprite.crop with no rectangle, to reset the crop effect, but can be userful in other situations so we've left it as a public method.
2014-06-10 23:37:33 +01:00
photonstorm
c0b3bd224e Removed the Pixi texture cache calls. 2014-06-06 04:12:51 +01:00
photonstorm
da75a22e82 Cache.checkKey added - allows you to pass in a Cache type and a key and return a boolean.
Cache.checkCanvasKey(key) - Check if a Canvas key exists in the cache (thanks to @delta11 for the proposal)
Cache.checkTextureKey(key) - Check if a Texture key exists in the cache (thanks to @delta11 for the proposal)
Cache.checkSoundKey(key) - Check if a Sound key exists in the cache (thanks to @delta11 for the proposal)
Cache.checkTextKey(key) - Check if a Text key exists in the cache (thanks to @delta11 for the proposal)
Cache.checkPhysicsKey(key) - Check if a Physics key exists in the cache (thanks to @delta11 for the proposal)
Cache.checkTilemapKey(key) - Check if a Tilemap key exists in the cache (thanks to @delta11 for the proposal)
Cache.checkBinaryKey(key) - Check if a Binary key exists in the cache (thanks to @delta11 for the proposal)
Cache.checkBitmapDataKey(key) - Check if a BitmapData key exists in the cache (thanks to @delta11 for the proposal)
Cache.checkBitmapFontKey(key) - Check if a BitmapFont key exists in the cache (thanks to @delta11 for the proposal)
Cache.checkJSONKey(key) - Check if a JSON key exists in the cache (thanks to @delta11 for the proposal)
2014-05-19 11:34:14 +01:00
photonstorm
b6ad11701e Various jshint fixes. 2014-04-01 01:30:20 +01:00
Georgios Kaleadis
0d77b36fc4 fixed p2 physics loading format and added the ability to extract a single fixture 2014-03-31 11:19:08 +03:00
Christian Wesselhoeft
61f18b675c Trim trailing whitespace. 2014-03-25 14:56:04 -07:00
photonstorm
c8e63582a4 Lots of small tweaks to pass jshint. 2014-03-13 16:49:52 +00:00
Charles Black
3d64410d7c Fix copy paste errors 2014-03-10 11:53:08 -04:00
Charles Black
6768cfd970 Cache.destory now destroys cache correctly 2014-03-10 11:22:06 -04:00
photonstorm
e45a929b00 Body.loadPolygon now parses all shapes that may exist in a JSON data file, and re-creates them all on the Body. Assumes shapes are CCW + Convex (tested working with Lime Exportor). Almost fixes #449 but Body rotation seems to screw orientation of shapes. 2014-02-28 05:46:02 +00:00
photonstorm
1448562abd Loader can now load JSON files specifically (game.load.json) and they are parsed and stored in the Game.Cache. Retrieve with game.cache.getJSON(key) (#329)
Also fixed UTF encoding on the animation file.
2014-02-21 18:48:06 +00:00
photonstorm
e5a4620b87 Loader.physics now lets you load Lime + Corona JSON Physics data, which can be used with Body.loadPolygon and Body.loadData.
Cache.addPhysicsData and Cache.getPhysicsData allow you to store parsed JSON physics data in the cache, for sharing between Bodies.
2014-02-14 23:51:49 +00:00
photonstorm
539a0f2256 BitmapFont fixes and updates and Cache support for it added. Working sweet now. 2014-02-14 16:38:06 +00:00
photonstorm
ef95fbaa00 BitmapFont moved to extending RenderTexture instead of BitmapData. Now applied as a texture to a Sprite/Image. 2014-02-14 13:50:50 +00:00
photonstorm
b38b00c2c1 Loader.bitmapFont now has 2 extra parameters: xSpacing and ySpacing. These allow you to add extra spacing to each letter or line of the font. 2014-02-14 04:34:57 +00:00
photonstorm
0896c2fac7 Updating copyright year and README. 2014-02-05 16:54:59 +00:00
photonstorm
86f6ddcbc8 Two new particle examples and a group animation example. Also fixed CocoonJS sound issue and Cache sound locked bug. 2013-12-31 03:37:11 +00:00
photonstorm
ce4cf531d4 Added class constructors, fixed Stripshader, added relative Tween example and updated Tween source. 2013-12-30 16:54:00 +00:00
photonstorm
3cbb820349 You can now load any binary file via the Loader: game.load.binary(key, url, callback) - the optional callback allows for post-load processing before entering the Cache. 2013-12-20 18:27:36 +00:00
photonstorm
5cf7ed4fdb More TypeScript updates. 2013-12-18 16:56:14 +00:00
photonstorm
50eee95c99 Improved TilemapLayer rendering and debug rendering significantly. Cleared out some old assets and added a new map. 2013-12-18 00:44:04 +00:00
photonstorm
a361a18616 Updated IE11 check, forces IE11 to use Canvas renderer even in AUTO mode. 2013-12-13 14:04:14 +00:00
photonstorm
669570c701 Tidying up the examples and more Tilemap work. 2013-12-10 12:23:42 +00:00
photonstorm
42c0bed502 Fixed World.scale and Group.scale. 2013-12-03 02:13:57 +00:00
photonstorm
299115ca5d The entire Phaser library has been updated to match the new JSHint configuration. 2013-11-25 04:40:04 +00:00
photonstorm
13a2cc2feb Updating all files to adhere to the JSHint settings and fixing lots of documentation errors on the way. 2013-11-25 03:13:04 +00:00
photonstorm
496639ff25 Added Phaser.Filter and started moving the shaders over into their own filter classes, so they won't all get bundled in unless needed. 2013-11-21 05:00:07 +00:00
Richard Davey
ebe441666c BitmapData object added 2013-11-13 20:57:09 +00:00
photonstorm
1f28d328a7 Commit before refactoring Sprite guts. 2013-10-24 21:21:00 +01:00
photonstorm
4b2ac6c6c6 More tilemap examples 2013-10-16 21:25:51 +01:00
photonstorm
0201baef11 And Tilemaps are rendering again - and much better than ever before :) Just one final optimisation pass to do and then it's on to collision. 2013-10-11 18:18:27 +01:00
photonstorm
cf414394c3 Tileset working, map coming next. 2013-10-11 06:30:28 +01:00
photonstorm
b868c2cb1b Started revamp of the Tilemap system. Also removed old 'Advanced Physics' and dropped in p2.js which is what I hope we'll eventually use. 2013-10-11 04:42:11 +01:00
Richard Davey
54f073e5cb Testing some new Camera tricks. 2013-10-03 23:20:24 +01:00
Richard Davey
96da57cac0 Fixed up the namespace in the documentation and finished off all sections other than Game Objects and Physics (yuck). 2013-10-03 02:38:35 +01:00
Richard Davey
f832bacfd6 More Docs! 2013-10-03 01:21:08 +01:00
Richard Davey
868ae81bab Input, Loader and Math docs tidied up. 2013-10-02 15:05:55 +01:00
Richard Davey
ca113b85aa More docs coming on. 2013-10-01 16:39:39 +01:00
Richard Davey
305b12d76b Adding docs. 2013-10-01 15:01:46 +01:00
Richard Davey
d9a49797c4 1.0.4 release 2013-09-18 06:34:56 +01:00
Richard Davey
dbaf7269e9 Promoted the Tilemap to a DisplayObject and vastly simplified the load process. 2013-09-12 04:24:01 +01:00
Richard Davey
95374339b9 Added a Sample Plugin and tested out the Plugin Manager. Working great :) 2013-09-11 17:32:53 +01:00
Richard Davey
87858d6bbf Fixed a bug stopping legacy Audio from starting correctly. Also fixed an issue in the Loader causing it to not load the next file if an unsupported audio file was encountered. Fixed audio playback issues on Firefox/Waterfox as a result. 2013-09-11 11:33:27 +01:00
Richard Davey
48ed27dfcc Finished off RenderTexture. Sprites can now accept a RenderTexture or a key when you create them. RenderTextures are also now stored in the cache under their own key, making re-using them across other Sprites much easier. Also ported over all of the Tilemap classes, but need to get them rendering. 2013-09-11 02:57:36 +01:00
Richard Davey
e2eddc8b24 Added Full Screen support and tested it. Also added in the BitmapText game object and custom XML loader. Game now sends a pause and resume signal, which the TweenManager listens to and handles correctly. 2013-09-10 23:51:35 +01:00
Richard Davey
e41e35fd09 Fixed an error that stopped 2 tweens from being able to run on the same object. Also refactored a lot of the classes to remove prototype properties and move them to local instance properties. 2013-09-10 20:40:34 +01:00
Richard Davey
a486bf6b4a Phaser now running on iOS. Also fixed a legacy bug where a pending sound wouldn't play once it was touch unlocked. Also fixed Input not working on WebGL contexts. Added WebGL texture updates to the Group/World swap functions. 2013-09-10 16:46:39 +01:00
Richard Davey
15fe5ed6c8 Fixed the Bring to Top bug and also fixed Group/World.swap when the child was a tail node. Also improved Group.dump significantly. Fixed Phaser.Utils namespace clash too. 2013-09-10 12:46:14 +01:00
Richard Davey
4f950ae801 Fixed a fantastic FrameData bug. Also added support to the Emitter to handle multiple image keys and/or frames. 2013-09-10 11:09:25 +01:00
Richard Davey
2fe8a3a0a7 Physics integration and a fix to Tween that stopped the repeat/yoyo from working. 2013-09-03 17:07:05 +01:00
Richard Davey
936118bd91 AnimationManager done and in, need to fix texture update bug, otherwise finished. 2013-08-30 04:20:14 +01:00
Richard Davey
a81a8effb4 Sprite Sheets now parse and render correctly too. 2013-08-30 02:18:00 +01:00
Richard Davey
559d75eba1 When Phaser loads images they are now added to the PIXI.BaseTextureCache. Also when it loads atlas data (regardless of the 3 formats) they are converted into PIXI TextureCache entries using UUIDs to avoid name clashes and to support index based atlases. 2013-08-30 01:50:17 +01:00
Richard Davey
4c1dacfa02 Loader can now parse both JSON Hash and JSON Array formated texture atlas files. 2013-08-29 22:53:55 +01:00
Richard Davey
09def364c3 Farewell TypeScript, see you on the other side. 2013-08-28 07:02:57 +01:00