Skip to content

Commit ab5853f

Browse files
committed
Started documenting the Graphics game object.
Added a couple of missing descriptions for the Container game object.
1 parent 39ace6c commit ab5853f

2 files changed

Lines changed: 43 additions & 43 deletions

File tree

src/gameobjects/container/Container.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var Vector2 = require('../../math/Vector2');
2323
* By default it will be removed from the Display List and instead added to the Containers own internal list.
2424
*
2525
* The position of the Game Object automatically becomes relative to the position of the Container.
26-
*
26+
*
2727
* When the Container is rendered, all of its children are rendered as well, in the order in which they exist
2828
* within the Container. Container children can be repositioned using methods such as `MoveUp`, `MoveDown` and `SendToBack`.
2929
*
@@ -102,10 +102,10 @@ var Container = new Class({
102102

103103
/**
104104
* Does this Container exclusively manage its children?
105-
*
105+
*
106106
* The default is `true` which means a child added to this Container cannot
107107
* belong in another Container, which includes the Scene display list.
108-
*
108+
*
109109
* If you disable this then this Container will no longer exclusively manage its children.
110110
* This allows you to create all kinds of interesting graphical effects, such as replicating
111111
* Game Objects without reparenting them all over the Scene.
@@ -159,7 +159,7 @@ var Container = new Class({
159159
* @since 3.4.0
160160
*/
161161
this.tempTransformMatrix = new Components.TransformMatrix();
162-
162+
163163
/**
164164
* A reference to the Scene Display List.
165165
*
@@ -274,10 +274,10 @@ var Container = new Class({
274274

275275
/**
276276
* Does this Container exclusively manage its children?
277-
*
277+
*
278278
* The default is `true` which means a child added to this Container cannot
279279
* belong in another Container, which includes the Scene display list.
280-
*
280+
*
281281
* If you disable this then this Container will no longer exclusively manage its children.
282282
* This allows you to create all kinds of interesting graphical effects, such as replicating
283283
* Game Objects without reparenting them all over the Scene.
@@ -308,10 +308,10 @@ var Container = new Class({
308308
*
309309
* Some children are unable to return their bounds, such as Graphics objects, in which case
310310
* they are skipped.
311-
*
311+
*
312312
* Depending on the quantity of children in this Container it could be a really expensive call,
313313
* so cache it and only poll it as needed.
314-
*
314+
*
315315
* The values are stored and returned in a Rectangle object.
316316
*
317317
* @method Phaser.GameObjects.Container#getBounds
@@ -394,7 +394,7 @@ var Container = new Class({
394394
if (this.exclusive)
395395
{
396396
gameObject.parentContainer = null;
397-
397+
398398
this._sysEvents.once('shutdown', gameObject.destroy, gameObject);
399399
}
400400
},
@@ -448,7 +448,7 @@ var Container = new Class({
448448

449449
/**
450450
* Adds the given Game Object, or array of Game Objects, to this Container.
451-
*
451+
*
452452
* Each Game Object must be unique within the Container.
453453
*
454454
* @method Phaser.GameObjects.Container#add
@@ -467,9 +467,9 @@ var Container = new Class({
467467

468468
/**
469469
* Adds the given Game Object, or array of Game Objects, to this Container at the specified position.
470-
*
470+
*
471471
* Existing Game Objects in the Container are shifted up.
472-
*
472+
*
473473
* Each Game Object must be unique within the Container.
474474
*
475475
* @method Phaser.GameObjects.Container#addAt
@@ -594,7 +594,7 @@ var Container = new Class({
594594
*
595595
* You can also specify a property and value to search for, in which case it will return the first
596596
* Game Object in this Container with a matching property and / or value.
597-
*
597+
*
598598
* For example: `getFirst('visible', true)` would return the first Game Object that had its `visible` property set.
599599
*
600600
* You can limit the search to the `startIndex` - `endIndex` range.
@@ -622,7 +622,7 @@ var Container = new Class({
622622
* For example: `getAll('body')` would return only Game Objects that have a body property.
623623
*
624624
* You can also specify a value to compare the property to:
625-
*
625+
*
626626
* `getAll('visible', true)` would return only Game Objects that have their visible property set to `true`.
627627
*
628628
* Optionally you can specify a start and end index. For example if this Container had 100 Game Objects,
@@ -647,16 +647,16 @@ var Container = new Class({
647647
/**
648648
* Returns the total number of Game Objects in this Container that have a property
649649
* matching the given value.
650-
*
650+
*
651651
* For example: `count('visible', true)` would count all the elements that have their visible property set.
652-
*
652+
*
653653
* You can optionally limit the operation to the `startIndex` - `endIndex` range.
654654
*
655655
* @method Phaser.GameObjects.Container#count
656656
* @since 3.4.0
657657
*
658-
* @param {string} property - [description]
659-
* @param {any} value - [description]
658+
* @param {string} property - The property to check.
659+
* @param {any} value - The value to check.
660660
* @param {integer} [startIndex=0] - An optional start index to search from.
661661
* @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included)
662662
*
@@ -676,7 +676,7 @@ var Container = new Class({
676676
*
677677
* @param {Phaser.GameObjects.GameObject} child1 - The first Game Object to swap.
678678
* @param {Phaser.GameObjects.GameObject} child2 - The second Game Object to swap.
679-
*
679+
*
680680
* @return {Phaser.GameObjects.Container} This Container instance.
681681
*/
682682
swap: function (child1, child2)
@@ -688,7 +688,7 @@ var Container = new Class({
688688

689689
/**
690690
* Moves a Game Object to a new position within this Container.
691-
*
691+
*
692692
* The Game Object must already be a child of this Container.
693693
*
694694
* The Game Object is removed from its old position and inserted into the new one.
@@ -711,7 +711,7 @@ var Container = new Class({
711711

712712
/**
713713
* Removes the given Game Object, or array of Game Objects, from this Container.
714-
*
714+
*
715715
* The Game Objects must already be children of this Container.
716716
*
717717
* You can also optionally call `destroy` on each Game Object that is removed from the Container.
@@ -746,7 +746,7 @@ var Container = new Class({
746746

747747
/**
748748
* Removes the Game Object at the given position in this Container.
749-
*
749+
*
750750
* You can also optionally call `destroy` on the Game Object, if one is found.
751751
*
752752
* @method Phaser.GameObjects.Container#removeAt
@@ -771,7 +771,7 @@ var Container = new Class({
771771

772772
/**
773773
* Removes the Game Objects between the given positions in this Container.
774-
*
774+
*
775775
* You can also optionally call `destroy` on each Game Object that is removed from the Container.
776776
*
777777
* @method Phaser.GameObjects.Container#removeBetween
@@ -800,7 +800,7 @@ var Container = new Class({
800800

801801
/**
802802
* Removes all Game Objects from this Container.
803-
*
803+
*
804804
* You can also optionally call `destroy` on each Game Object that is removed from the Container.
805805
*
806806
* @method Phaser.GameObjects.Container#removeAll
@@ -958,7 +958,7 @@ var Container = new Class({
958958

959959
/**
960960
* Returns `true` if the given Game Object is a direct child of this Container.
961-
*
961+
*
962962
* This check does not scan nested Containers.
963963
*
964964
* @method Phaser.GameObjects.Container#exists
@@ -975,7 +975,7 @@ var Container = new Class({
975975

976976
/**
977977
* Sets the property to the given value on all Game Objects in this Container.
978-
*
978+
*
979979
* Optionally you can specify a start and end index. For example if this Container had 100 Game Objects,
980980
* and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only
981981
* the first 50 Game Objects.
@@ -987,7 +987,7 @@ var Container = new Class({
987987
* @param {any} value - The value to get the property to.
988988
* @param {integer} [startIndex=0] - An optional start index to search from.
989989
* @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included)
990-
*
990+
*
991991
* @return {Phaser.GameObjects.Container} This Container instance.
992992
*/
993993
setAll: function (property, value, startIndex, endIndex)
@@ -1010,7 +1010,7 @@ var Container = new Class({
10101010
*
10111011
* A copy of the Container is made before passing each entry to your callback.
10121012
* This protects against the callback itself modifying the Container.
1013-
*
1013+
*
10141014
* If you know for sure that the callback will not change the size of this Container
10151015
* then you can use the more performant `Container.iterate` method instead.
10161016
*
@@ -1020,7 +1020,7 @@ var Container = new Class({
10201020
* @param {function} callback - The function to call.
10211021
* @param {object} [context] - Value to use as `this` when executing callback.
10221022
* @param {...*} [args] - Additional arguments that will be passed to the callback, after the child.
1023-
*
1023+
*
10241024
* @return {Phaser.GameObjects.Container} This Container instance.
10251025
*/
10261026
each: function (callback, context)
@@ -1057,7 +1057,7 @@ var Container = new Class({
10571057
* @param {function} callback - The function to call.
10581058
* @param {object} [context] - Value to use as `this` when executing callback.
10591059
* @param {...*} [args] - Additional arguments that will be passed to the callback, after the child.
1060-
*
1060+
*
10611061
* @return {Phaser.GameObjects.Container} This Container instance.
10621062
*/
10631063
iterate: function (callback, context)
@@ -1099,7 +1099,7 @@ var Container = new Class({
10991099

11001100
/**
11011101
* Returns the first Game Object within the Container, or `null` if it is empty.
1102-
*
1102+
*
11031103
* You can move the cursor by calling `Container.next` and `Container.previous`.
11041104
*
11051105
* @name Phaser.GameObjects.Container#first
@@ -1127,7 +1127,7 @@ var Container = new Class({
11271127

11281128
/**
11291129
* Returns the last Game Object within the Container, or `null` if it is empty.
1130-
*
1130+
*
11311131
* You can move the cursor by calling `Container.next` and `Container.previous`.
11321132
*
11331133
* @name Phaser.GameObjects.Container#last
@@ -1155,7 +1155,7 @@ var Container = new Class({
11551155

11561156
/**
11571157
* Returns the next Game Object within the Container, or `null` if it is empty.
1158-
*
1158+
*
11591159
* You can move the cursor by calling `Container.next` and `Container.previous`.
11601160
*
11611161
* @name Phaser.GameObjects.Container#next
@@ -1183,7 +1183,7 @@ var Container = new Class({
11831183

11841184
/**
11851185
* Returns the previous Game Object within the Container, or `null` if it is empty.
1186-
*
1186+
*
11871187
* You can move the cursor by calling `Container.next` and `Container.previous`.
11881188
*
11891189
* @name Phaser.GameObjects.Container#previous

src/gameobjects/graphics/Graphics.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var Render = require('./GraphicsRender');
3333
* @extends Phaser.GameObjects.Components.Visible
3434
* @extends Phaser.GameObjects.Components.ScrollFactor
3535
*
36-
* @param {Phaser.Scene} scene - [description]
36+
* @param {Phaser.Scene} scene - The Scene to which this Graphics object belongs.
3737
* @param {object} options - [description]
3838
*/
3939
var Graphics = new Class({
@@ -85,7 +85,7 @@ var Graphics = new Class({
8585
this.displayOriginY = 0;
8686

8787
/**
88-
* [description]
88+
* The array of commands used to render the Graphics.
8989
*
9090
* @name Phaser.GameObjects.Graphics#commandBuffer
9191
* @type {array}
@@ -95,7 +95,7 @@ var Graphics = new Class({
9595
this.commandBuffer = [];
9696

9797
/**
98-
* [description]
98+
* The default fill color for shapes rendered by this Graphics object.
9999
*
100100
* @name Phaser.GameObjects.Graphics#defaultFillColor
101101
* @type {number}
@@ -105,7 +105,7 @@ var Graphics = new Class({
105105
this.defaultFillColor = -1;
106106

107107
/**
108-
* [description]
108+
* The default fill alpha for shapes rendered by this Graphics object.
109109
*
110110
* @name Phaser.GameObjects.Graphics#defaultFillAlpha
111111
* @type {number}
@@ -115,7 +115,7 @@ var Graphics = new Class({
115115
this.defaultFillAlpha = 1;
116116

117117
/**
118-
* [description]
118+
* The default stroke width for shapes rendered by this Graphics object.
119119
*
120120
* @name Phaser.GameObjects.Graphics#defaultStrokeWidth
121121
* @type {number}
@@ -125,7 +125,7 @@ var Graphics = new Class({
125125
this.defaultStrokeWidth = 1;
126126

127127
/**
128-
* [description]
128+
* The default stroke color for shapes rendered by this Graphics object.
129129
*
130130
* @name Phaser.GameObjects.Graphics#defaultStrokeColor
131131
* @type {number}
@@ -135,7 +135,7 @@ var Graphics = new Class({
135135
this.defaultStrokeColor = -1;
136136

137137
/**
138-
* [description]
138+
* The default stroke alpha for shapes rendered by this Graphics object.
139139
*
140140
* @name Phaser.GameObjects.Graphics#defaultStrokeAlpha
141141
* @type {number}
@@ -158,12 +158,12 @@ var Graphics = new Class({
158158
},
159159

160160
/**
161-
* [description]
161+
* Set the default styles for this Graphics object.
162162
*
163163
* @method Phaser.GameObjects.Graphics#setDefaultStyles
164164
* @since 3.0.0
165165
*
166-
* @param {object} options - [description]
166+
* @param {object} options - The styles to set as defaults.
167167
*
168168
* @return {Phaser.GameObjects.Graphics} This Game Object.
169169
*/

0 commit comments

Comments
 (0)