Commit graph

487 commits

Author SHA1 Message Date
photonstorm
167bbde8d4 Game Objects all now using the new Components mixins. 2015-02-17 06:00:41 +00:00
photonstorm
166c0363fc jshint fixes 2015-02-17 05:59:54 +00:00
photonstorm
bf4c1d0620 Split out all the common GameObject features into components. 2015-02-17 05:15:04 +00:00
photonstorm
8483eac6aa Removing all use of _cache from all Game Objects. 2015-02-16 17:22:51 +00:00
photonstorm
8c23bca62d Sprite.left, Sprite.right, Sprite.top, Sprite.bottom are new properties that contain the totals of the Sprite position and dimensions, adjusted for the anchor.
Sprite.offsetX and Sprite.offsetY contain the offsets from the Sprite.x/y coordinates to the top-left of the Sprite, taking anchor into consideration.
2015-02-16 15:47:55 +00:00
photonstorm
c243222889 Docs update #1231 2015-02-11 16:41:56 +00:00
Richard Davey
b560af992f Merge pull request #1375 from pnstickne/wip-text-consistency
Text - font components can be specified as part of "style"
2015-02-11 15:06:48 +00:00
photonstorm
cc7096b045 jsdoc fix #1543 2015-02-10 21:22:36 +00:00
photonstorm
dfc8ff32d2 You can now tint animated Sprites in Canvas mode. Or change the texture atlas frame of a tinted Sprite or Image. Please note that this is pretty expensive (depending in the browser), as the tint is re-applied every time the *frame changes*. The Pixi tint cache has also been removed to allow for subtle tint color shifts and to avoid blowing up memory. So use this feature sparingly! But at least it does now work (#1070) 2015-02-10 14:53:55 +00:00
photonstorm
4489a12fd8 Sprite.loadTexture and Image.loadTexture now no longer call updateTexture if the texture given is a RenderTexture. This fixes issues with RetroFonts in IE11 WebGL as well as other RenderTexture related IE11 problems (#1310 #1381 #1523) 2015-02-10 12:27:55 +00:00
photonstorm
e85be1f1d8 BitmapText.font wouldn't update an internal Pixi property (fontName) causing the text to fail to change font (thanks @starnut #1602) 2015-02-08 22:07:36 +00:00
photonstorm
336fdfa672 TileSprites weren't destroying WebGL textures, leading to eventual out of memory errors (thanks @chacal #1563) 2015-02-03 21:32:39 +00:00
Richard Davey
21823f65e3 Merge pull request #1576 from vulvulune/jsdoc
Correct comments
2015-02-03 20:47:32 +00:00
photonstorm
d6ea8fb956 jsdoc updates (spelling mistakes, code formatting, etc) 2015-01-28 17:18:33 +00:00
vulvulune
8ef32f044c Correct comments
Correct comments:
-Phaser.Camera: checkWorldBounds =>checkBounds
-Phaser.RetroFont: Set correct @name for name and smoothed
-Phaser.DOM: inViewport => inLayoutViewport
2015-01-27 13:46:18 +01:00
photonstorm
a67d2df6f0 BitmapData.text will render the given string to the BitmapData, with optional font, color and shadow settings. 2015-01-18 12:24:00 +00:00
photonstorm
741131312a BitmapData.drawGroup draws the immediate children of a Phaser.Group to a BitmapData. Children are only drawn if they have their exists property set to true. The children will be drawn at their x and y world space coordinates. When drawing it will take into account the child's rotation, scale and alpha values. No iteration takes place. Groups nested inside other Groups will not be iterated through.
BitmapData.copy `tx` parameter if `null` and `source` is a Display Object, it will default to `source.x`.

BitmapData.copy `ty` parameter if `null` and `source` is a Display Object, it will default to `source.y`.
2015-01-05 14:28:16 +00:00
Richard Davey
b3f322469b Added Events.onEnterBounds to the destroy method (thanks @legendary-mich #1497) 2015-01-02 21:53:20 +00:00
Paul
a070e8db8f Fix for Event changes
This replaces 'eval' with closures (that should have probably
been used to begin with) to avoid warnings generated by some tools.

This change does not affect the approach used.

- Ref. #1494
2015-01-01 13:50:07 -08:00
photonstorm
c6c5856dec Phaser.Graphics.drawCircle now overrides PIXI.drawCircle which means the docs are now correct re: diameter not radius (thanks @ethankaminski #1454) 2014-12-17 13:44:12 +00:00
photonstorm
028943baad Moved the updateTransform to a Game level update on Stage and replaced the Pixi version.
Added a boolean check, so it can be either updated from updateLogic or render without duplicating the process.
#1424
2014-12-10 10:37:37 +00:00
photonstorm
4ad6df9a29 A test to try for #1424 2014-12-09 23:38:23 +00:00
photonstorm
def662f28f Text.setShadow has had the default color value changed from rgba(0,0,0,0) to rgba(0,0,0,1) so it appears as a black shadow by default - before the alpha channel made it invisible. 2014-12-02 09:03:55 +00:00
Richard Davey
152b26a668 Merge pull request #1378 from pnstickne/wip-minor-updatelogic-fix
Minor logic fix for Sprite life update
2014-12-01 12:07:56 +00:00
Richard Davey
81f356c235 Merge pull request #1386 from pnstickne/wip-docs-1130
Assorted documentation/consistency updates
2014-12-01 12:07:10 +00:00
Paul
d15037e283 Event-Signal object count optimization
There are a bunch of signals added for Sprites; more when input is
enabled. However, very few of these signals are ever actually used. While
the previous performance update related to Signals addressed the size of
each Signal object, this update is to reduce the number of Signal objects
as used by the Events type.

As a comparison the "Particle: Random Sprite" demo creates 3200+ Signals;
with this change there less than 70 signals created when running the same
demo. (Each Event creates at 8 signals by default, and there is an Event
for each of the 400 particles.) While this is an idealized scenario, a
huge amount (of albeit small) object reduction should be expected.

It does this by creating a signal proxy property getter and a signal
dispatch proxy. When the event property (eg. `onEvent`) is accessed a new
Signal object is created (and cached in `_onEvent`) as required. This
ensures that no user code has to perform an existance-check on the event
property first: it just continues to use the signal property as normal.

When the Phaser game code needs to dispatch the event it uses
`event.onEvent$dispath(..)` instead of `event.onEvent.dispatch(..)`. This
special auto-generated method automatically takes care of checking for if
the Signal has been created and only dispatches the event if this is the
case. (If the game code used the `onEvent` property itself the event
deferal approach would be defeated.)

This approach is designed to require minimal changes, not negatively
affect performance, and reduce the number of Signal objects and
corresponding Signal/Event resource usage.

The only known user-code change is that code can add to signal (eg.
onInput) events even when input is not enabled - this will allow some
previously invalid code run without throwing an exception.
2014-11-30 21:39:25 -08: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
photonstorm
cfbad72881 Documentation - general
Updated some documentation for formatting, consistency, and minor
corrections.
2014-11-30 04:02:45 -08:00
Paul
3299588326 Sprite - removed comment
The comment was no longer valid after the previos changes.
2014-11-29 14:12:14 -08:00
photonstorm
d5dfa464c0 Added alpha setting to getContext. 2014-11-29 19:40:50 +00:00
Paul
dfe7279090 Minor logic fix for Sprite life update
The substraction of `physicsElapsedMS` needs to be done for all individual
updates. (When current FPS ~ target FPS this is a 1-1 mapping, but catchup
updates can throw off the calculations.)

Also renamed `Game#updateNumber` (a poor initial name on my part) to
`currentUpdateID`. This matches the naming of
`Stage#currentRenderOrderID`.
2014-11-28 23:02:31 -08:00
Paul
83cbbf1d21 Text - font component cleanup
Some minor cleanup of font component handling and comments.

Also adds a warning if an "unparsable font" string is encountered. Might
save someone some trouble.
2014-11-28 03:50:52 -08:00
Paul
bf3d5aa22e Text - consistency updates
Added `cssFont`, `fontStyle`, and `fontVariant` properties for better
consistency and control.
2014-11-28 02:56:44 -08:00
Paul
8eb7594b29 Text - font size/weight can be specified as style
Fulfills: https://github.com/photonstorm/phaser/issues/1370

This allows `fontSize` and `fontWeight` to be specified as part of the
style as supplied to the Text constructor (and `setStyle` method). In
addition the `fontStyle` and `fontVariant` properties can also be set -
although these are not exposed later.

This also fixes edge cases that could be caused if `Text#fontSize` was
used without `Text#fontWeight`, where the applied style defaults would be
overwritten/reset.
2014-11-28 02:20:18 -08:00
Paul
5fbbeca7ab Text - documentation updates 2014-11-28 00:12:10 -08:00
photonstorm
471ad20b4a Added Time.physicsElapsedMS and used in Sprite lifespan and Tweens. 2014-11-26 13:13:25 +00:00
photonstorm
e86f00eb55 Text.lineSpacing works correctly again. Before no space was added between the lines (thanks @intimidate #1367 and @brejep #1366) 2014-11-25 17:06:17 +00:00
Tim van den Eijnden
990867547e fix issue with lineSpacing, no space was added between the lines. The complete text moved down instead 2014-11-25 16:45:29 +01:00
photonstorm
72eaee3139 Adjusted Sprite.preUpdate to remove the lifespan calculation. 2014-11-25 14:18:18 +00:00
photonstorm
1068563914 jsdoc fixes. 2014-11-25 14:15:55 +00:00
Paul
e2f65f58a8 Merge commit '0d9678e512f9037b686ca480907c90f82d5b631e' into wip-time-clarify 2014-11-25 00:35:31 -08:00
Paul
5f9025f800 Sprite/Time - lifespan based on physicsTime
- Lifespan is updated based on physics time which makes this consistent
  with fixed-step updates and tweens, etc.
2014-11-25 00:33:13 -08:00
photonstorm
0d9678e512 Promoted Game time loop count to protected public var. Checked in Sprite.lifespan decrement to avoid over-decreasing the lifespan (#1358) 2014-11-25 02:50:39 +00:00
photonstorm
c4b81ff6ea jsdoc fixes. 2014-11-25 00:24:28 +00:00
photonstorm
2d50334cd3 Updated lifeSpan to use elapsedMS instead. 2014-11-24 12:54:39 +00:00
photonstorm
06b2a2c6a0 Added Tween.generateData back in, now all the Particles and Tween examples work properly. 2014-11-24 12:34:42 +00:00
photonstorm
21479acd8e Sprite.autoCull now properly works if the camera moves around the world.
Sprite.inCamera uses a much faster check if auto culling or world bounds checks are enabled and properly adjusts for camera position.
2014-11-18 12:29:55 +00:00
photonstorm
497b00d781 Tidying up a little. 2014-11-13 00:27:47 +00:00
photonstorm
d6297884e6 Added Sprite.setScaleMinMax for testing. 2014-11-08 13:31:35 +00:00
Paul
60268dd048 Changes to preserve original API
- Added @deprecated/@readonly to various some properties but public properties maintain the same semantics
- Also removed some "cleverness"
- Still same good fixes ..
2014-10-29 19:31:03 -07:00