Commit graph

126 commits

Author SHA1 Message Date
photonstorm
97ebfce7a6 Fixed Matrix.apply. 2015-02-17 18:02:40 +00:00
photonstorm
e100f2f528 Added in type properties. 2015-02-17 16:38:07 +00:00
photonstorm
fa7fee99b6 Moved Matrix and RoundedRectangle into Phaser geom structure. 2015-02-17 15:49:30 +00:00
photonstorm
b68c3071a6 Phaser.Ellipse.contains is now working again (thanks @spayton) 2015-02-11 18:51:35 +00:00
photonstorm
689501c15c Phaser.Point.angleSq removed. It didn't work so any code relying on it would be broken, and it's unclear what it was meant for (thanks @nextht #1396) 2015-01-05 13:00:07 +00:00
photonstorm
fc63d0a33a Ellipse.right and Ellipse.bottom setters fixed (thanks @nextht #1397)
Fixed double Ellipse.getBounds definition (thanks @nextht #1397)
2015-01-05 12:36:35 +00:00
Richard Davey
cf83e14e8d Updated Line.reflect to remove intersects check.
Line.normalAngle gets the angle of the line normal in radians.
2015-01-04 12:38:40 +00:00
photonstorm
af15b9b4e7 Line.reflect will calculate the reflected, or outgoing angle of the line and a given line if they intersect. This can be used for Body vs. Line collision responses and rebounds.
Line.normalX and Line.normalY contain the x and y components of the left-hand normal of the line.
Line.fromAngle will sets this line to start at the given `x` and `y` coordinates and for the segment to extend at `angle` for the given `length`.
2015-01-04 05:11:19 +00:00
photonstorm
f23c0aa24b Removed redundant tolerance parameter from Rectangle.intersects (thanks @toolness #1463) 2014-12-17 13:25:21 +00: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
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
Paul
a6d2da2a8a Math/Utils - various cleanup and deprecations/moves
There are no known breaking changes.

- Timer
  - Uses standard Math.min/Math.max (it's better 2, 3 items).

- Math
  - Updated documentation
  - Marked various Math functions as deprecated, proxying as appropriate
    - Array-based functions -> ArrayUtils
    - RNG-based functions -> Utils
    - Updated core-usage
    - floor/ceil should not be used (alternatives provided)
  - Altered for some equivalencies
  - Also fixes some assorted issues
  - Marked a few internal functions as private

- Utils
  - Moved polyfills to their own file for better visibility
  - Moved array functions to ArrayUtils and marked proxies as deprecated

- Created Phaser.ArrayUtils for array-related functions

- polyfills moved to their own file
  - Functions given function names
  - Added Math.trunc
2014-11-09 16:17:18 -08:00
Paul
24c4cf2be3 Merge remote-tracking branch 'upstream/dev' into wip-scalemanager
Conflicts:
	src/core/ScaleManager.js
2014-11-08 19:29:47 -08:00
Paul
f5b9d4067e ScaleManager: additional cleanup
- Added `compatibility` settings
  - CHANGE (2.1.2-4): moved `supportsFullScreen` and `noMargins` into it
  - Added additional properties for greater control and up-front settings.
    - `scrollTo`: where the browser will scrollTo, if anywhere
    - `forceMinimumDocumentHeight`: apply document element style?
    - `allowShowAllExpand`: allow SHOW_ALL to try to expand? (It already
      could, this allows configuration.)

- Removed `windowConstraints.top/left`. This may be a feature in the
  future, but scrubbed for now.

- Added `USER_SCALE` scale mode. This is like NO_SCALE but it scales off
  of a user-specified scale factor, as set by `setUserScale`. This is
  marked as "experimental" as the exactly semantics of non-adjusting modes
  (e.g. NO_SCALE and USER_SCALE) wrt. Canvas and "maximum" size clamps
  need to be re-examined.

- FIX: `onSizeChange` now works as documented, which means it is also
  fired if the game size changes even though the game canvas size does
  not.

- CHANGE (no known breaking): `margins` is now non-Point/non-Rectangle
  that uses top/left/bottom/right properties (any quasi-updated x/y). This
  is to get around the issue that Rectangle is only designed for positive
  width/height cases.

- Cleaned up property access / quotes for consistency

- Various documentation cleanup and consistency

- Fixed issue with not clearing an unparented `_createdFullScreenTarget`

- Added Phaser.Rectangle.sameDimensions which does a strict equality check
  over the `width` and `height` properties of two objects, perhaps
  Rectangles.
2014-11-08 18:17:30 -08:00
photonstorm
d9c4890882 Point.floor will Math.floor both the x and y values of the Point.
Point.ceil will Math.ceil both the `x` and `y` values of the Point.
2014-11-04 23:57:21 +00:00
photonstorm
98993365d4 Small refactor to pass jshint. 2014-10-29 07:46:56 +00:00
photonstorm
ce32d492af Phaser.Polygon has been refactored to address some Pixi v2 migration issues (thanks @pnstickne for the original implementation #1267)
Polygon.area is now only calculated when the Polygon points list is modified, rather than on every call.

Phaser.Polygon can now accept the points list in a variety of formats: Arrays of Points, numbers, objects with public x/y properties or any combination of, or as a parameter list (thanks @pnstickne for the original implementation #1267)

Polygon.contains now correctly calculates the result  (thanks @pnstickne @BurnedToast #1267)
2014-10-29 07:46:56 +00:00
Sebastian Bombitzky
1e3c7cfee7 Fixed return value of Polygon.contains
Polygon.contains was toggling the return value on each valid hit.
2014-10-28 14:04:33 +01:00
photonstorm
e14c6efbc3 Updated to support new Pixi style of points. 2014-10-22 23:52:46 +01:00
photonstorm
01a068f53c Rectangle.scale allows you to scale the width and height of a Rectangle. 2014-10-21 00:25:54 +01:00
photonstorm
1a357e18c8 Rectangle contains updates. 2014-10-20 14:28:09 +01:00
photonstorm
ac27f12c95 Fixes for Pixi update WebGL UV calls. 2014-10-11 04:18:42 +01:00
photonstorm
ab78710daa BitmapData.textureLine takes a Phaser.Line object and an image in the image cache. It then accurately draws the image as a repeating texture for the full length of the line. 2014-10-03 02:21:09 +01:00
Richard Davey
abe6f5ace2 Point.parse updated to allow either/or x/y setting and default values.
Point.parse will return a new Point object based on the x and y properties of the object given to Point.parse (thanks @codevinsky #1198)
2014-09-23 22:23:01 +01:00
Richard Davey
d7d69947fb Merge pull request #1198 from codevinsky/feature/point-parse
Phaser.Point.parse
2014-09-23 22:15:51 +01:00
Richard Davey
eb72e4c581 Fixing jsdoc headers. 2014-09-21 10:28:04 +01:00
Jeremy Dowell
ab9da10999 added: Rectangle.aabb
* Calculates the Axis Aligned Bounding Box (or aabb) from an array of points.
*
* @method Phaser.Rectangle#aabb
* @param {Phaser.Point[]} points - The array of one or more points.
* @param {Phaser.Rectangle} [out] - Optional Rectangle to store the value in, if not supplied a new Rectangle object will be created.
* @return {Phaser.Rectangle} The new Rectangle object.
* @static
2014-09-18 15:16:33 -05:00
Jeremy Dowell
29dd09fdf6 added: Phaser.Point.parse
static method that will take an object of any kind and return a new point based on the x & y properties of that object.

optional x & y property names can also be supplied
2014-09-17 14:23:28 -05:00
photonstorm
20551f9129 Lots of jsdocs fixes ready for the new doc generator. 2014-09-16 17:35:08 +01:00
Federico Omoto
0bdb0bdde5 Unnecessary "if" in Line.fromSprite method 2014-09-09 17:24:36 -03:00
Federico Omoto
471c2f444b Documentation fixes 2014-09-09 16:22:59 -03:00
photonstorm
4903e47a98 Rectangle.topRight returns a Point object that represents the top-right coordinate of the Rectangle. 2014-09-05 15:45:47 +01:00
photonstorm
cb14fd1c01 Rectangle.centerOn(x,y) allows you to quickly center a Rectangle on the given coordinates. 2014-09-05 04:13:21 +01:00
Richard Davey
168ce82fe8 Rectangle.bottom setter swapped the order of the calculation (thanks @JakeCoxon #1165) 2014-09-03 22:42:24 +01:00
Richard Davey
e8ca3a8d7b Merge pull request #1130 from beeglebug/feature/clone-consistency
Improved consistency of clone methods on geometry classes
2014-08-28 01:40:51 +01:00
Richard Davey
cc1c7948f3 Merge pull request #1125 from beeglebug/fix/#1095-rectangle-contains-rect
swapped argument order of Rectangle.containsRect - fixes #1095
2014-08-28 01:33:33 +01:00
Stuart Lee
8ef5c5e0de fixed arguments 2014-08-22 16:33:42 +01:00
beeglebug
bfd0b77fd4 typo 2014-08-21 22:50:09 +01:00
beeglebug
c85f4c04b0 may as well use the setter logic, saves duplicating code 2014-08-21 22:46:44 +01:00
beeglebug
2faab9b516 added clone and setTo functions 2014-08-21 22:45:10 +01:00
beeglebug
7ae5657113 extra null check on output to match rectangle 2014-08-21 22:44:40 +01:00
beeglebug
5930a90546 added clone function to Line 2014-08-21 22:36:40 +01:00
beeglebug
8c0a400d65 rename out to output to match others 2014-08-21 22:36:24 +01:00
beeglebug
a435191fd0 swapped argument order of Rectangle.containsRect - fixes #1095 2014-08-21 20:59:08 +01:00
Sandeep Nambiar
b25e2bd782 Sign Error 2014-08-13 05:49:39 +05:30
Sandeep Nambiar
daade10ecc Should fix the Error in rotation 2014-08-13 05:19:21 +05:30
photonstorm
4a429c3c1f Added null check to Rectangle.clone and size. 2014-07-10 14:46:09 +01:00
photonstorm
494c33a9f4 Rectangle.randomX will return a random value located within the horizontal bounds of the Rectangle.
Rectangle.randomY will return a random value located within the vertical bounds of the Rectangle.
2014-07-09 11:34:18 +01:00
photonstorm
5ee9245acf Rectangle.right when set would set the new width to be Rectangle.x + the value given. However the value given should be a new Right coordinate, so the width calculation has been adjusted to compensate (thanks @cryptonomicon, #849) 2014-07-02 05:37:12 +01:00
photonstorm
c71ca3b849 Updated some Rectangle docs. 2014-07-01 22:10:13 +01:00