Commit graph

1009 commits

Author SHA1 Message Date
Felipe Alfonso
40262eb0cb Merge branch 'master' into rendering-cleanup 2018-01-12 12:42:45 -03:00
Richard Davey
718859b02e Moved the depth sorting functions into the DisplayList class, as it's really the one responsible for it, not System. 2018-01-11 13:59:06 +00:00
Michael Hadley
fdc1af0cd2 Install isTilemap prop used by physics system for fast type checking 2018-01-10 20:45:28 -06:00
Felipe Alfonso
8e66cf9f98 Merge branch 'master' into rendering-cleanup 2018-01-10 17:05:32 -03:00
Felipe Alfonso
54274b782a BlitterBatch pipeline working 2018-01-10 17:03:01 -03:00
Hal Helms
89e4289c9d
Fix WeightedRandomize.js 2018-01-09 22:26:02 -08:00
Hal Helms
42ad0ac399
Add semicolons to WeightedRandomize 2018-01-09 22:24:56 -08:00
Hal Helms
302eba15d9
Update WeightedRandomize docs for index arrays 2018-01-09 22:09:28 -08:00
Hal Helms
e128733f02
Update WeightedRandomize() to support index arrays 2018-01-09 22:05:34 -08:00
Richard Davey
d8f1ba03e9 Moved repository location 2018-01-09 21:43:56 +00:00
Richard Davey
0d90f75b5f Splitting the dev branch up into versions. 2016-11-22 01:36:56 +00:00
Richard Davey
7a155f66fe Added Tilemap back in and tested with Blitter object, and it works really fast. 2016-11-15 03:11:21 +00:00
Richard Davey
346fbc2cbd Blitter + Bob now rendering and updating fully. 2016-11-15 01:57:42 +00:00
Richard Davey
e150efea1f Added Blitter Game Object, for fast drawing of texture frames, with single level transforms. 2016-11-14 23:38:41 +00:00
photonstorm
fa3905c8c7 Containers added themselves to States properly. 2016-11-10 17:04:29 +00:00
photonstorm
38868d6ecf Fixed Pixel Field. 2016-11-09 15:33:42 +00:00
photonstorm
7a35f68ddc MainLoop rendering interpolation done. 2016-11-09 12:25:26 +00:00
Richard Davey
48f90fec34 Implemented a State based MainLoop system, with fully split logic / render cycles and frame rate. Each State can now set its own frame rate. Added in more Camera commands, moved the Tween Manager into the State Systems, and started work on the new heavily reduced Game object. 2016-11-08 01:50:57 +00:00
Richard Davey
4b42972a9b Comment out some parts that don't work yet. 2016-11-07 00:33:42 +00:00
Richard Davey
d568d2bede Moved _sys to a StateSystems class to keep things much cleaner, and avoid setter inheritance mess. 2016-11-06 12:18:08 +00:00
Richard Davey
268e40ea7e Add to 'state' by default now. 2016-11-03 22:26:39 +00:00
Richard Davey
a15747203e Moved boot into Game, and added State property. 2016-11-03 22:26:16 +00:00
Richard Davey
6e284cf4f9 Removed test code. 2016-11-01 01:19:32 +00:00
Richard Davey
03b651f79f Loads of tweaks re: Transform inheritance. 2016-11-01 00:31:45 +00:00
Richard Davey
8e2c5b7669 Removed dead code. 2016-10-31 00:03:57 +00:00
Richard Davey
c27b2f9fca Changed batch limits. Currently running 20,000 pixels in 1 draw call. 2016-10-30 23:59:47 +00:00
Richard Davey
c4a79bfadc Pixel Batch rendering working, and passing through properly. 2016-10-30 23:40:18 +00:00
Richard Davey
bd80999b33 Refined the Image and WebGL Renderers. 2016-10-30 22:58:14 +00:00
Richard Davey
a55df3f143 Added in the Pixel Field batch processor and start of the Game Object. 2016-10-30 22:57:50 +00:00
Richard Davey
577b81580a New batch system working. 2016-10-30 14:57:38 +00:00
Richard Davey
f1760f961d Working through splitting the Batch shader out of the manager, and into its own class. Got multi-shader swapping working. 2016-10-28 02:42:58 +01:00
Richard Davey
2b850ad4e8 Setting the anchor dirties the Transform. 2016-10-27 15:14:09 +01:00
photonstorm
fd3898742f Added ability to toggle multi-texture support at run-time. 2016-10-25 16:44:23 +01:00
photonstorm
8de992175e Renamed Renderer spriteBatch to just batch. 2016-10-25 14:30:29 +01:00
Richard Davey
120b6eb2bd Blend Modes work. More optimisations in the batch manager. 2016-10-25 03:57:34 +01:00
Richard Davey
4c6691863c Fixed Multi Texture support in the new batch manager. 2016-10-25 00:41:45 +01:00
photonstorm
2af81bdfba Masses of refactoring in BatchManager, making it as compact and fast as possible. 2016-10-24 17:14:10 +01:00
Richard Davey
3cb806c86e New addVerts method working. 2016-10-23 11:25:44 +01:00
photonstorm
64cd88f7b4 Trying out flash effect. 2016-10-19 17:17:26 +01:00
photonstorm
f1e8396b6f Tidying up. 2016-10-19 14:30:43 +01:00
photonstorm
0a659bcf67 No longer needed. 2016-10-19 14:29:38 +01:00
photonstorm
fb3bb4b32f Refactored into new Base Game Object class, that Image and Sprite (and everything else) will now extend. Much more versatile, and a lot less code duplication. 2016-10-19 11:54:00 +01:00
Richard Davey
5273799912 Added Color component to Stage and Image.
Added tint support into the Batch Manager.
2016-10-19 02:21:20 +01:00
photonstorm
18b12dfc3e Huge amount of work getting the WebGL renderer sorted out, tidied up and merged with the latest Texture and Transform components. 2016-10-18 17:03:25 +01:00
photonstorm
3020e3b8cf Updating core objects. 2016-10-14 08:59:24 +01:00
photonstorm
bfd391b251 Using Color component. 2016-10-14 08:58:26 +01:00
photonstorm
f9ffe098c3 Check the worldAlpha when rendering. 2016-10-14 06:32:03 +01:00
photonstorm
386e22b0fd Commented out all the bg color stuff. It now just changes the canvas CSS. 2016-10-14 06:31:26 +01:00
photonstorm
9961eeee6b Added worldAlpha property. 2016-10-14 06:31:01 +01:00
photonstorm
582d705b1f Updated base game objects. 2016-10-14 04:09:22 +01:00
photonstorm
ff2caeeb1c Some quick Image tests (will need to move to Sprite soon) 2016-10-14 02:21:21 +01:00
photonstorm
c5088d4ba6 Updated Factory to add to parent. 2016-10-14 02:21:04 +01:00
photonstorm
f6903df104 Stage now extends Container. 2016-10-14 02:20:01 +01:00
photonstorm
680ce51842 Updated Container methods, renamed renderers, added Factory. 2016-10-14 02:19:35 +01:00
Richard Davey
483c3eb34b Updated to work with new Image properties. 2016-10-13 01:54:40 +01:00
Richard Davey
559126d7b5 Moved to using new Transform component, and adjusted other properties. 2016-10-13 01:54:18 +01:00
Richard Davey
72ee3c7a84 Updating Image game object to use the new Transform component. 2016-10-13 00:08:26 +01:00
photonstorm
9ed542781b Added the new Data Component. 2016-10-12 15:19:04 +01:00
photonstorm
ce3308ea1d Hooking the Loader and Cache into the new Texture Manager. 2016-10-11 14:52:17 +01:00
Richard Davey
3ac8c4fcc5 Tidied up the Children component. 2016-10-09 23:39:27 +01:00
Richard Davey
0af16817a5 Refactored GameObjects to GameObject. 2016-10-09 22:27:58 +01:00
Richard Davey
fb13151959 Start of the container. 2016-10-08 17:19:55 +01:00
Richard Davey
d137d3e989 Swapped over to using the new Factory. 2016-10-08 16:31:08 +01:00
Richard Davey
380e717e52 Finished off missing factories. Moved over the docs. Changed rogue @returns to @return everywhere. 2016-10-08 16:17:46 +01:00
Richard Davey
6d0dc5e003 Added BitmapText Factory. 2016-10-08 13:18:35 +01:00
Richard Davey
729020477a New Game Objects structure in place, and starting to take shape.
Moved BitmapData and RenderTexture into the textures folder for now.

All Game Objects now have their own sub-folder, with their Factory and renderer functions alongside them, plus any other files they need.

New Factory class added. Currently hooked into `game.factory` for testing, but will swap to `game.add` when complete.
2016-10-08 03:05:42 +01:00
Richard Davey
f9fe6a3e94 Fixed canvas SpriteBatch and removed duplicate render functions. 2016-10-07 03:41:48 +01:00
Richard Davey
5b4280d694 Removed the matrix. 2016-10-07 03:34:42 +01:00
Richard Davey
35fd29a45a Removed Pixi globals, and moved constructors above the prototype. 2016-10-07 03:32:37 +01:00
Richard Davey
0abf9d958d Updated scaleMode global. 2016-10-07 03:22:59 +01:00
Richard Davey
3fab1ce385 Working through the Pixi globals and removing them. 2016-10-07 03:21:39 +01:00
Richard Davey
f6047763fa Fixed Graphics rendering. 2016-10-07 02:53:34 +01:00
Richard Davey
ea9c9ae7b3 Removed gl texture ID. 2016-10-07 00:59:10 +01:00
Richard Davey
4cd0e833d5 Sorted out the mixin needed for the Canvas renderer. 2016-10-05 01:09:23 +01:00
Richard Davey
047a994334 Canvas and WebGL rendering Text again. 2016-10-04 22:47:05 +01:00
Richard Davey
28eb7a5f40 Adding in more renderer game objects. 2016-10-04 22:36:07 +01:00
Richard Davey
d55cc215ee Moving more rendering functionality over. 2016-10-04 00:58:52 +01:00
photonstorm
1da95994a5 First pass of the newly re-structured Canvas Renderer (still using old texture system though). 2016-10-03 12:44:54 +01:00
Richard Davey
0aa6650422 Re-arranged methods and added parent. 2016-09-29 03:10:16 +01:00
Richard Davey
5cb7cc8e92 Start of the new Children component. 2016-09-29 02:29:56 +01:00
Richard Davey
6ce28658f6 PIXI.Float32Array, PIXI.Uint16Array, PIXI.Uint32Array and PIXI.ArrayBuffer have all been removed, and replaced with their own proper native versions. The polyfill now captures any instances where the browser needs to fall back to an Array instead. 2016-09-28 19:02:59 +01:00
photonstorm
c836d4bfbd PIXI.PI_2, PIXI.RAD_TO_DEG and PIXI.DEG_TO_RAD have all been removed, as they are no longer used internally, and are all available under Phaser.Math.
PIXI.VERSION has been removed, as it's no longer relevant and misleading.
2016-09-28 16:57:08 +01:00
photonstorm
f9a2c2a79e PIXI.Graphics and PIXI.GraphicsData have been removed, and all functionality merged in to Phaser.Graphics, to cut down on the number of internal classes and inheritance going on.
WebGLGraphics and CanvasGraphics have been updated so that it checks for Phaser Geometry shape types internally.
2016-09-28 16:42:33 +01:00
photonstorm
69db3632d6 PIXI.Rope and PIXI.Strip have been removed, and all functionality merged in to Phaser.Rope, to cut down on the number of internal classes and inheritance going on. 2016-09-28 15:10:43 +01:00
photonstorm
879bcffc88 Removed PIXI.Utils and remapped functions to their new locations. 2016-09-28 14:02:02 +01:00
photonstorm
1e15012a91 PIXI.CanvasPool has been moved into the Phaser utils folder, and renamed to Phaser.CanvasPool. All references to PIXI.CanvasPool have been updated to match the new namespace. 2016-09-28 12:53:04 +01:00
photonstorm
508e5ae723 PIXI.TilingSprite has been removed, and all functionality merged in to Phaser.TileSprite, to cut down on the number of internal classes and inheritance going on. 2016-09-28 11:57:11 +01:00
Richard Davey
2005c9d86d PIXI.RenderTexture has been removed, and all functionality merged in to Phaser.RenderTexture, to cut down on the number of internal classes and inheritance going on. 2016-09-28 01:40:29 +01:00
Richard Davey
1d7b54b7d4 Merged Sprite Batch updates. 2016-09-27 23:22:26 +01:00
Richard Davey
41ad0873d4 Fixing the Sprite Batch. 2016-09-27 23:20:38 +01:00
Richard Davey
2bc9c73838 The Video.playing property didn't check to see if the Video existed, and would throw the error Uncaught TypeError: Cannot read property 'paused' of null if you called it after destroying the video (thanks @Tetley #2740) 2016-09-26 23:35:41 +01:00
Richard Davey
0692bf01b5 If you called Video.changeSource, and then immediately called Video.play after it, it would fire the onComplete event twice (thanks @jaraiza #2543) 2016-09-26 23:28:41 +01:00
Richard Davey
f331697fee Text.splitRegExp is a new property that allows you to control the regular expression that is used to split the text into multiple lines (@dai-shi #1403) 2016-09-26 22:35:54 +01:00
Richard Davey
feb1b980c0 Text.width and Text.height now divide the result by the Text.resolution, to avoid incorrect dimensions on High DPI devices (thanks @mattahj #2146) 2016-09-26 22:22:31 +01:00
Richard Davey
3f4decd59e First pass at adding rotated atlas frame support in to the Canvas renderer. 2016-09-20 00:53:00 +01:00
photonstorm
a84021679b Tidied up how crop destroys itself. 2016-08-25 16:41:26 +01:00
photonstorm
94a0dbe547 Text.updateText now sets Text.dirty = false, which stops Text objects from having updateText called twice on them after creation. 2016-08-25 14:16:48 +01:00
Richard Davey
d8cb40aa5e Merge pull request #2700 from kjav/patch-2
Fixed typo in TileSprite.js comment
2016-08-25 13:04:31 +01:00
photonstorm
cbef6d6648 Formatting fix. 2016-08-22 18:38:40 +01:00
photonstorm
4382944a2e A tinted Texture in Canvas mode wouldn't be updated properly if it was also cropped, beyond the initial crop. Now a cropped texture will re-tint itself every time the crop is updated, and has changed (thanks @phoenixyjll #2688) 2016-08-18 15:55:13 +01:00
kjav
314b088975 Fixed typo in TileSprite.js comment
Changed typo 'etch' in TileSprite.js to 'etc'. Related to pull request #2699
2016-08-18 15:40:19 +01:00
Richard Davey
a4de55c419 Merge pull request #2685 from valent-novem/dev
Fix rendering text with bounds and resolution
2016-08-16 21:12:57 +01:00
Richard Davey
49e40fc2d4 Typo 2016-08-16 20:59:59 +01:00
Sergey Z
68fe8b8058 Fix rendering text with bounds and resolution 2016-08-08 16:51:07 +03:00
Richard Davey
a0c6ae6c51 Phaser.Image now has the ScaleMinMax component. 2016-08-03 05:00:09 +01:00
Richard Davey
ce764e098d As a result of changes in #2573 Graphics objects were calling updateLocalBounds on any shape change, which could cause dramatic performances drops in Graphics heavy situations (#2618). Graphics objects now have a new flag _boundsDirty which is used to detect if the bounds have been invalidated, i.e. by a Graphics being cleared or drawn to. If this is set to true then updateLocalBounds is called once in the postUpdate method (thanks @pengchuan #2618) 2016-07-23 12:52:35 +01:00
Richard Davey
b405570833 Docs fix #2624 2016-07-17 11:26:09 +01:00
Tomáš Blatný
2b90f2cb3b BitmapData.js: fixed fluent interface 2016-07-15 20:16:35 +02:00
Richard Davey
4548d70369 Experimenting with new MainLoop + position interpolation. (reverted from commit e49d45e278) 2016-07-13 02:44:35 +01:00
Richard Davey
e49d45e278 Experimenting with new MainLoop + position interpolation. 2016-07-12 03:05:29 +01:00
photonstorm
ee202667ed Huge docs update for all of the Game Object events. 2016-07-08 11:28:30 +01:00
Richard Davey
0014201917 Groups now have the following properties, which are getters and setters: centerX, centerY, left, right, top and bottom. These calculate the bounds of the Group, based on all visible children, and then allow you to apply positioning based on that. This means you can, for example, now get the horizontal center of a Group by called Group.centerX. These properties are also setters, so you can position the Groups, and it will take scale and rotation into consideration.
Groups have a new method `alignIn`. It allows you to align the Group within another Game Object, or a Rectangle. You can specify one of 9 positions which are the new position constants such as: `Phaser.TOP_LEFT` or `Phaser.CENTER` (see docs for the complete list). The Groups are positioned based on their child bounds, which takes rotation and scaling into consideration. You can easily place Groups into the corners of the screen, or game world, or align them within other Sprites, using this method.

Groups have a new method `alignTo`. It allows you to align a Group to the side of another Game Object, or a Rectangle. You can specify one of 11 positions which are the new position constants such as: `Phaser.TOP_LEFT` or `Phaser.LEFT_BOTTOM` (see docs for the complete list). The Groups are positioned based on their child bounds, which takes rotation and scaling into consideration. You can easily align Groups next to other Sprites using this method.
2016-07-08 01:33:42 +01:00
Richard Davey
c4d7870a31 * PIXI.Texture.fromImage, PIXI.BaseTexture.fromImage and PIXI.Sprite.fromImage have all been removed. They should never have actually been used, as they bypass the Phaser Loader, and don't factor in CORs or any other advanced loader settings.
* The PIXI.BaseTexture.imageUrl property has been removed, as it was never actually populated.
* The PIXI.BaseTexture._UID property has been removed, as it was never actually used internally.
* All references to PIXI.BaseTextureCache have been removed (primarily from BaseTexture.destroy and Texture.destroy), as the BaseTextureCache was never used internally by Phaser, or by our custom version of Pixi.
* PIXI.TextureCache has been removed. It was only ever used by the __default and __missing images that Phaser generates on start-up. It wasn't used internally by Phaser anywhere else, and the only references Pixi has to it have all been removed. If you need it in your own game, please refactor it to avoid it, or re-create the object on the PIXI global object.
* Canvases created by `BaseTexture.fromCanvas` no longer have the `_pixiId` property attached to them, as this was never used internally by Phaser or Pixi.
* PIXI.BaseTexture.updateSourceImage is now deprecated. Please use `Sprite.loadTexture` instead.
* The property PIXI.BaseTextureCacheIdGenerator has been removed, as it is no longer used internally by Phaser or Pixi.
* PIXI.Texture.addTextureToCache has been removed. The PIXI Texture Cache was never actually used by Phaser, and was leading to complications internally.
* PIXI.Texture.removeTextureFromCache has been removed. The PIXI Texture Cache was never actually used by Phaser, and was leading to complications internally.
* PIXI.Texture.fromFrame and PIXI.Sprite.fromFrame have been removed. They relied on the PIXI Texture Cache, which was never actually used by Phaser, and was never used internally by Pixi either.
* The property PIXI.TextureCacheIdGenerator has been removed, as it was not used internally.
* The property PIXI.FrameCache has been removed, as it was not used internally.
2016-07-06 21:47:27 +01:00
Richard Davey
33150018ad Text.fontPropertiesCanvas no longer uses a CanvasPool entry. 2016-07-06 20:59:28 +01:00
photonstorm
0036bf747f BitmapData has a new, optional, fifth argument: skipPool. By default BitmapData objects will ask for the first free canvas found in the CanvasPool, but this behavior can now be customized on a per object basis. 2016-07-04 12:57:08 +01:00
photonstorm
32bec66031 Docs update. 2016-06-29 16:18:54 +01:00
Richard Davey
a0c771d47e Text.setText has a new optional argument immediate which will re-create the texture immediately upon call, rather than wait for the next render pass to do so (thanks @Scraft #2594) 2016-06-27 22:42:01 +01:00
Richard Davey
8c5cea066a Updated docs. 2016-06-23 00:45:24 +01:00
photonstorm
bd30181a2a Docs update. 2016-06-20 12:18:39 +01:00
photonstorm
47f0224a40 Phaser 2.4.9 release. 2016-06-17 01:11:24 +01:00
photonstorm
9dd745167c Docs fix. 2016-06-16 17:18:49 +01:00
photonstorm
4da3b15ae2 Renamed alignTo to alignIn, and added the new method alignTo, to allow for Sprite to Sprite alignment. Updated all of the Bounds and TS defs. 2016-06-16 17:01:51 +01:00
photonstorm
5bcf84f5a4 Added offsetX and offsetY arguments to Bounds.alignTo. 2016-06-16 15:51:12 +01:00
Richard Davey
ed8fbd9a6c All Game Objects with the Bounds component; which includes Sprites, Images, Text, BitmapText, TileSprites and anything that extend these, now have a new method alignTo. It allows you to align the Game Object to another Game Object, or a Rectangle. You can specify one of 9 positions which are the new constants: Phaser.TOP_LEFT, Phaser.TOP_CENTER and so on (see above for the complete list). The Game Objects are positioned based on their Bounds, which takes rotation, scaling and anchor into consideration. You can easily place Sprites into the corners or the screen or game world, or align them against other Sprites, using this method. 2016-06-16 02:00:46 +01:00
Richard Davey
0efcf68b21 The Game Object Bounds component has been updated to include two new properties: centerX and centerY. This means you can, for example, now get the horizontal center of a Sprite by called Sprite.centerX. These properties are also setters, so you can position the Game Objects, and it will take scale and anchor into consideration. 2016-06-16 01:00:11 +01:00
Richard Davey
123e61c018 The Game Object Bounds component has been updated so that it now provides setters for all of the properties, as well as getters. Previously Sprite.left, Sprite.right, Sprite.top and Sprite.bottom were read-only, but they are now available to be set as well, and take into consideration the anchor and scale of the Game Objects. 2016-06-16 00:33:48 +01:00
photonstorm
bc00c900e9 BitmapData.smoothProperty is a new property that holds the string based prefix needed to set image scaling on the BitmapData context.
BitmapData.copyTransform allows you to draw a Game Object to the BitmapData, using its `worldTransform` property to control the location, scaling and rotation of the object. You can optionally provide

BitmapData.drawGroup now uses the new `copyTransform` method, to provide for far more accurate results. Previously nested Game Objects wouldn't render correctly, nor would Sprites added via `addChild` to another Sprite. BitmapText objects also rendered without rotation taken into account, and the Sprites smoothing property was ignored. All of these things are now covered by the new drawGroup method, which also handles full deep iteration down the display list.
2016-06-14 15:29:56 +01:00
photonstorm
fb3f7721cb Working through updating BitmapData.copy to use the source matrix instead, so it retains the correct draw sequence order. 2016-06-13 17:01:33 +01:00
Richard Davey
a180882d27 Fixed the data object not being created. 2016-06-06 00:31:46 +01:00
photonstorm
96711f4db9 Added the Weapon Plugin and worked lots on its docs. 2016-06-03 15:09:43 +01:00
Richard Davey
097add1aa6 Game Objects including Sprite, Image, Particle, TilemapLayer, Text, BitmapText and TileSprite have a new property called data. This is an empty Object that Phaser will never touch internally, but your own code, or Phaser Plugins, can store Game Object specific data within it. This allows you to associate data with a Game Object without having to pollute or change its class shape. 2016-06-03 01:08:32 +01:00
photonstorm
a81fe3cf02 jshint fixes. 2016-06-02 15:38:05 +01:00
photonstorm
21b5492e98 Video.onComplete wouldn't fire on iOS if the user hit the 'Done' button before the video had finished playing. It now uses the webkitendfullscreen event to detect this, and dispatches the onComplete signal should that event fire (thanks @kelu-smiley #2498) 2016-06-02 15:26:11 +01:00
Richard Davey
56cc7dc155 Merge pull request #2519 from TadejZupancic/patch-1
Fixing measurement of text width that produced too narrow canvas
2016-06-02 14:53:17 +01:00
TadejZupancic
317c85db90 Fixing measurement of text width that produced too narrow canvas
When using a style on characters (e.g. addColor), the length of the whole line with default style was measured ignoring the different width of the characters with added style. 

I've included the measureLine function, which does the same measurements as updateLine, but it does not render the line to canvas - it only returns the line length.

Now this function is used for measuring line of text if some style is added to it.
2016-06-02 11:10:40 +02:00
kevinleedrum
c1a2970488 Fixing issue #2496: Wrapped BitmapText not centering 2016-05-24 09:09:38 -04:00
photonstorm
a6a2c61240 Sprites that had a tint on them, that then had their frame changed via either Sprite.frame or Sprite.frameName wouldn't re-tint the new frame, and would become stuck on the old frame in Canvas mode (thaks @spayton #2453) 2016-05-17 21:04:40 +01:00
photonstorm
4fd2524c61 Text.setStyle has a new argument update which will optionally automatically call updateText after setting the new style (thanks @staff0rd #2478) 2016-05-16 12:55:27 +01:00
photonstorm
f34b567295 BitmapData.copy, and by extension any method that uses it, including BitmapData.draw, drawGroup and drawFull, now all support drawing RenderTexture objects. These can either be passed directly, or be the textures of Sprites, such as from a call to generateTexture. 2016-05-12 03:48:14 +01:00
photonstorm
1d18c70371 BitmapData.drawGroupProxy is now capable of iterating through Sprites that have children, and also now uses the world positions for drawing instead. 2016-05-11 16:38:42 +01:00
photonstorm
1adece490a Docs update. 2016-05-04 02:02:13 +01:00
Lewis Pollard
719b4bb7f6 Alter BitmapText to use toString on text parameter in constructor
The BitmapText property accessor for the text property uses toString on the value passed in, meaning Numbers can be passed in as the text value with no problem. However, passing a Number into the constructor results in the following exception as it isn't implicitly converted to a string in a similar manner.

phaser.js:71890 TypeError: text.substr is not a function
    at Phaser.BitmapText.updateText (http://localhost/phaser/build/phaser.js:56283:21)
    at new Phaser.BitmapText (http://localhost/phaser/build/phaser.js:56034:10)
    at Phaser.GameObjectFactory.bitmapText (http://localhost/phaser/build/phaser.js:46318:26)
    at Object.Boot.create (http://localhost/phaser/:46:34)
    at Phaser.StateManager.loadComplete (http://localhost/phaser/build/phaser.js:29240:35)
    at Phaser.Loader.finishedLoading (http://localhost/phaser/build/phaser.js:71446:25)
    at Phaser.Loader.processLoadQueue (http://localhost/phaser/build/phaser.js:71403:18)
    at Phaser.Loader.asyncComplete (http://localhost/phaser/build/phaser.js:71476:14)
    at Phaser.Loader.xmlLoadComplete (http://localhost/phaser/build/phaser.js:72413:14)
    at .<anonymous> (http://localhost/phaser/build/phaser.js:72236:34)

This simply mimics the logic in the property accessor by running toString on the text value and using an empty string if null to allow Numbers to be passed into the constructor.
2016-04-13 15:24:29 +01:00
photonstorm
b9f62e77e6 You can now pass a TilemapLayer as a Texture to a TileSprite. A limitation of this is that if you pass it to a TileSprite it will make a fill pattern from the TilemapLayer at that instant it's passed, and it won't keep track of the layer in future should it update (thanks @jdnichollsc #1989) 2016-04-07 03:45:21 +01:00
photonstorm
fc7b5c79e3 Graphics objects can now have a Physics Body directly attached to them, where-as before it would throw an error due to a lack of anchor property (thanks @NLilley #2400) 2016-04-07 00:14:41 +01:00
photonstorm
0945083a4b Removed further mentions of RenderTexture re: TileSprite. 2016-04-06 23:58:34 +01:00
photonstorm
b3757ed862 jsdocs update #2384 2016-04-06 02:33:29 +01:00
Richard Davey
71056ccb69 Merge pull request #2371 from stoneman1/dev
Fixed video for future
2016-04-06 01:08:22 +01:00
photonstorm
4d69b13977 Passing a BitmapData to a TileSprite as a texture would fail if the BitmapData had not been previously added to the cache. It now uses the new frameData property (thanks @mzamateo @lucap86 #2380) 2016-04-06 00:44:55 +01:00
photonstorm
c33b53fa95 BitmapData has a new property frameData which is a Phaser.FrameData container instance. It contains a single Frame by default, matching the dimensions of the entire BitmapData, but can be populated with additional frames should you wish to create animations from dynamic BitmapData textures. 2016-04-06 00:43:21 +01:00
photonstorm
f9949166be Text that used fonts which had numbers in their names wouldn't be correctly rendered unless you explicitly set the font property after creation. You can now pass font names with numbers in them as the font style object correctly (thanks @And-0 #2390) 2016-04-04 23:20:04 +01:00
photonstorm
bc4b828b51 BitmapData.copy, and by extension draw, drawFull, drawGroup, etc, would incorrectly handle drawing a tinted Sprite if it was using a frame from a texture atlas (thanks @PhaserDebugger #2405) 2016-04-04 22:53:13 +01:00
photonstorm
f40cfbe2ae 2015 - 2016. 2016-04-04 22:16:16 +01:00
photonstorm
12f3bd6cc5 The Destroy component will now call TweenManager.removeFrom, removing any active tweens from the TweenManager upon the Game Objects destructions (thanks @PokemonAshLovesMyTurkeyAndILikeYouTwo #2408)
Tween.update will now return `false` (flagging the Tween for destruction) should the Tween.target property every become falsey. This can happen if the object the Tween was tracking is destroyed, nulled or generally removed..
2016-04-04 22:06:16 +01:00
Richard Davey
8e880eddee Merge pull request #2402 from jakewilson/dev
Added ability to kill a Game Object when it leaves camera bounds.
2016-04-04 21:52:30 +01:00
photonstorm
63b3b3e887 Negative lineSpacing in Text objects will no longer crop the bottom pixels off lines of text (thanks @gaelenh #2379 #2374) 2016-04-04 21:36:37 +01:00
photonstorm
f9ff892510 Formatting. 2016-04-04 21:25:21 +01:00
slash
fbdf8073ad Add "maxLines" style attribute to Text object, maximum number of lines
to be shown for wrapped text or 0 for no limit. (default).
2016-04-03 10:08:35 -05:00
Jake Wilson
ae663f97aa Added ability to kill a Game Object when it leaves camera bounds. 2016-03-28 20:34:00 -04:00
Stoneman1
ee335fe466 Fixed backwards compatibility issue. 2016-03-02 13:28:44 +02:00
Stoneman1
5bdc1c05b4 MediaStream.stop() deprecated. Using MediaStreamTrack.stop() instead. 2016-03-02 12:34:28 +02:00
photonstorm
17071b578c BaseTexture.destroy wasn't correctly removing the texture from the BaseTextureCache if it was a cached CanvasPool entry (such as Text objects use), causing drawImage errors in Canvas mode, and just blank textures in WebGL (thanks @civet #2339) 2016-02-18 12:59:40 +00:00
Richard Davey
b629539176 SpriteBatch incorrectly applied the PIXI SpriteBatch prototype over the top of Phaser.Group meaning that Sprites with animations wouldn't render correctly (thanks @qdrj #1951) 2016-02-17 03:23:56 +00:00
Richard Davey
0c52b9316a Text with lineSpacing set wouldn't apply the lineSpacing to the final line of text in the Text string, or to text with just single lines. This could lead to incorrect height calculations for further layout and unwanted padding at the bottom of Text objects (thanks @Lopdo #2137) 2016-02-17 03:14:51 +00:00
photonstorm
5bcfa08af6 Text.useAdvancedWrap allows you to swap between the Basic and the Advanced word wrapping functions. In Advanced it will wrap long-words and condense and trim excess white space (thanks @soldoutactivist #1811) 2016-02-04 16:00:21 +00:00
Richard Davey
a4c5fb9660 BitmapData.drawGroup can now handle drawing Emitters and BitmapText objects that are part of the Group. 2016-02-03 23:08:54 +00:00
Richard Davey
10209dc8f5 GameObject.revive used to add the health amount given to the Game Object (via heal) instead of setting it as the new health amount. It now calls setHealth instead, giving it the exact amount (thanks @netgfx #2231)
GameObject.revive will now set the health amount to 100 instead of 1, bringing it in-line with the `maxHealth` default value.
2016-02-03 21:44:06 +00:00
Richard Davey
034428e92c Sprite (and all Game Objects) have a new argument in their destroy method: destroyTexture. This boolean (which is false by default) controls if the BaseTexture of the Game Object should be destroyed or not. This is extremely useful in situations where you've got a lot of dynamic assets you no longer need, such as textures created from BitmapDatas. You must set the destroyTexture argument yourself. This can be done in a custom Game Object destroy method or as part of your state shutdown (#2261) 2016-02-03 11:41:37 +00:00
Richard Davey
8043d29aa6 BitmapData would always create a private _swapCanvas which was a clone of its main canvas used for advanced movement operations. This no longer happens. The swap canvas is created only as needed, by those functions that use it (specifically moveH and moveV), meaning a BitmapData will now use half the amount of memory it used to, and you'll have half the amount of canvas DOM elements created (unless you make heavy use of the move functions). 2016-02-03 11:41:37 +00:00
Richard Davey
75d6bbb251 Updated defs and improved jsdocs for #2277 2016-02-02 23:37:08 +00:00
Richard Davey
d4edbe6619 Merge pull request #2277 from slashman/exposeWrappedLinesOnText
Alow precalculating the results of text wrapping.
2016-02-03 01:32:49 +02:00
Richard Davey
88f1ea95d2 Fixed BitmapText.cleanText so it works properly with new-lines within the text.
BitmapText would crash if it tried to render a character that didn't exist in the font set. Any character that doesn't exist in the font set now renders a space character instead.

BitmapText would load and parse the kerning data from the font, but would never use it when rendering. The kerning values are now applied on rendering as well (thanks @veu #2165)
2016-02-02 22:54:01 +00:00
Richard Davey
bceca55c8f Merge pull request #2222 from FracturedShader/patch-2
Update BitmapData.shiftHSL, limitValue -> clamp
2016-02-02 02:31:54 +02:00
Richard Davey
5893224f10 The Style object passed in to Phaser.Text is now cloned instead of referenced. This means you can adjust single Text instances without invaliding other Text objects using the same style object (thanks @asyncanup #2267) 2016-02-02 00:29:46 +00:00
Richard Davey
34aff350eb The Video game object used an anonymous bound function for both the 'ended' and 'playing' event listeners, meaning that they were never removed properly (thanks @ramalhovfc #2303) 2016-02-02 00:18:50 +00:00
Richard Davey
1d2d707b32 Merge pull request #2168 from nlotz/dev
fix typos in API docs
2016-02-01 19:01:58 +02:00
Richard Davey
e551254b52 Merge pull request #2209 from FracturedShader/patch-1
Update BitmapData.setHSL to accept 0
2016-02-01 18:57:29 +02:00
Richard Davey
76e2dc66ee Fixed docs (#2216) 2016-02-01 16:42:03 +00:00
Richard Davey
37d9b3402d Merge pull request #2226 from milkey-mouse/fix-retrofont-smoothed
Change RetroFont.smoothed from string to boolean
2016-02-01 18:32:22 +02:00
photonstorm
d7b6d4e784 jshint fix (missing semi-colon) 2016-01-13 16:15:46 +00:00
photonstorm
70437a0bdd Clean text automatically on creation. 2016-01-13 15:18:42 +00:00
photonstorm
6a868cba5e BitmapText.cleanText is a new method that will scan the given text and either remove or replace all characters that are not present in the font data. It is called automatically by BitmapText.updateText. 2016-01-13 15:15:51 +00:00
photonstorm
36d9c8d673 Changed from a space to '' and added 'replace' argument. 2016-01-13 15:14:14 +00:00
slash
5cc6b5962b Add missing assignations required for wrapping calculations to work
correctly
2016-01-03 16:54:27 -05:00
slash
ef7c2c6275 Alow precalculating the results of text wrapping. This may be useful for
example if the developer wants to control pagination, in which case
he may know in advance the total number of lines the text will wrap to,
and then set it on batches.
2016-01-03 16:33:33 -05:00
Robert Plante
8f1450ecca Update to BitmapData.setHSL to follow conventions 2015-11-23 12:46:12 -05:00
Milkey Mouse
19845eb691 Changed RetroFont.smoothed from string to boolean 2015-11-22 21:37:28 -08:00
Robert Plante
45195848bc Update BitmapData.shiftHSL, limitValue -> clamp
`math.limitValue` does not exist so it was changed to `math.clamp` which provides the desired functionality.
2015-11-17 15:34:42 -05:00
Robert Plante
e236cac1e6 Update setHSL
Checking `if (h)` yields `false` when `h = 0`, but 0 is an acceptable value here. Had to decide between caching HSL verification and doing `typeof` 3x/pixel and opted for the temporary variables.
2015-11-17 14:15:26 -05:00
photonstorm
609b38c6e1 BitmapData.update causes a snowballing memory leak under WebGL due to a Context.getImageData call. BitmapData.clear used to call update automatically but no longer does. This resolves the issue of the Debug class causing excessive memory build-up in Chrome. Firefox and IE were unaffected (thanks @kingjerod #2208) 2015-11-17 14:07:56 +00:00
photonstorm
1c169ef571 Video jsdoc fixes. 2015-11-02 11:51:15 +00:00
Richard Davey
799efa3079 You can use the new const Phaser.PENDING_ATLAS as the texture key for any sprite. Doing this then sets the key to be the frame argument (the frame is set to zero). This allows you to create sprites using load.image during development, and then change them to use a Texture Atlas later in development by simply searching your code for 'PENDING_ATLAS' and swapping it to be the key of the atlas data. 2015-10-31 01:04:14 +00:00
nlotz
da45d04a70 fix typos in API docs 2015-10-27 09:10:14 +01:00
photonstorm
efc69ff463 Buttons (or any Sprites) that don't have a texture, but have children, would incorrectly render the children under WebGL due to the baseTexture.skipRender property (thanks @puzzud #2141) 2015-10-16 16:44:51 +01:00
photonstorm
45d92d4217 ScaleMin and ScaleMax stopped working in Phaser 2.3.0 due to an incorrect transform callback scope (thanks @brianbunch #2132) 2015-10-13 13:32:55 +01:00
photonstorm
84373dc478 Removed use of the tilePosition property in the Phaser.Rope class as it isn't implemented and caused calls to Rope.reset to crash (thanks @spayton #2135) 2015-10-13 12:20:02 +01:00
Richard Davey
e097a1227e Merge pull request #2052 from nickryall/fix-for-text-centered-on-sprite
adjust wrapped text that is centered to sprite via anchor
2015-10-13 13:50:11 +03:00
photonstorm
e01a754732 Removed the FrameDebugger and moved to its own branch. 2015-10-12 11:10:37 +01:00
Richard Davey
8899eddd9a BitmapData.clear now automatically calls BitmapData.update at the end of it. 2015-09-29 14:02:26 +01:00
Richard Davey
5a275f14a8 Removing dead code. 2015-09-28 03:26:27 +01:00
photonstorm
de5283b989 The default Button.onOverMouseOnly value has changed from false to true. If you used this in your touch enabled games then please be aware of this change (#2083) 2015-09-22 15:24:52 +01:00