Skip to content

Commit

Permalink
Finish documents for Cache, CameraManager, Game, SoundManager, Sound.
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelpicosean authored and photonstorm committed May 10, 2013
1 parent 4be5a10 commit 1052df6
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 104 deletions.
50 changes: 25 additions & 25 deletions Phaser/Cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ module Phaser {

/**
* Add a new canvas.
* @param key Asset key for this canvas.
* @param canvas Canvas DOM element.
* @param context Render context of this canvas.
* @param key {string} Asset key for this canvas.
* @param canvas {HTMLCanvasElement} Canvas DOM element.
* @param context {CanvasRenderingContext2D} Render context of this canvas.
*/
public addCanvas(key: string, canvas: HTMLCanvasElement, context: CanvasRenderingContext2D) {

Expand All @@ -65,12 +65,12 @@ module Phaser {

/**
* Add a new sprite sheet.
* @param key Asset key for the sprite sheet.
* @param url URL of this sprite sheet file.
* @param data Extra sprite sheet data.
* @param frameWidth Width of the sprite sheet.
* @param frameHeight Height of the sprite sheet.
* @param frameMax How many frames stored in the sprite sheet.
* @param key {string} Asset key for the sprite sheet.
* @param url {string} URL of this sprite sheet file.
* @param data {object} Extra sprite sheet data.
* @param frameWidth {number} Width of the sprite sheet.
* @param frameHeight {number} Height of the sprite sheet.
* @param frameMax {number} How many frames stored in the sprite sheet.
*/
public addSpriteSheet(key: string, url: string, data, frameWidth: number, frameHeight: number, frameMax: number) {

Expand All @@ -81,10 +81,10 @@ module Phaser {

/**
* Add a new texture atlas.
* @param key Asset key for the texture atlas.
* @param url URL of this texture atlas file.
* @param data Extra texture atlas data.
* @param data Texture atlas frames data.
* @param key {string} Asset key for the texture atlas.
* @param url {string} URL of this texture atlas file.
* @param data {object} Extra texture atlas data.
* @param data {object} Texture atlas frames data.
*/
public addTextureAtlas(key: string, url: string, data, jsonData) {

Expand All @@ -95,9 +95,9 @@ module Phaser {

/**
* Add a new image.
* @param key Asset key for the image.
* @param url URL of this image file.
* @param data Extra image data.
* @param key {string} Asset key for the image.
* @param url {string} URL of this image file.
* @param data {object} Extra image data.
*/
public addImage(key: string, url: string, data) {

Expand All @@ -107,9 +107,9 @@ module Phaser {

/**
* Add a new sound.
* @param key Asset key for the sound.
* @param url URL of this sound file.
* @param data Extra sound data.
* @param key {string} Asset key for the sound.
* @param url {string} URL of this sound file.
* @param data {object} Extra sound data.
*/
public addSound(key: string, url: string, data) {

Expand All @@ -119,9 +119,9 @@ module Phaser {

/**
* Add a new decoded sound.
* @param key Asset key for the sound.
* @param url URL of this sound file.
* @param data Extra sound data.
* @param key {string} Asset key for the sound.
* @param url {string} URL of this sound file.
* @param data {object} Extra sound data.
*/
public decodedSound(key: string, data) {

Expand All @@ -132,9 +132,9 @@ module Phaser {

/**
* Add a new text data.
* @param key Asset key for the text data.
* @param url URL of this text data file.
* @param data Extra text data.
* @param key {string} Asset key for the text data.
* @param url {string} URL of this text data file.
* @param data {object} Extra text data.
*/
public addText(key: string, url: string, data) {

Expand Down
22 changes: 11 additions & 11 deletions Phaser/CameraManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ module Phaser {
* CameraManager constructor
* This will create a new <code>Camera</code> with position and size.
*
* @param x X Position of the created camera.
* @param y y Position of the created camera.
* @param width Width of the created camera.
* @param height Height of the created camera.
* @param x {number} X Position of the created camera.
* @param y {number} y Position of the created camera.
* @param width {number} Width of the created camera.
* @param height {number} Height of the created camera.
*/
constructor(game: Game, x: number, y: number, width: number, height: number) {

Expand Down Expand Up @@ -55,7 +55,7 @@ module Phaser {
/**
* Get all the cameras.
*
* @returns {array} An array contains all the cameras.
* @returns {Camera[]} An array contains all the cameras.
*/
public getAll(): Camera[] {
return this._cameras;
Expand All @@ -78,11 +78,11 @@ module Phaser {
/**
* Create a new camera with specific position and size.
*
* @param x X position of the new camera.
* @param y Y position of the new camera.
* @param width Width of the new camera.
* @param height Height of the new camera.
* @returns {Camera=} The newly created camera object.
* @param x {number} X position of the new camera.
* @param y {number} Y position of the new camera.
* @param width {number} Width of the new camera.
* @param height {number} Height of the new camera.
* @returns {Camera} The newly created camera object.
*/
public addCamera(x: number, y: number, width: number, height: number): Camera {

Expand All @@ -99,7 +99,7 @@ module Phaser {
/**
* Remove a new camera with its id.
*
* @param id ID of the camera you want to remove.
* @param id {number} ID of the camera you want to remove.
* @returns {boolean} True if successfully removed the camera, otherwise return false.
*/
public removeCamera(id: number): bool {
Expand Down
110 changes: 55 additions & 55 deletions Phaser/Game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ module Phaser {
*
* Instantiate a new <code>Game</code> object.
*
* @param callbackContext Which context will the callbacks be called with.
* @param parent ID of its parent DOM element.
* @param width The width of your game in game pixels.
* @param height The height of your game in game pixels.
* @param initCallback Init callback invoked when init default screen.
* @param createCallback Create callback invoked when create default screen.
* @param updateCallback Update callback invoked when update default screen.
* @param renderCallback Render callback invoked when render default screen.
* @param callbackContext Which context will the callbacks be called with.
* @param parent {string} ID of its parent DOM element.
* @param width {number} The width of your game in game pixels.
* @param height {number} The height of your game in game pixels.
* @param initCallback {function} Init callback invoked when init default screen.
* @param createCallback {function} Create callback invoked when create default screen.
* @param updateCallback {function} Update callback invoked when update default screen.
* @param renderCallback {function} Render callback invoked when render default screen.
*/
constructor(callbackContext, parent?: string = '', width?: number = 800, height?: number = 600, initCallback = null, createCallback = null, updateCallback = null, renderCallback = null) {

Expand Down Expand Up @@ -224,9 +224,9 @@ module Phaser {

/**
* Initialize engine sub modules and start the game.
* @param parent ID of parent Dom element.
* @param width Width of the game screen.
* @param height Height of the game screen.
* @param parent {string} ID of parent Dom element.
* @param width {number} Width of the game screen.
* @param height {number} Height of the game screen.
*/
private boot(parent: string, width: number, height: number) {

Expand Down Expand Up @@ -398,10 +398,10 @@ module Phaser {

/**
* Set all state callbacks (init, create, update, render).
* @param initCallback Init callback invoked when init state.
* @param createCallback Create callback invoked when create state.
* @param updateCallback Update callback invoked when update state.
* @param renderCallback Render callback invoked when render state.
* @param initCallback {function} Init callback invoked when init state.
* @param createCallback {function} Create callback invoked when create state.
* @param updateCallback {function} Update callback invoked when update state.
* @param renderCallback {function} Render callback invoked when render state.
*/
public setCallbacks(initCallback = null, createCallback = null, updateCallback = null, renderCallback = null) {

Expand All @@ -414,9 +414,9 @@ module Phaser {

/**
* Switch to a new State.
* @param state The state you want to switch to.
* @param clearWorld Optional, clear everything in the world? (Default to true)
* @param clearCache Optional, clear asset cache? (Default to false and ONLY available when clearWorld=true)
* @param state {State} The state you want to switch to.
* @param clearWorld {boolean} Optional, clear everything in the world? (Default to true)
* @param clearCache {boolean} Optional, clear asset cache? (Default to false and ONLY available when clearWorld=true)
*/
public switchState(state, clearWorld: bool = true, clearCache: bool = false) {

Expand Down Expand Up @@ -560,11 +560,11 @@ module Phaser {
/**
* Create a new camera with specific position and size.
*
* @param x X position of the new camera.
* @param y Y position of the new camera.
* @param width Width of the new camera.
* @param height Height of the new camera.
* @returns {Camera=} The newly created camera object.
* @param x {number} X position of the new camera.
* @param y {number} Y position of the new camera.
* @param width {number} Width of the new camera.
* @param height {number} Height of the new camera.
* @returns {Camera} The newly created camera object.
*/
public createCamera(x: number, y: number, width: number, height: number): Camera {
return this.world.createCamera(x, y, width, height);
Expand All @@ -573,9 +573,9 @@ module Phaser {
/**
* Create a new GeomSprite with specific position.
*
* @param x X position of the new geom sprite.
* @param y Y position of the new geom sprite.
* @returns {GeomSprite=} The newly created geom sprite object.
* @param x {number} X position of the new geom sprite.
* @param y {number} Y position of the new geom sprite.
* @returns {GeomSprite} The newly created geom sprite object.
*/
public createGeomSprite(x: number, y: number): GeomSprite {
return this.world.createGeomSprite(x, y);
Expand All @@ -584,10 +584,10 @@ module Phaser {
/**
* Create a new Sprite with specific position and sprite sheet key.
*
* @param x X position of the new sprite.
* @param y Y position of the new sprite.
* @param key Optinal, key for the sprite sheet you want it to use.
* @returns {Sprite=} The newly created sprite object.
* @param x {number} X position of the new sprite.
* @param y {number} Y position of the new sprite.
* @param key {string} Optinal, key for the sprite sheet you want it to use.
* @returns {Sprite} The newly created sprite object.
*/
public createSprite(x: number, y: number, key?: string = ''): Sprite {
return this.world.createSprite(x, y, key);
Expand All @@ -596,9 +596,9 @@ module Phaser {
/**
* Create a new DynamicTexture with specific size.
*
* @param width Width of the texture.
* @param height Height of the texture.
* @returns {DynamicTexture=} The newly created dynamic texture object.
* @param width {number} Width of the texture.
* @param height {number} Height of the texture.
* @returns {DynamicTexture} The newly created dynamic texture object.
*/
public createDynamicTexture(width: number, height: number): DynamicTexture {
return this.world.createDynamicTexture(width, height);
Expand All @@ -607,8 +607,8 @@ module Phaser {
/**
* Create a new object container.
*
* @param MaxSize Optinal, capacity of this group.
* @returns {Group=} The newly created group.
* @param MaxSize {number} Optinal, capacity of this group.
* @returns {Group} The newly created group.
*/
public createGroup(MaxSize?: number = 0): Group {
return this.world.createGroup(MaxSize);
Expand All @@ -617,7 +617,7 @@ module Phaser {
/**
* Create a new Particle.
*
* @return {Particle=} The newly created particle object.
* @return {Particle} The newly created particle object.
*/
public createParticle(): Particle {
return this.world.createParticle();
Expand All @@ -626,10 +626,10 @@ module Phaser {
/**
* Create a new Emitter.
*
* @param x Optinal, x position of the emitter.
* @param y Optinal, y position of the emitter.
* @param size Optinal, size of this emitter.
* @return {Emitter=} The newly created emitter object.
* @param x {number} Optinal, x position of the emitter.
* @param y {number} Optinal, y position of the emitter.
* @param size {number} Optinal, size of this emitter.
* @return {Emitter} The newly created emitter object.
*/
public createEmitter(x?: number = 0, y?: number = 0, size?: number = 0): Emitter {
return this.world.createEmitter(x, y, size);
Expand All @@ -638,12 +638,12 @@ module Phaser {
/**
* Create a new ScrollZone object with image key, position and size.
*
* @param key Key to a image you wish this object to use.
* @param x X position of this object.
* @param y Y position of this object.
* @param width Width of this object.
* @param height Heigth of this object.
* @returns {ScrollZone=} The newly created scroll zone object.
* @param key {string} Key to a image you wish this object to use.
* @param x {number} X position of this object.
* @param y {number} Y position of this object.
* @param width number} Width of this object.
* @param height {number} Heigth of this object.
* @returns {ScrollZone} The newly created scroll zone object.
*/
public createScrollZone(key: string, x?: number = 0, y?: number = 0, width?: number = 0, height?: number = 0): ScrollZone {
return this.world.createScrollZone(key, x, y, width, height);
Expand All @@ -652,13 +652,13 @@ module Phaser {
/**
* Create a new Tilemap.
*
* @param key Key for tileset image.
* @param mapData Data of this tilemap.
* @param format Format of map data. (Tilemap.FORMAT_CSV or Tilemap.FORMAT_TILED_JSON)
* @param resizeWorld Optinal, resize the world to make same as tilemap?
* @param tileWidth Optinal, width of each tile.
* @param tileHeight Optinal, height of each tile.
* @return {Tilemap=} The newly created tilemap object.
* @param key {string} Key for tileset image.
* @param mapData {string} Data of this tilemap.
* @param format {number} Format of map data. (Tilemap.FORMAT_CSV or Tilemap.FORMAT_TILED_JSON)
* @param resizeWorld {boolean} Optional, resize the world to make same as tilemap?
* @param tileWidth {number} Optional, width of each tile.
* @param tileHeight {number} Optional, height of each tile.
* @return {Tilemap} The newly created tilemap object.
*/
public createTilemap(key: string, mapData: string, format: number, resizeWorld: bool = true, tileWidth?: number = 0, tileHeight?: number = 0): Tilemap {
return this.world.createTilemap(key, mapData, format, resizeWorld, tileWidth, tileHeight);
Expand All @@ -667,8 +667,8 @@ module Phaser {
/**
* Create a tween object for a specific object.
*
* @param obj Object you wish the tween will affect.
* @return {Phaser.Tween=} The newly created tween object.
* @param obj Object you wish the tween will affect.
* @return {Phaser.Tween} The newly created tween object.
*/
public createTween(obj): Tween {
return this.tweens.create(obj);
Expand Down
15 changes: 7 additions & 8 deletions Phaser/SoundManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ module Phaser {

/**
* SoundManager constructor
*
* Create a new <code>SoundManager</code>.
*/
constructor(game: Game) {
Expand Down Expand Up @@ -91,9 +90,9 @@ module Phaser {

/**
* Decode a sound with its assets key.
* @param key Assets key of the sound to be decoded.
* @param callback This will be invoked when finished decoding.
* @param sound Optional, its bufer will be set to decoded data.
* @param key {string} Assets key of the sound to be decoded.
* @param callback {function} This will be invoked when finished decoding.
* @param sound {Sound} Optional, its bufer will be set to decoded data.
*/
public decode(key: string, callback = null, sound?: Sound = null) {

Expand Down Expand Up @@ -122,10 +121,10 @@ module Phaser {

/**
* Play a sound with its assets key.
* @param key Assets key of the sound you want to play.
* @param volume Optional, volume of the sound you want to play.
* @param loop Optional, loop when it finished playing? (Default to false)
* @return {Sound=} The playing sound object.
* @param key {string} Assets key of the sound you want to play.
* @param volume {number} Optional, volume of the sound you want to play.
* @param loop {boolean} Optional, loop when it finished playing? (Default to false)
* @return {Sound} The playing sound object.
*/
public play(key: string, volume?: number = 1, loop?: bool = false): Sound {

Expand Down
Loading

0 comments on commit 1052df6

Please sign in to comment.