Commit graph

184 commits

Author SHA1 Message Date
photonstorm
915a757f96 Text.updateText will now check the width and height values of the Text canvas and if either are zero it sets Text.renderable = false to avoid throwing WebGL texture binding errors. 2015-07-22 12:43:43 +01: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
fc1e0de790 Merge pull request #1923 from mkristo/pixi-patch
Make PIXI available for Phaser when using require
2015-07-21 16:14:09 +01:00
photonstorm
7144b10ad5 TileSprites fixed for WebGL. 2015-07-21 13:24:12 +01:00
Markus Kristo
6d742155bf Make sure PIXI is available when using require for phaser builds
This is a hackish solution, and would not be needed if Phaser used require and a JS bundler like webpack
2015-07-21 10:55:54 +02:00
Richard Davey
f552615982 Fixed RenderTexture in WebGL. 2015-07-16 02:27:07 +01:00
Richard Davey
1c9fb614a4 PIXI._CompileShader can now take an array or a string for the fragment src. 2015-07-15 23:20:39 +01:00
Richard Davey
44c650f6e7 PIXI.DisplayObject.updateTransform now nulls the _currentBounds property (thanks @gaufqwi #1906) 2015-07-12 12:01:38 +01:00
photonstorm
45f06bd01c Fixed #1866 2015-07-09 16:41:53 +01:00
photonstorm
87ac0b8f50 jsdoc tweak. 2015-07-08 16:40:40 +01:00
photonstorm
29f9eeabc6 RenderTexture now takes the display objects alpha into consideration when rendering it, before it would always reset worldAlpha to 1 before rendering, thus ignoring any alpha that may be set. 2015-07-02 13:28:44 +01:00
photonstorm
a69c156526 The Text Bounds is a rectangular region that allows you to align your text within it, regardless of the number of lines of text or position within the world. For example in an 800x600 sized game if you set the textBounds to be 0,0,800,600 and text alignment to 'left' and vertical alignment to 'bottom' then the text will render in the bottom-right hand corner of the game, regardless of the size of font you're using or the number of lines in the text itself.
Set the Style properties `boundsAlignH` and `boundsAlignV` or adjust them via the Text setters to change the alignment.

It works by calculating the final position based on the Text.canvas size, which is modified as the text is updated. Some fonts have additional padding around them which you can mitigate by tweaking the Text.padding property.

Setting a textBounds _doesn't_ update the wordWrapWidth, so be aware of the relationship between the two.

Call this method with nothing defined for any of the parameters to reset an existing textBounds.

#1824
2015-06-17 17:18:04 +01:00
photonstorm
0258245f12 Phaser.Text no longer extends PIXI.Text but replaces it entirely. Phaser.Text now natively extends a Phaser Sprite, meaning it can be enabled for physics, damaged, etc. 2015-06-17 13:21:28 +01:00
photonstorm
cf83f51315 Added textureDebug boolean - allows you to visually debug the generated texture a TilingSprite creates. 2015-06-16 18:31:39 +01:00
photonstorm
b481402ae4 Due to a Pixi 2 issue TileSprite when running under WebGL didn't respect the world alpha setting and would only work with its own alpha (thanks @hanenbro #1774) 2015-06-16 17:03:19 +01:00
photonstorm
c0c3fef420 jsdocs update. 2015-06-16 14:16:04 +01:00
Richard Davey
660ab8510c Merge pull request #1833 from danxexe/fix-drawcircle-docstring
Fix docstring of drawCircle
2015-06-04 04:23:45 +01:00
DanX
860d2e9538 Fix docstring of drawCircle 2015-06-03 13:41:42 -03:00
photonstorm
52b1b499a8 Removed un-needed Pixi file. 2015-06-03 05:28:24 +01:00
photonstorm
17648b74db Complete refactoring of PIXI.updateText - now properly respects the maxWidth setting regardless of kerning or font scale. 2015-06-03 05:28:23 +01:00
photonstorm
cc5740af10 BitmapText line spacing and word wrapping has been vastly improved and bought in-line with how Pixi 3 handles it, but with additional anchor support. 2015-05-31 01:31:11 +01:00
photonstorm
1e2940a6a4 PIXI.Graphics was calling Polygon.flatten in its drawShape call, causing the original Polygon object to internally change. It now takes a clone of the polygon and only flattens that (#1779) 2015-05-19 14:53:32 +01:00
photonstorm
9b95026cc9 Removed ConvertTintToImage as the Image object it created was never returned or used anywhere, so pointless having.
Optimised the canvas creation - before it was creating a new canvas every time it tinted a sprite.
Removed un-used tint method (tint with overlay)
Optimised tintWithMultiply.
2015-05-08 04:14:56 +01:00
photonstorm
8e6f9574ea Heavily tweaked tint texture handling. Can now be set by a texture and cached internally. 2015-05-08 04:13:34 +01:00
photonstorm
2cd59bbf32 Tidying up docs and formatting. 2015-05-08 04:12:07 +01:00
photonstorm
6f351ff0c1 Texture.requiresReTint is a new property that controls if a texture requires the display object to be re-tinted having been updated internally. The LoadTexture component now sets this. 2015-05-08 04:11:48 +01:00
photonstorm
9cb7122743 Improved code formatting. 2015-05-08 01:51:06 +01:00
photonstorm
12362a8300 Mark new textures as valid. 2015-05-07 02:44:29 +01:00
photonstorm
7674060afc Removed PIXI.EventListener and VideoTexture as it's no longer required. 2015-05-06 01:59:49 +01:00
photonstorm
df6dc70a41 Various VideoTexture tests (this file will be removed shortly however). 2015-05-05 14:02:38 +01:00
photonstorm
a686f6e212 PIXI.DisplayObject.worldPosition contains the position of the DisplayObject (and therefore any object that inherits from it, such as Phaser.Sprite) taking into account all transforms in the display list. It is updated at the end of DisplayObject.updateTransform. DisplayObject.position reflects only the position applied to the object directly, whereas worldPosition includes the positions that may have been applied to its ancestors.
PIXI.DisplayObject.worldScale contains the scale of the DisplayObject (and therefore any object that inherits from it, such as Phaser.Sprite) taking into account all transforms in the display list. It is updated at the end of `DisplayObject.updateTransform`. DisplayObject.scale reflects only the scale applied to the object directly, whereas worldScale includes any scales that may have been applied to its ancestors.

PIXI.DisplayObject.worldRotation contains the rotation of the DisplayObject (and therefore any object that inherits from it, such as Phaser.Sprite) taking into account all transforms in the display list. It is updated at the end of `DisplayObject.updateTransform`. DisplayObject.rotation reflects only the rotation applied to the object directly, whereas worldRotation includes any rotations that may have been applied to its ancestors.
2015-05-03 13:53:03 +01:00
photonstorm
df3c684760 PIXI.BaseTexture.forceLoaded allows you to set a BaseTexture as loaded, with the given width and height. It then calls BaseTexture.dirty. This is important for when you don't want to modify the shape of the source object by forcing in complete or dimension properties it may not naturally have, but still wish to use it as a base texture. 2015-05-03 13:53:02 +01:00
photonstorm
3f51463c7b PIXI.CanvasTinter.tintWithMultiply was performing a double drawImage operation for no reason. Simplified down to a single drawImage call. 2015-05-03 13:53:02 +01:00
photonstorm
e291f6d590 Added type parameter to VideoTexture.fromUrl allowing you to define the mime-type of the video file, which is required for Firefox and Safari in most cases. 2015-04-29 14:41:47 +01:00
photonstorm
c461c26393 Added onUpdate signal. 2015-04-27 16:22:36 +01:00
photonstorm
5d680ce4d4 pause not stop. 2015-04-27 16:22:35 +01:00
photonstorm
214e8abcda Added play and stop methods and related signals. 2015-04-23 02:35:27 +01:00
Richard Davey
fa5ed16f7d Trying something out :) 2015-04-22 04:22:17 +01:00
Richard Davey
be65b08e3b Close to getting WebGL Tiling Sprites back again - animations now work too, but the placement isn't quite right. 2015-04-22 01:36:12 +01:00
photonstorm
aa9ea30e79 Working through fixing TilingSprites for WebGL. 2015-04-21 17:01:24 +01:00
photonstorm
04e7be38bf Heavily refactored. Vastly optimised generateTexture method. Canvas renderer now works correctly with animated sprites, texture atlases and trimmed sprites. Warning: Currently breaks WebGL rendering. Will fix soon. 2015-04-21 15:57:17 +01:00
photonstorm
8fb5a89e1f Added video alias. 2015-04-21 05:11:31 +01:00
photonstorm
8981e9603e Removed Frame.uuid and updating TileSprite to work with animated sprites. 2015-04-21 05:11:19 +01:00
photonstorm
a5c14befa7 Formatting. 2015-04-17 19:56:14 +01:00
photonstorm
21de1e7c09 Added delayed load event handling back in. 2015-04-17 19:55:53 +01:00
photonstorm
97bc582f8d Added VideoTexture support back in and fixed various load related issues. 2015-04-17 19:55:30 +01:00
photonstorm
b196e4f17e Enabled PIXI.VideoTexture support. 2015-04-17 17:36:20 +01:00
photonstorm
2e2ba665cd PIXI.DisplayObject.updateTransform has a new optional parameter parent. If the DisplayObject doesn't have a parent (i.e. it isn't on the display list yet) then in the past updateTransform would fail. This meant you couldn't do things like scale or rotate a Sprite and then draw it to a RenderTexture or BitmapData, as calls to updateTransform would be ignored. The new checks now look to see if the parent parameter is set. If so this takes priority over the actual parent and is used to modify the transform (note that it **doesn't** reparent the DisplayObject, it merely uses it for the transform.) If there is no parent (explicitly or via the parameter) then it falls back to use Phaser.World as the parent. If it can't reach that then no transform takes place. 2015-04-17 03:22:23 +01:00
photonstorm
3a61fa35f0 RenderTexture.render now takes a Matrix as its second parameter, not a Point object. This brings it in line with Pixi and allows you to perform much more complex transformations on the object being rendered. If you need to replicate the old behavior please use RenderTexture.renderXY(sprite, point.x, point.y) instead.
RenderTexture.render and `renderXY` would ignore the Sprites rotation or scale. The full Sprite transform is now used correctly when the Sprite is drawn to the texture. If you wish to replicate the old behavior please use `RenderTexture.renderRawXY` instead.

RenderTexture.matrix has been removed as it's no longer used.

Fixed bug in Pixi where RenderTexture.render would ignore the given matrix.

Fixed a bug in Pixi where drawing a Sprite to a RenderTexture would reset the Sprites transform to an identity Matrix.
2015-04-17 03:22:07 +01:00
photonstorm
cdfc4ff45b Pixi.Sprite.renderCanvas and renderWebGL now has a new optional matrix parameter. You can use this to render the Sprite with an alternative transform matrix without actually adjusting the Sprite matrix at all. 2015-04-17 03:20:44 +01:00