From e88c48641dc0a2ca079ec89bfddc68205242522e Mon Sep 17 00:00:00 2001 From: Sean Date: Sat, 4 May 2013 19:53:11 +0800 Subject: [PATCH] Finish document for AnimationManager, Tile, FrameData, BootScreen, PauseScreen. --- Phaser/AnimationManager.ts | 25 +++++++++++-------- Phaser/system/Tile.ts | 16 ++++++------- Phaser/system/animation/FrameData.ts | 36 ++++++++++++++-------------- Phaser/system/screens/BootScreen.ts | 5 ++-- Phaser/system/screens/PauseScreen.ts | 5 ++-- 5 files changed, 45 insertions(+), 42 deletions(-) diff --git a/Phaser/AnimationManager.ts b/Phaser/AnimationManager.ts index c2f166fa..00e297c0 100644 --- a/Phaser/AnimationManager.ts +++ b/Phaser/AnimationManager.ts @@ -18,10 +18,9 @@ module Phaser { /** * AnimationManager constructor - * * Create a new AnimationManager. * - * @param parent Owner sprite of this manager. + * @param parent {Sprite} Owner sprite of this manager. */ constructor(game: Game, parent: Sprite) { @@ -78,11 +77,11 @@ module Phaser { /** * Add a new animation. - * @param name What this animation should be called (e.g. "run"). - * @param frames An array of numbers/strings indicating what frames to play in what order (e.g. [1, 2, 3] or ['run0', 'run1', run2]). - * @param frameRate The speed in frames per second that the animation should play at (e.g. 60 fps). - * @param loop Whether or not the animation is looped or just plays once. - * @param useNumericIndex Use number indexes instead of string indexes? + * @param name {string} What this animation should be called (e.g. "run"). + * @param frames {any[]} An array of numbers/strings indicating what frames to play in what order (e.g. [1, 2, 3] or ['run0', 'run1', run2]). + * @param frameRate {number} The speed in frames per second that the animation should play at (e.g. 60 fps). + * @param loop {boolean} Whether or not the animation is looped or just plays once. + * @param useNumericIndex {boolean} Use number indexes instead of string indexes? */ public add(name: string, frames: any[] = null, frameRate: number = 60, loop: bool = false, useNumericIndex: bool = true) { @@ -116,6 +115,12 @@ module Phaser { } + /** + * Check whether the frames is valid. + * @param frames {any[]} Frames to be validated. + * @param useNumericIndex {boolean} Does these frames use number indexes or string indexes? + * @return {boolean} True if they're valid, otherwise return false. + */ private validateFrames(frames: any[], useNumericIndex: bool): bool { for (var i = 0; i < frames.length; i++) @@ -142,9 +147,9 @@ module Phaser { /** * Play animation with specific name. - * @param name The string name of the animation you want to play. - * @param frameRate FrameRate you want to specify instead of using default. - * @param loop Whether or not the animation is looped or just plays once. + * @param name {string} The string name of the animation you want to play. + * @param frameRate {number} FrameRate you want to specify instead of using default. + * @param loop {boolean} Whether or not the animation is looped or just plays once. */ public play(name: string, frameRate?: number = null, loop?: bool) { diff --git a/Phaser/system/Tile.ts b/Phaser/system/Tile.ts index e62fda26..5f1287d7 100644 --- a/Phaser/system/Tile.ts +++ b/Phaser/system/Tile.ts @@ -14,10 +14,10 @@ module Phaser { * Tile constructor * Create a new Tile. * - * @param tilemap the tilemap this tile belongs to. - * @param index The index of this tile type in the core map data. - * @param width Width of the tile. - * @param height Height of the tile. + * @param tilemap {Tilemap} the tilemap this tile belongs to. + * @param index {number} The index of this tile type in the core map data. + * @param width {number} Width of the tile. + * @param height number} Height of the tile. */ constructor(game: Game, tilemap: Tilemap, index: number, width: number, height: number) { @@ -121,10 +121,10 @@ module Phaser { /** * Set collision configs. - * @param collision Bit field of flags. (see Tile.allowCollision) - * @param resetCollisions Reset collision flags before set. - * @param separateX Enable seprate at x-axis. - * @param separateY Enable seprate at y-axis. + * @param collision {number} Bit field of flags. (see Tile.allowCollision) + * @param resetCollisions {boolean} Reset collision flags before set. + * @param separateX {boolean} Enable seprate at x-axis. + * @param separateY {boolean} Enable seprate at y-axis. */ public setCollision(collision: number, resetCollisions: bool, separateX: bool, separateY: bool) { diff --git a/Phaser/system/animation/FrameData.ts b/Phaser/system/animation/FrameData.ts index 823066e5..ac670d31 100644 --- a/Phaser/system/animation/FrameData.ts +++ b/Phaser/system/animation/FrameData.ts @@ -35,8 +35,8 @@ module Phaser { /** * Add a new frame. - * @param frame The frame you want to add. - * @return {Frame=} The frame you just added. + * @param frame {Frame} The frame you want to add. + * @return {Frame} The frame you just added. */ public addFrame(frame: Frame): Frame { @@ -55,8 +55,8 @@ module Phaser { /** * Get a frame by its index. - * @param index Index of the frame you want to get. - * @return {Frame=} The frame you want. + * @param index {number} Index of the frame you want to get. + * @return {Frame} The frame you want. */ public getFrame(index: number): Frame { @@ -71,8 +71,8 @@ module Phaser { /** * Get a frame by its name. - * @param name Name of the frame you want to get. - * @return {Frame=} The frame you want. + * @param name {string} Name of the frame you want to get. + * @return {Frame} The frame you want. */ public getFrameByName(name: string): Frame { @@ -87,7 +87,7 @@ module Phaser { /** * Check whether there's a frame with given name. - * @param name Name of the frame you want to check. + * @param name {string} Name of the frame you want to check. * @return {boolean} True if frame with given name found, otherwise return false. */ public checkFrameName(name: string): bool { @@ -103,10 +103,10 @@ module Phaser { /** * Get ranges of frames in an array. - * @param start Start index of frames you want. - * @param end End index of frames you want. - * @param output Optional, result will be added into this array. - * @return {array} Ranges of specific frames in an array. + * @param start {number} Start index of frames you want. + * @param end {number} End index of frames you want. + * @param output {Frame[]} Optional, result will be added into this array. + * @return {Frame[]} Ranges of specific frames in an array. */ public getFrameRange(start: number, end: number, output?: Frame[] = []): Frame[] { @@ -121,8 +121,8 @@ module Phaser { /** * Get all indexes of frames by giving their name. - * @param output Optional, result will be added into this array. - * @return {array} Indexes of specific frames in an array. + * @param output {number[]} Optional, result will be added into this array. + * @return {number[]} Indexes of specific frames in an array. */ public getFrameIndexes(output?: number[] = []): number[] { @@ -139,8 +139,8 @@ module Phaser { /** * Get all names of frames by giving their indexes. - * @param output Optional, result will be added into this array. - * @return {array} Names of specific frames in an array. + * @param output {number[]} Optional, result will be added into this array. + * @return {number[]} Names of specific frames in an array. */ public getFrameIndexesByName(input: string[]): number[] { @@ -160,7 +160,7 @@ module Phaser { /** * Get all frames in this frame data. - * @return {array} All the frames in an array. + * @return {Frame[]} All the frames in an array. */ public getAllFrames(): Frame[] { return this._frames; @@ -168,8 +168,8 @@ module Phaser { /** * Get All frames with specific ranges. - * @param range Ranges in an array. - * @return All frames in an array. + * @param range {number[]} Ranges in an array. + * @return {Frame[]} All frames in an array. */ public getFrames(range: number[]) { diff --git a/Phaser/system/screens/BootScreen.ts b/Phaser/system/screens/BootScreen.ts index df562ccb..22c80284 100644 --- a/Phaser/system/screens/BootScreen.ts +++ b/Phaser/system/screens/BootScreen.ts @@ -12,11 +12,10 @@ module Phaser { /** * BootScreen constructor - * * Create a new BootScreen with specific width and height. * - * @param width Screen canvas width. - * @param height Screen canvas height. + * @param width {number} Screen canvas width. + * @param height {number} Screen canvas height. */ constructor(game:Game) { diff --git a/Phaser/system/screens/PauseScreen.ts b/Phaser/system/screens/PauseScreen.ts index 7cd1f25c..5ef4482c 100644 --- a/Phaser/system/screens/PauseScreen.ts +++ b/Phaser/system/screens/PauseScreen.ts @@ -12,11 +12,10 @@ module Phaser { /** * PauseScreen constructor - * * Create a new PauseScreen with specific width and height. * - * @param width Screen canvas width. - * @param height Screen canvas height. + * @param width {number} Screen canvas width. + * @param height {number} Screen canvas height. */ constructor(game: Game, width: number, height: number) {