Commit graph

242 commits

Author SHA1 Message Date
photonstorm
ca752cc59c jsdoc updates. 2015-03-23 08:13:59 +00:00
photonstorm
5a9b509b44 ArraySet.removeAll allows you to remove all members of an ArraySet and optionally call destroy on them as well.
GameObject.input.dragStartPoint now stores the coordinates the object was at when the drag started. This value is populated when the drag starts. It can be used to return an object to its pre-drag position, for example if it was dropped in an invalid place in-game.
2015-03-19 00:51:13 +00:00
photonstorm
a69e53f901 Copyright date change. 2015-02-25 03:36:23 +00:00
photonstorm
f613e5882e Allowed Keyboard and Gamepad to be optional. 2015-02-19 05:00:41 +00:00
photonstorm
8483eac6aa Removing all use of _cache from all Game Objects. 2015-02-16 17:22:51 +00:00
photonstorm
9670c8aa86 InputHandler.enableDrag with a boundsRect set now takes into account the Sprites anchor when limiting the drag (thanks @unindented #1593)
InputHandler.enableDrag with a boundsSprite set now takes into account both the Sprites anchor and the boundsSprite anchor when limiting the drag.
2015-02-16 15:49:46 +00:00
photonstorm
ae198e9364 InputHandler was using the wrong property in checkBoundsSprite when fixedToCamera (thanks @yig #1613) 2015-02-14 19:10:06 +00:00
photonstorm
aa2df803b7 Pointer.stop would call event.preventDefault if Pointer._stateReset was true, which is always true after a State has changed and before Pointer.start has been called. However this broken interacting with DOM elements in the case where the State changes and you immediately try to use the DOM element without first having clicked on the Phaser game. An additional guard was added so preventDefault will now only be called if both _stateReste and Pointer.withinGame are true (thanks @satan6 #1509) 2015-02-11 16:03:24 +00:00
photonstorm
c891d617d9 Swapped back to 2.2.2 expected setting. 2015-02-08 21:57:09 +00:00
photonstorm
9cdcdc7bc5 Device.touch checks if window.navigator.maxTouchPoints is >= 1 rather than > 1, which now allows touch events to work properly in Chrome mobile emulation. 2015-02-05 06:12:20 +00:00
photonstorm
5bd231d532 JSDoc fixes. 2015-02-05 05:13:22 +00:00
photonstorm
8dec37107e MSPointer.capture allows you to optionally event.preventDefault the pointer events (was previously always on)
MSPointer.event now stores the most recent pointer event.
MSPointer.pointerDownCallback, pointerMoveCallback and pointerUpCallback all allow you to set your own event based callbacks.
2015-02-05 05:12:00 +00:00
photonstorm
f55ba6755f jsdoc fix 2015-02-03 21:32:39 +00:00
photonstorm
3eba508382 Sprite.events.onDragStart has 2 new parameters x and y which is the position of the Sprite before the drag was started. The full list of parameters is: (sprite, pointer, x, y). This allows you to retain the position of the Sprite prior to dragging should dragFromCenter have been enabled (thanks @vulvulune #1583) 2015-02-03 21:32:39 +00:00
Richard Davey
a2854d21fd Merge pull request #1580 from integricho/fix#1551
fix #1551 - detect mouseup on tilesprites
2015-02-03 21:16:33 +00:00
photonstorm
7003b65df6 Added missing properties to the InputHandler prototype, reducing hidden class modifications. 2015-02-03 20:28:18 +00:00
Andrean Franc
b52b765c53 fix #1551 - detect mouseup on tilesprites 2015-01-28 19:31:36 +01:00
photonstorm
d6ea8fb956 jsdoc updates (spelling mistakes, code formatting, etc) 2015-01-28 17:18:33 +00:00
photonstorm
c1eb456ed2 Mouse.mouseMoveCallback is flagged as deprecated. 2015-01-02 04:14:44 +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
a012d8caa2 jsdoc update 2014-11-29 19:40:50 +00:00
photonstorm
c4b81ff6ea jsdoc fixes. 2014-11-25 00:24:28 +00:00
photonstorm
69b57073f2 Added missing duration parameter. 2014-11-20 21:19:09 +00:00
photonstorm
7e4a494f13 Keyboard.justPressed has bee renamed to Keyboard.downDuration which is a much clearer name for what the method actually does.
Keyboard.justReleased has bee renamed to Keyboard.upDuration which is a much clearer name for what the method actually does.
Keyboard.downDuration, Keyboard.upDuration and Keyboard.isDown now all return `null` if the Key wasn't found in the local keys array.
2014-11-20 20:55:51 +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
Richard Davey
5fa06a241b Merge pull request #1325 from pnstickne/wip-collections
ArrayList/LinkedList updates
2014-11-16 18:54:24 +00:00
photonstorm
527934d909 Key.justPressed has bee renamed to Key.downDuration which is a much clearer name for what the method actually does. See Key.justDown for a nice clean alternative.
Key.justReleased has bee renamed to Key.upDuration which is a much clearer name for what the method actually does. See Key.justUp for a nice clean alternative.
Key.justDown allows you to test if a Key has just been pressed down or not. You can only call justDown once per key press. It will only return `true` once, until the Key is released and pressed down again. This allows you to use it in situations where you want to check if this key is down without using a Signal, such as in a core game loop (thanks @pjbaron #1321)
Key.justUp allows you to test if a Key has just been released or not. You can only call justUp once per key press. It will only return `true` once, until the Key is pressed down and released again. This allows you to use it in situations where you want to check if this key is up without using a Signal, such as in a core game loop (thanks @pjbaron #1321)
2014-11-13 13:01:58 +00:00
Richard Davey
5dc6a8a8c5 Merge pull request #1321 from pjbaron/dev
justDown property indicates if a key has been newly pressed since last time you checked
2014-11-13 12:39:24 +00:00
Paul
aa3c21ade7 ArraySet/LinkedList - minor updates
- Renamed ArrayList to ArraySet
  - Added ArrayList is a deprecated proxy for compatibility
  - Updated internal code to use ArraySet

- ArraySet can be constructed with an array; if the caller is willing to
  accept some responsibility this can remove the O(n^2) behavior of
  repeatedly calling `add`.
  - Updated Group.filter to take advantage of this

- ArraySet.total is read-only proxy for for list.length

- Fixes ArraySet.setAll where it would only set properties with truthy
  values

- Updated documentation
2014-11-13 01:41:08 -08:00
Pete Baron
d1a8ecf3e6 Added justDown access to _justDown internal boolean. Records whether the key has been pressed since the last time it was checked. Resets to false only when it is read. Used for anything that needs to know when a key is first pressed with no autorepeat, without using closures or callbacks. 2014-11-13 18:34:36 +13:00
Paul
7004d68cbd Mouse Scroll Events - device separation
- The wheel event type is now determined in by Device

- The various input checking in Device have been moved to a new function
2014-11-12 13:24:03 -08:00
Paul
a0dcc61df2 Mouse Scroll Events - quibbles 2014-11-12 04:01:50 -08:00
Paul
796b2a7f2f Mouse Scroll Events - added support for WheelEvent, fixes
- Added support for the Wheel Event, which is the DOM3 spec.

- Wheel Scroll Event (old non-FF) and DOM Mouse Wheel (old FF) are
  supported via a non-exported reused wrapper object, WheelEventProxy.
  The proxy methods are generated one-time dynamically; future changes
  to the Mouse class (such as requiring an opt-in for mouse scroll events)
  could bypass secondary stub generation.

- FIX: Only ONE of the mouse wheel events is listened too, newest standard first.
  This fixes a bug in FF where it would use the default DOMMouseWheel.
2014-11-12 03:53:26 -08:00
photonstorm
1352b526c7 Merged final Pixi v2.1.0 release. 2014-11-11 23:24:50 +00:00
photonstorm
0a86a7ef51 Time.now can no longer be relied upon to contain a timestamp value. If the browser supports requestAnimationFrame then Time.now will contain the high resolution timer value that rAf generates. Otherwise it will contain the value of Date.now. If you require the actual time value (in milliseconds) then please use Time.time instead. Note that all Phaser sub-systems that used to rely on Time.now have been updated, so if you have any code that extends these please be sure to check it. 2014-11-08 20:01:10 +00:00
Richard Davey
f4237b3130 Merge pull request #1272 from pnstickne/wip-1246b
Button - bug fixes, issue #1246 (try number two)
2014-11-04 23:51:46 +00:00
Richard Davey
a4870a7e62 Merge pull request #1283 from pnstickne/wip-pointer-mgmt
Input - Minor Pointer refactor and documentation updates
2014-11-02 12:24:50 +00:00
photonstorm
30159691fa Fixed onClickTrampoline jsdocs. 2014-11-02 12:20:19 +00:00
Richard Davey
21a47faaed Merge pull request #1282 from pnstickne/wip-trampoline-click
Click Trampolines - support to trampoline pointer events into 'click' events
2014-11-02 12:15:37 +00:00
Richard Davey
5a23b77ec9 Merge pull request #1257 from pnstickne/wip-1191
Input "enabled/disabled" API and documentation consistency updates
2014-11-02 12:12:19 +00:00
photonstorm
e57c700816 The Gamepad.addCallbacks context parameter was never actually remembered, causing the callbacks to run in the wrong context (thanks @englercj #1285) 2014-11-02 11:04:02 +00:00
Paul
2f460aaf8a Browser incompatibility fix - MAX_SAFE_INTEGER
- Number.MAX_SAFE_INTEGER is only defined in ES6 and not currently cross-browser
2014-11-01 09:50:28 -07:00
Paul
5ec14929de Input - Minor Pointer refactor and documentation updates
- `pointerN` are aliases to backed `pointers[N-1]` array.
  This simplifies (and increases the efficiency of) looping through all the pointers when applicable; also eliminates pointer-existance checks
  Removes various hard-coded limits (added MAX_POINTERS); changed `maxPointers` default
- Removed some special-casing from cases where it did not matter
- Removed `=== false/true`, `==` usage for consistency, changed missing value check to `typeof`, etc.
- Updated documentation for specificty; added `@public\@protected`
- `@deprecated` currentPointers due to odd set pattern; `totalCurrentPointers` is more appropriate.
2014-11-01 09:45:12 -07:00
Paul
31061775d7 Pointe - removed extra whitespace 2014-11-01 01:25:01 -07:00
Paul
14002ca02d Pointer - minor documentation update for click trampolines 2014-11-01 01:11:26 -07:00
Paul
3005419435 Click Trampolines - support to trampoline pointer events into 'click' events
- This is needed to support Fullscreen on IE11 because IE only trusts 'click' events for this operation; click trampolines as a general solution, although they are only required in some "special" cases.
2014-11-01 01:04:17 -07:00
Paul
136af47064 Merge remote-tracking branch 'upstream/dev' into wip-1246b 2014-10-29 18:09:04 -07:00
Paul
5d04c62b33 Button - bug fixes, issue #1246
- Fix incorrect passing of "was clicked" to processInteractiveObjects
  - Button would not return to Over/Out state because of strict too check to catch `undefined`
  - Removed [undocumented] property usage from processInteractiveObjects and slight reformatting
  - Update Button state frames/sounds to remove duplication
  - Updated documentation in Button for consistency
2014-10-28 23:26:35 -07:00