Commit graph

2958 commits

Author SHA1 Message Date
Richard Davey
ca3ecd796e Merge pull request #1346 from pnstickne/wip-scalemanager-windowbounds2
ScaleManager + DOM - window constraint updates
2014-11-20 20:34:24 +00:00
Richard Davey
dab26a65fa Merge pull request #1349 from neurofuzzy/patch-1
Keyboard.js does not reflect Phaser.Key changes
2014-11-20 20:33:44 +00:00
Geoff Gaudreault
dbde5ee913 Keyboard.js does not reflect Phaser.Key changes
Calling justPressed or justReleased on Phaser.Keyboard throws an exception. Changed to reflect new method names in Phaser.Key

I imagine you'd want these methods renamed as well, but it appears to be called by a few other classes and I didn't want a huge pull-request.
2014-11-20 11:23:43 -08:00
photonstorm
c909c29935 Undefined fix #1347 2014-11-20 10:00:08 +00:00
photonstorm
2589000435 Tweens have been completely rewritten. They're now much more flexible and efficient than before:
When specifying the ease in `Tween.to` or `Tween.from` you can now use a string instead of the Function. This makes your code less verbose. For example instead of `Phaser.Easing.Sinusoidal.Out` and you can now just use the string "Sine".The string names match those used by TweenMax and includes: "Linear", "Quad", "Cubic", "Quart", "Quint", "Sine", "Expo", "Circ", "Elastic", "Back", "Bounce", "Power0", "Power1", "Power2", "Power3" and "Power4". You can append ".easeIn", ".easeOut" and "easeInOut" variants. All are supported for each ease types.
Tweens now create a TweenData object. The Tween object itself acts like more of a timeline, managing multiple TweenData objects. You can now call `Tween.to` and each call will create a new child tween that is added to the timeline, which are played through in sequence.
Tweens are now bound to the new Time.desiredFps value and update based on the new Game core loop, rather than being bound to time calculations. This means that tweens are now running with the same update logic as physics and the core loop.
Tween.timeScale allows you to scale the duration of a tween (and any child tweens it may have). A value of 1.0 means it should play at the desiredFps rate. A value of 0.5 will run at half the frame rate, 2 at double and so on. You can even tween the timeScale value for interesting effects!
Tween.reverse allows you to instantly reverse an active tween. If the Tween has children then it will smoothly reverse through all child tweens as well.
Tween.repeatAll allows you to control how many times all child tweens will repeat before firing the Tween.onComplete event. You can set the value to -1 to repeat forever.
Tween.loop now controls the looping of all child tweens.
Tween.onRepeat is a new signal that is dispatched whenever a Tween repeats. If a Tween has many child tweens its dispatched once the sequence has repeated.
Tween.onChildComplete is a new signal that is dispatched whenever any child tweens have completed. If a Tween consists of 4 sections you will get 3 onChildComplete events followed by 1 onComplete event as the final tween finishes.
Chained tweens are now more intelligently handled. Because you can easily create child tweens (by simply calling Tween.to multiple times) chained tweens are now used to kick-off longer sequences. You can pass as many Tween objects to `Tween.chain` as you like as they'll all be played in sequence. As one Tween completes it passes on to the next until the entire chain is finished.
Tween.stop has a new `complete` parameter that if set will still fire the onComplete event and start the next chained tween, if there is one.
Tween.delay, Tween.repeat, Tween.yoyo, Tween.easing and Tween.interpolation all have a new `index` parameter. This allows you to target specific child tweens, or if set to -1 it will update all children at once.
Tween.totalDuration reports the total duration of all child tweens in ms.
There are new easing aliases:
* Phaser.Easing.Power0 = Phaser.Easing.Linear.None
* Phaser.Easing.Power1 = Phaser.Easing.Quadratic.Out
* Phaser.Easing.Power2 = Phaser.Easing.Cubic.Out
* Phaser.Easing.Power3 = Phaser.Easing.Quartic.Out
* Phaser.Easing.Power4 = Phaser.Easing.Quintic.Out
2014-11-20 06:06:26 +00:00
photonstorm
a952cd398d Final new tween system is in place (just generateData left to do). 2014-11-20 05:26:50 +00:00
photonstorm
2a7c0058e6 Tidied up code formatting. 2014-11-20 05:26:50 +00:00
photonstorm
a34824c5a3 Planning new vStart cache. 2014-11-20 05:26:50 +00:00
photonstorm
64cf3a6f5b repeatAll and loop support added back in. 2014-11-20 05:26:49 +00:00
photonstorm
4220382376 Evolving the Tween engine. TweenMax string syntax now supported. 2014-11-20 05:26:49 +00:00
photonstorm
ab114cc4a1 The start of TweenData. 2014-11-20 05:26:49 +00:00
Paul
e7fd527c72 ScaleManager + DOM - window constraint updates
ScaleManager.windowContraints now allows specifing 'visual' or 'layout' as
the constraint. Using the 'layout' constraint should prevent a mobile
device from trying to resize the game when zooming.

Including the the new changes the defaults have been changed to

   windowContraints = { right: 'layout', bottom: '' }

This changes the current scaling behavior as seen in "Game Scaling" (as it
will only scale for the right edge) but also prevents such scaling from
going wonkers in some mobile environtments like the newer Android browser.
(Automatic scroll-to-top, albeit configurable, enabled for non-desktop by
default is not a fun situation here.)

To obtain the current semantics on a desktop the bottom should be changed
to 'layout'; although this will result in different behavior depending on
mobile device. To make the sizing also follow mobile zooming they should
be changed to 'visual'.

Also added temp Rectangle re-used for various internal calculations.

---

Phaser.DOM now also special-cases desktops to align the layout bounds
correctly (this may disagree with CSS breakpoints but it aligns the with
actual CSS width), without applying a window height/width expansion as
required on mobile browsers.

(And the jshint error isn't mine..)
2014-11-19 15:42:08 -08:00
Richard Davey
babb8687c8 Merge pull request #1345 from clark-stevenson/dev
Definition Updates
2014-11-19 10:29:17 +00:00
photonstorm
aa72cf63c1 Emitter.setScale fixed minX minY order presedence (thanks spayton) 2014-11-18 15:38:08 +00:00
Clark Stevenson
1f39f7e3ec Definition Updates 2014-11-18 12:54:07 +00:00
photonstorm
07d43934c6 Docs update. 2014-11-18 12:43:26 +00:00
photonstorm
8e109b072a Updated RC version. 2014-11-18 12:36:35 +00:00
photonstorm
1d2b36fa1b Camera.preUpdate. 2014-11-18 12:36:25 +00:00
photonstorm
395171b660 Added renderable check to Pixi.Sprite. 2014-11-18 12:36:11 +00:00
photonstorm
683f1a3a10 Tiny bit of tidying up. 2014-11-18 12:30:14 +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
Clark Stevenson
423342afd0 Merge remote-tracking branch 'clark/dev' into dev 2014-11-18 11:43:06 +00:00
Clark Stevenson
e0b8af7bdd Definition Updates 2014-11-18 11:41:50 +00:00
photonstorm
60aa21db64 Updated config file. 2014-11-18 09:45:52 +00:00
photonstorm
8a89e8e97b Fixed grunt manifest 2014-11-18 09:45:39 +00:00
photonstorm
49b1896189 Added Tween.percent variable and tidied up the time values. 2014-11-18 09:22:24 +00:00
photonstorm
9caa13e489 Fixed TileSprite rendering issue. 2014-11-18 09:22:24 +00:00
photonstorm
8a45ad2ebd jsdoc fixes 2014-11-18 09:22:24 +00:00
Richard Davey
53422b97f4 Merge pull request #1344 from pnstickne/wip-dom-viewport
ScaleManager + DOM
2014-11-18 09:22:04 +00:00
Richard Davey
3411c90f86 Merge pull request #1343 from pnstickne/wp-array-set-docs
ArraySet - documentation
2014-11-18 09:17:28 +00:00
Paul
644f87b15d ScaleManager + DOM 2014-11-17 23:56:30 -08:00
Paul
884353d71e ScaleManager + DOM
"Final" changes for a solid 2.2-worthy ScaleManager.

This adds in official support for USER_SCALE, which allows a flexible way
to control the scaling dynamically.

It fixes a visible display bug in desktop browsers (viewport clipping was
off) and mitigates some potential issues all around by using a unified
visualBound calculations in Phaser.DOM.

It applies some protected/deprecated attributes, but does not remove any
behavior of already-established (as in, outside-dev) means.

There are no known [signficant] breaking changes; any known breaks (not
considered fixes) are constrained to dev with no known consumers.

Phaser.DOM

  There are no known significant breaking changes; Phaser.DOM was
  internal.

  - Added visualBounds; this should be the true visual area, minus the
    scrollbars. This should be used instead of clientWidth/clientHeight to
    detect the visual viewport.

  - Expose various viewport sizes as dynamically updated properties on
    Rectangle objects. These are visualBounds, layoutBounds,
    documentBounds.

  - Updated documentation the different bounds; in particular drawing
    distinction between viewport/layout bounds and visual bounds.

  - Renamed `inViewport` to `inLayoutViewport` to indidcate behavior.
    - Minor breaking, but dev-only

  - Changed `getAspectRatio` to work on Visual viewport. This will yield
    the expected behavior on mobiles.
    - Minor breaking, but dev-only

  - Removed some quirks-mode and legacy-browser special casing

Phaser.ScaleManager

  There are no known significant breaking changes.

  - USER_SCALE is 'made public'. It can used to flexibly configure any
    custom-yet-dynamic scaling requirements; it should now be able to
    replace any sane usage of manual sizing invoking the deprecated
    setSize/setScreenSize.
    - Added additional usage documentation and links to such
    - Added the ability to specify a post-scale trim factor.

  - Change the arguments the resize callback and document what is passed
    - Minor breaking, but the previous arguments were undocumented

  - `compatiblity.showAllCanExpand` renamed to `canExpandParent` and made
    generalized over possibly-expanding scaling.
    - Minor breaking, dev-only, for coding changing this settin

  - Switched from direct usage of of window innerWidth/Heigth to
    Phaser.DOM visualViewport - this change correctly accounts for
    scrollbars in desktop environments
    - Although it does slightly alter the behavior, this is a fix.

  - Removed usage of window outerWidth/outerHeight which didn't make much
    sense where it was used for desktops and was catostrophic for mobile
    browser
    - Although it may slightly alter the behavior, this is a fix.

  - Removed `aspect` and `elementBounds` because they are duplicative of
    Phaser.DOM (which can not be accessed as `scale.dom`).
    - Minor breaking, but internal methods on dev-only

  - Marked the minWidth/maxWidth/minHeight/maxHeight properties as
    protected. They are not removed/obsoleted, but should be revised later
    for more flexibility.

  - Orientation handling; non-breaking forward deprecations
    - Added `onOrientationChange` and deprecated the 4 separate leave,
      enter, landscape and portrait signals. They are not removed, so this
      is a future-migration change.
    - Fixed issue where state not updated prior to callback
    - Fixed issue where orientation callbacks were not always delayed

  - Fullscreen events: non-breaking forward deprecations
    - Added `onFullScreenChange` and deprecated `enterFullScreen` and
      `leaveFullScreen`.
    - Renamed (with proxy) `fullScreenFailed` to `onFullScreenError`.

Phaser.Device

  - Improved `whenReady` to support Phaser.DOM better
    - Allows a ready handler to be added without starting the
      device-detection proccess. This allows it to be registered to
      internally (eg. from System.DOM) without affecting current behavior.
    - Passes the device object as the first parameter to the callback
      function.

  - Fixed code where Silk detection not applied to `desktop` detection.

Manifest: System.Device moved before System.DOM
2014-11-17 23:48:06 -08:00
Paul
3c57773710 ArraySet - documentation
(rest of changes..)
2014-11-17 19:55:23 -08:00
Paul
5ec4c4cbe8 ArraySet - documentation
No breaking changes.

- Fixed jsdoc error `*[]` with documentation

- Also corrected documentation to align with behavior and changed
  `callback` to `key` in callAll for consistency
2014-11-17 19:52:13 -08:00
photonstorm
40c490ce23 Phaser 2.2 Release Candidate 8 (newsletter build) 2014-11-17 14:14:50 +00:00
photonstorm
a8574b42ef Phaser 2.2 Release Candidate 8 2014-11-17 13:08:53 +00:00
photonstorm
09e6839c63 Pixi update 2014-11-17 13:07:53 +00:00
Clark Stevenson
28aaba2942 Definition Updates 2014-11-16 22:10:48 +00:00
photonstorm
ff8a138081 jshint fix 2014-11-16 21:18:29 +00:00
photonstorm
5cd4225412 If you are reloading a Phaser Game on a page that never properly refreshes (such as in an AngularJS project) then you will quickly run out of AudioContext nodes. If this is the case create a global var called PhaserGlobal on the window object before creating the game. The active AudioContext will then be saved to window.PhaserGlobal.audioContext when the Phaser game is destroyed, and re-used when it starts again (#1233) 2014-11-16 21:05:31 +00:00
Clark Stevenson
a56c9e334b Merge remote-tracking branch 'clark/dev' into dev 2014-11-16 19:27:38 +00:00
photonstorm
b635ca511e docs update 2014-11-16 19:13:53 +00:00
Richard Davey
730f53c99e Merge pull request #1279 from lewster32/patch-1
Added TweenManager#removeFrom method
2014-11-16 18:58:43 +00:00
Richard Davey
5fa06a241b Merge pull request #1325 from pnstickne/wip-collections
ArrayList/LinkedList updates
2014-11-16 18:54:24 +00:00
Richard Davey
9fb46c67e8 Merge pull request #1335 from pnstickne/wip-sm-r2
ScaleManger - better FS init, documentation
2014-11-16 15:22:00 +00:00
Richard Davey
8fcd840a02 Merge pull request #1337 from musically-ut/patch-1
Fix documentation for Cache.addPhysicsData
2014-11-16 15:05:53 +00:00
Richard Davey
daa1a0e34b Merge pull request #1336 from clark-stevenson/patch-1
IPixiShader should be interface and not class
2014-11-16 15:05:14 +00: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
Clark Stevenson
4a4f0deece IPixiShader should be interface and not class 2014-11-16 13:13:07 +00:00
Clark Stevenson
04178039f0 Merge remote-tracking branch 'clark/dev' into dev 2014-11-16 12:51:25 +00:00