Commit graph

152 commits

Author SHA1 Message Date
Samuel Hodge
a53676a924 Added new format for polygon points 2016-02-26 14:56:25 -05:00
photonstorm
11fa0c2690 Docs fix #2310 2016-02-02 16:19:09 +00:00
Richard Davey
fc8bff7b9e jshint fix. 2015-08-07 01:41:59 +01:00
Richard Davey
7588e123c7 Line.centerOn will position the Line so that its midpoint lays on the coordinates given. 2015-08-07 01:40:37 +01:00
Richard Davey
614b84e2ea * Line.rotateAround allows you to rotate a Line around the given coordinates (in world space)
* Point.rotate uses a faster and simpler rotation function when no distance argument is specified.
* Line.rotate used a calculation method which resulted in the line growing (or shrinking) in length over time, the more it was rotated. The new method never changes the lines length.
2015-08-07 01:35:31 +01:00
photonstorm
8e7b717a50 Line.midPoint will return a Point object where the x and y values correspond to the center (or midpoint) of the Line segment. 2015-08-06 17:10:39 +01:00
photonstorm
858ad51610 Phaser 2.4 release. 2015-07-22 15:31:30 +01:00
photonstorm
f15fe6706c All undefined argument checks were changed from if (typeof x === 'undefined') to if (x === undefined) removing the typeof check and saving some bytes across the codebase in the process. 2015-07-22 10:37:15 +01:00
photonstorm
732b80813e Line.rotate allows you to rotate a line by the given amount around its center point. 2015-06-13 05:20:43 +01:00
photonstorm
5f9bff0e8b Clarified the documentation for Point.rotate and fixed all the examples. 2015-06-13 05:02:07 +01:00
photonstorm
9e78cd1d7a Rectangle.random will return a uniformly distributed random point from anywhere within the rectangle. 2015-06-13 04:18:50 +01:00
photonstorm
77e7b2af9b Ellipse.random will return a uniformly distributed random point from anywhere within the ellipse. 2015-06-13 03:46:20 +01:00
photonstorm
3daea179fb Line.random will return a random point from anywhere on the Line segment. 2015-06-13 03:04:02 +01:00
photonstorm
9212c01dae Returns a random point from anywhere within this circle. 2015-06-12 19:15:56 +01:00
photonstorm
681d8679e7 Rectangle.resize allows you to resize a Rectangle to the new given dimensions without altering its position. 2015-06-11 06:01:29 +01:00
luckylooke
1939efd1c1 Copypaste typo
`Point.setTo(2, 2)` to `Point.set(2, 2)`
2015-05-20 14:21:35 +02:00
photonstorm
7b938f396e Rectangle.bottomLeft has been added (thanks @mattmogford #1788) 2015-05-12 13:03:26 +01:00
photonstorm
da0bd86c26 Rectangle.ceil runs Math.ceil() on both the x and y values of the Rectangle.
Rectangle.ceilAll runs Math.ceil() on the x, y, width and height values of the Rectangle.
2015-04-29 13:13:11 +01:00
photonstorm
8144c4910e jshint fixes. 2015-04-17 03:23:40 +01:00
photonstorm
1d8f88173d Phaser.Matrix.clone allows you to clone the Matrix to a new object, or copy its values into the given Matrix.
Phaser.Matrix.copyFrom and copyTo allow you to copy Matrix values from and to other Matrix  objects.

Phaser.Matrix.setTo allows you to set all properties of a Matrix in a single call.

The Phaser.Matrix constructor now allows you to optionally set all Matrix properties on instantiation.
2015-04-17 03:19:28 +01:00
photonstorm
67039df214 jsdoc fixes. 2015-03-27 10:47:25 +00:00
photonstorm
93ed950f89 Small geom tidy-up. 2015-03-25 11:04:31 +00:00
photonstorm
a69e53f901 Copyright date change. 2015-02-25 03:36:23 +00:00
photonstorm
eba1743404 jshint fixes. 2015-02-18 10:25:27 +00:00
photonstorm
f47fb7a7c7 jshint fixes. 2015-02-17 18:16:12 +00:00
photonstorm
819826ce08 Added Polygon.flatten and Polygon.toNumberArray.
Fixed Graphics.lineTo if no moveTo has been specified.
Fixed Graphics.drawShape if a mixed-type Polygon has been given.
2015-02-17 18:03:15 +00:00
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