diff --git a/Docs/Documentation Checklist.xlsx b/Docs/Documentation Checklist.xlsx
index 09a7b447..292dcd33 100644
Binary files a/Docs/Documentation Checklist.xlsx and b/Docs/Documentation Checklist.xlsx differ
diff --git a/examples/camera/follow styles.php b/examples/camera/follow styles.php
new file mode 100644
index 00000000..dac30a44
--- /dev/null
+++ b/examples/camera/follow styles.php
@@ -0,0 +1,139 @@
+
+
+
+
+
+
diff --git a/examples/camera/moving the game camera.php b/examples/camera/moving the game camera.php
index d1dcb921..28edd32e 100644
--- a/examples/camera/moving the game camera.php
+++ b/examples/camera/moving the game camera.php
@@ -21,13 +21,11 @@
//setting the size of the game world larger than the tilemap's size
game.world.setSize(2000,2000);
- // game.camera.width=150;
- // game.camera.height=150;
-
game.stage.backgroundColor = '#255d3b';
// adding the tilemap
- game.add.tilemap(0, 168, 'snes');
+ game.add.tilemap(0, 150, 'snes');
+
}
diff --git a/examples/camera/world sprite.php b/examples/camera/world sprite.php
new file mode 100644
index 00000000..56244285
--- /dev/null
+++ b/examples/camera/world sprite.php
@@ -0,0 +1,70 @@
+
+
+
+
+
+
diff --git a/examples/display/render crisp.php b/examples/display/render crisp.php
index e5e1917a..90e337bb 100644
--- a/examples/display/render crisp.php
+++ b/examples/display/render crisp.php
@@ -7,7 +7,7 @@
(function () {
- var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create });
+ var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create });
function preload() {
@@ -21,17 +21,21 @@
function create() {
// For browsers that support it, this keeps our pixel art looking crisp
- //Phaser.Canvas.setSmoothingEnabled(game.stage.canvas.context, false);
+ // This only works when you use Phaser.CANVAS as the renderer
+ Phaser.Canvas.setSmoothingEnabled(game.context, false);
boss = game.add.sprite(game.world.centerX, game.world.centerY, 'boss');
boss.anchor.setTo(0.5, 0.5);
- // Zoom in each time we press it
+
+ // Zoom in each time we press the button
button = game.add.button(32, 32, 'button', clickedIt, this, 2, 1, 0);
}
function clickedIt() {
+
boss.scale.x += 0.5;
boss.scale.y += 0.5;
+
}
})();
diff --git a/src/core/Camera.js b/src/core/Camera.js
index b738e5f5..e5da9e26 100644
--- a/src/core/Camera.js
+++ b/src/core/Camera.js
@@ -1,65 +1,107 @@
/**
-* Phaser - Camera
+* @author Richard Davey
+* @copyright 2013 Photon Storm Ltd.
+* @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License
+* @module Phaser.Camera
+*/
+
+/**
*
* A Camera is your view into the game world. It has a position and size and renders only those objects within its field of view.
* The game automatically creates a single Stage sized camera on boot. Move the camera around the world with Phaser.Camera.x/y
*
-* @class Phaser.Camera
+* @class Camera
* @constructor
-* @param game {Phaser.Game} game reference to the currently running game.
-* @param id {number} not being used at the moment, will be when Phaser supports multiple camera
-* @param x {number} position of the camera on the X axis
-* @param y {number} position of the camera on the Y axis
-* @param width {number} the width of the view rectangle
-* @param height {number} the height of the view rectangle
+* @param {Phaser.Game} game game reference to the currently running game.
+* @param {number} id not being used at the moment, will be when Phaser supports multiple camera
+* @param {number} x position of the camera on the X axis
+* @param {number} y position of the camera on the Y axis
+* @param {number} width the width of the view rectangle
+* @param {number} height the height of the view rectangle
*/
Phaser.Camera = function (game, id, x, y, width, height) {
+ /**
+ * A reference to the currently running Game.
+ * @property game
+ * @public
+ * @type {Phaser.Game}
+ */
this.game = game;
+
+ /**
+ * A reference to the game world
+ * @property world
+ * @public
+ * @type {Phaser.World}
+ */
this.world = game.world;
- this.id = 0; // reserved for future multiple camera set-ups
-
- // The view into the world we wish to render (by default the game dimensions)
- // The x/y values are in world coordinates, not screen coordinates, the width/height is how many pixels to render
- // Objects outside of this view are not rendered (unless set to ignore the Camera, i.e. UI?)
+
+ /**
+ * reserved for future multiple camera set-ups
+ * @property id
+ * @public
+ * @type {number}
+ */
+ this.id = 0;
/**
* Camera view.
- * @type {Rectangle}
+ * The view into the world we wish to render (by default the game dimensions)
+ * The x/y values are in world coordinates, not screen coordinates, the width/height is how many pixels to render
+ * Objects outside of this view are not rendered (unless set to ignore the Camera, i.e. UI?)
+ * @property view
+ * @public
+ * @type {Phaser.Rectangle}
*/
this.view = new Phaser.Rectangle(x, y, width, height);
/**
* Used by Sprites to work out Camera culling.
- * @type {Rectangle}
+ * @property screenView
+ * @public
+ * @type {Phaser.Rectangle}
*/
this.screenView = new Phaser.Rectangle(x, y, width, height);
/**
* Sprite moving inside this Rectangle will not cause camera moving.
- * @type {Rectangle}
+ * @property deadzone
+ * @type {Phaser.Rectangle}
*/
this.deadzone = null;
/**
* Whether this camera is visible or not. (default is true)
+ * @property visible
+ * @public
+ * @default true
* @type {bool}
*/
this.visible = true;
/**
* Whether this camera is flush with the World Bounds or not.
+ * @property atLimit
* @type {bool}
*/
this.atLimit = { x: false, y: false };
/**
* If the camera is tracking a Sprite, this is a reference to it, otherwise null
- * @type {Sprite}
+ * @property target
+ * @public
+ * @type {Phaser.Sprite}
*/
this.target = null;
+ /**
+ * Edge property
+ * @property edge
+ * @private
+ * @type {number}
+ */
this._edge = 0;
};
@@ -74,8 +116,9 @@ Phaser.Camera.prototype = {
/**
* Tells this camera which sprite to follow.
- * @param target {Sprite} The object you want the camera to track. Set to null to not follow anything.
- * @param [style] {number} Leverage one of the existing "deadzone" presets. If you use a custom deadzone, ignore this parameter and manually specify the deadzone after calling follow().
+ * @method follow
+ * @param {Phaser.Sprite} target The object you want the camera to track. Set to null to not follow anything.
+ * @param {number} [style] Leverage one of the existing "deadzone" presets. If you use a custom deadzone, ignore this parameter and manually specify the deadzone after calling follow().
*/
follow: function (target, style) {
@@ -112,9 +155,10 @@ Phaser.Camera.prototype = {
},
/**
- * Move the camera focus to this location instantly.
- * @param x {number} X position.
- * @param y {number} Y position.
+ * Move the camera focus to a location instantly.
+ * @method focusOnXY
+ * @param {number} x X position.
+ * @param {number} y Y position.
*/
focusOnXY: function (x, y) {
@@ -125,6 +169,7 @@ Phaser.Camera.prototype = {
/**
* Update focusing and scrolling.
+ * @method update
*/
update: function () {
@@ -172,6 +217,10 @@ Phaser.Camera.prototype = {
},
+ /**
+ * Method called to ensure the camera doesn't venture outside of the game world
+ * @method checkWorldBounds
+ */
checkWorldBounds: function () {
this.atLimit.x = false;
@@ -206,6 +255,14 @@ Phaser.Camera.prototype = {
},
+ /**
+ * A helper function to set both the X and Y properties of the camera at once
+ * without having to use game.camera.x and game.camera.y
+ *
+ * @method setPosition
+ * @param {number} x X position.
+ * @param {number} y Y position.
+ */
setPosition: function (x, y) {
this.view.x = x;
@@ -214,6 +271,13 @@ Phaser.Camera.prototype = {
},
+ /**
+ * Sets the size of the view rectangle given the width and height in parameters
+ *
+ * @method setSize
+ * @param {number} width The desired width.
+ * @param {number} height The desired height.
+ */
setSize: function (width, height) {
this.view.width = width;
@@ -225,10 +289,17 @@ Phaser.Camera.prototype = {
Object.defineProperty(Phaser.Camera.prototype, "x", {
+ /**
+ * @method x
+ * @return {Number} The x position
+ */
get: function () {
return this.view.x;
},
-
+ /**
+ * @method x
+ * @return {Number} Sets the camera's x position and clamp it if it's outside the world bounds
+ */
set: function (value) {
this.view.x = value;
this.checkWorldBounds();
@@ -238,10 +309,18 @@ Object.defineProperty(Phaser.Camera.prototype, "x", {
Object.defineProperty(Phaser.Camera.prototype, "y", {
+ /**
+ * @method y
+ * @return {Number} The y position
+ */
get: function () {
return this.view.y;
},
+ /**
+ * @method y
+ * @return {Number} Sets the camera's y position and clamp it if it's outside the world bounds
+ */
set: function (value) {
this.view.y = value;
this.checkWorldBounds();
@@ -251,10 +330,18 @@ Object.defineProperty(Phaser.Camera.prototype, "y", {
Object.defineProperty(Phaser.Camera.prototype, "width", {
+ /**
+ * @method width
+ * @return {Number} The width of the view rectangle, in pixels
+ */
get: function () {
return this.view.width;
},
+ /**
+ * @method width
+ * @return {Number} Sets the width of the view rectangle
+ */
set: function (value) {
this.view.width = value;
}
@@ -263,10 +350,18 @@ Object.defineProperty(Phaser.Camera.prototype, "width", {
Object.defineProperty(Phaser.Camera.prototype, "height", {
+ /**
+ * @method height
+ * @return {Number} The height of the view rectangle, in pixels
+ */
get: function () {
return this.view.height;
},
+ /**
+ * @method height
+ * @return {Number} Sets the height of the view rectangle
+ */
set: function (value) {
this.view.height = value;
}
diff --git a/src/core/Stage.js b/src/core/Stage.js
index 5a4e07e6..73ea9392 100644
--- a/src/core/Stage.js
+++ b/src/core/Stage.js
@@ -1,49 +1,97 @@
/**
- * Stage
- *
- * The Stage controls the canvas on which everything is displayed. It handles display within the browser,
- * focus handling, game resizing, scaling and the pause, boot and orientation screens.
- *
- * @package Phaser.Stage
- * @author Richard Davey
- * @copyright 2013 Photon Storm Ltd.
- * @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License
-
+* @author Richard Davey
+* @copyright 2013 Photon Storm Ltd.
+* @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License
+* @module Phaser.Stage
+*/
+/**
+*
+* The Stage controls the canvas on which everything is displayed. It handles display within the browser,
+* focus handling, game resizing, scaling and the pause, boot and orientation screens.
+*
* @class Stage
* @constructor
-* @param game {Phaser.Game} game reference to the currently running game.
-* @param width {number} width of the canvas element
-* @param height {number} height of the canvas element
+* @param {Phaser.Game} game Game reference to the currently running game.
+* @param {number} width Width of the canvas element
+* @param {number} height Height of the canvas element
*/
Phaser.Stage = function (game, width, height) {
-
+
+ /**
+ * A reference to the currently running Game.
+ * @property game
+ * @public
+ * @type {Phaser.Game}
+ */
this.game = game;
/**
* Background color of the stage (defaults to black). Set via the public backgroundColor property.
+ * @property _backgroundColor
+ * @private
* @type {string}
*/
this._backgroundColor = 'rgb(0,0,0)';
- // Get the offset values (for input and other things)
+ /**
+ * Get the offset values (for input and other things)
+ * @property offset
+ * @public
+ * @type {Phaser.Point}
+ */
this.offset = new Phaser.Point;
-
+
+ /**
+ * reference to the newly created