Commit graph

889 commits

Author SHA1 Message Date
photonstorm
a471cfc235 Game.destroy now destroys either the WebGLRenderer or CanvasRenderer, whichever Pixi was using. 2014-10-27 22:09:39 +00:00
photonstorm
da87c75e00 Loader.useXDomainRequest used to be enabled automatically for IE9 but is now always set to false. Please enable it only if you know your server set-up / CDN requires it, as some most certainly do, but we're finding them to be less and less used these days, so we feel it's safe to now disable this by default (#1248)
Loader.json was using the wrong context in IE9 with XDomainRequest calls (thanks @pnstickne #1258)
2014-10-27 12:31:55 +00: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
12c2f83bfc Repackaging for 2.1.4 release. 2014-10-27 10:59:37 +00: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
18f6b320ab Preparing for Phaser v2.2.0 2014-10-23 13:52:39 +01:00
photonstorm
fbe68e330d Phaser 2.1.3 build. 2014-10-22 21:42:12 +01:00
photonstorm
9b16b11c88 Small Roadmap update. 2014-10-21 22:45:36 +01:00
photonstorm
01a068f53c Rectangle.scale allows you to scale the width and height of a Rectangle. 2014-10-21 00:25:54 +01:00
photonstorm
9d58297eb9 Button.setSounds now works if given an AudioSprite as the sound source. 2014-10-20 23:17:05 +01:00
photonstorm
1a357e18c8 Rectangle contains updates. 2014-10-20 14:28:09 +01:00
photonstorm
b580746cb8 Input.hitTest now accurately detects hits on the extreme edges of a display object (thanks InsaneHero) 2014-10-20 14:28:09 +01:00
photonstorm
d70406588c Filter.update now caches the previous pointer position to avoid flooding the uniform. Also the mouse uniform is now a value between 0 and 1 depending on the position within the game view. 2014-10-17 19:29:50 +01:00
photonstorm
f0b7670506 Fixed an issue where audio files with query strings after them would fail the canPlayAudio checks (thanks Vithar) 2014-10-17 18:50:12 +01:00
photonstorm
52f1663642 Fixed the Filter mouse uniform value population. 2014-10-17 16:52:28 +01:00
photonstorm
4f1ba99120 BitmapData.getFirstPixel will scan the BitmapData and return the color and location of the first non-transparent pixel encountered. You can specify one of 4 scan directions: top to bottom, bottom to top, left to right and right to left.
BitmapData.getBounds will return a `Rectangle` object that encompasses the full extent of the non-transparent pixels in the BitmapData. This can be useful if you wish to trim away transparent pixels from the sides of a BitmapData down to size before saving.
2014-10-17 16:51:50 +01:00
photonstorm
fbfb107146 JSDoc fixes in the Rope class (thanks @Rovanion) 2014-10-15 22:05:38 +01:00
photonstorm
2657de0daa Sound.fadeTo allows you to fade the Sound to the given volume over the duration specified (thanks @nickryall #1225) 2014-10-15 21:48:00 +01:00
photonstorm
db68dd2780 docs update. 2014-10-15 21:39:33 +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
photonstorm
4ac162216a readme updates. 2014-10-14 01:10:26 +01:00
photonstorm
3997a7c372 Time.prevTime is a new property that contains the raw value of the game timer from the previous update.
Timer.timeCap has been changed from `1000` to `1 / 60 * 1000` to bring it in line with Time.timeCap.
2014-10-13 16:18:42 +01:00
photonstorm
5d84f38f6e Device.canPlayAudio now supports the opus files directly, as well as opus encoded audio stored in ogg containers (#1232) 2014-10-13 13:52:41 +01:00
photonstorm
ac27f12c95 Fixes for Pixi update WebGL UV calls. 2014-10-11 04:18:42 +01:00
photonstorm
163a6c46f3 Updated to Pixi 2.0.0-dev. 2014-10-10 20:36:04 +01:00
photonstorm
022d7094d5 jsdoc fixes and frameRate change. 2014-10-10 14:49:01 +01:00
photonstorm
bee0e73748 Preparing for 2.1.3 dev. 2014-10-09 16:32:31 +01:00
photonstorm
9f24c08216 Updated readme and docs. 2014-10-09 16:12:53 +01:00
photonstorm
506a091257 Sound.allowMultiple allows you to have multiple instances of a single Sound playing at once. This is only useful when running under Web Audio, and we recommend you implement a local pooling system to not flood the sound channels. But it allows for one Sound object to play overlapping times, useful for gun effects and similar (#1220) 2014-10-09 14:44:25 +01:00
photonstorm
a2a60f207f Updated readme and TS defs. 2014-10-09 14:16:24 +01:00
photonstorm
94b6c01f31 readme updates. 2014-10-09 14:16:23 +01:00
photonstorm
b00866cee9 AnimationManager.name will now return the name property of the currently playing animation, if any. 2014-10-09 14:06:13 +01:00
Richard Davey
5dbe6b6017 The Uint32Array check used in Utils was incorrectly replacing Uint32Array on Safari, causing errors like BitmapData.getPixel32 to fail and other related issues (fixes #1043 and #1197) 2014-10-05 12:35:40 +01:00
photonstorm
ab78710daa BitmapData.textureLine takes a Phaser.Line object and an image in the image cache. It then accurately draws the image as a repeating texture for the full length of the line. 2014-10-03 02:21:09 +01:00
photonstorm
173786c60d Color.createColor now populates the color property of the returned object with the results of Phaser.Color.getColor.
Color.createColor now has a `color32` property with the results of `Phaser.Color.getColor32`.
Color.hexToColor has been optimised to inline the regex and has moved the createColor call so it now populates the color object fully, not just setting the r,g,b properties.
2014-10-01 16:51:34 +01:00
photonstorm
2794d94b08 Color.createColor now populates the color objects color and color32 properties with the results of Phaser.Color.getColor and getColor32 respectively. 2014-10-01 15:19:57 +01: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
26f9e05dca BitmapData.shadow(color, blur, x, y) provides a quick way to set all the relevant shadow settings, which are then be used in future draw calls. 2014-09-30 22:50:08 +01:00
photonstorm
ef85b8415d If you pass a tinted Sprite to BitmapData.draw or BitmapData.copy it will now draw the tinted version of the Sprite to the BitmapData and not the original texture. 2014-09-30 21:07:57 +01:00
photonstorm
c195998a1e Color.webToColor restored. Converts a CSS rgba color into a native color value. 2014-09-30 01:44:33 +01:00
photonstorm
ecfed2b311 AnimationParser is now using value instead of nodeValue when parsing atlas XML files, avoiding Chrome deprecation warnings (thanks @valtterip #1189) 2014-09-29 22:52:09 +01:00
photonstorm
ccc4e42e03 A Timer with a delay value that was a float and not an integer would not loop correctly. Timer delay values are now passed through Math.round to avoid this (thanks @osmanzeki #1196) 2014-09-29 22:15:41 +01:00
Richard Davey
acba9c4e14 Updated TypeScript defs. 2014-09-29 12:14:02 +01:00
photonstorm
415c7fe578 Added the sourceRect and maskRect parameters back into BitmapData.alphaMask as they were accidentally removed in 2.1 (thanks seejay92) 2014-09-25 15:30:03 +01:00
photonstorm
7f196a01e7 Text.addColor allows you to set specific colors within the Text. It works by taking a color value, which is a typical HTML string such as #ff0000 or rgb(255,0,0) and a position. The position value is the index of the character in the Text string to start applying this color to. Once set the color remains in use until either another color or the end of the string is encountered. For example if the Text was Photon Storm and you did Text.addColor('#ffff00', 6) it would color in the word Storm in yellow.
Text.clearColors resets any previously set colors from `Text.addColor`.
2014-09-24 17:10:02 +01:00
photonstorm
9e29a58d89 Sound.fadeOut(duration) will fade the Sound to a volume of zero over the duration given. At the end of the fade the Sound will be stopped and Sound.onFadeComplete dispatched.
Sound.fadeIn(duration, loop) will start the Sound playing, or restart it if already playing, set its volume to zero and then increase the volume over the duration given until it reaches 1. At the end of the fade the Sound.onFadeComplete event is dispatched.
2014-09-24 06:51:39 +01:00
photonstorm
dd74e3b0b4 Changing any of the Text properties such as font, lineSpacing and fontSize on a Text object that wasn't already on the display list would cause an updateTransform error. Parent is now checked first in all setters. 2014-09-24 01:10:36 +01:00
Richard Davey
abe6f5ace2 Point.parse updated to allow either/or x/y setting and default values.
Point.parse will return a new Point object based on the x and y properties of the object given to Point.parse (thanks @codevinsky #1198)
2014-09-23 22:23:01 +01:00
Richard Davey
01fd3df434 AudioSprite support is now built into the Loader and SoundManager. AudioSprites are like sprite sheets, only they consist of a selection of audio files and markers in a json configuration. You can find more details at https://github.com/tonistiigi/audiosprite (thanks @codevinsky #1205)
Fixed AudioSprite jsdoc, casing and formatting issues.
2014-09-23 22:15:09 +01:00
Richard Davey
0c4d4cd7e1 readme update. 2014-09-19 15:22:33 +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
597b828d7a StateManager.boot would call start on a State twice if it was added to the game and started before the DOM load had completed. This didn't cause an error but was duplicating function calls needlessly. 2014-09-18 05:14:44 +01:00
photonstorm
d68ed61999 If you called StateManager.start from within a states init method which also had a preload method it would fail to start the next State. 2014-09-18 05:11:58 +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
fc6b7dd36c StateManager.unlink will null all State-level Phaser properties, such as game, add, etc. Useful if you never need to return to the State again. 2014-09-15 13:19:01 +01:00
photonstorm
60acef2f97 If Game Objects change their frame, such as with an animated Sprite, and the change goes from a previously trimmed frame to a non-trimmed (full size) one, then the previous trim values were still left active, causing it to glitch (thanks stupot) 2014-09-11 20:56:01 +01:00
photonstorm
e5cac96302 Preparing for 2.1.2 2014-09-11 12:02:20 +01:00
photonstorm
5b922be56e Version 2.1.1. of Phaser is an emergency point release. It addresses a potential race condition that could happen in States that tried to change state from the create method but had an empty preloader or pre-cached assets. 2014-09-11 10:38:40 +01:00
photonstorm
a1a0861070 readme update + screen shot 2014-09-11 10:38:38 +01:00
photonstorm
b801630d78 Preparing for 2.1.1 development. 2014-09-09 16:50:23 +01:00
photonstorm
33d9b19e29 The Debug canvas is now cleared on State swap. 2014-09-09 15:28:58 +01:00
photonstorm
133ffd5fd1 2.1.0 docs updates. 2014-09-09 14:47:30 +01:00
photonstorm
1f089d74c5 Phaser.Easing.Default is a new property that is used when a specific type of ease isn't given. It defaults to Linear.None but can be overridden to anything (thanks @alvinsight) 2014-09-09 14:01:49 +01:00
photonstorm
c40c140631 Camera.roundPx is a new boolean. If set to true it will call view.floor as part of its update loop, keeping its boundary to integer values. Set to false to disable this from happening (#1141) 2014-09-09 12:47:27 +01:00
photonstorm
79d873f47b If you are using CocoonJS, please set your game render type to CANVAS and not WEBGL or AUTO. You should also disable any of the ScaleManager screen resizing or margin setting code. By default in this mode CocoonJS will now set 'screencanvas=true' which helps with performance significantly. 2014-09-08 22:34:53 +01:00
photonstorm
282db76351 Readme update. 2014-09-08 22:34:53 +01:00
photonstorm
df16970bcc Readme update. 2014-09-08 22:34:53 +01:00
photonstorm
59f7c53019 P2.Body.addCapsule didn't use to pass the radius value through pxm, but now does so you have to specify it in pixels, not meters. 2014-09-08 22:34:53 +01:00
photonstorm
4903e47a98 Rectangle.topRight returns a Point object that represents the top-right coordinate of the Rectangle. 2014-09-05 15:45:47 +01:00
photonstorm
0af4ec4da2 The StateManager will now check if a State has a method called resize. If it does, and if the game is running in the RESIZE Scale Mode then this method will be called whenever the game resizes. It will be passed two parameters: width and height that will match the games new dimensions. Resizing can happen as a result of either the parent container changing shape, or the browser window resizing. 2014-09-05 06:22:10 +01:00
photonstorm
f2a8a927f9 Group.addMultiple allows you to pass an array of game objects and they'll all be added to the Group in turn. 2014-09-05 06:01:25 +01:00
photonstorm
cb14fd1c01 Rectangle.centerOn(x,y) allows you to quickly center a Rectangle on the given coordinates. 2014-09-05 04:13:21 +01:00
photonstorm
d5ffe1f971 Phaser.Mouse will now add a listener to the window to detect mouseup events. This is used to detect if the player releases the mouse while outside of the game canvas. Previously Pointer objects incorrectly thought they were still pressed when you returned the mouse over the canvas (#1167) 2014-09-04 23:29:43 +01:00
Richard Davey
7ee1564f2e Signal.removeAll would ignore the context parameter and remove all bindings regardless (thanks @alect #1168) 2014-09-04 22:24:47 +01:00
Richard Davey
55400ce988 World.createDistanceConstraint signature changed to include new local anchors (thanks @rhmoller #1169) 2014-09-04 22:22:10 +01:00
photonstorm
9aaa8d80ca jsdocs, fixes to load, draw, copy and addToWorld. 2014-09-04 05:05:30 +01:00
photonstorm
7d9a4f4100 Phaser.Text wouldn't render the text to its local canvas if you passed the text on the constructor and didn't add it to the display list. If a string is given it now updates the local canvas on creation. 2014-09-04 02:18:12 +01:00
Richard Davey
0d486aa949 Updated the road map. 2014-09-03 23:01:24 +01:00
Richard Davey
168ce82fe8 Rectangle.bottom setter swapped the order of the calculation (thanks @JakeCoxon #1165) 2014-09-03 22:42:24 +01:00
Richard Davey
fe0c03d5d7 Phaser.Text.destroy will now destroy the base texture by default (#1162) 2014-09-03 22:34:10 +01:00
Richard Davey
42f19f4978 Phaser.Canvas.setImageRenderingCrisp now sets image-rendering: pixelated, perfect for pixel art and which is now supported in Chrome 38. 2014-09-03 22:16:03 +01:00
photonstorm
15e6edc56b BitmapData.copy no longer creates any temporary variables. It also accurately copies over Sprite/Image values before drawing them.
Creation now defaults to a texture size of 256x256.
2014-09-03 12:53:07 +01:00
photonstorm
1f84024a3e Cache.getImage now returns null if no image was found. 2014-09-03 11:11:48 +01:00
photonstorm
8bc5ba8d7d Tween.generateData would skip the end values in the data array. They are now included as the object in the final array element. 2014-09-02 15:45:52 +01:00
photonstorm
865c6878bf P2.World.getSprings used to return an empty array, but now returns all the Springs in the world (#1134) 2014-09-02 15:06:43 +01:00
photonstorm
d26f937f1c RetroFont has a new property called frameData which contains the Frame objects for each of the letters in the font, which can be used by Sprites. 2014-09-02 00:41:53 +01:00
Richard Davey
152335ff46 docs update. 2014-09-01 21:33:29 +01:00
Carlos Martinez
a869939bc3 Merge branch 'master' of https://github.com/photonstorm/phaser into dev 2014-09-01 14:20:15 +01:00
photonstorm
070e33f1e7 ArcadePhysics.overlap has been updated so that the Body.overlapX/Y properties are set to the amount the two bodies overlapped by. Previously they were zero and only populated during the separation phase, but now the data is available for just overlap checks as well. You can then use these values in your ovrelap callback as required - note that they are changed for every check, so a Sprite overlap tested against 10 other sprites will have the overlapX/Y values updated 10 times in a single collision pass, so you can only safely use the values in the callback (#641) 2014-09-01 03:54:55 +01:00
photonstorm
7fc37751b2 ScaleManager.orientationSprite has been removed because it never displayed correctly anyway (it would be distorted by the game scale), it will be bought back in a future version by way of a custom orientation state. 2014-09-01 03:30:02 +01:00
photonstorm
8fec5169f0 Added Sound._muteVolume which stops Firefox and IE9 crashing if you try to unmute a sound that hasn't yet been muted, which can also happen as a result of a game visibility change (thanks @osmanzeki #1108 #1123) 2014-09-01 03:13:05 +01:00
photonstorm
80d1df4705 ScaleManager.setMinMax(minWidth, minHeight, maxWidth, maxHeight) is a handy function to allow you to set all the min/max dimensions in one call. 2014-09-01 03:07:17 +01:00
photonstorm
fe9dbd15e5 The World bounds can now be set to any size, including smaller than the game dimensions. Before it was locked to a minimum size of the game canvas, but it can now be anything. 2014-09-01 02:41:07 +01:00
photonstorm
1a60d641b1 Canvas.removeFromDOM(canvas) will remove a canvas element from the DOM.
Game.destroy now removes the games canvas element from the DOM.
2014-09-01 02:38:21 +01:00
photonstorm
97d771c4e8 ScaleManager has a new scaleMode called RESIZE which will tell Phaser to track the size of the parent container (either a dom element or the browser window if none given) and set the canvas size to match it. If the parent changes size the canvas will resize as well, keeping a 1:1 pixel ratio. There is also a new ScaleManager.setResizeCallback method which will let you define your own function to handle resize events from the game, such as re-positioning sprites for a fluid responsive layout (#642)
The width and height given to the Phaser.Game constructor can now be numbers or strings in which case the value is treated as a percentage. For example a value of "100%" for the width and height will tell Phaser to size the game to match the parent container dimensions exactly (or the browser window if no parent is given). Equally a size of "50%" would tell it to be half the size of the parent. The values are retained even through resize events, allowing it to maintain a percentage size based on the parent even as it updates.
2014-09-01 01:52:04 +01:00
photonstorm
5fb8c7eb85 ScaleManager window.resize handler would constantly dispatch enterPortrait and enterLandscape events on window resizing, regardless if it actually entered that orientation or not.
Stage.offset has been moved to ScaleManager.offset
Stage.bounds has been removed, you can access it via Stage.getBounds.
Stage.checkOffsetInterval has been moved to ScaleManager.trackParentInterval
ScaleManager.hasResized signal has been removed. Use ScaleManager.setResizeCallback instead.
2014-09-01 01:02:48 +01:00
photonstorm
e3f11d5aba change log update. 2014-08-31 00:21:47 +01:00
photonstorm
92386221e4 Tile.setCollision now adjusts the tiles interesting faces list as well, this allows you to create one-way jump tiles without using custom callbacks on a specific tile basis (thanks @RafaelOliveira #886) 2014-08-29 18:03:32 +01:00
photonstorm
5546e5903c Tiled polylines are now imported into the map objects property as well as map collision (#1117) 2014-08-29 16:56:30 +01:00
photonstorm
0284d0b98c If Time.elapsed was > Time.timeCap it would reset the elapsed value to be 1 / 60. It's now set to Time.timeCap and Time.timeCap defaults to 1 / 60 * 1000 as it's a ms value (thanks @casensiom #899) 2014-08-29 16:37:57 +01:00