Commit graph

1770 commits

Author SHA1 Message Date
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
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
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
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
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
Paul
d72d4c41dc ScaleManger - better FS init, documentation
- Added `onFullScreenInit` signal which is the correct place for a client
  to alter the FS target element, such as to set a background color or add
  a CSS class.

- Increased documentation overview and specificity including expected
  Parent behavior, sizing calculations, and when `refresh` may be required.

- Grouped documentation for scale modes (in 'scaleMode')

- Separated out internal/deprecated `setScreenSize` method from
  `updateLayout`.

There are no known breaking changes.
2014-11-16 00:34:26 -08:00
photonstorm
8622d91dea Pixi update. 2014-11-15 19:53:38 +00:00
photonstorm
02665076e6 Docs updates. 2014-11-15 19:50:03 +00:00
Richard Davey
497a9ecd70 Merge pull request #1328 from pnstickne/wip-device-to-1
Phaser.Device - inverted from Game
2014-11-14 18:34:38 +00:00
Richard Davey
cbaa36fdd6 Merge pull request #1291 from spayton/dev
Groups always had zero z index
2014-11-14 18:21:08 +00:00
Lewis Lane
671d0072da Ensured removeFrom also removes from the _add array 2014-11-14 16:41:14 +00:00
photonstorm
d8d2ebdb31 Phaser 2.2.0 - Release Candidate 6. 2014-11-14 08:16:55 +00:00
Paul
fb8917658f Phaser.Device - quibbles
- Removed useless arguments
2014-11-13 19:31:35 -08:00
Paul
599479dfdf Phaser.Device - inverted from Game
The only known breaking change is if user-code relied on `device.game` or
manually called `checkFullScreenSupport`, as both have been removed.

- Phaser.Device is now a singleton object that does not belong to a
  particular game. The only thing that it belongs to is the window/host
  context.
  - `game.device` (shared between all games) and `Phaser.Device` are the
    same object.
  - There is no more `Device#game` property.

- The specific device-ready detection is moved out of Game into the Device
  code
  - It is possible for multiple Games (or even non-Games) to use
    `Device.whenReady`.
  - Initialization is done immediately upon device-ready; there is an
    onInitialized signal that is dispatched that can be subscribed to
    extend the default initialization.

- The fullscreen-detection code (that was the only dependent of game) now
  uses an new element.

- Updated jsdoc documentation
2014-11-13 18:21:28 -08: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
Paul
794c9f65fe ArrayList/LinkedList - moved from core to utils
- ArrayList is also renamed to ArraySet to better reflect the nature
2014-11-13 00:59:42 -08:00
Sean
ef49f9bede Modify value of PIXI.scaleMode.DEFAULT instead of PIXI.scaleMode.LINEAR since LINEAR and NEAREST are constants 2014-11-13 15:01:44 +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
photonstorm
497b00d781 Tidying up a little. 2014-11-13 00:27:47 +00:00
photonstorm
b287b9dbab Added missing docs. 2014-11-13 00:27:26 +00:00
photonstorm
e7356fc575 Pixi 2.1.1 merge. 2014-11-12 22:38:51 +00:00
Richard Davey
7366854f9b Merge pull request #1307 from pnstickne/wip-math-util-cleanup
Math/Utils - various cleanup and deprecations/moves
2014-11-12 22:21:34 +00:00
Richard Davey
824c0e2be7 Merge pull request #1318 from pnstickne/wip-wheel-scroll-updates
Mouse Scroll Events - added support for WheelEvent, fixes
2014-11-12 22:10:52 +00: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
Richard Davey
d786d4e455 Merge pull request #1317 from pjbaron/dev
prevent multiple catch-up frames which cause physics objects to 'tunnel'
2014-11-12 13:04:25 +00: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
Pete Baron
7bd0a8db71 Temporary fix to prevent huge numbers of catch-up frames happening all at once if the user navigates away from the game. Limits them to 3 now (which allows it to still detect and react to spiralling).
A proper fix involves putting the physics collision into the same update as the physics motion.
2014-11-13 00:00:13 +13:00
Richard Davey
26e74fef18 Merge pull request #1315 from pjbaron/dev
Minor logic fix and updateRender change
2014-11-12 09:18:36 +00:00
Richard Davey
b5ed3324b2 Merge pull request #1316 from pnstickne/wip-1306
ScaleManager - orientation updates/fixes
2014-11-12 09:17:47 +00:00
Paul
cf3bebd00c ScaleManager - orientation, minor 2014-11-11 23:02:43 -08:00
Paul
59dddece0b ScaleManager - orientation
- A few minor quibbles
2014-11-11 22:53:00 -08:00
Paul
e36027f599 ScaleManager - orientation
- Removed some "debug" logging, oops.

- And a dab of documentation updates while I'm at it..
2014-11-11 22:41:53 -08:00
Paul
0fd6a4a5b6 ScaleManager - orientation
- FIX #1306, hopefully, where an orientation change did not correclty
  cause a screen/layout update.

- FIX/CHANGE where Paused games would not update the scale
  - The new behavior "runs" the ScaleManager in a paused state via
    `pauseUpdate`; a User paused game will now correctly track scale
    changes. This is closer to the 2.1.3 behavior in some cases, such as
    window resizing, when the updates were done in the DOM event.
  - This change also affects device orientation change monitoring and
    events, which are also deferred to the update cycle
  - The update cycle is set to the maximum and is still dependent on the
    RAF / primary loop running, so it should not affect background
    apps/tabs

- FIX/CHANGE New better backoff timing; ie. continuous window resizing is
  limited to ~10 fps update calculations. This makes it much harder to
  crash Chrome by rapidly and continously resizing the window.  Also
  increases the scaling from 0..10..20..40 to 0..25..50..100.

- FIX an issue where the incorrect orientation was "one frame behind" the
  scaling.

- UPDATE The contract for when the change orientation events occurs is
  better defined - it now always happens in the update context as with
  game sizing.

- UPDATE Unifies orientation-change code / handling and duplicate.

- CHANGE Added DOM.getScreenOrientation which obtains the orientation via
  the Device Orientation API (WD) and provides comprehensive fallbacks
  - This should cover all modern browsers
  - FIX: Orientation on desktops now computed as screen ratio by default
    which fixesi the false-portrait chain/detection when the page is made
    more narrow than it is tall.
  - CHANGE/FIX: window.orientation is now only used as fallback, if
    requested (due to device differences). It may be appropriate to enable
    this (via `scale.compatibility` on boot, for instance) in some
    environments.

Signed-off-by: Paul <pstickne@gmail.com>
2014-11-11 22:30:07 -08:00
Paul
ae6cba5928 Math/Utils - various cleanup and deprecations/moves
- FIX/CHANGE - Math.wrapAngle over radians; it would convert radians to degrees
  - No internal code relies on unexpected the radians-to-degrees behavior

- Moved additional methods over to ArrayUtils, only marked deprecated in Math

- Removed some private annotations; e.g. linear / factorial public, but bernstein / catmullRom still protected

- Marked additional duplicates deprecated; e.g linearValue, angleLimit

- Documentation updates

- Fixed some accidental "Utils.Arrays" usage (oops!)

- Bumped deprecations from 2.1.4 to 2.2.0
2014-11-11 21:28:25 -08:00
Pete Baron
1c5a106b17 Modify updateRender call to use desiredFps rate when spiralling is detected. 2014-11-12 15:01:09 +13:00
Pete Baron
bc70ce74b5 Minor logic fix to nested loop counters. 2014-11-12 15:00:26 +13:00
Pete Baron
4d0fcd2165 Paste over to fix unwanted HEAD entries 2014-11-12 13:26:12 +13:00
Pete Baron
1c7059ea6c Merge remote-tracking branch 'phaser-github/dev' into dev
Conflicts:
	src/animation/FrameData.js
	src/core/Game.js
	src/particles/arcade/Emitter.js
	src/time/Time.js
	src/tween/Tween.js
2014-11-12 13:03:52 +13:00
photonstorm
1352b526c7 Merged final Pixi v2.1.0 release. 2014-11-11 23:24:50 +00:00
Pete Baron
af09290cbf Add getObjectsAtLocation method in Arcade physics. 2014-11-12 11:24:38 +13:00
photonstorm
a4e049ac63 RC3 Build files. 2014-11-11 14:31:31 +00:00
photonstorm
da031d8bbb Phaser games should now work again from the CocoonJS Launcher. 2014-11-11 14:31:20 +00:00