Skip to content

Commit 1052df6

Browse files
pixelpicoseanphotonstorm
authored andcommitted
Finish documents for Cache, CameraManager, Game, SoundManager, Sound.
1 parent 4be5a10 commit 1052df6

5 files changed

Lines changed: 103 additions & 104 deletions

File tree

Phaser/Cache.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ module Phaser {
5353

5454
/**
5555
* Add a new canvas.
56-
* @param key Asset key for this canvas.
57-
* @param canvas Canvas DOM element.
58-
* @param context Render context of this canvas.
56+
* @param key {string} Asset key for this canvas.
57+
* @param canvas {HTMLCanvasElement} Canvas DOM element.
58+
* @param context {CanvasRenderingContext2D} Render context of this canvas.
5959
*/
6060
public addCanvas(key: string, canvas: HTMLCanvasElement, context: CanvasRenderingContext2D) {
6161

@@ -65,12 +65,12 @@ module Phaser {
6565

6666
/**
6767
* Add a new sprite sheet.
68-
* @param key Asset key for the sprite sheet.
69-
* @param url URL of this sprite sheet file.
70-
* @param data Extra sprite sheet data.
71-
* @param frameWidth Width of the sprite sheet.
72-
* @param frameHeight Height of the sprite sheet.
73-
* @param frameMax How many frames stored in the sprite sheet.
68+
* @param key {string} Asset key for the sprite sheet.
69+
* @param url {string} URL of this sprite sheet file.
70+
* @param data {object} Extra sprite sheet data.
71+
* @param frameWidth {number} Width of the sprite sheet.
72+
* @param frameHeight {number} Height of the sprite sheet.
73+
* @param frameMax {number} How many frames stored in the sprite sheet.
7474
*/
7575
public addSpriteSheet(key: string, url: string, data, frameWidth: number, frameHeight: number, frameMax: number) {
7676

@@ -81,10 +81,10 @@ module Phaser {
8181

8282
/**
8383
* Add a new texture atlas.
84-
* @param key Asset key for the texture atlas.
85-
* @param url URL of this texture atlas file.
86-
* @param data Extra texture atlas data.
87-
* @param data Texture atlas frames data.
84+
* @param key {string} Asset key for the texture atlas.
85+
* @param url {string} URL of this texture atlas file.
86+
* @param data {object} Extra texture atlas data.
87+
* @param data {object} Texture atlas frames data.
8888
*/
8989
public addTextureAtlas(key: string, url: string, data, jsonData) {
9090

@@ -95,9 +95,9 @@ module Phaser {
9595

9696
/**
9797
* Add a new image.
98-
* @param key Asset key for the image.
99-
* @param url URL of this image file.
100-
* @param data Extra image data.
98+
* @param key {string} Asset key for the image.
99+
* @param url {string} URL of this image file.
100+
* @param data {object} Extra image data.
101101
*/
102102
public addImage(key: string, url: string, data) {
103103

@@ -107,9 +107,9 @@ module Phaser {
107107

108108
/**
109109
* Add a new sound.
110-
* @param key Asset key for the sound.
111-
* @param url URL of this sound file.
112-
* @param data Extra sound data.
110+
* @param key {string} Asset key for the sound.
111+
* @param url {string} URL of this sound file.
112+
* @param data {object} Extra sound data.
113113
*/
114114
public addSound(key: string, url: string, data) {
115115

@@ -119,9 +119,9 @@ module Phaser {
119119

120120
/**
121121
* Add a new decoded sound.
122-
* @param key Asset key for the sound.
123-
* @param url URL of this sound file.
124-
* @param data Extra sound data.
122+
* @param key {string} Asset key for the sound.
123+
* @param url {string} URL of this sound file.
124+
* @param data {object} Extra sound data.
125125
*/
126126
public decodedSound(key: string, data) {
127127

@@ -132,9 +132,9 @@ module Phaser {
132132

133133
/**
134134
* Add a new text data.
135-
* @param key Asset key for the text data.
136-
* @param url URL of this text data file.
137-
* @param data Extra text data.
135+
* @param key {string} Asset key for the text data.
136+
* @param url {string} URL of this text data file.
137+
* @param data {object} Extra text data.
138138
*/
139139
public addText(key: string, url: string, data) {
140140

Phaser/CameraManager.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ module Phaser {
1919
* CameraManager constructor
2020
* This will create a new <code>Camera</code> with position and size.
2121
*
22-
* @param x X Position of the created camera.
23-
* @param y y Position of the created camera.
24-
* @param width Width of the created camera.
25-
* @param height Height of the created camera.
22+
* @param x {number} X Position of the created camera.
23+
* @param y {number} y Position of the created camera.
24+
* @param width {number} Width of the created camera.
25+
* @param height {number} Height of the created camera.
2626
*/
2727
constructor(game: Game, x: number, y: number, width: number, height: number) {
2828

@@ -55,7 +55,7 @@ module Phaser {
5555
/**
5656
* Get all the cameras.
5757
*
58-
* @returns {array} An array contains all the cameras.
58+
* @returns {Camera[]} An array contains all the cameras.
5959
*/
6060
public getAll(): Camera[] {
6161
return this._cameras;
@@ -78,11 +78,11 @@ module Phaser {
7878
/**
7979
* Create a new camera with specific position and size.
8080
*
81-
* @param x X position of the new camera.
82-
* @param y Y position of the new camera.
83-
* @param width Width of the new camera.
84-
* @param height Height of the new camera.
85-
* @returns {Camera=} The newly created camera object.
81+
* @param x {number} X position of the new camera.
82+
* @param y {number} Y position of the new camera.
83+
* @param width {number} Width of the new camera.
84+
* @param height {number} Height of the new camera.
85+
* @returns {Camera} The newly created camera object.
8686
*/
8787
public addCamera(x: number, y: number, width: number, height: number): Camera {
8888

@@ -99,7 +99,7 @@ module Phaser {
9999
/**
100100
* Remove a new camera with its id.
101101
*
102-
* @param id ID of the camera you want to remove.
102+
* @param id {number} ID of the camera you want to remove.
103103
* @returns {boolean} True if successfully removed the camera, otherwise return false.
104104
*/
105105
public removeCamera(id: number): bool {

Phaser/Game.ts

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ module Phaser {
5050
*
5151
* Instantiate a new <code>Game</code> object.
5252
*
53-
* @param callbackContext Which context will the callbacks be called with.
54-
* @param parent ID of its parent DOM element.
55-
* @param width The width of your game in game pixels.
56-
* @param height The height of your game in game pixels.
57-
* @param initCallback Init callback invoked when init default screen.
58-
* @param createCallback Create callback invoked when create default screen.
59-
* @param updateCallback Update callback invoked when update default screen.
60-
* @param renderCallback Render callback invoked when render default screen.
53+
* @param callbackContext Which context will the callbacks be called with.
54+
* @param parent {string} ID of its parent DOM element.
55+
* @param width {number} The width of your game in game pixels.
56+
* @param height {number} The height of your game in game pixels.
57+
* @param initCallback {function} Init callback invoked when init default screen.
58+
* @param createCallback {function} Create callback invoked when create default screen.
59+
* @param updateCallback {function} Update callback invoked when update default screen.
60+
* @param renderCallback {function} Render callback invoked when render default screen.
6161
*/
6262
constructor(callbackContext, parent?: string = '', width?: number = 800, height?: number = 600, initCallback = null, createCallback = null, updateCallback = null, renderCallback = null) {
6363

@@ -224,9 +224,9 @@ module Phaser {
224224

225225
/**
226226
* Initialize engine sub modules and start the game.
227-
* @param parent ID of parent Dom element.
228-
* @param width Width of the game screen.
229-
* @param height Height of the game screen.
227+
* @param parent {string} ID of parent Dom element.
228+
* @param width {number} Width of the game screen.
229+
* @param height {number} Height of the game screen.
230230
*/
231231
private boot(parent: string, width: number, height: number) {
232232

@@ -398,10 +398,10 @@ module Phaser {
398398

399399
/**
400400
* Set all state callbacks (init, create, update, render).
401-
* @param initCallback Init callback invoked when init state.
402-
* @param createCallback Create callback invoked when create state.
403-
* @param updateCallback Update callback invoked when update state.
404-
* @param renderCallback Render callback invoked when render state.
401+
* @param initCallback {function} Init callback invoked when init state.
402+
* @param createCallback {function} Create callback invoked when create state.
403+
* @param updateCallback {function} Update callback invoked when update state.
404+
* @param renderCallback {function} Render callback invoked when render state.
405405
*/
406406
public setCallbacks(initCallback = null, createCallback = null, updateCallback = null, renderCallback = null) {
407407

@@ -414,9 +414,9 @@ module Phaser {
414414

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

@@ -560,11 +560,11 @@ module Phaser {
560560
/**
561561
* Create a new camera with specific position and size.
562562
*
563-
* @param x X position of the new camera.
564-
* @param y Y position of the new camera.
565-
* @param width Width of the new camera.
566-
* @param height Height of the new camera.
567-
* @returns {Camera=} The newly created camera object.
563+
* @param x {number} X position of the new camera.
564+
* @param y {number} Y position of the new camera.
565+
* @param width {number} Width of the new camera.
566+
* @param height {number} Height of the new camera.
567+
* @returns {Camera} The newly created camera object.
568568
*/
569569
public createCamera(x: number, y: number, width: number, height: number): Camera {
570570
return this.world.createCamera(x, y, width, height);
@@ -573,9 +573,9 @@ module Phaser {
573573
/**
574574
* Create a new GeomSprite with specific position.
575575
*
576-
* @param x X position of the new geom sprite.
577-
* @param y Y position of the new geom sprite.
578-
* @returns {GeomSprite=} The newly created geom sprite object.
576+
* @param x {number} X position of the new geom sprite.
577+
* @param y {number} Y position of the new geom sprite.
578+
* @returns {GeomSprite} The newly created geom sprite object.
579579
*/
580580
public createGeomSprite(x: number, y: number): GeomSprite {
581581
return this.world.createGeomSprite(x, y);
@@ -584,10 +584,10 @@ module Phaser {
584584
/**
585585
* Create a new Sprite with specific position and sprite sheet key.
586586
*
587-
* @param x X position of the new sprite.
588-
* @param y Y position of the new sprite.
589-
* @param key Optinal, key for the sprite sheet you want it to use.
590-
* @returns {Sprite=} The newly created sprite object.
587+
* @param x {number} X position of the new sprite.
588+
* @param y {number} Y position of the new sprite.
589+
* @param key {string} Optinal, key for the sprite sheet you want it to use.
590+
* @returns {Sprite} The newly created sprite object.
591591
*/
592592
public createSprite(x: number, y: number, key?: string = ''): Sprite {
593593
return this.world.createSprite(x, y, key);
@@ -596,9 +596,9 @@ module Phaser {
596596
/**
597597
* Create a new DynamicTexture with specific size.
598598
*
599-
* @param width Width of the texture.
600-
* @param height Height of the texture.
601-
* @returns {DynamicTexture=} The newly created dynamic texture object.
599+
* @param width {number} Width of the texture.
600+
* @param height {number} Height of the texture.
601+
* @returns {DynamicTexture} The newly created dynamic texture object.
602602
*/
603603
public createDynamicTexture(width: number, height: number): DynamicTexture {
604604
return this.world.createDynamicTexture(width, height);
@@ -607,8 +607,8 @@ module Phaser {
607607
/**
608608
* Create a new object container.
609609
*
610-
* @param MaxSize Optinal, capacity of this group.
611-
* @returns {Group=} The newly created group.
610+
* @param MaxSize {number} Optinal, capacity of this group.
611+
* @returns {Group} The newly created group.
612612
*/
613613
public createGroup(MaxSize?: number = 0): Group {
614614
return this.world.createGroup(MaxSize);
@@ -617,7 +617,7 @@ module Phaser {
617617
/**
618618
* Create a new Particle.
619619
*
620-
* @return {Particle=} The newly created particle object.
620+
* @return {Particle} The newly created particle object.
621621
*/
622622
public createParticle(): Particle {
623623
return this.world.createParticle();
@@ -626,10 +626,10 @@ module Phaser {
626626
/**
627627
* Create a new Emitter.
628628
*
629-
* @param x Optinal, x position of the emitter.
630-
* @param y Optinal, y position of the emitter.
631-
* @param size Optinal, size of this emitter.
632-
* @return {Emitter=} The newly created emitter object.
629+
* @param x {number} Optinal, x position of the emitter.
630+
* @param y {number} Optinal, y position of the emitter.
631+
* @param size {number} Optinal, size of this emitter.
632+
* @return {Emitter} The newly created emitter object.
633633
*/
634634
public createEmitter(x?: number = 0, y?: number = 0, size?: number = 0): Emitter {
635635
return this.world.createEmitter(x, y, size);
@@ -638,12 +638,12 @@ module Phaser {
638638
/**
639639
* Create a new ScrollZone object with image key, position and size.
640640
*
641-
* @param key Key to a image you wish this object to use.
642-
* @param x X position of this object.
643-
* @param y Y position of this object.
644-
* @param width Width of this object.
645-
* @param height Heigth of this object.
646-
* @returns {ScrollZone=} The newly created scroll zone object.
641+
* @param key {string} Key to a image you wish this object to use.
642+
* @param x {number} X position of this object.
643+
* @param y {number} Y position of this object.
644+
* @param width number} Width of this object.
645+
* @param height {number} Heigth of this object.
646+
* @returns {ScrollZone} The newly created scroll zone object.
647647
*/
648648
public createScrollZone(key: string, x?: number = 0, y?: number = 0, width?: number = 0, height?: number = 0): ScrollZone {
649649
return this.world.createScrollZone(key, x, y, width, height);
@@ -652,13 +652,13 @@ module Phaser {
652652
/**
653653
* Create a new Tilemap.
654654
*
655-
* @param key Key for tileset image.
656-
* @param mapData Data of this tilemap.
657-
* @param format Format of map data. (Tilemap.FORMAT_CSV or Tilemap.FORMAT_TILED_JSON)
658-
* @param resizeWorld Optinal, resize the world to make same as tilemap?
659-
* @param tileWidth Optinal, width of each tile.
660-
* @param tileHeight Optinal, height of each tile.
661-
* @return {Tilemap=} The newly created tilemap object.
655+
* @param key {string} Key for tileset image.
656+
* @param mapData {string} Data of this tilemap.
657+
* @param format {number} Format of map data. (Tilemap.FORMAT_CSV or Tilemap.FORMAT_TILED_JSON)
658+
* @param resizeWorld {boolean} Optional, resize the world to make same as tilemap?
659+
* @param tileWidth {number} Optional, width of each tile.
660+
* @param tileHeight {number} Optional, height of each tile.
661+
* @return {Tilemap} The newly created tilemap object.
662662
*/
663663
public createTilemap(key: string, mapData: string, format: number, resizeWorld: bool = true, tileWidth?: number = 0, tileHeight?: number = 0): Tilemap {
664664
return this.world.createTilemap(key, mapData, format, resizeWorld, tileWidth, tileHeight);
@@ -667,8 +667,8 @@ module Phaser {
667667
/**
668668
* Create a tween object for a specific object.
669669
*
670-
* @param obj Object you wish the tween will affect.
671-
* @return {Phaser.Tween=} The newly created tween object.
670+
* @param obj Object you wish the tween will affect.
671+
* @return {Phaser.Tween} The newly created tween object.
672672
*/
673673
public createTween(obj): Tween {
674674
return this.tweens.create(obj);

Phaser/SoundManager.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ module Phaser {
1313

1414
/**
1515
* SoundManager constructor
16-
*
1716
* Create a new <code>SoundManager</code>.
1817
*/
1918
constructor(game: Game) {
@@ -91,9 +90,9 @@ module Phaser {
9190

9291
/**
9392
* Decode a sound with its assets key.
94-
* @param key Assets key of the sound to be decoded.
95-
* @param callback This will be invoked when finished decoding.
96-
* @param sound Optional, its bufer will be set to decoded data.
93+
* @param key {string} Assets key of the sound to be decoded.
94+
* @param callback {function} This will be invoked when finished decoding.
95+
* @param sound {Sound} Optional, its bufer will be set to decoded data.
9796
*/
9897
public decode(key: string, callback = null, sound?: Sound = null) {
9998

@@ -122,10 +121,10 @@ module Phaser {
122121

123122
/**
124123
* Play a sound with its assets key.
125-
* @param key Assets key of the sound you want to play.
126-
* @param volume Optional, volume of the sound you want to play.
127-
* @param loop Optional, loop when it finished playing? (Default to false)
128-
* @return {Sound=} The playing sound object.
124+
* @param key {string} Assets key of the sound you want to play.
125+
* @param volume {number} Optional, volume of the sound you want to play.
126+
* @param loop {boolean} Optional, loop when it finished playing? (Default to false)
127+
* @return {Sound} The playing sound object.
129128
*/
130129
public play(key: string, volume?: number = 1, loop?: bool = false): Sound {
131130

0 commit comments

Comments
 (0)