Commit graph

59 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
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
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
photonstorm
5d84f38f6e Device.canPlayAudio now supports the opus files directly, as well as opus encoded audio stored in ogg containers (#1232) 2014-10-13 13:52:41 +01:00
photonstorm
e5eea56c9b jsdoc updates. 2014-09-16 19:44:04 +01:00
photonstorm
4d0cae0e2d jshint fixes for CocoonJS.App and continuing work on the new ScaleManager. 2014-08-31 10:17:02 +01:00
Dan Cox
3f7f6fac2c Adjustment for JSLint 2014-08-29 22:33:33 -04:00
Dan Cox
c1872356fe Detect CocoonJS.App
There's a bit of a story behind this, but I'll try to keep it short.

While I've been working on a patch to detect Cordova's 'pause' and 'resume' events for Phaser.Stage's checkVisibilityChange(), I came across this [thread] (http://www.html5gamedevs.com/topic/8834-cocoonjs-pause-game-on-app-switch/) over on the forum. My hope, at the time, was that someone else would come along and write this patch and I could use their work to finish my own code. But, since that hasn't happened yet (and might never), I'm sending in this PR first for the check that establishes a 'game.device.cocoonJSApp' boolean that I plan to use later.
2014-08-29 20:58:19 -04:00
Richard Davey
3a9f869882 Merge pull request #1129 from videlais/patch-2
Device detection of Node-Webkit
2014-08-28 04:37:58 +01:00
Dan Cox
a0840274f7 Tests for both Node and Node-Webkit 2014-08-27 22:00:14 -04:00
Richard Davey
ee579c2b0d Merge pull request #989 from lucbloom/android-stock-browser
Android stock browser check
2014-08-28 02:01:25 +01:00
Dan Cox
2065c3a77a Fixed trailing whitespace 2014-08-21 20:37:27 -04:00
Dan Cox
fa0fa860c0 Device detection of Node-Webkit
Because the user-agent string can be (easily changed) [https://github.com/rogerwang/node-webkit/wiki/Manifest-format#user-agent], one of the few ways to detect Node-Webkit is to look for the 'process' object and require() function. If they exist, Node support was enabled and 'process.version' will have the version of Node.js used to create the project.

However, if Node is (disabled) [https://github.com/rogerwang/node-webkit/wiki/Manifest-format#nodejs], the 'process' object won't exist and the project will be executed as if it was in a single instance of a browser anyway.
2014-08-21 17:37:51 -04:00
Dan Cox
d54725212f Device detection of Apache Cordova
Simple check if "window.cordova" is defined for device detection of Phaser running (most likely) under Apache Cordova.
2014-08-11 12:33:06 -04:00
Alvin
79166bb268 Fixed #1078 chromeOS no belongs to desktops 2014-08-06 14:08:38 +02:00
Richard Davey
0c4c43be1e Merge pull request #1080 from lucbloom/detect-kindle
Added a UA string test for Kindle
2014-08-03 11:00:40 +01:00
Luc Bloom
84cf835e83 Added a UA string test for Kindle
Also added PS Vita so the “silk” detection doesn’t confuse that one.
2014-07-31 15:40:59 +02:00
Txus Ordorika
b952884d9d Fix for scale issues in CocoonJS using webgl renderer and screencanvas 2014-07-23 17:16:25 +02:00
Luc Bloom
4183237fb3 Android stock browser check
This is a class-static function of Phaser.Device to check wether we’re
running on an Android Stock browser. Autors might want to scale down on
effects and switch to the CANVAS rendering method on those devices.
Usage: var defaultRenderingMode = Phaser.Device.isAndroidStockBrowser()
? Phaser.CANVAS : Phaser.AUTO;
2014-07-10 18:00:29 +02:00
photonstorm
757136bf4f Device.mobileSafari was no longer detecting Mobile Safari, now fixed (thanks @Zammy, #927) 2014-07-01 19:19:49 +01:00
photonstorm
db22b019be Swapped the ScaleManager creation order in Game, so both start and stop fullScreen requests work now. 2014-07-01 16:50:33 +01:00
photonstorm
d2fc42520b stopFullScreen has been changed to run against document instead of the canvas since the cancelFullScreen method is created on the document (thanks @j0hnskot, #863) 2014-07-01 15:46:32 +01:00
Joe Flowers
821da772aa Updates Silk UA test to avoid Safari conflict 2014-05-08 00:28:27 -04:00
photonstorm
11ca2deaf6 Finally - fully working setHSL and shiftHSL. 2014-04-25 02:45:35 +01:00
photonstorm
c88fa2bd91 Loads of BitmapData updates. More details soon. 2014-04-24 03:49:49 +01:00
photonstorm
0f1e0a3d4e Updated the Device little / big endianess check. 2014-04-23 23:35:36 +01:00
photonstorm
055cb8058d Device.crosswalk detects if your game is running under Intels Crosswalk XDK. 2014-04-14 16:40:14 +01:00
Christian Wesselhoeft
61f18b675c Trim trailing whitespace. 2014-03-25 14:56:04 -07:00
photonstorm
a7ff5f884c Added basic Webcam plugin.
Added Device.getUserMedia detection.
Updated config.php so you can toggle physics engines on/off via flags.
Updated Gruntfile.js so it builds a Phaser + Pixi but no Physics libs.
2014-03-18 15:14:28 +00:00
photonstorm
3ebd0d9303 Updated Device.isConsoleOpen as it no longer works in Chrome. Revised code and documentation accordingly (fix #593)
Revised p2 clear process.
2014-03-17 19:39:56 +00:00
photonstorm
db88bd2f22 Fixed the IE11 version check (fixes #579) 2014-03-16 00:39:42 +00:00
photonstorm
7ff4e51ab1 Time.reset does a removeAll on any Timers.
Device no longer things a Windows Phone or Windows Tablet are desktop devices (thanks wombatbuddy, fixes #506)
2014-03-02 10:56:39 +00:00
photonstorm
34ee2b0b20 Fixed issue with CocoonJS detection in Device.
Fixed docs issue in Tilemap.
Created landscape pointer test, confirmed working fine (issue #276)
2014-02-28 03:09:04 +00:00
photonstorm
db2e3733c2 Fullscreen mode now uses window.outerWidth/Height when using EXACT_FIT as the scale mode, which fixes input coordinate errors (fixes #232)
Fullscreen mode now works in Internet Explorer and uses the new fullscreen non-prefix call.
2014-02-25 21:16:56 +00:00
photonstorm
d057a9fe11 Device, Canvas and GamePad classes all updated for better CocoonJS support (thanks Videlais) 2014-02-19 02:45:42 +00:00
photonstorm
d2366d5fa5 Fix for issue #376 - IE11 didn't populate the Device.ieVersion value. Now extracted from Trident revision, but still use Device.trident instead for IE11+ checks. 2014-02-10 02:23:45 +00:00
photonstorm
0896c2fac7 Updating copyright year and README. 2014-02-05 16:54:59 +00:00
photonstorm
35e61172e1 Device.quirksMode is a boolean that informs you if the page is in strict (false) or quirks (true) mode.
Canvas.getOffset now runs a strict/quirks check and uses document.documentElement when calculating scrollTop and scrollLeft to avoid Chrome console warnings.
The Time class now has three new methods: addEvent, repeatEvent and loopEvent. See the new Timer examples to show how to use them.
2014-01-08 11:21:48 +00:00
photonstorm
ce4cf531d4 Added class constructors, fixed Stripshader, added relative Tween example and updated Tween source. 2013-12-30 16:54:00 +00:00
photonstorm
167a498a5e Phaser.Game constructor can now be passed a single object containing game settings + Stage settings, useful for advanced configurations. 2013-12-24 03:18:55 +00:00
photonstorm
896e9af9f5 TilemapLayers now render tiles correctly, with our without debugging overlay. Collision working well across single and index ranges. 2013-12-17 05:07:00 +00:00
photonstorm
a361a18616 Updated IE11 check, forces IE11 to use Canvas renderer even in AUTO mode. 2013-12-13 14:04:14 +00:00
photonstorm
2fc5c89c1e Preparing to extend the Loader to handle script loading. 2013-11-26 17:14:21 +00:00
photonstorm
141337bed9 Heavily optimised PixiShader. 2013-11-26 05:13:56 +00:00
photonstorm
299115ca5d The entire Phaser library has been updated to match the new JSHint configuration. 2013-11-25 04:40:04 +00:00
photonstorm
e620c99479 ShaderToy convertor up and working, lots of shaders being turned into Pixi filters :) 2013-11-20 02:28:28 +00:00
photonstorm
b63bd14172 ScaleMode fix, BitmapData change and Device updates. 2013-11-18 20:27:40 +00:00
photonstorm
9261160571 1.1.1 release with fix for Phaser.AUTO and a new text example. 2013-10-26 19:14:13 +01:00
photonstorm
94c7c57e1c Fixed WebGL detection and code colour on Firefox. 2013-10-23 15:13:21 +01:00