From 3be5d8573363ca4308d1383b600a77a0df6bbd72 Mon Sep 17 00:00:00 2001 From: Florian Rival Date: Wed, 4 Jul 2018 21:13:41 +0100 Subject: [PATCH] Update GDJS docs to use JSDoc --- Extensions/AdMobObject/admobruntimeobject.js | 4 +- .../examplejsextensiontools.js | 2 +- .../facebookinstantgamestools.js | 2 +- Extensions/Inventory/inventorytools.js | 2 +- Extensions/LinkedObjects/linkedobjects.js | 7 +- .../panelspriteruntimeobject.js | 2 +- .../pathfindingobstacleruntimebehavior.js | 18 +- .../pathfindingruntimebehavior.js | 15 +- .../PhysicsBehavior/physicsruntimebehavior.js | 8 +- .../platformruntimebehavior.js | 18 +- .../shapepainterruntimeobject.js | 2 +- Extensions/Shopify/shopifytools.js | 2 +- Extensions/SkeletonObject/Ask.js | 6 +- Extensions/SkeletonObject/Cskbone.js | 4 +- Extensions/SkeletonObject/Dskslot.js | 4 +- Extensions/SkeletonObject/Eskarmature.js | 4 +- Extensions/SkeletonObject/Fskanimation.js | 4 +- .../SkeletonObject/Gskeletonruntimeobject.js | 2 +- Extensions/SystemInfo/systeminfotools.js | 2 +- .../TextEntryObject/textentryruntimeobject.js | 2 +- Extensions/TextObject/textruntimeobject.js | 20 +- .../tiledspriteruntimeobject.js | 2 +- .../cocos-renderers/cocos-director-manager.js | 3 +- .../cocos-renderers/cocos-image-manager.js | 18 ++ GDJS/Runtime/cocos-renderers/cocos-tools.js | 35 ++- .../runtimegame-cocos-renderer.js | 9 +- .../runtimescene-cocos-renderer.js | 8 + .../cocos-sound-manager.js | 7 +- GDJS/Runtime/events-tools/cameratools.js | 3 +- GDJS/Runtime/events-tools/commontools.js | 24 +-- GDJS/Runtime/events-tools/inputtools.js | 9 +- GDJS/Runtime/events-tools/networktools.js | 2 +- GDJS/Runtime/events-tools/objecttools.js | 18 +- .../Runtime/events-tools/runtimescenetools.js | 2 +- GDJS/Runtime/events-tools/soundtools.js | 2 +- GDJS/Runtime/events-tools/storagetools.js | 11 +- GDJS/Runtime/events-tools/stringtools.js | 17 +- GDJS/Runtime/events-tools/windowtools.js | 2 +- GDJS/Runtime/eventscontext.js | 7 +- GDJS/Runtime/force.js | 21 +- GDJS/Runtime/gd.js | 203 +++++++++--------- .../howler-sound-manager.js | 13 +- GDJS/Runtime/inputmanager.js | 22 +- GDJS/Runtime/layer.js | 51 ++--- GDJS/Runtime/libs/hshg.js | 18 +- .../pixi-renderers/layer-pixi-renderer.js | 3 - .../pixi-renderers/pixi-image-manager.js | 11 +- .../runtimegame-pixi-renderer.js | 13 +- GDJS/Runtime/polygon.js | 42 ++-- GDJS/Runtime/profiler.js | 11 +- GDJS/Runtime/runtimebehavior.js | 31 +-- GDJS/Runtime/runtimegame.js | 58 ++--- GDJS/Runtime/runtimeobject.js | 90 +------- GDJS/Runtime/runtimescene.js | 57 ++--- GDJS/Runtime/scenestack.js | 2 +- GDJS/Runtime/spriteruntimeobject.js | 22 +- GDJS/Runtime/timemanager.js | 11 +- GDJS/Runtime/timer.js | 19 +- GDJS/Runtime/variable.js | 24 +-- GDJS/Runtime/variablescontainer.js | 17 +- .../websocket-debugger-client.js | 5 +- GDJS/docs/jsdoc.conf.json | 54 +++++ GDJS/test-docs/scripts/linenumber.js | 25 +++ GDJS/test-docs/scripts/prettify/lang-css.js | 2 + GDJS/test-docs/scripts/prettify/prettify.js | 28 +++ .../Renderers/RenderedAdMobInstance.js | 2 - .../Renderers/RenderedInstance.js | 6 - .../Renderers/RenderedPanelSpriteInstance.js | 2 - .../RenderedParticleEmitterInstance.js | 2 - .../Renderers/RenderedSpriteInstance.js | 2 - .../Renderers/RenderedTextInstance.js | 2 - .../Renderers/RenderedTiledSpriteInstance.js | 2 - 72 files changed, 491 insertions(+), 689 deletions(-) create mode 100644 GDJS/docs/jsdoc.conf.json create mode 100644 GDJS/test-docs/scripts/linenumber.js create mode 100644 GDJS/test-docs/scripts/prettify/lang-css.js create mode 100644 GDJS/test-docs/scripts/prettify/prettify.js diff --git a/Extensions/AdMobObject/admobruntimeobject.js b/Extensions/AdMobObject/admobruntimeobject.js index cb9567e75..cffc7fd63 100644 --- a/Extensions/AdMobObject/admobruntimeobject.js +++ b/Extensions/AdMobObject/admobruntimeobject.js @@ -12,10 +12,10 @@ if (typeof AdMob !== "undefined") * The AdMobRuntimeObject displays an AdMob ad banner on screen. * This works with Cordova compatible platforms with `cordova-plugin-admobpro` plugin installed. * - * @namespace gdjs + * @memberof gdjs * @class AdMobRuntimeObject * @extends RuntimeObject - * @namespace gdjs + * @memberof gdjs */ gdjs.AdMobRuntimeObject = function(runtimeScene, objectData) { diff --git a/Extensions/ExampleJsExtension/examplejsextensiontools.js b/Extensions/ExampleJsExtension/examplejsextensiontools.js index 87d5f87b3..5b04f7a66 100644 --- a/Extensions/ExampleJsExtension/examplejsextensiontools.js +++ b/Extensions/ExampleJsExtension/examplejsextensiontools.js @@ -5,7 +5,7 @@ * * Functions are being passed the arguments that were declared in the extension. * - * @namespace gdjs.evtTools + * @memberof gdjs.evtTools * @class exampleJsExtension * @static * @private diff --git a/Extensions/FacebookInstantGames/facebookinstantgamestools.js b/Extensions/FacebookInstantGames/facebookinstantgamestools.js index 4be8aa253..acc522ad3 100644 --- a/Extensions/FacebookInstantGames/facebookinstantgamestools.js +++ b/Extensions/FacebookInstantGames/facebookinstantgamestools.js @@ -1,5 +1,5 @@ /** - * @namespace gdjs.evtTools + * @memberof gdjs.evtTools * @class facebookInstantGames * @static * @private diff --git a/Extensions/Inventory/inventorytools.js b/Extensions/Inventory/inventorytools.js index 7ee69b112..b1971f90c 100644 --- a/Extensions/Inventory/inventorytools.js +++ b/Extensions/Inventory/inventorytools.js @@ -16,7 +16,7 @@ gdjs.InventoryManager.get = function(runtimeScene, name) { } /** - * @namespace gdjs.evtTools + * @memberof gdjs.evtTools * @class inventory * @static * @private diff --git a/Extensions/LinkedObjects/linkedobjects.js b/Extensions/LinkedObjects/linkedobjects.js index f4fd669a2..e5841c7ba 100644 --- a/Extensions/LinkedObjects/linkedobjects.js +++ b/Extensions/LinkedObjects/linkedobjects.js @@ -6,7 +6,7 @@ Copyright (c) 2013-2016 Florian Rival (Florian.Rival@gmail.com) /** * Manages the links between objects. * - * @namespace gdjs + * @memberof gdjs * @class LinksManager * @constructor */ @@ -17,9 +17,6 @@ gdjs.LinksManager = function() /** * Get the links manager of a scene. - * - * @method getManager - * @static */ gdjs.LinksManager.getManager = function(runtimeScene) { if (!runtimeScene.linkedObjectsManager) { //Create the shared manager if necessary. @@ -77,7 +74,7 @@ gdjs.LinksManager.prototype.removeLinkBetween = function(objA, objB) { }; /** - * @namespace gdjs.evtTools + * @memberof gdjs.evtTools * @class linkedObjects * @static * @private diff --git a/Extensions/PanelSpriteObject/panelspriteruntimeobject.js b/Extensions/PanelSpriteObject/panelspriteruntimeobject.js index 2e287b6a4..9ed002260 100644 --- a/Extensions/PanelSpriteObject/panelspriteruntimeobject.js +++ b/Extensions/PanelSpriteObject/panelspriteruntimeobject.js @@ -8,7 +8,7 @@ * * @class PanelSpriteRuntimeObject * @extends RuntimeObject - * @namespace gdjs + * @memberof gdjs */ gdjs.PanelSpriteRuntimeObject = function(runtimeScene, objectData) { diff --git a/Extensions/PathfindingBehavior/pathfindingobstacleruntimebehavior.js b/Extensions/PathfindingBehavior/pathfindingobstacleruntimebehavior.js index 771356f0f..d7e7248ff 100644 --- a/Extensions/PathfindingBehavior/pathfindingobstacleruntimebehavior.js +++ b/Extensions/PathfindingBehavior/pathfindingobstacleruntimebehavior.js @@ -10,8 +10,7 @@ Copyright (c) 2013-2016 Florian Rival (Florian.Rival@gmail.com) * ( see gdjs.PathfindingRuntimeBehavior.obstaclesManagers ). * * @class PathfindingObstaclesManager - * @namespace gdjs - * @constructor + * @memberof gdjs */ gdjs.PathfindingObstaclesManager = function(runtimeScene) { @@ -21,9 +20,6 @@ gdjs.PathfindingObstaclesManager = function(runtimeScene) /** * Get the obstacles manager of a scene. - * - * @method getManager - * @static */ gdjs.PathfindingObstaclesManager.getManager = function(runtimeScene) { if (!runtimeScene.pathfindingObstaclesManager) { //Create the shared manager if necessary. @@ -35,8 +31,6 @@ gdjs.PathfindingObstaclesManager.getManager = function(runtimeScene) { /** * Add a obstacle to the list of existing obstacles. - * - * @method addObstacle */ gdjs.PathfindingObstaclesManager.prototype.addObstacle = function(pathfindingObstacleBehavior) { this._obstaclesHSHG.addObject(pathfindingObstacleBehavior); @@ -45,8 +39,6 @@ gdjs.PathfindingObstaclesManager.prototype.addObstacle = function(pathfindingObs /** * Remove a obstacle from the list of existing obstacles. Be sure that the obstacle was * added before. - * - * @method removeObstacle */ gdjs.PathfindingObstaclesManager.prototype.removeObstacle = function(pathfindingObstacleBehavior) { this._obstaclesHSHG.removeObject(pathfindingObstacleBehavior); @@ -55,9 +47,8 @@ gdjs.PathfindingObstaclesManager.prototype.removeObstacle = function(pathfinding /** * Tool class which represents a simple point with a radius and a getAABB method. * @class Vertex - * @namespace gdjs.PathfindingObstaclesManager + * @memberof gdjs.PathfindingObstaclesManager * @private - * @constructor */ gdjs.PathfindingObstaclesManager.Vertex = function(x,y,radius) { this.x = x; @@ -67,7 +58,6 @@ gdjs.PathfindingObstaclesManager.Vertex = function(x,y,radius) { /** * Return an axis aligned bouding box for the vertex. - * @method getAABB */ gdjs.PathfindingObstaclesManager.Vertex.prototype.getAABB = function(){ var rad = this.radius, x = this.x, y = this.y; @@ -81,7 +71,6 @@ gdjs.PathfindingObstaclesManager.Vertex.prototype.getAABB = function(){ * @param radius The radius of the search * @param result If defined, the obstacles near the object will be inserted into result (Using the identifier of their owner object as key). * @return If result is not defined, an array with all obstacles near the position. Otherwise, nothing is returned. - * @method getAllObstaclesAround */ gdjs.PathfindingObstaclesManager.prototype.getAllObstaclesAround = function(x, y, radius, result) { var vertex = new gdjs.PathfindingObstaclesManager.Vertex(x,y, radius); @@ -95,8 +84,7 @@ gdjs.PathfindingObstaclesManager.prototype.getAllObstaclesAround = function(x, y * considered as a obstacle by objects having Pathfinding Behavior. * * @class PathfindingObstacleRuntimeBehavior - * @namespace gdjs - * @constructor + * @memberof gdjs */ gdjs.PathfindingObstacleRuntimeBehavior = function(runtimeScene, behaviorData, owner) { diff --git a/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js b/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js index 15385d673..79c856669 100644 --- a/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js +++ b/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js @@ -8,7 +8,7 @@ Copyright (c) 2010-2016 Florian Rival (Florian.Rival@gmail.com) * follow a path computed to avoid obstacles. * * @class PathfindingRuntimeBehavior - * @constructor + * @memberof gdjs */ gdjs.PathfindingRuntimeBehavior = function(runtimeScene, behaviorData, owner) { @@ -169,7 +169,6 @@ gdjs.PathfindingRuntimeBehavior.prototype.getDestinationY = function() { /** * Return true if the latest call to moveTo succeeded. - * @method pathFound */ gdjs.PathfindingRuntimeBehavior.prototype.pathFound = function() { return this._pathFound; @@ -177,7 +176,6 @@ gdjs.PathfindingRuntimeBehavior.prototype.pathFound = function() { /** * Return true if the object reached its destination. - * @method destinationReached */ gdjs.PathfindingRuntimeBehavior.prototype.destinationReached = function() { return this._reachedEnd; @@ -185,7 +183,6 @@ gdjs.PathfindingRuntimeBehavior.prototype.destinationReached = function() { /** * Compute and move on the path to the specified destination. - * @method moveTo */ gdjs.PathfindingRuntimeBehavior.prototype.moveTo = function(runtimeScene, x, y) { @@ -319,7 +316,7 @@ gdjs.PathfindingRuntimeBehavior.prototype.doStepPostEvents = function(runtimeSce /** * Internal tool class representing a node when looking for a path * @private - * @namespace gdjs.PathfindingRuntimeBehavior + * @memberof gdjs.PathfindingRuntimeBehavior * @class Node */ gdjs.PathfindingRuntimeBehavior.Node = function(xPos, yPos) @@ -341,8 +338,7 @@ gdjs.PathfindingRuntimeBehavior.Node = function(xPos, yPos) /** * Compute the euclidean distance between two positions. * @private - * @namespace gdjs.PathfindingRuntimeBehavior - * @method euclideanDistance + * @memberof gdjs.PathfindingRuntimeBehavior */ gdjs.PathfindingRuntimeBehavior.euclideanDistance = function(a, b) { @@ -352,8 +348,7 @@ gdjs.PathfindingRuntimeBehavior.euclideanDistance = function(a, b) /** * Compute the taxi distance between two positions. * @private - * @namespace gdjs.PathfindingRuntimeBehavior - * @method manhattanDistance + * @memberof gdjs.PathfindingRuntimeBehavior */ gdjs.PathfindingRuntimeBehavior.manhattanDistance = function(a, b) { @@ -361,7 +356,7 @@ gdjs.PathfindingRuntimeBehavior.manhattanDistance = function(a, b) }; /** - * \brief Internal tool class containing the structures used by A* and members functions related + * Internal tool class containing the structures used by A* and members functions related * to them. */ gdjs.PathfindingRuntimeBehavior.SearchContext = function() diff --git a/Extensions/PhysicsBehavior/physicsruntimebehavior.js b/Extensions/PhysicsBehavior/physicsruntimebehavior.js index 2f709ed13..08dbe66e0 100644 --- a/Extensions/PhysicsBehavior/physicsruntimebehavior.js +++ b/Extensions/PhysicsBehavior/physicsruntimebehavior.js @@ -6,6 +6,8 @@ Copyright (c) 2013-2016 Florian Rival (Florian.Rival@gmail.com) /** * Manage the common objects shared by objects having a * physics behavior. + * @memberof gdjs + * @class PhysicsSharedData */ gdjs.PhysicsSharedData = function(runtimeScene, sharedData) { @@ -70,9 +72,6 @@ gdjs.PhysicsSharedData = function(runtimeScene, sharedData) /** * Get the shared data for a scene. - * - * @method getSharedData - * @static */ gdjs.PhysicsSharedData.getSharedData = function(runtimeScene, name) { if (!runtimeScene.physicsSharedData) { //Create the shared data if necessary. @@ -162,9 +161,6 @@ gdjs.PhysicsRuntimeBehavior.prototype.ownerRemovedFromScene = function() { /** * Return a Box2D.b2Vec2 with the specified coordinates. * Should be used instead of doing 'new Box2D.b2Vec2(x, y)'. - * - * @method b2Vec2 - * @private */ gdjs.PhysicsRuntimeBehavior.prototype.b2Vec2 = function(x, y) { this._tempb2Vec2.set_x(x); diff --git a/Extensions/PlatformBehavior/platformruntimebehavior.js b/Extensions/PlatformBehavior/platformruntimebehavior.js index 62a38a6fc..26d6c5d5e 100644 --- a/Extensions/PlatformBehavior/platformruntimebehavior.js +++ b/Extensions/PlatformBehavior/platformruntimebehavior.js @@ -10,8 +10,7 @@ Copyright (c) 2013-2016 Florian Rival (Florian.Rival@gmail.com) * (see gdjs.PlatformRuntimeBehavior.getManager). * * @class PlatformObjectsManager - * @namespace gdjs - * @constructor + * @memberof gdjs */ gdjs.PlatformObjectsManager = function(runtimeScene, sharedData) { @@ -20,9 +19,6 @@ gdjs.PlatformObjectsManager = function(runtimeScene, sharedData) /** * Get the platforms manager of a scene. - * - * @method getManager - * @static */ gdjs.PlatformObjectsManager.getManager = function(runtimeScene) { if (!runtimeScene.platformsObjectsManager) { //Create the shared manager if necessary. @@ -34,8 +30,6 @@ gdjs.PlatformObjectsManager.getManager = function(runtimeScene) { /** * Add a platform to the list of existing platforms. - * - * @method addPlatform */ gdjs.PlatformObjectsManager.prototype.addPlatform = function(platformBehavior) { this._platformRBush.insert(platformBehavior); @@ -44,8 +38,6 @@ gdjs.PlatformObjectsManager.prototype.addPlatform = function(platformBehavior) { /** * Remove a platform from the list of existing platforms. Be sure that the platform was * added before. - * - * @method removePlatform */ gdjs.PlatformObjectsManager.prototype.removePlatform = function(platformBehavior) { this._platformRBush.remove(platformBehavior); @@ -53,10 +45,9 @@ gdjs.PlatformObjectsManager.prototype.removePlatform = function(platformBehavior /** * Returns all the platforms around the specified object. - * @param object {gdjs.RuntimeObject} The object - * @param maxMovementLength The maximum distance, in pixels, the object is going to do. + * @param {gdjs.RuntimeObject} object The object + * @param {number} maxMovementLength The maximum distance, in pixels, the object is going to do. * @return An array with all platforms near the object. - * @method getAllPlatformsAround */ gdjs.PlatformObjectsManager.prototype.getAllPlatformsAround = function(object, maxMovementLength, result) { var ow = object.getWidth(); @@ -79,8 +70,7 @@ gdjs.PlatformObjectsManager.prototype.getAllPlatformsAround = function(object, m * considered as a platform by objects having PlatformerObject Behavior. * * @class PlatformRuntimeBehavior - * @namespace gdjs - * @constructor + * @memberof gdjs */ gdjs.PlatformRuntimeBehavior = function(runtimeScene, behaviorData, owner) { diff --git a/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js b/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js index 0e82187a5..cd9f19b85 100644 --- a/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js +++ b/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js @@ -8,7 +8,7 @@ * * @class ShapePainterRuntimeObject * @extends RuntimeObject - * @namespace gdjs + * @memberof gdjs */ gdjs.ShapePainterRuntimeObject = function(runtimeScene, objectData) { diff --git a/Extensions/Shopify/shopifytools.js b/Extensions/Shopify/shopifytools.js index e63e01429..5115d114a 100644 --- a/Extensions/Shopify/shopifytools.js +++ b/Extensions/Shopify/shopifytools.js @@ -20,7 +20,7 @@ gdjs.ShopifyClientsManager.get = function(runtimeScene, name) { } /** - * @namespace gdjs.evtTools + * @memberof gdjs.evtTools * @class shopify * @static * @private diff --git a/Extensions/SkeletonObject/Ask.js b/Extensions/SkeletonObject/Ask.js index 38156a889..f3fd9ec98 100644 --- a/Extensions/SkeletonObject/Ask.js +++ b/Extensions/SkeletonObject/Ask.js @@ -6,7 +6,7 @@ This project is released under the MIT License. */ /** - * @namespace gdjs.sk + * @memberof gdjs.sk */ gdjs.sk = gdjs.sk || { // Some useful constants @@ -27,7 +27,7 @@ gdjs.sk = gdjs.sk || { /** * The Matrix holds the basic transformation data in a matrix form. * - * @namespace gdjs.sk + * @memberof gdjs.sk * @class Matrix */ gdjs.sk.Matrix = function(a=1, b=0, tx=0, c=0, d=1, ty=0){ @@ -110,7 +110,7 @@ gdjs.sk.Matrix.prototype.str = function(){ /** * The Transform is the basic class for transformable objects as bones, slots and armatures. * - * @namespace gdjs.sk + * @memberof gdjs.sk * @class Transform */ gdjs.sk.Transform = function(x=0, y=0, rot=0, sx=1, sy=1){ diff --git a/Extensions/SkeletonObject/Cskbone.js b/Extensions/SkeletonObject/Cskbone.js index 1a2d65164..7b1d7910f 100644 --- a/Extensions/SkeletonObject/Cskbone.js +++ b/Extensions/SkeletonObject/Cskbone.js @@ -7,7 +7,7 @@ This project is released under the MIT License. /** - * @namespace gdjs.sk + * @memberof gdjs.sk * @class SharedBone */ gdjs.sk.SharedBone = function(){ @@ -47,7 +47,7 @@ gdjs.sk.SharedBone.prototype.loadDragonBones = function(boneData){ /** * The Bone holds basic transform data in a hierarchy tree. * - * @namespace gdjs.sk + * @memberof gdjs.sk * @class Bone * @extends gdjs.sk.Transform */ diff --git a/Extensions/SkeletonObject/Dskslot.js b/Extensions/SkeletonObject/Dskslot.js index d014a6c7e..2323d561d 100644 --- a/Extensions/SkeletonObject/Dskslot.js +++ b/Extensions/SkeletonObject/Dskslot.js @@ -7,7 +7,7 @@ This project is released under the MIT License. /** - * @namespace gdjs.sk + * @memberof gdjs.sk * @class SharedSlot */ gdjs.sk.SharedSlot = function(){ @@ -157,7 +157,7 @@ gdjs.sk.SharedSlot.prototype.loadDragonBonesSkinData = function(skinDatas, index /** * The Slot display images transformed by animations itself and bones. * - * @namespace gdjs.sk + * @memberof gdjs.sk * @class Slot * @extends gdjs.sk.Transform */ diff --git a/Extensions/SkeletonObject/Eskarmature.js b/Extensions/SkeletonObject/Eskarmature.js index 574661331..fae97e5d5 100644 --- a/Extensions/SkeletonObject/Eskarmature.js +++ b/Extensions/SkeletonObject/Eskarmature.js @@ -7,7 +7,7 @@ This project is released under the MIT License. /** - * @namespace gdjs.sk + * @memberof gdjs.sk * @class SharedArmature */ gdjs.sk.SharedArmature = function(){ @@ -78,7 +78,7 @@ gdjs.sk.SharedArmature.prototype.loadDragonBones = function(armatureData, textur /** * The Armature holds the bones and slots/attachments as well as its animations. * - * @namespace gdjs.sk + * @memberof gdjs.sk * @class Armature * @extends gdjs.sk.Transform */ diff --git a/Extensions/SkeletonObject/Fskanimation.js b/Extensions/SkeletonObject/Fskanimation.js index 135bb01ec..0d222fbd7 100644 --- a/Extensions/SkeletonObject/Fskanimation.js +++ b/Extensions/SkeletonObject/Fskanimation.js @@ -6,7 +6,7 @@ This project is released under the MIT License. */ /** - * @namespace gdjs.sk + * @memberof gdjs.sk * @class SharedAnimation */ gdjs.sk.SharedAnimation = function(){ @@ -75,7 +75,7 @@ gdjs.sk.SharedAnimation.prototype.loadDragonBones = function(animationData, fps, /** * The Animation holds information to transform bones and slots through time. * - * @namespace gdjs.sk + * @memberof gdjs.sk * @class Animation */ gdjs.sk.Animation = function(armature){ diff --git a/Extensions/SkeletonObject/Gskeletonruntimeobject.js b/Extensions/SkeletonObject/Gskeletonruntimeobject.js index 5e9320776..406f3db9e 100644 --- a/Extensions/SkeletonObject/Gskeletonruntimeobject.js +++ b/Extensions/SkeletonObject/Gskeletonruntimeobject.js @@ -9,7 +9,7 @@ This project is released under the MIT License. /** * The SkeletonRuntimeObject imports and displays skeletal animations files. * - * @namespace gdjs + * @memberof gdjs * @class SkeletonRuntimeObject * @extends RuntimeObject */ diff --git a/Extensions/SystemInfo/systeminfotools.js b/Extensions/SystemInfo/systeminfotools.js index bcc2d216f..ce1757ad4 100644 --- a/Extensions/SystemInfo/systeminfotools.js +++ b/Extensions/SystemInfo/systeminfotools.js @@ -4,7 +4,7 @@ Copyright (c) 2016 Florian Rival (Florian.Rival@gmail.com) */ /** - * @namespace gdjs.evtTools + * @memberof gdjs.evtTools * @class linkedObjects * @static * @private diff --git a/Extensions/TextEntryObject/textentryruntimeobject.js b/Extensions/TextEntryObject/textentryruntimeobject.js index b1e5e03a9..ae9d88007 100644 --- a/Extensions/TextEntryObject/textentryruntimeobject.js +++ b/Extensions/TextEntryObject/textentryruntimeobject.js @@ -8,7 +8,7 @@ * * @class TextEntryRuntimeObject * @extends RuntimeObject - * @namespace gdjs + * @memberof gdjs */ gdjs.TextEntryRuntimeObject = function(runtimeScene, objectData) { diff --git a/Extensions/TextObject/textruntimeobject.js b/Extensions/TextObject/textruntimeobject.js index e8c46daee..9cdac1d17 100644 --- a/Extensions/TextObject/textruntimeobject.js +++ b/Extensions/TextObject/textruntimeobject.js @@ -6,10 +6,9 @@ /** * Displays a text on the screen. * - * @namespace gdjs + * @memberof gdjs * @class TextRuntimeObject * @extends RuntimeObject - * @namespace gdjs */ gdjs.TextRuntimeObject = function(runtimeScene, objectData) { @@ -43,7 +42,6 @@ gdjs.TextRuntimeObject.prototype.update = function() { /** * Update the position object's. - * @method _updateTextPosition * @private */ gdjs.TextRuntimeObject.prototype._updateTextPosition = function() { @@ -53,7 +51,6 @@ gdjs.TextRuntimeObject.prototype._updateTextPosition = function() { /** * Set object's position in X. - * @method setX */ gdjs.TextRuntimeObject.prototype.setX = function(x) { gdjs.RuntimeObject.prototype.setX.call(this, x); @@ -62,7 +59,6 @@ gdjs.TextRuntimeObject.prototype.setX = function(x) { /** * Set object's position in Y. - * @method setY */ gdjs.TextRuntimeObject.prototype.setY = function(y) { gdjs.RuntimeObject.prototype.setY.call(this, y); @@ -71,7 +67,6 @@ gdjs.TextRuntimeObject.prototype.setY = function(y) { /** * Set the angle of the object. - * @method setAngle * @param angle {Number} The new angle of the object */ gdjs.TextRuntimeObject.prototype.setAngle = function(angle) { @@ -81,7 +76,6 @@ gdjs.TextRuntimeObject.prototype.setAngle = function(angle) { /** * Set object's opacity. - * @method setOpacity */ gdjs.TextRuntimeObject.prototype.setOpacity = function(opacity) { if ( opacity < 0 ) opacity = 0; @@ -93,7 +87,6 @@ gdjs.TextRuntimeObject.prototype.setOpacity = function(opacity) { /** * Get object's opacity. - * @method getOpacity */ gdjs.TextRuntimeObject.prototype.getOpacity = function() { return this.opacity; @@ -101,7 +94,6 @@ gdjs.TextRuntimeObject.prototype.getOpacity = function() { /** * Get object's string. - * @method getString */ gdjs.TextRuntimeObject.prototype.getString = function() { return this._str; @@ -109,7 +101,6 @@ gdjs.TextRuntimeObject.prototype.getString = function() { /** * Set object's string. - * @method setString * @param {String} Change string of text for your object. */ gdjs.TextRuntimeObject.prototype.setString = function(str) { @@ -122,7 +113,6 @@ gdjs.TextRuntimeObject.prototype.setString = function(str) { /** * Get size of characters of the object. - * @method getCharacterSize */ gdjs.TextRuntimeObject.prototype.getCharacterSize = function() { return this._characterSize; @@ -130,7 +120,6 @@ gdjs.TextRuntimeObject.prototype.getCharacterSize = function() { /** * Set size of characters of the object. - * @method setCharacterSize * @param newSize {Number} The new size for text. */ gdjs.TextRuntimeObject.prototype.setCharacterSize = function(newSize) { @@ -141,7 +130,6 @@ gdjs.TextRuntimeObject.prototype.setCharacterSize = function(newSize) { /** * Return true if your text is bold. - * @method isBold */ gdjs.TextRuntimeObject.prototype.isBold = function() { return this._bold; @@ -149,7 +137,6 @@ gdjs.TextRuntimeObject.prototype.isBold = function() { /** * Set bold for your object text. - * @method setBold * @param enable {Boolean} Set it to true to have a bold text, false to not bold. */ gdjs.TextRuntimeObject.prototype.setBold = function(enable) { @@ -159,7 +146,6 @@ gdjs.TextRuntimeObject.prototype.setBold = function(enable) { /** * Return true if your text is italic. - * @method isItalic */ gdjs.TextRuntimeObject.prototype.isItalic = function() { return this._italic; @@ -167,7 +153,6 @@ gdjs.TextRuntimeObject.prototype.isItalic = function() { /** * Set italic for your object text. - * @method setItalic * @param enable {Boolean} Set it to true to have a italic text, false to not italic. */ gdjs.TextRuntimeObject.prototype.setItalic = function(enable) { @@ -177,7 +162,6 @@ gdjs.TextRuntimeObject.prototype.setItalic = function(enable) { /** * Get width for your object text. - * @method getWidth */ gdjs.TextRuntimeObject.prototype.getWidth = function() { return this._renderer.getWidth(); @@ -185,7 +169,6 @@ gdjs.TextRuntimeObject.prototype.getWidth = function() { /** * Get height for your object text. - * @method getHeight */ gdjs.TextRuntimeObject.prototype.getHeight = function() { return this._renderer.getHeight(); @@ -193,7 +176,6 @@ gdjs.TextRuntimeObject.prototype.getHeight = function() { /** * Change the text color. - * @method setColor * @param {String} example for red : "255;0;0" */ gdjs.TextRuntimeObject.prototype.setColor = function(str) { diff --git a/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js b/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js index 4171d76ab..616900b89 100644 --- a/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js +++ b/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js @@ -8,7 +8,7 @@ * * @class TiledSpriteRuntimeObject * @extends RuntimeObject - * @namespace gdjs + * @memberof gdjs */ gdjs.TiledSpriteRuntimeObject = function(runtimeScene, objectData) { diff --git a/GDJS/Runtime/cocos-renderers/cocos-director-manager.js b/GDJS/Runtime/cocos-renderers/cocos-director-manager.js index 29daed171..f530f73df 100644 --- a/GDJS/Runtime/cocos-renderers/cocos-director-manager.js +++ b/GDJS/Runtime/cocos-renderers/cocos-director-manager.js @@ -10,7 +10,8 @@ * director needs (always a scene living, different call to push the 1st scene). * * @class CocosDirectorManager - * @namespace gdjs + * @memberof gdjs + * @param {Object} The Cocos2D-JS to use. If not specified, `cc.director` will be used. */ gdjs.CocosDirectorManager = function(cocosDirector) { diff --git a/GDJS/Runtime/cocos-renderers/cocos-image-manager.js b/GDJS/Runtime/cocos-renderers/cocos-image-manager.js index 08bd4c1d0..3b16aa937 100644 --- a/GDJS/Runtime/cocos-renderers/cocos-image-manager.js +++ b/GDJS/Runtime/cocos-renderers/cocos-image-manager.js @@ -4,6 +4,13 @@ * This project is released under the MIT License. */ +/** + * CocosImageManager loads and stores textures that can be used by the Cocos2D-JS renderers. + * + * @class CocosImageManager + * @memberof gdjs + * @param {Object} resources The resources data of the game. + */ gdjs.CocosImageManager = function(resources) { this._resources = {}; @@ -17,6 +24,11 @@ gdjs.CocosImageManager = function(resources) gdjs.ImageManager = gdjs.CocosImageManager; //Register the class to let the engine use it. +/** + * Return the texture associated to the specified name. + * Returns a placeholder texture if not found. + * @param {string} name The name of the resource to get. + */ gdjs.CocosImageManager.prototype.getTexture = function(imageName) { var texture; if (this._resources.hasOwnProperty(imageName)) { @@ -31,6 +43,12 @@ gdjs.CocosImageManager.prototype.getTexture = function(imageName) { return texture; }; +/** + * Return a texture which can be used as a placeholder when no + * suitable texture can be found. + * TODO: The path to the file is hardcoded and can create crash if not existing, + * especially when compiled to a native game on iOS/Android/macOS. + */ gdjs.CocosImageManager.prototype.getInvalidTexture = function() { return "res/HelloWorld.png"; //TODO }; diff --git a/GDJS/Runtime/cocos-renderers/cocos-tools.js b/GDJS/Runtime/cocos-renderers/cocos-tools.js index 5213ccd42..77b24b9b1 100644 --- a/GDJS/Runtime/cocos-renderers/cocos-tools.js +++ b/GDJS/Runtime/cocos-renderers/cocos-tools.js @@ -1,11 +1,14 @@ /** * Common tools that can be used for rendering with Cocos2d-JS. * @class CocosTools - * @namespace gdjs + * @memberof gdjs */ gdjs.CocosTools = function() { }; +/** + * @memberof gdjs.CocosTools + */ gdjs.CocosTools.hexToCCColor = function(hexColor, opacity) { return cc.color( (hexColor >> 16) & 255, @@ -15,11 +18,18 @@ gdjs.CocosTools.hexToCCColor = function(hexColor, opacity) { ); } +/** + * @memberof gdjs.CocosTools + */ gdjs.CocosTools.isHTML5 = function() { return (typeof document !== "undefined"); } //TODO: move the rest to cocos-shader-tools + +/** + * @memberof gdjs.CocosTools + */ gdjs.CocosTools.getDefaultVertexShader = function() { var projectionMatrix = gdjs.CocosTools.isHTML5() ? "(CC_PMatrix * CC_MVMatrix)" : @@ -45,6 +55,9 @@ gdjs.CocosTools.getDefaultVertexShader = function() { + '}\n'; } +/** + * @memberof gdjs.CocosTools + */ gdjs.CocosTools.makeNightShader = function() { var shader = new cc.GLProgram(); @@ -75,6 +88,9 @@ gdjs.CocosTools.makeNightShader = function() { return shader; } +/** + * @memberof gdjs.CocosTools + */ gdjs.CocosTools.makeLightNightShader = function() { var shader = new cc.GLProgram(); @@ -104,6 +120,9 @@ gdjs.CocosTools.makeLightNightShader = function() { return shader; } +/** + * @memberof gdjs.CocosTools + */ gdjs.CocosTools.makeSepiaShader = function() { var shader = new cc.GLProgram(); @@ -139,7 +158,7 @@ gdjs.CocosTools.makeSepiaShader = function() { * the shaders uniforms: uPixelSize (using texture size), uFrame * and uTransform (using texture and object size). * - * @method makeTilingShader + * @memberof gdjs.CocosTools */ gdjs.CocosTools.makeTilingShader = function() { var shader = new cc.GLProgram(); @@ -219,8 +238,7 @@ gdjs.CocosTools._effects = { /** * Get the shader and its uniforms name for an effect - * @method getEffect - * @static + * @memberof gdjs.CocosTools */ gdjs.CocosTools.getEffect = function(effectName) { if (gdjs.CocosTools._effects.hasOwnProperty(effectName)) @@ -229,6 +247,9 @@ gdjs.CocosTools.getEffect = function(effectName) { return null; } +/** + * @memberof gdjs.CocosTools + */ gdjs.CocosTools.setUniformLocationWith1f = function(node, shader, uniform, uniformName, value) { if (gdjs.CocosTools.isHTML5()) { shader.setUniformLocationWith1f(uniform, value); @@ -237,6 +258,9 @@ gdjs.CocosTools.setUniformLocationWith1f = function(node, shader, uniform, unifo } } +/** + * @memberof gdjs.CocosTools + */ gdjs.CocosTools.setUniformLocationWith2f = function(node, shader, uniform, uniformName, p1, p2) { if (gdjs.CocosTools.isHTML5()) { shader.setUniformLocationWith2f(uniform, p1, p2); @@ -245,6 +269,9 @@ gdjs.CocosTools.setUniformLocationWith2f = function(node, shader, uniform, unifo } } +/** + * @memberof gdjs.CocosTools + */ gdjs.CocosTools.setUniformLocationWith4f = function(node, shader, uniform, uniformName, p1, p2, p3, p4) { if (gdjs.CocosTools.isHTML5()) { shader.setUniformLocationWith4f(uniform, p1, p2, p3, p4); diff --git a/GDJS/Runtime/cocos-renderers/runtimegame-cocos-renderer.js b/GDJS/Runtime/cocos-renderers/runtimegame-cocos-renderer.js index 4479e3c97..a3d3df034 100644 --- a/GDJS/Runtime/cocos-renderers/runtimegame-cocos-renderer.js +++ b/GDJS/Runtime/cocos-renderers/runtimegame-cocos-renderer.js @@ -4,6 +4,11 @@ * This project is released under the MIT License. */ +/** + * The renderer for a gdjs.RuntimeGame using Cocos2D-JS. + * @class RuntimeGameCocosRenderer + * @memberof gdjs + */ gdjs.RuntimeGameCocosRenderer = function(game, width, height, forceFullscreen) { this._directorManager = new gdjs.CocosDirectorManager(); @@ -44,7 +49,6 @@ gdjs.RuntimeGameCocosRenderer.prototype.setMargins = function(top, right, bottom /** * De/activate fullscreen for the game. - * @method setFullScreen */ gdjs.RuntimeGameCocosRenderer.prototype.setFullScreen = function(enable) { //TODO @@ -69,8 +73,7 @@ gdjs.RuntimeGameCocosRenderer.prototype.getDirectorManager = function() { /** * As Cocos2d is managing the game loop, the Cocos scenes need to call this - * function to step the game engine. See RuntimeSceneCocosRenderer. - * @method onSceneUpdated + * function to step the game engine. See gdjs.RuntimeSceneCocosRenderer. */ gdjs.RuntimeGameCocosRenderer.prototype.onSceneUpdated = function(dt) { if (!this._gameLoopFn(dt)) { diff --git a/GDJS/Runtime/cocos-renderers/runtimescene-cocos-renderer.js b/GDJS/Runtime/cocos-renderers/runtimescene-cocos-renderer.js index 3d097f1b5..7a9819a54 100644 --- a/GDJS/Runtime/cocos-renderers/runtimescene-cocos-renderer.js +++ b/GDJS/Runtime/cocos-renderers/runtimescene-cocos-renderer.js @@ -4,6 +4,11 @@ * This project is released under the MIT License. */ +/** + * Renderer for a gdjs.RuntimeScene with Cocos2d-JS. + * @memberof gdjs + * @class RuntimeSceneCocosRenderer + */ gdjs.RuntimeSceneCocosRenderer = function(runtimeScene, runtimeGameRenderer) { this._runtimeScene = runtimeScene; @@ -57,6 +62,9 @@ gdjs.RuntimeSceneCocosRenderer.prototype.onCanvasResized = function() { // Nothing to do here. }; +/** + * Render the scene + */ gdjs.RuntimeSceneCocosRenderer.prototype.render = function() { var intColor = this._runtimeScene.getBackgroundColor(); var r = (intColor >> 16) & 255; diff --git a/GDJS/Runtime/cocos-sound-manager/cocos-sound-manager.js b/GDJS/Runtime/cocos-sound-manager/cocos-sound-manager.js index 871176414..1df20ed25 100644 --- a/GDJS/Runtime/cocos-sound-manager/cocos-sound-manager.js +++ b/GDJS/Runtime/cocos-sound-manager/cocos-sound-manager.js @@ -5,7 +5,7 @@ */ /** - * @namespace gdjs + * @memberof gdjs * @class CocosEffect * @private */ @@ -52,7 +52,7 @@ gdjs.CocosEffect.prototype.seek = function() { }; /** - * @namespace gdjs + * @memberof gdjs * @class CocosSoundManager * @constructor */ @@ -72,9 +72,8 @@ gdjs.SoundManager = gdjs.CocosSoundManager; //Register the class to let the engi * Names and files are loaded from resources when preloadAudio is called. If no * file is associated to the given name, then the name will be considered as a * filename and will be returned. - * @method _getFileFromSoundName - * @private * @return The associated filename + * @private */ gdjs.CocosSoundManager.prototype._getFileFromSoundName = function(soundName) { if (this._availableResources.hasOwnProperty(soundName) && diff --git a/GDJS/Runtime/events-tools/cameratools.js b/GDJS/Runtime/events-tools/cameratools.js index bea1a570f..8a4054f1e 100644 --- a/GDJS/Runtime/events-tools/cameratools.js +++ b/GDJS/Runtime/events-tools/cameratools.js @@ -5,10 +5,9 @@ */ /** - * @namespace gdjs.evtTools + * @memberof gdjs.evtTools * @class camera * @private - * @static */ gdjs.evtTools.camera = gdjs.evtTools.camera || {}; diff --git a/GDJS/Runtime/events-tools/commontools.js b/GDJS/Runtime/events-tools/commontools.js index c5b6901d0..34cab4448 100644 --- a/GDJS/Runtime/events-tools/commontools.js +++ b/GDJS/Runtime/events-tools/commontools.js @@ -5,7 +5,7 @@ */ /** - * @namespace gdjs.evtTools + * @memberof gdjs.evtTools * @class common * @static * @private @@ -16,9 +16,7 @@ gdjs.evtTools.common = gdjs.evtTools.common || {}; /** * Get the value of a variable. Equivalent of variable.getAsNumber(). - * @method getVariableValue * @private - * @static */ gdjs.evtTools.common.getVariableNumber = function(variable) { return variable.getAsNumber(); @@ -26,63 +24,49 @@ gdjs.evtTools.common.getVariableNumber = function(variable) { /** * Get the string of a variable. Equivalent of variable.getAsString(). - * @method getVariableValue * @private - * @static */ gdjs.evtTools.common.getVariableString = function(variable) { return variable.getAsString(); }; /** - * @method sceneVariableExists * @private - * @static */ gdjs.evtTools.common.sceneVariableExists = function(runtimeScene, variableName) { return runtimeScene.getVariables().has(variableName); }; /** - * @method globalVariableExists * @private - * @static */ gdjs.evtTools.common.globalVariableExists = function(runtimeScene, variableName) { return runtimeScene.getGame().getVariables().has(variableName); }; /** - * @method variableChildExists * @private - * @static */ gdjs.evtTools.common.variableChildExists = function(variable, childName) { return variable.hasChild(childName); }; /** - * @method variableRemoveChild * @private - * @static */ gdjs.evtTools.common.variableRemoveChild = function(variable, childName) { return variable.removeChild(childName); }; /** - * @method variableClearChildren * @private - * @static */ gdjs.evtTools.common.variableClearChildren = function(variable) { variable.clearChildren(); }; /** - * @method getVariableChildCount * @private - * @static */ gdjs.evtTools.common.getVariableChildCount = function(variable) { if (variable.isStructure() == false) return 0; @@ -91,9 +75,7 @@ gdjs.evtTools.common.getVariableChildCount = function(variable) { /** * Convert a string to a float. - * @method toNumber * @private - * @static */ gdjs.evtTools.common.toNumber = function(str) { return parseFloat(str); @@ -101,9 +83,7 @@ gdjs.evtTools.common.toNumber = function(str) { /** * Convert a number to a string. - * @method toString * @private - * @static */ gdjs.evtTools.common.toString = function(num) { //Using String literal is fastest than using toString according to @@ -113,9 +93,7 @@ gdjs.evtTools.common.toString = function(num) { /** * Negate the boolean. - * @method logicalNegation * @private - * @static */ gdjs.evtTools.common.logicalNegation = function(bool) { return !bool; diff --git a/GDJS/Runtime/events-tools/inputtools.js b/GDJS/Runtime/events-tools/inputtools.js index c38634cfc..9126dde9b 100644 --- a/GDJS/Runtime/events-tools/inputtools.js +++ b/GDJS/Runtime/events-tools/inputtools.js @@ -7,7 +7,7 @@ /** * Tools related to input ( Keyboard, mouse ), for events generated code. * - * @namespace gdjs.evtTools + * @memberof gdjs.evtTools * @class input * @static * @private @@ -17,7 +17,6 @@ gdjs.evtTools.input = gdjs.evtTools.input || {}; /** * Return true if the specified key is pressed * - * @method isKeyPressed * @private */ gdjs.evtTools.input.isKeyPressed = function(runtimeScene, key) { @@ -31,7 +30,6 @@ gdjs.evtTools.input.isKeyPressed = function(runtimeScene, key) { /** * Return true if the specified key was just released * - * @method isKeyPressed * @private */ gdjs.evtTools.input.wasKeyReleased = function(runtimeScene, key) { @@ -44,7 +42,6 @@ gdjs.evtTools.input.wasKeyReleased = function(runtimeScene, key) { /** * Return the name of the last key pressed in the game - * @method lastPressedKey * @private */ gdjs.evtTools.input.lastPressedKey = function(runtimeScene) { @@ -69,9 +66,7 @@ gdjs.evtTools.input.lastPressedKey = function(runtimeScene) { /** * Hashmap associated each name of a key to its keyCode. - * @namespace gdjs.evtTools - * @property keysNameToCode - * @static + * @memberof gdjs.evtTools */ gdjs.evtTools.input.keysNameToCode = { "a": 65, diff --git a/GDJS/Runtime/events-tools/networktools.js b/GDJS/Runtime/events-tools/networktools.js index 7c7c074bd..4240b531b 100644 --- a/GDJS/Runtime/events-tools/networktools.js +++ b/GDJS/Runtime/events-tools/networktools.js @@ -5,7 +5,7 @@ */ /** - * @namespace gdjs.evtTools + * @memberof gdjs.evtTools * @class network * @static * @private diff --git a/GDJS/Runtime/events-tools/objecttools.js b/GDJS/Runtime/events-tools/objecttools.js index 3e6230a17..57af42e28 100644 --- a/GDJS/Runtime/events-tools/objecttools.js +++ b/GDJS/Runtime/events-tools/objecttools.js @@ -6,21 +6,17 @@ /** * Tools related to objects, for events generated code. - * @namespace gdjs.evtTools - * @class object - * @static - * @private + * @memberof gdjs.evtTools + * @namespace object */ gdjs.evtTools.object = gdjs.evtTools.object || {}; /** - * \brief Keep only the specified object in the lists of picked objects. + * Keep only the specified object in the lists of picked objects. * - * @method pickOnly * @param objectsLists The lists of objects to trim * @param runtimeObject {gdjs.RuntimeObject} The object to keep in the lists - * @static */ gdjs.evtTools.object.pickOnly = function(objectsLists, runtimeObject) { var lists = gdjs.staticArray(gdjs.evtTools.object.pickOnly); @@ -53,9 +49,6 @@ gdjs.evtTools.object.pickOnly = function(objectsLists, runtimeObject) { * Note: predicate is called with the two objects to compare, and an optional argument `extraArg`. * This should be used to avoid declaring the predicate as a closure that would be created and destroyed * at each call to twoListsTest (potentially multiple time per frame). - * - * @method TwoListsTest - * @static */ gdjs.evtTools.object.twoListsTest = function(predicate, objectsLists1, objectsLists2, inverted, extraArg) { @@ -149,7 +142,7 @@ gdjs.evtTools.object.twoListsTest = function(predicate, objectsLists1, objectsLi } /** - * @brief Filter objects to keep only the one that fullfil the predicate + * Filter objects to keep only the one that fullfil the predicate * * Objects that do not fullfil the predicate are removed from objects lists. * @@ -158,9 +151,6 @@ gdjs.evtTools.object.twoListsTest = function(predicate, objectsLists1, objectsLi * @param negatePredicate If set to true, the result of the predicate is negated. * @param extraArg Argument passed to the predicate (along with the object). Useful for avoiding relying on temporary closures. * @return true if at least one object fulfill the predicate. - * - * @method PickObjectsIf - * @static */ gdjs.evtTools.object.pickObjectsIf = function(predicate, objectsLists, negatePredicate, extraArg) { var isTrue = false; diff --git a/GDJS/Runtime/events-tools/runtimescenetools.js b/GDJS/Runtime/events-tools/runtimescenetools.js index 8788d2840..f93fb0769 100644 --- a/GDJS/Runtime/events-tools/runtimescenetools.js +++ b/GDJS/Runtime/events-tools/runtimescenetools.js @@ -6,7 +6,7 @@ /** * Tools related to runtime scene, for events generated code. - * @namespace gdjs.evtTools + * @memberof gdjs.evtTools * @class runtimeScene * @static * @private diff --git a/GDJS/Runtime/events-tools/soundtools.js b/GDJS/Runtime/events-tools/soundtools.js index 3250f00a3..fa0c5edba 100644 --- a/GDJS/Runtime/events-tools/soundtools.js +++ b/GDJS/Runtime/events-tools/soundtools.js @@ -7,7 +7,7 @@ /** * Class used by events to interact with the soundManager. * - * @namespace gdjs.evtTools + * @memberof gdjs.evtTools * @class sound * @static * @private diff --git a/GDJS/Runtime/events-tools/storagetools.js b/GDJS/Runtime/events-tools/storagetools.js index d124fdd9f..bdedd103e 100644 --- a/GDJS/Runtime/events-tools/storagetools.js +++ b/GDJS/Runtime/events-tools/storagetools.js @@ -7,9 +7,8 @@ /** * Tools related to storage, for events generated code. * - * @namespace gdjs.evtTools - * @class storage - * @static + * @memberof gdjs.evtTools + * @namespace storage * @private */ gdjs.evtTools.storage = gdjs.evtTools.storage || { @@ -23,10 +22,7 @@ gdjs.evtTools.storage = gdjs.evtTools.storage || { * provided by the browser. * The JSON object is named GDJS_filename in the localStorage object. * - * @method loadJSONFileFromStorage * @param filename {String} The name of the JSON object - * @static - * @private */ gdjs.evtTools.storage.loadJSONFileFromStorage = function(filename) { if ( gdjs.evtTools.storage.loadedFiles.containsKey(filename) ) @@ -64,10 +60,7 @@ gdjs.evtTools.storage.loadJSONFileFromStorage = function(filename) { * object provided by the browser. * The JSON object is named GDJS_filename in the localStorage object. * - * @method loadJSONFileFromStorage * @param filename {String} The name of the JSON object - * @static - * @private */ gdjs.evtTools.storage.unloadJSONFile = function(filename) { if ( !gdjs.evtTools.storage.loadedFiles.containsKey(filename) ) diff --git a/GDJS/Runtime/events-tools/stringtools.js b/GDJS/Runtime/events-tools/stringtools.js index 5b50dc369..64ccf4fce 100644 --- a/GDJS/Runtime/events-tools/stringtools.js +++ b/GDJS/Runtime/events-tools/stringtools.js @@ -7,16 +7,14 @@ /** * Tools related to strings manipulation, for events generated code. * - * @namespace gdjs.evtTools - * @class string - * @static + * @memberof gdjs.evtTools + * @namespace string * @private */ gdjs.evtTools.string = gdjs.evtTools.string || {}; /** * Return a string containing a new line character. - * @method newLine * @private */ gdjs.evtTools.string.newLine = function() { @@ -25,7 +23,6 @@ gdjs.evtTools.string.newLine = function() { /** * Return a character from its codepoint. - * @method fromCodePoint * @private */ gdjs.evtTools.string.fromCodePoint = function(codePoint) { @@ -34,7 +31,6 @@ gdjs.evtTools.string.fromCodePoint = function(codePoint) { /** * Return the uppercased version of the string. - * @method toUpperCase * @private */ gdjs.evtTools.string.toUpperCase = function(str) { @@ -43,7 +39,6 @@ gdjs.evtTools.string.toUpperCase = function(str) { /** * Return the lowercased version of the string. - * @method toLowerCase * @private */ gdjs.evtTools.string.toLowerCase = function(str) { @@ -52,7 +47,6 @@ gdjs.evtTools.string.toLowerCase = function(str) { /** * Return a new string containing the substring of the original string. - * @method subStr * @private */ gdjs.evtTools.string.subStr = function(str, start, len) { @@ -64,7 +58,6 @@ gdjs.evtTools.string.subStr = function(str, start, len) { /** * Return a new string containing the character at the specified position. - * @method strAt * @private */ gdjs.evtTools.string.strAt = function(str, start) { @@ -76,7 +69,6 @@ gdjs.evtTools.string.strAt = function(str, start) { /** * Return the string repeated. - * @method strAt * @private */ gdjs.evtTools.string.strRepeat = function(str, count) { @@ -89,7 +81,6 @@ gdjs.evtTools.string.strRepeat = function(str, count) { /** * Return the length of the string - * @method strLen * @private */ gdjs.evtTools.string.strLen = function(str) { @@ -98,7 +89,6 @@ gdjs.evtTools.string.strLen = function(str) { /** * Search in a string - * @method strFind * @private */ gdjs.evtTools.string.strFind = function(str, what) { @@ -107,7 +97,6 @@ gdjs.evtTools.string.strFind = function(str, what) { /** * Reverse search in a string - * @method strRFind * @private */ gdjs.evtTools.string.strRFind = function(str, what) { @@ -116,7 +105,6 @@ gdjs.evtTools.string.strRFind = function(str, what) { /** * Search in a string, starting from a specified position. - * @method strFindFrom * @private */ gdjs.evtTools.string.strFindFrom = function(str, what, pos) { @@ -125,7 +113,6 @@ gdjs.evtTools.string.strFindFrom = function(str, what, pos) { /** * Reverse search in a string, starting from a specified position. - * @method strRFindFrom * @private */ gdjs.evtTools.string.strRFindFrom = function(str, what, pos) { diff --git a/GDJS/Runtime/events-tools/windowtools.js b/GDJS/Runtime/events-tools/windowtools.js index 8ef9b21b5..a57c9d1a6 100644 --- a/GDJS/Runtime/events-tools/windowtools.js +++ b/GDJS/Runtime/events-tools/windowtools.js @@ -6,7 +6,7 @@ /** * Tools related to window, for events generated code. - * @namespace gdjs.evtTools + * @memberof gdjs.evtTools * @class window * @static * @private diff --git a/GDJS/Runtime/eventscontext.js b/GDJS/Runtime/eventscontext.js index 098139b2a..b34ca3118 100644 --- a/GDJS/Runtime/eventscontext.js +++ b/GDJS/Runtime/eventscontext.js @@ -8,7 +8,7 @@ * EventsContext contains specific tools and data structures used * by events generated code only. * - * @namespace gdjs + * @memberof gdjs * @class EventsContext * @constructor */ @@ -23,7 +23,6 @@ gdjs.EventsContext = function() /** * To be called when events begin so that "Trigger once" conditions * are properly handled. - * @method startNewFrame */ gdjs.EventsContext.prototype.startNewFrame = function() { this.clearObject(this._lastFrameOnceTrigger); @@ -41,7 +40,6 @@ gdjs.EventsContext.prototype.startNewFrame = function() { * Used by "Trigger once" conditions: return true only if * this method was not called with the same identifier during the last frame. * @param triggerId The identifier of the "Trigger once" condition. - * @method triggerOnce */ gdjs.EventsContext.prototype.triggerOnce = function(triggerId) { this._onceTriggers[triggerId] = true; @@ -59,7 +57,6 @@ gdjs.EventsContext.prototype.clearObject = function(obj) { /** * Clear the map containing objects lists. - * @method clearEventsObjectsMap */ gdjs.EventsContext.prototype.clearEventsObjectsMap = function() { if (this._currentObjectsMap === this._objectsMapCache.length) @@ -71,7 +68,6 @@ gdjs.EventsContext.prototype.clearEventsObjectsMap = function() { /** * Add an objects list to the objects lists map. - * @method addObjectsToEventsMap */ gdjs.EventsContext.prototype.addObjectsToEventsMap = function(name, objectList) { this._objectsMapCache[this._currentObjectsMap].put(name, objectList); @@ -80,7 +76,6 @@ gdjs.EventsContext.prototype.addObjectsToEventsMap = function(name, objectList) /** * Return the objects lists map. - * @method getEventsObjectsMap */ gdjs.EventsContext.prototype.getEventsObjectsMap = function() { return this._objectsMapCache[this._currentObjectsMap++]; diff --git a/GDJS/Runtime/force.js b/GDJS/Runtime/force.js index c2d9b8ff2..39fbf6f20 100644 --- a/GDJS/Runtime/force.js +++ b/GDJS/Runtime/force.js @@ -5,14 +5,13 @@ */ /** - * A Force is used to move objects. + * A vector used to move objects. * - * @namespace gdjs + * @memberof gdjs * @class Force - * @constructor - * @param x The initial x component - * @param y The initial y component - * @param clearing The clearing + * @param {number} x The initial x component + * @param {number} y The initial y component + * @param {number} damping The damping (0 for a force that disappear on next frame, 1 to keep it) */ gdjs.Force = function(x,y, clearing) { @@ -26,7 +25,6 @@ gdjs.Force = function(x,y, clearing) /** * Returns the X component of the force. - * @method getX */ gdjs.Force.prototype.getX = function() { return this._x; @@ -34,7 +32,6 @@ gdjs.Force.prototype.getX = function() { /** * Returns the Y component of the force. - * @method getY */ gdjs.Force.prototype.getY = function() { return this._y; @@ -42,7 +39,6 @@ gdjs.Force.prototype.getY = function() { /** * Set the x component of the force. - * @method setX * @param x {Number} The new X component */ gdjs.Force.prototype.setX = function(x) { @@ -52,7 +48,6 @@ gdjs.Force.prototype.setX = function(x) { /** * Set the y component of the force. - * @method setY * @param y {Number} The new Y component */ gdjs.Force.prototype.setY = function(y) { @@ -62,7 +57,6 @@ gdjs.Force.prototype.setY = function(y) { /** * Set the angle of the force. - * @method setAngle * @param angle {Number} The new angle */ gdjs.Force.prototype.setAngle = function(angle) { @@ -79,7 +73,6 @@ gdjs.Force.prototype.setAngle = function(angle) { /** * Set the length of the force. - * @method setLength * @param len {Number} The length */ gdjs.Force.prototype.setLength = function(len) { @@ -96,7 +89,6 @@ gdjs.Force.prototype.setLength = function(len) { /** * Get the angle of the force - * @method getAngle */ gdjs.Force.prototype.getAngle = function() { if ( this._dirty ) { @@ -112,7 +104,6 @@ gdjs.Force.prototype.getAngle = function() { /** * Get the length of the force - * @method getLength */ gdjs.Force.prototype.getLength = function() { if ( this._dirty ) { @@ -127,7 +118,6 @@ gdjs.Force.prototype.getLength = function() { /** * Return true if the force is temporary, false if it is permanent. - * @method getClearing */ gdjs.Force.prototype.getClearing = function() { return this._clearing; @@ -135,7 +125,6 @@ gdjs.Force.prototype.getClearing = function() { /** * Set if the force clearing. - * @method setClearing */ gdjs.Force.prototype.setClearing = function(clearing) { this._clearing = clearing; diff --git a/GDJS/Runtime/gd.js b/GDJS/Runtime/gd.js index 676af9f71..7dba34467 100644 --- a/GDJS/Runtime/gd.js +++ b/GDJS/Runtime/gd.js @@ -4,61 +4,61 @@ * This project is released under the MIT License. */ - /** - * @namespace gdjs +/** + * The `gdjs` namespace should contains every class and object of the game engine. + * @namespace */ var gdjs = gdjs || { - objectsTypes:new Hashtable(), - behaviorsTypes:new Hashtable(), - evtTools:{}, - callbacksRuntimeSceneLoaded: [], - callbacksRuntimeSceneUnloaded: [], - callbacksObjectDeletedFromScene: [] + objectsTypes: new Hashtable(), + behaviorsTypes: new Hashtable(), + /** + * Contains functions used by events (this is a convention only, functions can actually + * by anywhere). + * @namespace + * @memberof gdjs + */ + evtTools: {}, + callbacksRuntimeSceneLoaded: [], + callbacksRuntimeSceneUnloaded: [], + callbacksObjectDeletedFromScene: [], }; /** * Convert a rgb color value to a hex string. - * @note No "#" or "0x" are added. - * @static + * + * No "#" or "0x" are added. */ gdjs.rgbToHex = function(r, g, b) { - return "" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); + return '' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); }; /** * Convert a rgb color value to a hex value. - * @static */ gdjs.rgbToHexNumber = function(r, g, b) { - return (r << 16) + (g << 8) + b; -} + return (r << 16) + (g << 8) + b; +}; /** * Get a random integer between 0 and max. - * @method random - * @static */ gdjs.random = function(max) { - if ( max <= 0 ) return 0; - return Math.floor((Math.random()*(max+1))); + if (max <= 0) return 0; + return Math.floor(Math.random() * (max + 1)); }; /** * Convert an angle in degrees to radians. - * @method toRad - * @static */ gdjs.toRad = function(angleInDegrees) { - return angleInDegrees/180*3.14159; + return (angleInDegrees / 180) * 3.14159; }; /** * Convert an angle in radians to degrees. - * @method toDegrees - * @static */ gdjs.toDegrees = function(angleInRadians) { - return angleInRadians*180/3.14159; + return (angleInRadians * 180) / 3.14159; }; /** @@ -68,20 +68,17 @@ gdjs.toDegrees = function(angleInRadians) { * The name of the type of the object must be complete, with the namespace if any. For * example, if you are providing a Text object in the TextObject extension, the full name * of the type of the object is "TextObject::Text". - * - * @method registerObjects - * @static */ gdjs.registerObjects = function() { - gdjs.objectsTypes.clear(); + gdjs.objectsTypes.clear(); - for (var p in this) { - if (this.hasOwnProperty(p)) { - if ( gdjs[p].thisIsARuntimeObjectConstructor != undefined) { - gdjs.objectsTypes.put(gdjs[p].thisIsARuntimeObjectConstructor, gdjs[p]); - } - } + for (var p in this) { + if (this.hasOwnProperty(p)) { + if (gdjs[p].thisIsARuntimeObjectConstructor != undefined) { + gdjs.objectsTypes.put(gdjs[p].thisIsARuntimeObjectConstructor, gdjs[p]); + } } + } }; /** @@ -91,20 +88,20 @@ gdjs.registerObjects = function() { * The name of the type of the behavior must be complete, with the namespace if any. For * example, if you are providing a Draggable behavior in the DraggableBehavior extension, * the full name of the type of the behavior is "DraggableBehavior::Draggable". - * - * @method registerBehaviors - * @static */ gdjs.registerBehaviors = function() { - gdjs.behaviorsTypes.clear(); + gdjs.behaviorsTypes.clear(); - for (var p in this) { - if (this.hasOwnProperty(p)) { - if ( gdjs[p].thisIsARuntimeBehaviorConstructor != undefined) { - gdjs.behaviorsTypes.put(gdjs[p].thisIsARuntimeBehaviorConstructor, gdjs[p]); - } - } + for (var p in this) { + if (this.hasOwnProperty(p)) { + if (gdjs[p].thisIsARuntimeBehaviorConstructor != undefined) { + gdjs.behaviorsTypes.put( + gdjs[p].thisIsARuntimeBehaviorConstructor, + gdjs[p] + ); + } } + } }; /** @@ -113,111 +110,111 @@ gdjs.registerBehaviors = function() { * Callbacks must be called respectively gdjsCallbackRuntimeSceneLoaded, gdjsCallbackRuntimeSceneUnloaded * or gdjsCallbackObjectDeletedFromScene and be part of a (nested) child object of gdjs.
* Arguments passed to the function are the runtimeScene and the object if applicable. - * - * @method registerGlobalCallbacks - * @static */ gdjs.registerGlobalCallbacks = function() { - gdjs.callbacksRuntimeSceneLoaded = []; - gdjs.callbacksRuntimeSceneUnloaded = []; - gdjs.callbacksObjectDeletedFromScene = []; + gdjs.callbacksRuntimeSceneLoaded = []; + gdjs.callbacksRuntimeSceneUnloaded = []; + gdjs.callbacksObjectDeletedFromScene = []; - var totalprop = 0; + var totalprop = 0; - innerRegisterGlobalCallbacks = function (obj, nestLevel) { - - for (var p in obj) { - if (obj.hasOwnProperty(p) && obj[p] !== null && - Object.prototype.toString.call( obj[p] ) !== '[object Array]' && typeof obj === "object") { - totalprop++; - if ( obj[p].gdjsCallbackRuntimeSceneLoaded !== undefined) { - gdjs.callbacksRuntimeSceneLoaded.push(obj[p].gdjsCallbackRuntimeSceneLoaded); - } - if ( obj[p].gdjsCallbackRuntimeSceneUnloaded !== undefined) { - gdjs.callbacksRuntimeSceneUnloaded.push(obj[p].gdjsCallbackRuntimeSceneUnloaded); - } - if ( obj[p].gdjsCallbackObjectDeletedFromScene !== undefined) { - gdjs.callbacksObjectDeletedFromScene.push(obj[p].gdjsCallbackObjectDeletedFromScene); - } - - if ( nestLevel <= 1 ) - innerRegisterGlobalCallbacks(obj[p], nestLevel+1); - } + innerRegisterGlobalCallbacks = function(obj, nestLevel) { + for (var p in obj) { + if ( + obj.hasOwnProperty(p) && + obj[p] !== null && + Object.prototype.toString.call(obj[p]) !== '[object Array]' && + typeof obj === 'object' + ) { + totalprop++; + if (obj[p].gdjsCallbackRuntimeSceneLoaded !== undefined) { + gdjs.callbacksRuntimeSceneLoaded.push( + obj[p].gdjsCallbackRuntimeSceneLoaded + ); + } + if (obj[p].gdjsCallbackRuntimeSceneUnloaded !== undefined) { + gdjs.callbacksRuntimeSceneUnloaded.push( + obj[p].gdjsCallbackRuntimeSceneUnloaded + ); + } + if (obj[p].gdjsCallbackObjectDeletedFromScene !== undefined) { + gdjs.callbacksObjectDeletedFromScene.push( + obj[p].gdjsCallbackObjectDeletedFromScene + ); } - }; - innerRegisterGlobalCallbacks(this, 0); + if (nestLevel <= 1) innerRegisterGlobalCallbacks(obj[p], nestLevel + 1); + } + } + }; + + innerRegisterGlobalCallbacks(this, 0); }; /** * Get the constructor of an object. * - * @method getObjectConstructor - * @static * @param name {String} The name of the type of the object. */ gdjs.getObjectConstructor = function(name) { - if ( name !== undefined && gdjs.objectsTypes.containsKey(name) ) - return gdjs.objectsTypes.get(name); + if (name !== undefined && gdjs.objectsTypes.containsKey(name)) + return gdjs.objectsTypes.get(name); - console.warn("Object type \""+name+"\" was not found."); - return gdjs.objectsTypes.get(""); //Create a base empty runtime object. + console.warn('Object type "' + name + '" was not found.'); + return gdjs.objectsTypes.get(''); //Create a base empty runtime object. }; /** * Get the constructor of a behavior. * - * @method getBehaviorConstructor - * @static * @param name {String} The name of the type of the behavior. */ gdjs.getBehaviorConstructor = function(name) { - if ( name !== undefined && gdjs.behaviorsTypes.containsKey(name) ) - return gdjs.behaviorsTypes.get(name); + if (name !== undefined && gdjs.behaviorsTypes.containsKey(name)) + return gdjs.behaviorsTypes.get(name); - console.warn("Behavior type \""+name+"\" was not found."); - return gdjs.behaviorsTypes.get(""); //Create a base empty runtime behavior. + console.warn('Behavior type "' + name + '" was not found.'); + return gdjs.behaviorsTypes.get(''); //Create a base empty runtime behavior. }; /** * Create a static array that won't need a new allocation each time it's used. */ gdjs.staticArray = function(owner) { - owner._staticArray = owner._staticArray || []; - return owner._staticArray; -} + owner._staticArray = owner._staticArray || []; + return owner._staticArray; +}; /** * Create a second static array that won't need a new allocation each time it's used. */ gdjs.staticArray2 = function(owner) { - owner._staticArray2 = owner._staticArray2 || []; - return owner._staticArray2; -} + owner._staticArray2 = owner._staticArray2 || []; + return owner._staticArray2; +}; /** * Create a static object that won't need a new allocation each time it's used. */ gdjs.staticObject = function(owner) { - owner._staticObject = owner._staticObject || {}; - return owner._staticObject; -} + owner._staticObject = owner._staticObject || {}; + return owner._staticObject; +}; Array.prototype.remove = function(from) { - //Adapted from the nice article available at - //https://www.scirra.com/blog/76/how-to-write-low-garbage-real-time-javascript - for (var i = from, len = this.length - 1; i < len; i++) - this[i] = this[i + 1]; + //Adapted from the nice article available at + //https://www.scirra.com/blog/76/how-to-write-low-garbage-real-time-javascript + for (var i = from, len = this.length - 1; i < len; i++) this[i] = this[i + 1]; - this.length = len; + this.length = len; }; Array.prototype.createFrom = function(arr) { - var len = arr.length; - for (var i = 0;i < len;++i) { - this[i] = arr[i]; - } - this.length = len; + var len = arr.length; + for (var i = 0; i < len; ++i) { + this[i] = arr[i]; + } + this.length = len; }; //Make sure console.warn and console.error are available. diff --git a/GDJS/Runtime/howler-sound-manager/howler-sound-manager.js b/GDJS/Runtime/howler-sound-manager/howler-sound-manager.js index 7ce893332..0a857ec55 100644 --- a/GDJS/Runtime/howler-sound-manager/howler-sound-manager.js +++ b/GDJS/Runtime/howler-sound-manager/howler-sound-manager.js @@ -6,13 +6,12 @@ /** * A thin wrapper around a Howl object. - * gdjs.HowlerSound just adds `paused`, `stopped`, `rate` and `canBeDestroyed` methods. + * `gdjs.HowlerSound` just adds `paused`, `stopped`, `rate` and `canBeDestroyed` methods. * * See https://github.com/goldfire/howler.js/tree/2.0 for the full documentation. * - * @namespace gdjs + * @memberof gdjs * @class HowlerSound - * @private */ gdjs.HowlerSound = function(o) { Howl.call(this, o); @@ -70,9 +69,8 @@ gdjs.HowlerSound.prototype.setRate = function(rate) { * It is basically a container to associate channels to sounds and keep a list * of all sounds being played. * - * @namespace gdjs + * @memberof gdjs * @class HowlerSoundManager - * @constructor */ gdjs.HowlerSoundManager = function(resources) { @@ -137,8 +135,8 @@ gdjs.SoundManager = gdjs.HowlerSoundManager; //Register the class to let the eng /** * Ensure rate is in a range valid for Howler.js - * @method clampRate * @return The clamped rate + * @private */ gdjs.HowlerSoundManager.clampRate = function(rate) { if (rate > 4.0) return 4.0; @@ -153,7 +151,7 @@ gdjs.HowlerSoundManager.clampRate = function(rate) { * Names and files are loaded from resources when preloadAudio is called. If no * file is associated to the given name, then the name will be considered as a * filename and will be returned. - * @method _getFileFromSoundName + * * @private * @return The associated filename */ @@ -173,7 +171,6 @@ gdjs.HowlerSoundManager.prototype._getFileFromSoundName = function(soundName) { * * @param {Array} arr The array containing the sounds. * @param {gdjs.HowlerSound} arr The gdjs.HowlerSound to add. - * @method _storeSoundInArray * @return The gdjs.HowlerSound that have been added (i.e: the second parameter). * @private */ diff --git a/GDJS/Runtime/inputmanager.js b/GDJS/Runtime/inputmanager.js index 62d3eb78d..ddf61711f 100644 --- a/GDJS/Runtime/inputmanager.js +++ b/GDJS/Runtime/inputmanager.js @@ -13,7 +13,7 @@ * end of a frame (necessary for proper touches events handling). * * @constructor - * @namespace gdjs + * @memberof gdjs * @class InputManager */ gdjs.InputManager = function() @@ -35,7 +35,6 @@ gdjs.InputManager = function() /** * Should be called whenever a key is pressed - * @method onKeyPressed * @param keyCode {Number} The key code associated to the key press. */ gdjs.InputManager.prototype.onKeyPressed = function(keyCode) { @@ -45,7 +44,6 @@ gdjs.InputManager.prototype.onKeyPressed = function(keyCode) { /** * Should be called whenever a key is released - * @method onKeyReleased * @param keyCode {Number} The key code associated to the key release. */ gdjs.InputManager.prototype.onKeyReleased = function(keyCode) { @@ -56,7 +54,6 @@ gdjs.InputManager.prototype.onKeyReleased = function(keyCode) { /** * Return the code of the last key that was pressed. * @return {Number} The code of the last key pressed. - * @method getLastPressedKey */ gdjs.InputManager.prototype.getLastPressedKey = function() { return this._lastPressedKey; @@ -64,7 +61,6 @@ gdjs.InputManager.prototype.getLastPressedKey = function() { /** * Return true if the key corresponding to keyCode is pressed. - * @method isKeyPressed * @param keyCode {Number} The key code to be tested. */ gdjs.InputManager.prototype.isKeyPressed = function(keyCode) { @@ -73,7 +69,6 @@ gdjs.InputManager.prototype.isKeyPressed = function(keyCode) { /** * Return true if the key corresponding to keyCode was released during the last frame. - * @method wasKeyReleased * @param keyCode {Number} The key code to be tested. */ gdjs.InputManager.prototype.wasKeyReleased = function(keyCode) { @@ -82,7 +77,6 @@ gdjs.InputManager.prototype.wasKeyReleased = function(keyCode) { /** * Return true if any key is pressed - * @method anyKeyPressed */ gdjs.InputManager.prototype.anyKeyPressed = function() { for(var keyCode in this._pressedKeys.items) { @@ -100,7 +94,6 @@ gdjs.InputManager.prototype.anyKeyPressed = function() { * Should be called when the mouse is moved.
* Please note that the coordinates must be expressed relative to the view position. * - * @method onMouseMove * @param x {Number} The mouse new X position * @param y {Number} The mouse new Y position */ @@ -112,7 +105,6 @@ gdjs.InputManager.prototype.onMouseMove = function(x,y) { /** * Get the mouse X position * - * @method getMouseX * @return the mouse X position, relative to the game view. */ gdjs.InputManager.prototype.getMouseX = function() { @@ -122,7 +114,6 @@ gdjs.InputManager.prototype.getMouseX = function() { /** * Get the mouse Y position * - * @method getMouseY * @return the mouse Y position, relative to the game view. */ gdjs.InputManager.prototype.getMouseY = function() { @@ -131,7 +122,6 @@ gdjs.InputManager.prototype.getMouseY = function() { /** * Should be called whenever a mouse button is pressed - * @method onMouseButtonPressed * @param buttonCode {Number} The mouse button code associated to the event.
0: Left button
1: Right button */ gdjs.InputManager.prototype.onMouseButtonPressed = function(buttonCode) { @@ -141,7 +131,6 @@ gdjs.InputManager.prototype.onMouseButtonPressed = function(buttonCode) { /** * Should be called whenever a mouse button is released - * @method onMouseButtonReleased * @param buttonCode {Number} The mouse button code associated to the event. ( See onMouseButtonPressed ) */ gdjs.InputManager.prototype.onMouseButtonReleased = function(buttonCode) { @@ -151,7 +140,6 @@ gdjs.InputManager.prototype.onMouseButtonReleased = function(buttonCode) { /** * Return true if the mouse button corresponding to buttonCode is pressed. - * @method isMouseButtonPressed * @param buttonCode {Number} The mouse button code (0: Left button, 1: Right button). */ gdjs.InputManager.prototype.isMouseButtonPressed = function(buttonCode) { @@ -160,7 +148,6 @@ gdjs.InputManager.prototype.isMouseButtonPressed = function(buttonCode) { /** * Return true if the mouse button corresponding to buttonCode was just released. - * @method isMouseButtonReleased * @param buttonCode {Number} The mouse button code (0: Left button, 1: Right button). */ gdjs.InputManager.prototype.isMouseButtonReleased = function(buttonCode) { @@ -169,7 +156,6 @@ gdjs.InputManager.prototype.isMouseButtonReleased = function(buttonCode) { /** * Should be called whenever the mouse wheel is used - * @method onMouseWheel * @param wheelDelta {Number} The mouse wheel delta */ gdjs.InputManager.prototype.onMouseWheel = function(wheelDelta) { @@ -178,7 +164,6 @@ gdjs.InputManager.prototype.onMouseWheel = function(wheelDelta) { /** * Return the mouse wheel delta - * @method getMouseWheelDelta */ gdjs.InputManager.prototype.getMouseWheelDelta = function() { return this._mouseWheelDelta; @@ -187,7 +172,6 @@ gdjs.InputManager.prototype.getMouseWheelDelta = function() { /** * Get a touch X position * - * @method getTouchX * @return the touch X position, relative to the game view. */ gdjs.InputManager.prototype.getTouchX = function(identifier) { @@ -200,7 +184,6 @@ gdjs.InputManager.prototype.getTouchX = function(identifier) { /** * Get a touch Y position * - * @method getTouchY * @return the touch Y position, relative to the game view. */ gdjs.InputManager.prototype.getTouchY = function(identifier) { @@ -213,7 +196,6 @@ gdjs.InputManager.prototype.getTouchY = function(identifier) { /** * Update and return the array containing the identifiers of all touches. * - * @method getAllTouchIdentifiers */ gdjs.InputManager.prototype.getAllTouchIdentifiers = function() { gdjs.InputManager._allTouchIds = gdjs.InputManager._allTouchIds || []; @@ -278,7 +260,6 @@ gdjs.InputManager.prototype.popEndedTouch = function() { * * If true, any touch will move the mouse position and set mouse buttons * as pressed/released. - * @method touchSimulateMouse * @param enable {Boolean} true to simulate mouse events, false to disable it. */ gdjs.InputManager.prototype.touchSimulateMouse = function(enable) { @@ -292,7 +273,6 @@ gdjs.InputManager.prototype.touchSimulateMouse = function(enable) { * only for one frame (started/ended touches) should be reset. * * This method should be called in the game loop (see gdjs.RuntimeGame.startGameLoop). - * @method onFrameEnded */ gdjs.InputManager.prototype.onFrameEnded = function() { //Only clear the ended touches at the end of the frame. diff --git a/GDJS/Runtime/layer.js b/GDJS/Runtime/layer.js index 9b2e4b410..d707262a5 100644 --- a/GDJS/Runtime/layer.js +++ b/GDJS/Runtime/layer.js @@ -7,11 +7,10 @@ /** * Represents a layer of a scene, used to display objects. * - * *Not yet implemented:* Viewports and support for multiple cameras + * Viewports and multiple cameras are not supported. * * @class Layer - * @namespace gdjs - * @constructor + * @memberof gdjs */ gdjs.Layer = function(layerData, runtimeScene) { @@ -37,7 +36,6 @@ gdjs.Layer.prototype.getRenderer = function() { /** * Get the name of the layer - * @method getName * @return {String} The name of the layer */ gdjs.Layer.prototype.getName = function() { @@ -47,7 +45,6 @@ gdjs.Layer.prototype.getName = function() { /** * Change the camera center X position. * - * @method getCameraX * @param cameraId The camera number. Currently ignored. * @return The x position of the camera */ @@ -58,7 +55,6 @@ gdjs.Layer.prototype.getCameraX = function(cameraId) { /** * Change the camera center Y position. * - * @method getCameraY * @param cameraId The camera number. Currently ignored. * @return The y position of the camera */ @@ -69,9 +65,8 @@ gdjs.Layer.prototype.getCameraY = function(cameraId) { /** * Set the camera center X position. * - * @method setCameraX - * @param x {Number} The new x position - * @param cameraId The camera number. Currently ignored. + * @param {number} x The new x position + * @param {number} cameraId The camera number. Currently ignored. */ gdjs.Layer.prototype.setCameraX = function(x, cameraId) { this._cameraX = x; @@ -81,9 +76,8 @@ gdjs.Layer.prototype.setCameraX = function(x, cameraId) { /** * Set the camera center Y position. * - * @method setCameraY - * @param y {Number} The new y position - * @param cameraId The camera number. Currently ignored. + * @param {number} y The new y position + * @param {number} cameraId The camera number. Currently ignored. */ gdjs.Layer.prototype.setCameraY = function(y, cameraId) { this._cameraY = y; @@ -106,7 +100,6 @@ gdjs.Layer.prototype.show = function(enable) { /** * Check if the layer is visible. * - * @method isVisible * @return true if the layer is visible. */ gdjs.Layer.prototype.isVisible = function() { @@ -116,9 +109,8 @@ gdjs.Layer.prototype.isVisible = function() { /** * Set the zoom of a camera. * - * @method setCameraZoom - * @param The new zoom. Must be superior to 0. 1 is the default zoom. - * @param cameraId The camera number. Currently ignored. + * @param {number} newZoom The new zoom. Must be superior to 0. 1 is the default zoom. + * @param {number} cameraId The camera number. Currently ignored. */ gdjs.Layer.prototype.setCameraZoom = function(newZoom, cameraId) { this._zoomFactor = newZoom; @@ -128,9 +120,8 @@ gdjs.Layer.prototype.setCameraZoom = function(newZoom, cameraId) { /** * Get the zoom of a camera. * - * @method getZoom - * @param cameraId The camera number. Currently ignored. - * @return The zoom. + * @param {number} cameraId The camera number. Currently ignored. + * @return {number} The zoom. */ gdjs.Layer.prototype.getCameraZoom = function(cameraId) { return this._zoomFactor; @@ -139,9 +130,8 @@ gdjs.Layer.prototype.getCameraZoom = function(cameraId) { /** * Get the rotation of the camera, expressed in degrees. * - * @method getCameraRotation - * @param cameraId The camera number. Currently ignored. - * @return The rotation, in degrees. + * @param {number} cameraId The camera number. Currently ignored. + * @return {number} The rotation, in degrees. */ gdjs.Layer.prototype.getCameraRotation = function(cameraId) { return this._cameraRotation; @@ -151,9 +141,8 @@ gdjs.Layer.prototype.getCameraRotation = function(cameraId) { * Set the rotation of the camera, expressed in degrees. * The rotation is made around the camera center. * - * @method setCameraRotation - * @param rotation {Number} The new rotation, in degrees. - * @param cameraId The camera number. Currently ignored. + * @param {number} rotation The new rotation, in degrees. + * @param {number} cameraId The camera number. Currently ignored. */ gdjs.Layer.prototype.setCameraRotation = function(rotation, cameraId) { this._cameraRotation = rotation; @@ -166,10 +155,9 @@ gdjs.Layer.prototype.setCameraRotation = function(rotation, cameraId) { * * TODO: Update this method to store the result in a static array * - * @method convertCoords - * @param x {Number} The x position, in canvas coordinates. - * @param y {Number} The y position, in canvas coordinates. - * @param cameraId The camera number. Currently ignored. + * @param {number} x The x position, in canvas coordinates. + * @param {number} y The y position, in canvas coordinates. + * @param {number} cameraId The camera number. Currently ignored. */ gdjs.Layer.prototype.convertCoords = function(x, y, cameraId) { x -= this._width/2; @@ -226,8 +214,7 @@ gdjs.Layer.prototype.setEffectsDefaultParameters = function() { /** * Set the time scale for the objects on the layer: * time will be slower if time scale is < 1, faster if > 1. - * @method setTimeScale - * @param timeScale {Number} The new time scale (must be positive). + * @param {number} timeScale The new time scale (must be positive). */ gdjs.Layer.prototype.setTimeScale = function(timeScale) { if ( timeScale >= 0 ) this._timeScale = timeScale; @@ -235,7 +222,6 @@ gdjs.Layer.prototype.setTimeScale = function(timeScale) { /** * Get the time scale for the objects on the layer. - * @method getTimeScale */ gdjs.Layer.prototype.getTimeScale = function() { return this._timeScale; @@ -244,7 +230,6 @@ gdjs.Layer.prototype.getTimeScale = function() { /** * Return the time elapsed since the last frame, * in milliseconds, for objects on the layer. - * @method getElapsedTime */ gdjs.Layer.prototype.getElapsedTime = function(runtimeScene) { return runtimeScene.getTimeManager().getElapsedTime() * this._timeScale; diff --git a/GDJS/Runtime/libs/hshg.js b/GDJS/Runtime/libs/hshg.js index 8ac33afc3..fee15de30 100644 --- a/GDJS/Runtime/libs/hshg.js +++ b/GDJS/Runtime/libs/hshg.js @@ -1,6 +1,11 @@ // Hierarchical Spatial Hash Grid: HSHG //Note that this file has been customized so that HSHG is put into the gdjs object. //Thus, it must be included after gd.js + +/** + * @namespace + * @memberof gdjs + */ gdjs.HSHG = gdjs.HSHG || {}; (function(root, undefined){ @@ -81,7 +86,7 @@ function getLongestAABBEdge(min, max){ * A hierarchical spatial grid containing objects and allowing fast test collisions between them. * * @class HSHG - * @namespace gdjs.HSHG + * @memberof gdjs.HSHG * @constructor */ function HSHG(){ @@ -99,8 +104,6 @@ function HSHG(){ /** * Add an object to the grid. The object can be anything as long as it provides a getAABB method. * An 'HSHG' property is added to the object, and is then deleted when the object is removed from the HSHG. - * - * @method addObject */ HSHG.prototype.addObject = function(obj){ var x ,i @@ -168,7 +171,6 @@ HSHG.prototype.addObject = function(obj){ /** * Remove an object from the HSHG. The object must be in the HSHG before being removed. - * @method removeObject */ HSHG.prototype.removeObject = function(obj){ var meta = obj.HSHG @@ -199,7 +201,6 @@ HSHG.prototype.removeObject = function(obj){ /** * Must be called when objects have been moved ( typically at each "tick" of the game/simulation ). - * @method update */ HSHG.prototype.update = function(){ this.UPDATE_METHOD.call(this); @@ -207,8 +208,7 @@ HSHG.prototype.update = function(){ /** * Return a list of objects colliding with theObject. - * @param theObject The object to be tested against. - * @method queryForCollisionWith + * @param {gdjs.RuntimeObject} theObject The object to be tested against. */ HSHG.prototype.queryForCollisionWith = function(theObject, result){ @@ -340,7 +340,7 @@ HSHG.update_REMOVEALL = update_REMOVEALL; * Grid * * @class Grid - * @namespace gdjs.HSHG + * @memberof gdjs.HSHG * @constructor * @param cellSize {int} the pixel size of each cell of the grid * @param cellCount {int} the total number of cells for the grid (width x height) @@ -591,7 +591,7 @@ Grid.prototype.expandGrid = function(){ * A cell of a grid * * @class Cell - * @namespace gdjs.HSHG + * @memberof gdjs.HSHG * @constructor * @private */ diff --git a/GDJS/Runtime/pixi-renderers/layer-pixi-renderer.js b/GDJS/Runtime/pixi-renderers/layer-pixi-renderer.js index 012231a16..662c08968 100644 --- a/GDJS/Runtime/pixi-renderers/layer-pixi-renderer.js +++ b/GDJS/Runtime/pixi-renderers/layer-pixi-renderer.js @@ -66,7 +66,6 @@ gdjs.LayerPixiRenderer.prototype._addFilters = function() { * Add a child to the pixi container associated to the layer. * All objects which are on this layer must be children of this container. * - * @method addRendererObject * @param child The child (PIXI object) to be added. * @param zOrder The z order of the associated object. */ @@ -85,7 +84,6 @@ gdjs.LayerPixiRenderer.prototype.addRendererObject = function(child, zOrder) { /** * Change the z order of a child associated to an object. * - * @method changeRendererObjectZOrder * @param child The child (PIXI object) to be modified. * @param newZOrder The z order of the associated object. */ @@ -98,7 +96,6 @@ gdjs.LayerPixiRenderer.prototype.changeRendererObjectZOrder = function(child, ne * Remove a child from the internal pixi container. * Should be called when an object is deleted or removed from the layer. * - * @method removeRendererObject * @param child The child (PIXI object) to be removed. */ gdjs.LayerPixiRenderer.prototype.removeRendererObject = function(child) { diff --git a/GDJS/Runtime/pixi-renderers/pixi-image-manager.js b/GDJS/Runtime/pixi-renderers/pixi-image-manager.js index c63363320..7ca976597 100644 --- a/GDJS/Runtime/pixi-renderers/pixi-image-manager.js +++ b/GDJS/Runtime/pixi-renderers/pixi-image-manager.js @@ -5,11 +5,11 @@ */ /** - * PixiImageManager loads and stores textures that can be used by the objects. + * PixiImageManager loads and stores textures that can be used by the Pixi.js renderers. * * @class PixiImageManager - * @namespace gdjs - * @param runtimeGame The runtimeGame to be imageManager belongs to. + * @memberof gdjs + * @param {Object} resources The resources data of the game. */ gdjs.PixiImageManager = function(resources) { @@ -23,8 +23,7 @@ gdjs.ImageManager = gdjs.PixiImageManager; //Register the class to let the engin /** * Return the PIXI texture associated to the specified name. * Returns a placeholder texture if not found. - * @param name The name of the texture to get. - * @method getPIXITexture + * @param {string} name The name of the resource to get. */ gdjs.PixiImageManager.prototype.getPIXITexture = function(name) { if ( this._loadedTextures.containsKey(name) ) { @@ -61,7 +60,6 @@ gdjs.PixiImageManager.prototype.getPIXITexture = function(name) { /** * Return a PIXI texture which can be used as a placeholder when no * suitable texture can be found. - * @method getInvalidPIXITexture */ gdjs.PixiImageManager.prototype.getInvalidPIXITexture = function() { return this._invalidTexture; @@ -75,7 +73,6 @@ gdjs.PixiImageManager.prototype.getInvalidPIXITexture = function() { * @param onComplete Callback called when loading is done. * @param resources The resources to be loaded. If not specified, will load the resources * specified in the PixiImageManager constructor. - * @method loadTextures */ gdjs.PixiImageManager.prototype.loadTextures = function(onProgress, onComplete, resources) { resources = resources || this._resources; diff --git a/GDJS/Runtime/pixi-renderers/runtimegame-pixi-renderer.js b/GDJS/Runtime/pixi-renderers/runtimegame-pixi-renderer.js index b201d3bb4..06d910d46 100644 --- a/GDJS/Runtime/pixi-renderers/runtimegame-pixi-renderer.js +++ b/GDJS/Runtime/pixi-renderers/runtimegame-pixi-renderer.js @@ -1,3 +1,9 @@ + +/** + * The renderer for a gdjs.RuntimeGame using Pixi.js. + * @class RuntimeGamePixiRenderer + * @memberof gdjs + */ gdjs.RuntimeGamePixiRenderer = function(game, width, height, forceFullscreen) { this._game = game; @@ -27,7 +33,6 @@ gdjs.RuntimeGameRenderer = gdjs.RuntimeGamePixiRenderer; //Register the class to /** * Create a standard canvas inside canvasArea. * - * @method createStandardCanvas */ gdjs.RuntimeGamePixiRenderer.prototype.createStandardCanvas = function(canvasArea) { this._canvasArea = canvasArea; @@ -52,7 +57,6 @@ gdjs.RuntimeGamePixiRenderer.prototype.createStandardCanvas = function(canvasAre /** * Get the current width of the canvas. - * @method getCurrentWidth */ gdjs.RuntimeGamePixiRenderer.prototype.getCurrentWidth = function() { return this._currentWidth; @@ -60,7 +64,6 @@ gdjs.RuntimeGamePixiRenderer.prototype.getCurrentWidth = function() { /** * Get the current height of the canvas. - * @method getCurrentHeight */ gdjs.RuntimeGamePixiRenderer.prototype.getCurrentHeight = function() { return this._currentHeight; @@ -71,7 +74,6 @@ gdjs.RuntimeGamePixiRenderer.prototype.getCurrentHeight = function() { * Note that if the canvas is fullscreen, it won't be resized, but when going back to * non fullscreen mode, the requested size will be used. * - * @method setSize * @param width {Number} The new width * @param height {Number} The new height */ @@ -88,7 +90,6 @@ gdjs.RuntimeGamePixiRenderer.prototype.setSize = function(width, height) { * Resize the canvas, according to _isFullscreen, _forceFullscreen, _currentWidth, * _currentHeight, _marginTop, _marginLeft, _marginRight, _marginBottom, _keepRatio. * - * @method _resizeCanvas * @private */ gdjs.RuntimeGamePixiRenderer.prototype.resize = function() { @@ -157,7 +158,6 @@ gdjs.RuntimeGamePixiRenderer.prototype.setMargins = function(top, right, bottom, /** * De/activate fullscreen for the game. - * @method setFullScreen */ gdjs.RuntimeGamePixiRenderer.prototype.setFullScreen = function(enable) { if (this._forceFullscreen) return; @@ -190,7 +190,6 @@ gdjs.RuntimeGamePixiRenderer.prototype.setFullScreen = function(enable) { /** * Add the standard events handler. - * @method bindStandardEvents */ gdjs.RuntimeGamePixiRenderer.prototype.bindStandardEvents = function(manager, window, document) { var renderer = this._pixiRenderer; diff --git a/GDJS/Runtime/polygon.js b/GDJS/Runtime/polygon.js index b3ec86709..97da47f2e 100644 --- a/GDJS/Runtime/polygon.js +++ b/GDJS/Runtime/polygon.js @@ -7,29 +7,28 @@ /** * Polygon represents a polygon which can be used to create collisions masks for RuntimeObject. * - * @constructor - * @namespace gdjs + * @memberof gdjs * @class Polygon */ gdjs.Polygon = function() { /** * The vertices of the polygon - * @property vertices + * @member {Array} */ this.vertices = []; /** * The edges of the polygon. This property is only valid after calling * computeEdges, and remains valid until vertices are modified. - * @property edges + * @member {Array} */ this.edges = []; /** * The center of the polygon. This property is only valid after calling * computeCenter, and remains valid until vertices are modified. - * @property center + * @member {Array} */ this.center = [0,0]; }; @@ -126,11 +125,9 @@ gdjs.Polygon.createRectangle = function(width, height) { * Based on this * and this article. * - * @method collisionTest - * @static - * @return {Boolean} true if polygons are overlapping - * @param p1 {polygon} The first polygon - * @param p2 {polygon} The second polygon + * @return {boolean} true if polygons are overlapping + * @param {gdjs.Polygon} p1 The first polygon + * @param {gdjs.Polygon} p2 The second polygon */ gdjs.Polygon.collisionTest = function(p1,p2) { //Algorithm core : @@ -222,15 +219,14 @@ gdjs.Polygon.collisionTest._statics = { /** * Do a raycast test.
* Please note that the polygon must be convex! - * For some theory, check Find the Intersection Point of Two Line Segments + * + * For some theory, check Find the Intersection Point of Two Line Segments. * - * @method raycastTest - * @static - * @param poly {Polygon} The polygon to test - * @param startX {Number} The raycast start point X - * @param startY {Number} The raycast start point Y - * @param endX {Number} The raycast end point X - * @param endY {Number} The raycast end point Y + * @param {gdjs.Polygon} poly The polygon to test + * @param {number} startX The raycast start point X + * @param {number} startY The raycast start point Y + * @param {number} endX The raycast end point X + * @param {number} endY The raycast end point Y * @return A raycast result with the contact points and distances */ gdjs.Polygon.raycastTest = function(poly, startX, startY, endX, endY) @@ -411,12 +407,10 @@ gdjs.Polygon.distance = function(minA, maxA, minB, maxB) * * Uses PNPOLY by W. Randolph Franklin. * - * @method isPointInside - * @static - * @param poly {Polygon} The polygon to test - * @param x {Number} The point x coordinate - * @param y {Number} The point y coordinate - * @return {Boolean} true if the point is inside the polygon + * @param {gdjs.Polygon} poly The polygon to test + * @param {number} x The point x coordinate + * @param {number} y The point y coordinate + * @return {boolean} true if the point is inside the polygon */ gdjs.Polygon.isPointInside = function(poly, x, y) { diff --git a/GDJS/Runtime/profiler.js b/GDJS/Runtime/profiler.js index 5f6b75bee..30451bf6d 100644 --- a/GDJS/Runtime/profiler.js +++ b/GDJS/Runtime/profiler.js @@ -1,5 +1,8 @@ /** - * A basic profiling tool that can be used to measure time spent in sections of the engine + * A basic profiling tool that can be used to measure time spent in sections of the engine. + * @class Profiler + * @see gdjs.RuntimeGame + * @memberof gdjs */ gdjs.Profiler = function() { this._framesMeasures = []; // All the measures for the last frames @@ -137,11 +140,11 @@ gdjs.Profiler.prototype.getStats = function() { }; /** - * @brief Convert measures for a section into texts. + * Convert measures for a section into texts. * Useful for ingame profiling. * - * @param {*} sectionName The name of the section - * @param {*} profilerSection The section measures + * @param {string} sectionName The name of the section + * @param {s} profilerSection The section measures * @param {*} outputs The array where to push the results */ gdjs.Profiler.getProfilerSectionTexts = function( diff --git a/GDJS/Runtime/runtimebehavior.js b/GDJS/Runtime/runtimebehavior.js index da74efca6..6614b9c38 100644 --- a/GDJS/Runtime/runtimebehavior.js +++ b/GDJS/Runtime/runtimebehavior.js @@ -8,10 +8,10 @@ * RuntimeBehavior represents a behavior being used by a RuntimeObject. * * @class RuntimeBehavior - * @constructor - * @param runtimeScene The scene owning the object of the behavior - * @param behaviorData The object used to setup the behavior - * @param owner The object owning the behavior + * @memberof gdjs + * @param {gdjs.RuntimeScene} runtimeScene The scene owning the object of the behavior + * @param {Object} behaviorData The object used to setup the behavior + * @param {gdjs.RuntimeObject} owner The object owning the behavior */ gdjs.RuntimeBehavior = function(runtimeScene, behaviorData, owner) { @@ -23,8 +23,7 @@ gdjs.RuntimeBehavior = function(runtimeScene, behaviorData, owner) }; /** * Get the name of the behavior. - * @method getName - * @return {String} The behavior's name. + * @return {string} The behavior's name. */ gdjs.RuntimeBehavior.prototype.getName = function() { return this.name; @@ -32,8 +31,7 @@ gdjs.RuntimeBehavior.prototype.getName = function() { /** * Get the name identifier of the behavior. - * @method getNameId - * @return {Number} The behavior's name identifier. + * @return {number} The behavior's name identifier. */ gdjs.RuntimeBehavior.prototype.getNameId = function() { return this._nameId; @@ -42,8 +40,7 @@ gdjs.RuntimeBehavior.prototype.getNameId = function() { /** * Called at each frame before events. Call doStepPreEvents.
* Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead. - * @method stepPreEvents - * @param runtimeScene The runtimeScene owning the object + * @param {gdjs.RuntimeScene} runtimeScene The runtimeScene owning the object */ gdjs.RuntimeBehavior.prototype.stepPreEvents = function(runtimeScene) { if ( this._activated ) { @@ -59,8 +56,7 @@ gdjs.RuntimeBehavior.prototype.stepPreEvents = function(runtimeScene) { /** * Called at each frame after events. Call doStepPostEvents.
* Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead. - * @method stepPostEvents - * @param runtimeScene The runtimeScene owning the object + * @param {gdjs.RuntimeScene} runtimeScene The runtimeScene owning the object */ gdjs.RuntimeBehavior.prototype.stepPostEvents = function(runtimeScene) { if ( this._activated ) { @@ -75,7 +71,6 @@ gdjs.RuntimeBehavior.prototype.stepPostEvents = function(runtimeScene) { /** * De/Activate the behavior - * @method activate */ gdjs.RuntimeBehavior.prototype.activate = function(enable) { if ( enable === undefined ) enable = true; @@ -91,7 +86,6 @@ gdjs.RuntimeBehavior.prototype.activate = function(enable) { /** * Return true if the behavior is activated - * @method activated */ gdjs.RuntimeBehavior.prototype.activated = function() { return this._activated; @@ -100,7 +94,6 @@ gdjs.RuntimeBehavior.prototype.activated = function() { /** * Behaviors writers: Reimplement this method to do extra work * when the behavior is activated - * @method onActivate */ gdjs.RuntimeBehavior.prototype.onActivate = function() { @@ -109,7 +102,6 @@ gdjs.RuntimeBehavior.prototype.onActivate = function() { /** * Behaviors writers: Reimplement this method to do extra work * when the behavior is deactivated - * @method onDeActivate */ gdjs.RuntimeBehavior.prototype.onDeActivate = function() { @@ -117,8 +109,7 @@ gdjs.RuntimeBehavior.prototype.onDeActivate = function() { /** * Behaviors writers: This method is called each tick before events are done. - * @method doStepPreEvents - * @param runtimeScene The runtimeScene owning the object + * @param {gdjs.RuntimeScene} runtimeScene The runtimeScene owning the object */ gdjs.RuntimeBehavior.prototype.doStepPreEvents = function(runtimeScene) { @@ -126,8 +117,7 @@ gdjs.RuntimeBehavior.prototype.doStepPreEvents = function(runtimeScene) { /** * Behaviors writers: This method is called each tick after events are done. - * @method doStepPostEvents - * @param runtimeScene The runtimeScene owning the object + * @param {gdjs.RuntimeScene} runtimeScene The runtimeScene owning the object */ gdjs.RuntimeBehavior.prototype.doStepPostEvents = function(runtimeScene) { @@ -136,7 +126,6 @@ gdjs.RuntimeBehavior.prototype.doStepPostEvents = function(runtimeScene) { /** * Behaviors writers: This method is called when the owner of the behavior * is removed from its scene. - * @method ownerRemovedFromScene */ gdjs.RuntimeBehavior.prototype.ownerRemovedFromScene = function() { diff --git a/GDJS/Runtime/runtimegame.js b/GDJS/Runtime/runtimegame.js index 9c86b953d..fd489445a 100644 --- a/GDJS/Runtime/runtimegame.js +++ b/GDJS/Runtime/runtimegame.js @@ -7,11 +7,10 @@ /** * Represents a game being played. * - * @constructor - * @namespace gdjs + * @memberof gdjs * @class RuntimeGame - * @param data The object (usually stored in data.json) containing the full project data - * @param spec Optional object for specifiying additional options: {forceFullscreen: ...} + * @param {Object} data The object (usually stored in data.json) containing the full project data + * @param {Object} spec Optional object for specifiying additional options: {forceFullscreen: ...} */ gdjs.RuntimeGame = function(data, spec) { spec = spec || {}; @@ -60,8 +59,7 @@ gdjs.RuntimeGame.prototype.getRenderer = function() { /** * Get the variables of the RuntimeGame. - * @method getVariables - * @return a variablesContainer object. + * @return {gdjs.VariablesContainer} The global variables */ gdjs.RuntimeGame.prototype.getVariables = function() { return this._variables; @@ -69,7 +67,6 @@ gdjs.RuntimeGame.prototype.getVariables = function() { /** * Get the gdjs.SoundManager of the RuntimeGame. - * @method getSoundManager * @return {gdjs.SoundManager} The sound manager. */ gdjs.RuntimeGame.prototype.getSoundManager = function() { @@ -78,7 +75,6 @@ gdjs.RuntimeGame.prototype.getSoundManager = function() { /** * Get the gdjs.ImageManager of the RuntimeGame. - * @method getImageManager * @return {gdjs.ImageManager} The image manager. */ gdjs.RuntimeGame.prototype.getImageManager = function() { @@ -88,7 +84,7 @@ gdjs.RuntimeGame.prototype.getImageManager = function() { /** * Get the input manager of the game, storing mouse, keyboard * and touches states. - * @return The input manager owned by the game + * @return {gdjs.InputManager} The input manager owned by the game */ gdjs.RuntimeGame.prototype.getInputManager = function() { return this._inputManager; @@ -96,8 +92,7 @@ gdjs.RuntimeGame.prototype.getInputManager = function() { /** * Get the object containing the game data - * @method getGameData - * @return The object associated to the game. + * @return {Object} The object associated to the game. */ gdjs.RuntimeGame.prototype.getGameData = function() { return this._data; @@ -106,8 +101,7 @@ gdjs.RuntimeGame.prototype.getGameData = function() { /** * Get the data associated to a scene. * - * @method getSceneData - * @param sceneName The name of the scene. If not defined, the first scene will be returned. + * @param {string} sceneName The name of the scene. If not defined, the first scene will be returned. * @return The data associated to the scene. */ gdjs.RuntimeGame.prototype.getSceneData = function(sceneName) { @@ -130,9 +124,8 @@ gdjs.RuntimeGame.prototype.getSceneData = function(sceneName) { /** * Check if a scene exists * - * @method hasScene - * @param sceneName The name of the scene to search. - * @return true if the scene exists. If sceneName is undefined, true if the game has a scene. + * @param {string} sceneName The name of the scene to search. + * @return {boolean} true if the scene exists. If sceneName is undefined, true if the game has a scene. */ gdjs.RuntimeGame.prototype.hasScene = function(sceneName) { var isTrue = false; @@ -151,9 +144,8 @@ gdjs.RuntimeGame.prototype.hasScene = function(sceneName) { /** * Get the data associated to an external layout. * - * @method getExternalLayoutData - * @param name The name of the external layout. - * @return The data associated to the external layout or null if not found. + * @param {string} name The name of the external layout. + * @return {Object} The data associated to the external layout or null if not found. */ gdjs.RuntimeGame.prototype.getExternalLayoutData = function(name) { var externalLayout = null; @@ -171,8 +163,7 @@ gdjs.RuntimeGame.prototype.getExternalLayoutData = function(name) { /** * Get the data representing all the global objects of the game. - * @method getInitialObjectsData - * @return The data associated to the global objects. + * @return {Object} The data associated to the global objects. */ gdjs.RuntimeGame.prototype.getInitialObjectsData = function() { return this._data.objects || []; @@ -182,7 +173,6 @@ gdjs.RuntimeGame.prototype.getInitialObjectsData = function() { * Get the original width of the game, as set on the startup of the game. * * This is guaranteed to never change, even if the size of the game is changed afterwards. - * @method getOriginalWidth */ gdjs.RuntimeGame.prototype.getOriginalWidth = function() { return this._originalWidth; @@ -192,7 +182,6 @@ gdjs.RuntimeGame.prototype.getOriginalWidth = function() { * Get the original height of the game, as set on the startup of the game. * * This is guaranteed to never change, even if the size of the game is changed afterwards. - * @method getOriginalHeight */ gdjs.RuntimeGame.prototype.getOriginalHeight = function() { return this._originalHeight; @@ -201,7 +190,6 @@ gdjs.RuntimeGame.prototype.getOriginalHeight = function() { /** * Get the default width of the game: canvas is created with this width, * and cameras of layers are created using this width when a scene is started. - * @method getDefaultWidth */ gdjs.RuntimeGame.prototype.getDefaultWidth = function() { return this._defaultWidth; @@ -210,7 +198,6 @@ gdjs.RuntimeGame.prototype.getDefaultWidth = function() { /** * Get the default height of the game: canvas is created with this height, * and cameras of layers are created using this height when a scene is started. - * @method getDefaultHeight */ gdjs.RuntimeGame.prototype.getDefaultHeight = function() { return this._defaultHeight; @@ -219,8 +206,7 @@ gdjs.RuntimeGame.prototype.getDefaultHeight = function() { /** * Change the default width of the game: It won't affect the canvas size, but * new scene cameras will be created with this size. - * @method setDefaultWidth - * @param width {Number} The new default width + * @param {number} width The new default width */ gdjs.RuntimeGame.prototype.setDefaultWidth = function(width) { this._defaultWidth = width; @@ -229,8 +215,7 @@ gdjs.RuntimeGame.prototype.setDefaultWidth = function(width) { /** * Change the default height of the game: It won't affect the canvas size, but * new scene cameras will be created with this size. - * @method setDefaultHeight - * @param height {Number} The new default height + * @param {number} height The new default height */ gdjs.RuntimeGame.prototype.setDefaultHeight = function(height) { this._defaultHeight = height; @@ -239,7 +224,6 @@ gdjs.RuntimeGame.prototype.setDefaultHeight = function(height) { /** * Return the minimal fps that must be guaranteed by the game * (otherwise, game is slowed down). - * @method getMinimalFramerate */ gdjs.RuntimeGame.prototype.getMinimalFramerate = function() { return this._minFPS; @@ -248,8 +232,7 @@ gdjs.RuntimeGame.prototype.getMinimalFramerate = function() { /** * Set or unset the game as paused. * When paused, the game won't step and will be freezed. Useful for debugging. - * @method pause - * @param enable {Boolean} true to pause the game, false to unpause + * @param {boolean} enable true to pause the game, false to unpause */ gdjs.RuntimeGame.prototype.pause = function(enable) { this._paused = enable; @@ -257,7 +240,6 @@ gdjs.RuntimeGame.prototype.pause = function(enable) { /** * Load all assets, displaying progress in renderer. - * @method loadAllAssets */ gdjs.RuntimeGame.prototype.loadAllAssets = function(callback, progressCallback) { var loadingScreen = new gdjs.LoadingScreenRenderer( @@ -289,6 +271,9 @@ gdjs.RuntimeGame.prototype.loadAllAssets = function(callback, progressCallback) ); }; +/** + * Start the game loop, to be called once assets are loaded. + */ gdjs.RuntimeGame.prototype.startGameLoop = function() { if (!this.hasScene()) { console.log('The game has no scene.'); @@ -341,8 +326,7 @@ gdjs.RuntimeGame.prototype.startGameLoop = function() { /** * Enlarge/reduce the width (or the height) of the game to fill the screen. - * @method adaptRendererSizeToFillScreen - * @param mode {string} "adaptWidth" to change the width, "adaptHeight" to change the height + * @param {string} mode `adaptWidth` to change the width, `adaptHeight` to change the height */ gdjs.RuntimeGame.prototype.adaptRendererSizeToFillScreen = function(mode) { if (!gdjs.RuntimeGameRenderer || !gdjs.RuntimeGameRenderer.getScreenWidth || !gdjs.RuntimeGameRenderer.getScreenHeight) @@ -370,8 +354,7 @@ gdjs.RuntimeGame.prototype.adaptRendererSizeToFillScreen = function(mode) { /** * Start a profiler for the currently running scene. - * @param onProfilerStopped Function to be called when the profiler is stopped. Will be passed the profiler as argument. - * @method startCurrentSceneProfiler + * @param {Function} onProfilerStopped Function to be called when the profiler is stopped. Will be passed the profiler as argument. */ gdjs.RuntimeGame.prototype.startCurrentSceneProfiler = function(onProfilerStopped) { var currentScene = this._sceneStack.getCurrentScene(); @@ -383,7 +366,6 @@ gdjs.RuntimeGame.prototype.startCurrentSceneProfiler = function(onProfilerStoppe /** * Stop the profiler for the currently running scene. - * @method stopCurrentSceneProfiler */ gdjs.RuntimeGame.prototype.stopCurrentSceneProfiler = function() { var currentScene = this._sceneStack.getCurrentScene(); diff --git a/GDJS/Runtime/runtimeobject.js b/GDJS/Runtime/runtimeobject.js index 6e8df8b8d..bcb6e4e74 100644 --- a/GDJS/Runtime/runtimeobject.js +++ b/GDJS/Runtime/runtimeobject.js @@ -14,10 +14,9 @@ * However, you should not be calling the constructor on an already existing object * which is not a RuntimeObject. * - * @namespace gdjs + * @memberof gdjs * @class RuntimeObject - * @constructor - * @param runtimeScene The RuntimeScene owning the object. + * @param {gdjs.RuntimeScene} runtimeScene The RuntimeScene owning the object. * @param objectData The data defining the object */ gdjs.RuntimeObject = function(runtimeScene, objectData) @@ -101,8 +100,7 @@ gdjs.RuntimeObject.forcesGarbage = []; //Global container for unused forces, avo * * Objects can have different elapsed time if they are on layers with different time scales. * - * @method getElapsedTime - * @param runtimeScene The RuntimeScene the object belongs to. + * @param {gdjs.RuntimeScene} runtimeScene The RuntimeScene the object belongs to. */ gdjs.RuntimeObject.prototype.getElapsedTime = function(runtimeScene) { //TODO: Memoize? @@ -112,8 +110,7 @@ gdjs.RuntimeObject.prototype.getElapsedTime = function(runtimeScene) { /** * Called once during the game loop, before events and rendering. - * @method update - * @param runtimeScene The gdjs.RuntimeScene the object belongs to. + * @param {gdjs.RuntimeScene} runtimeScene The gdjs.RuntimeScene the object belongs to. */ gdjs.RuntimeObject.prototype.update = function(runtimeScene) { //Nothing to do. @@ -123,7 +120,6 @@ gdjs.RuntimeObject.prototype.update = function(runtimeScene) { * Called when the object is created from an initial instance at the startup of the scene.
* Note that common properties (position, angle, z order...) have already been setup. * - * @method extraInitializationFromInitialInstance * @param initialInstanceData The data of the initial instance. */ gdjs.RuntimeObject.prototype.extraInitializationFromInitialInstance = function(initialInstanceData) { @@ -133,8 +129,7 @@ gdjs.RuntimeObject.prototype.extraInitializationFromInitialInstance = function(i /** * Remove an object from a scene.
* Extensions writers, do not change this method. Instead, redefine the onDeletedFromScene method. - * @method deleteFromScene - * @param runtimeScene The RuntimeScene owning the object. + * @param {gdjs.RuntimeScene} runtimeScene The RuntimeScene owning the object. */ gdjs.RuntimeObject.prototype.deleteFromScene = function(runtimeScene) { if ( this.livingOnScene ) { @@ -146,8 +141,7 @@ gdjs.RuntimeObject.prototype.deleteFromScene = function(runtimeScene) { /** * Called when the object is removed from its scene. * - * @method onDeletedFromScene - * @param runtimeScene The RuntimeScene owning the object. + * @param {gdjs.RuntimeScene} runtimeScene The RuntimeScene owning the object. */ gdjs.RuntimeObject.prototype.onDeletedFromScene = function(runtimeScene) { var theLayer = runtimeScene.getLayer(this.layer); @@ -160,7 +154,6 @@ gdjs.RuntimeObject.prototype.onDeletedFromScene = function(runtimeScene) { * Called with a callback function that should be called with the internal * object used for rendering by the object (PIXI.DisplayObject...) * - * @method getRendererObject * @return {Object} The internal rendered object (PIXI.DisplayObject...) */ gdjs.RuntimeObject.prototype.getRendererObject = function() { @@ -170,7 +163,6 @@ gdjs.RuntimeObject.prototype.getRendererObject = function() { /** * Get the name of the object. - * @method getName * @return {String} The object's name. */ gdjs.RuntimeObject.prototype.getName = function() { @@ -179,7 +171,6 @@ gdjs.RuntimeObject.prototype.getName = function() { /** * Get the name identifier of the object. - * @method getNameId * @return {Number} The object's name identifier. */ gdjs.RuntimeObject.prototype.getNameId = function() { @@ -192,7 +183,6 @@ gdjs.RuntimeObject.prototype.getNameId = function() { * You can also use the id property (this._object.id) for increased efficiency instead of * calling this method. * - * @method getUniqueId * @return {Number} The object identifier */ gdjs.RuntimeObject.prototype.getUniqueId = function() { @@ -202,7 +192,6 @@ gdjs.RuntimeObject.prototype.getUniqueId = function() { /** * Set the position of the object. * - * @method setPosition * @param x {Number} The new X position * @param y {Number} The new Y position */ @@ -214,7 +203,6 @@ gdjs.RuntimeObject.prototype.setPosition = function(x,y) { /** * Set the X position of the object. * - * @method setX * @param x {Number} The new X position */ gdjs.RuntimeObject.prototype.setX = function(x) { @@ -227,7 +215,6 @@ gdjs.RuntimeObject.prototype.setX = function(x) { /** * Get the X position of the object. * - * @method getX * @return {Number} The X position of the object */ gdjs.RuntimeObject.prototype.getX = function() { @@ -237,7 +224,6 @@ gdjs.RuntimeObject.prototype.getX = function() { /** * Set the Y position of the object. * - * @method setY * @param y {Number} The new Y position */ gdjs.RuntimeObject.prototype.setY = function(y) { @@ -250,7 +236,6 @@ gdjs.RuntimeObject.prototype.setY = function(y) { /** * Get the Y position of the object. * - * @method getY * @return {Number} The Y position of the object */ gdjs.RuntimeObject.prototype.getY = function() { @@ -263,7 +248,6 @@ gdjs.RuntimeObject.prototype.getY = function() { * has an origin this.is not the same as the point (0,0) of the object displayed, * getDrawableX will differs. * - * @method getDrawableX * @return {Number} The X position of the rendered object. */ gdjs.RuntimeObject.prototype.getDrawableX = function() { @@ -276,7 +260,6 @@ gdjs.RuntimeObject.prototype.getDrawableX = function() { * has an origin this.is not the same as the point (0,0) of the object displayed, * getDrawableY will differs. * - * @method getDrawableY * @return {Number} The Y position of the rendered object. */ gdjs.RuntimeObject.prototype.getDrawableY = function() { @@ -315,7 +298,6 @@ gdjs.RuntimeObject.prototype.rotate = function(speed, runtimeScene) { /** * Set the angle of the object. * - * @method setAngle * @param angle {Number} The new angle of the object */ gdjs.RuntimeObject.prototype.setAngle = function(angle) { @@ -328,7 +310,6 @@ gdjs.RuntimeObject.prototype.setAngle = function(angle) { /** * Get the rotation of the object. * - * @method getAngle * @return {Number} The rotation of the object */ gdjs.RuntimeObject.prototype.getAngle = function() { @@ -338,7 +319,6 @@ gdjs.RuntimeObject.prototype.getAngle = function() { /** * Set the layer of the object. * - * @method setLayer * @return {String} The new layer of the object */ gdjs.RuntimeObject.prototype.setLayer = function(layer) { @@ -356,7 +336,6 @@ gdjs.RuntimeObject.prototype.setLayer = function(layer) { /** * Get the layer of the object. * - * @method getLayer * @return {String} The layer of the object */ gdjs.RuntimeObject.prototype.getLayer = function() { @@ -366,7 +345,6 @@ gdjs.RuntimeObject.prototype.getLayer = function() { /** * Return true if the object is on the specified layer * - * @method isOnLayer * @param layer {String} The layer to be tested. * @return {Boolean} true if the object is on the specified layer */ @@ -378,7 +356,6 @@ gdjs.RuntimeObject.prototype.isOnLayer = function(layer) { /** * Set the Z order of the object. * - * @method setZOrder * @param z {Number} The new Z order position of the object */ gdjs.RuntimeObject.prototype.setZOrder = function(z) { @@ -394,7 +371,6 @@ gdjs.RuntimeObject.prototype.setZOrder = function(z) { /** * Get the Z order of the object. * - * @method getZOrder * @return {Number} The Z order of the object */ gdjs.RuntimeObject.prototype.getZOrder = function() { @@ -403,7 +379,6 @@ gdjs.RuntimeObject.prototype.getZOrder = function() { /** * Get the container of the object variables - * @method getVariables * @return {variablesContainer} The variables of the object */ gdjs.RuntimeObject.prototype.getVariables = function() { @@ -412,7 +387,6 @@ gdjs.RuntimeObject.prototype.getVariables = function() { /** * Get the value of a variable considered as a number. Equivalent of variable.getAsNumber() - * @method getVariableNumber * @param variable The variable to be accessed * @return The value of the specified variable * @static @@ -426,7 +400,6 @@ gdjs.RuntimeObject.prototype.getVariableNumber = gdjs.RuntimeObject.getVariableN * Return the variable passed as argument without any change. * Only for usage by events. * - * @method returnVariable * @param variable The variable to be accessed * @return The specified variable * @static @@ -438,7 +411,6 @@ gdjs.RuntimeObject.prototype.returnVariable = gdjs.RuntimeObject.returnVariable; /** * Get the value of a variable considered as a string. Equivalent of variable.getAsString() - * @method getVariableString * @param variable The variable to be accessed * @return The string of the specified variable * @static @@ -450,7 +422,6 @@ gdjs.RuntimeObject.prototype.getVariableString = gdjs.RuntimeObject.getVariableS /** * Get the number of children from a variable - * @method getVariableChildCount * @param variable The variable to be accessed * @return The number of children * @static @@ -462,7 +433,6 @@ gdjs.RuntimeObject.getVariableChildCount = function(variable) { /** * Shortcut to set the value of a variable considered as a number - * @method setVariableNumber * @param variable The variable to be changed * @param newValue {Number} The value to be set */ @@ -473,7 +443,6 @@ gdjs.RuntimeObject.prototype.setVariableNumber = gdjs.RuntimeObject.setVariableN /** * Shortcut to set the value of a variable considered as a string - * @method setVariableString * @param variable The variable to be changed * @param newValue {String} The value to be set */ @@ -483,7 +452,6 @@ gdjs.RuntimeObject.setVariableString = function(variable, newValue) { gdjs.RuntimeObject.prototype.setVariableString = gdjs.RuntimeObject.setVariableString; /** - * @method variableChildExists * @static * @private * @param variable The variable to be tested @@ -495,7 +463,6 @@ gdjs.RuntimeObject.variableChildExists = function(variable, childName) { gdjs.RuntimeObject.prototype.variableChildExists = gdjs.RuntimeObject.variableChildExists; /** - * @method variableRemoveChild * @static * @private * @param variable The variable to be changed @@ -507,7 +474,6 @@ gdjs.RuntimeObject.variableRemoveChild = function(variable, childName) { gdjs.RuntimeObject.prototype.variableRemoveChild = gdjs.RuntimeObject.variableRemoveChild; /** - * @method variableClearChildren * @static * @private * @param variable The variable to be cleared @@ -519,7 +485,6 @@ gdjs.RuntimeObject.prototype.variableClearChildren = gdjs.RuntimeObject.variable /** * Shortcut to test if a variable exists for the object. - * @method hasVariable * @param name {String} The variable to be tested * @return {Boolean} true if the variable exists. */ @@ -529,7 +494,6 @@ gdjs.RuntimeObject.prototype.hasVariable = function(name) { /** * Hide or show the object - * @method hide * @param enable {Boolean} Set it to true to hide the object, false to show it. */ gdjs.RuntimeObject.prototype.hide = function(enable) { @@ -539,7 +503,6 @@ gdjs.RuntimeObject.prototype.hide = function(enable) { /** * Return true if the object is not hidden. - * @method isVisible * @return {Boolean} true if the object is not hidden. */ gdjs.RuntimeObject.prototype.isVisible = function() { @@ -548,7 +511,6 @@ gdjs.RuntimeObject.prototype.isVisible = function() { /** * Return true if the object is hidden. - * @method isHidden * @return {Boolean} true if the object is hidden. */ gdjs.RuntimeObject.prototype.isHidden = function() { @@ -557,7 +519,6 @@ gdjs.RuntimeObject.prototype.isHidden = function() { /** * Return the width of the object - * @method getWidth * @return {Number} The width of the object */ gdjs.RuntimeObject.prototype.getWidth = function() { @@ -566,7 +527,6 @@ gdjs.RuntimeObject.prototype.getWidth = function() { /** * Return the width of the object - * @method getHeight * @return {Number} The height of the object */ gdjs.RuntimeObject.prototype.getHeight = function() { @@ -575,7 +535,6 @@ gdjs.RuntimeObject.prototype.getHeight = function() { /** * Return the X position of the object center, relative to the object position. - * @method getCenterX */ gdjs.RuntimeObject.prototype.getCenterX = function() { return this.getWidth() / 2; @@ -583,7 +542,6 @@ gdjs.RuntimeObject.prototype.getCenterX = function() { /** * Return the Y position of the object center, relative to the object position. - * @method getCenterY */ gdjs.RuntimeObject.prototype.getCenterY = function() { return this.getHeight() / 2; @@ -595,7 +553,6 @@ gdjs.RuntimeObject.prototype.getCenterY = function() { * Get a force from the garbage, or create a new force is garbage is empty.
* To be used each time a force is created so as to avoid temporaries objects. * - * @method getRecycledForce * @private * @param x {Number} The x coordinates of the force * @param y {Number} The y coordinates of the force @@ -615,7 +572,6 @@ gdjs.RuntimeObject.prototype._getRecycledForce = function(x, y, clearing) { /** * Add a force to the object to make it moving. - * @method addForce * @param x {Number} The x coordinates of the force * @param y {Number} The y coordinates of the force * @param clearing {Number} Set the force clearing @@ -626,7 +582,6 @@ gdjs.RuntimeObject.prototype.addForce = function(x,y, clearing) { /** * Add a force using polar coordinates. - * @method addPolarForce * @param angle {Number} The angle of the force * @param len {Number} The length of the force * @param clearing {Number} Set the force clearing @@ -640,7 +595,6 @@ gdjs.RuntimeObject.prototype.addPolarForce = function(angle, len, clearing) { /** * Add a force oriented toward a position - * @method addForceTowardPosition * @param x {Number} The target x position * @param y {Number} The target y position * @param len {Number} The force length, in pixels. @@ -659,7 +613,6 @@ gdjs.RuntimeObject.prototype.addForceTowardPosition = function(x,y, len, clearin /** * Add a force oriented toward another object.
* (Shortcut for addForceTowardPosition) - * @method addForceTowardObject * @param obj The target object * @param len {Number} The force length, in pixels. * @param clearing {Number} Set the force clearing @@ -674,7 +627,6 @@ gdjs.RuntimeObject.prototype.addForceTowardObject = function(obj, len, clearing) /** * Deletes all forces applied on the object - * @method clearForces */ gdjs.RuntimeObject.prototype.clearForces = function() { gdjs.RuntimeObject.forcesGarbage.push.apply(gdjs.RuntimeObject.forcesGarbage, this._forces); @@ -683,7 +635,6 @@ gdjs.RuntimeObject.prototype.clearForces = function() { /** * Return true if no forces are applied on the object. - * @method hasNoForces * @return {Boolean} true if no forces are applied on the object. */ gdjs.RuntimeObject.prototype.hasNoForces = function() { @@ -693,7 +644,6 @@ gdjs.RuntimeObject.prototype.hasNoForces = function() { /** * Called once a step by runtimeScene to update forces magnitudes and * remove null ones. - * @method updateForces */ gdjs.RuntimeObject.prototype.updateForces = function(elapsedTime) { for(var i = 0;i * Be careful, the behavior must exists, no check is made on the name. - * @method getBehavior * @param name {String} The behavior name. */ gdjs.RuntimeObject.prototype.getBehavior = function(name) { @@ -853,7 +796,6 @@ gdjs.RuntimeObject.prototype.getBehavior = function(name) { /** * Check if a behavior is used by the object. * - * @method hasBehavior * @param name {String} The behavior name. */ gdjs.RuntimeObject.prototype.hasBehavior = function(name) { @@ -863,7 +805,6 @@ gdjs.RuntimeObject.prototype.hasBehavior = function(name) { /** * De/activate a behavior of the object. * - * @method activateBehavior * @param name {String} The behavior name. * @param enable {Boolean} true to activate the behavior */ @@ -876,7 +817,6 @@ gdjs.RuntimeObject.prototype.activateBehavior = function(name, enable) { /** * Check if a behavior is activated * - * @method behaviorActivated * @param name {String} The behavior name. * @return true if the behavior is activated. */ @@ -892,7 +832,6 @@ gdjs.RuntimeObject.prototype.behaviorActivated = function(name) { /** * Separate the object from others objects, using their hitboxes. - * @method separateFromObjects * @param objects Objects * @return true if the object was moved */ @@ -926,7 +865,6 @@ gdjs.RuntimeObject.prototype.separateFromObjects = function(objects) { /** * Separate the object from others objects, using their hitboxes. - * @method separateFromObjectsList * @param objectsLists Tables of objects * @return true if the object was moved */ @@ -966,7 +904,6 @@ gdjs.RuntimeObject.prototype.separateFromObjectsList = function(objectsLists) { /** * Get the distance, in pixels, to another object. - * @method getDistanceToObject * @param otherObject The other object */ gdjs.RuntimeObject.prototype.getDistanceToObject = function(otherObject) { @@ -975,7 +912,6 @@ gdjs.RuntimeObject.prototype.getDistanceToObject = function(otherObject) { /** * Get the squared distance, in pixels, to another object. - * @method getSqDistanceToObject * @param otherObject The other object */ gdjs.RuntimeObject.prototype.getSqDistanceToObject = function(otherObject) { @@ -989,7 +925,6 @@ gdjs.RuntimeObject.prototype.getSqDistanceToObject = function(otherObject) { /** * Get the squared distance, in pixels, to a position. - * @method getSqDistanceTo * @param pointX {Number} X position * @param pointY {Number} Y position */ @@ -1004,7 +939,6 @@ gdjs.RuntimeObject.prototype.getSqDistanceTo = function(pointX, pointY) { * Put the object around a position, with a specific distance and angle.
* The distance is computed between the position and the center of the object. * - * @method putAround * @param x {Number} The x position of the target * @param y {Number} The y position of the target * @param distance {Number} The distance between the object and the target @@ -1021,7 +955,6 @@ gdjs.RuntimeObject.prototype.putAround = function(x,y,distance,angleInDegrees) { * Put the object around another object, with a specific distance and angle.
* The distance is computed between the centers of the objects. * - * @method putAround * @param obj The target object * @param distance {Number} The distance between the object and the target * @param angleInDegrees {Number} The angle between the object and the target, in degrees. @@ -1032,7 +965,6 @@ gdjs.RuntimeObject.prototype.putAroundObject = function(obj,distance,angleInDegr }; /** - * @method separateObjectsWithoutForces * @deprecated * @param objectsLists Tables of objects */ @@ -1068,7 +1000,6 @@ gdjs.RuntimeObject.prototype.separateObjectsWithoutForces = function(objectsList }; /** - * @method SeparateObjectsWithForces * @deprecated * @param objectsLists Tables of objects */ @@ -1115,7 +1046,6 @@ gdjs.RuntimeObject.prototype.separateObjectsWithForces = function(objectsLists, /** * Return true if the hitboxes of two objects are overlapping - * @method collisionTest * @static * @param obj1 The first runtimeObject * @param obj2 The second runtimeObject @@ -1151,7 +1081,6 @@ gdjs.RuntimeObject.collisionTest = function(obj1, obj2) { }; /** - * @method raycastTest * @param x {Number} The raycast source X * @param y {Number} The raycast source Y * @param endX {Number} The raycast end position X @@ -1199,7 +1128,6 @@ gdjs.RuntimeObject.prototype.raycastTest = function(x, y, endX, endY, closest) { * The position should be in "world" coordinates, i.e use gdjs.Layer.convertCoords * if you need to pass the mouse or a touch position that you get from gdjs.InputManager. * - * @method insideObject */ gdjs.RuntimeObject.prototype.insideObject = function(x, y) { return this.getDrawableX() <= x @@ -1210,7 +1138,6 @@ gdjs.RuntimeObject.prototype.insideObject = function(x, y) { /** * Check the distance between two objects. - * @method distanceTest * @static */ gdjs.RuntimeObject.distanceTest = function(obj1, obj2, distance) { @@ -1220,7 +1147,6 @@ gdjs.RuntimeObject.distanceTest = function(obj1, obj2, distance) { /** * Return true if the cursor, or any touch, is on the object. * - * @method cursorOnObject * @return true if the cursor, or any touch, is on the object. */ gdjs.RuntimeObject.prototype.cursorOnObject = function(runtimeScene) { @@ -1247,7 +1173,6 @@ gdjs.RuntimeObject.prototype.cursorOnObject = function(runtimeScene) { /** * \brief Check if a point is inside the object collision hitboxes. - * @method isCollidingWithPoint * @param pointX The point x coordinate. * @param pointY The point y coordinate. * @return true if the point is inside the object collision hitboxes. @@ -1266,8 +1191,7 @@ gdjs.RuntimeObject.prototype.isCollidingWithPoint = function(pointX, pointY) { /** * Get the identifier associated to an object name :
* Some features may want to compare objects name a large number of time. In this case, - * it may be more efficient to compare objects name identifier ( see gdjs.RuntimeObject.getNameId ). - * @method getNameIdentifier + * it may be more efficient to compare objects name identifier. * @static */ gdjs.RuntimeObject.getNameIdentifier = function(name) { diff --git a/GDJS/Runtime/runtimescene.js b/GDJS/Runtime/runtimescene.js index 0c2070af5..ce4d6f8cc 100644 --- a/GDJS/Runtime/runtimescene.js +++ b/GDJS/Runtime/runtimescene.js @@ -8,8 +8,8 @@ * The runtimeScene object represents a scene being played and rendered in the browser in a canvas. * * @class RuntimeScene + * @memberof gdjs * @param {gdjs.RuntimeGame} runtimeGame The game associated to this scene. - * @param {PIXI.WebGLRenderer|PIXI.CanvasRenderer} pixiRenderer The renderer to be used */ gdjs.RuntimeScene = function(runtimeGame) { @@ -42,8 +42,7 @@ gdjs.RuntimeScene = function(runtimeGame) /** * Should be called when the canvas where the scene is rendered has been resized. * See gdjs.RuntimeGame.startGameLoop in particular. - * - * @method onCanvasResized + * @memberof gdjs.RuntimeScene */ gdjs.RuntimeScene.prototype.onCanvasResized = function() { this._renderer.onCanvasResized(); @@ -51,8 +50,8 @@ gdjs.RuntimeScene.prototype.onCanvasResized = function() { /** * Load the runtime scene from the given scene. - * @method loadFromScene - * @param sceneData An object containing the scene data. + * @param {Object} sceneData An object containing the scene data. + * @see gdjs.RuntimeGame#getSceneData */ gdjs.RuntimeScene.prototype.loadFromScene = function(sceneData) { if ( sceneData === undefined ) { @@ -176,10 +175,9 @@ gdjs.RuntimeScene.prototype.unloadScene = function() { * Create objects from initial instances data ( for example, the initial instances * of the scene or from an external layout ). * - * @method createObjectsFrom - * @param data The instances data - * @param xPos The offset on X axis - * @param yPos The offset on Y axis + * @param {Object} data The instances data + * @param {number} xPos The offset on X axis + * @param {number} yPos The offset on Y axis */ gdjs.RuntimeScene.prototype.createObjectsFrom = function(data, xPos, yPos) { for(var i = 0, len = data.length;i - * The function will be passed the runtimeScene as argument. + * Set the function called each time the scene is stepped. + * The function will be passed the `runtimeScene` as argument. * - * Note that this is already set up by the runtimeScene constructor and that you should + * Note that this is already set up by the gdjs.RuntimeScene constructor and that you should * not need to use this method. * - * @method setEventsFunction - * @param The function to be called. + * @param {Function} func The function to be called. */ gdjs.RuntimeScene.prototype.setEventsFunction = function(func) { this._eventsFunction = func; @@ -214,8 +211,7 @@ gdjs.RuntimeScene.prototype.setEventsFunction = function(func) { /** * Step and render the scene. - * @method renderAndStep - * @return true if the game loop should continue, false if a scene change/push/pop + * @return {boolean} true if the game loop should continue, false if a scene change/push/pop * or a game stop was requested. */ gdjs.RuntimeScene.prototype.renderAndStep = function(elapsedTime) { @@ -251,7 +247,6 @@ gdjs.RuntimeScene.prototype.renderAndStep = function(elapsedTime) { /** * Render the PIXI container associated to the runtimeScene. - * @method render */ gdjs.RuntimeScene.prototype.render = function() { this._renderer.render(); @@ -280,7 +275,6 @@ gdjs.RuntimeScene.prototype._updateLayersCameraCoordinates = function() { * * Visibility is set to false if object is hidden, or if * object is too far from the camera of its layer ("culling"). - * @method _updateObjectsVisibility * @private */ gdjs.RuntimeScene.prototype._updateObjectsVisibility = function() { @@ -331,7 +325,6 @@ gdjs.RuntimeScene.prototype._updateObjectsVisibility = function() { * The removed objects could not be sent directly to the cache, as events may still be using them after * removing them from the scene for example. * - * @method _cacheOrClearRemovedInstances * @private */ gdjs.RuntimeScene.prototype._cacheOrClearRemovedInstances = function() { @@ -346,7 +339,6 @@ gdjs.RuntimeScene.prototype._cacheOrClearRemovedInstances = function() { /** * Tool function filling _allObjectsList member with all the instances. - * @method _constructListOfAllObjects * @private */ gdjs.RuntimeScene.prototype._constructListOfAllInstances = function() { @@ -372,7 +364,6 @@ gdjs.RuntimeScene.prototype._constructListOfAllInstances = function() { /** * Update the objects before launching the events. - * @method _updateObjectsPreEvents * @private */ gdjs.RuntimeScene.prototype._updateObjectsPreEvents = function() { @@ -389,7 +380,6 @@ gdjs.RuntimeScene.prototype._updateObjectsPreEvents = function() { /** * Update the objects (update positions, time management...) - * @method _updateObjects * @private */ gdjs.RuntimeScene.prototype._updateObjects = function() { @@ -420,7 +410,6 @@ gdjs.RuntimeScene.prototype._updateObjects = function() { /** * Change the background color - * @method setBackgroundColor */ gdjs.RuntimeScene.prototype.setBackgroundColor = function(r,g,b) { this._backgroundColor = parseInt(gdjs.rgbToHex(r,g,b),16); @@ -432,7 +421,6 @@ gdjs.RuntimeScene.prototype.getBackgroundColor = function() { /** * Get the name of the scene. - * @method getName */ gdjs.RuntimeScene.prototype.getName = function() { return this._name; @@ -440,7 +428,6 @@ gdjs.RuntimeScene.prototype.getName = function() { /** * Update the objects positions according to their forces - * @method updateObjectsForces */ gdjs.RuntimeScene.prototype.updateObjectsForces = function() { for (var name in this._instances.items) { @@ -464,7 +451,6 @@ gdjs.RuntimeScene.prototype.updateObjectsForces = function() { /** * Add an object to the instances living on the scene. - * @method addObject * @param obj The object to be added. */ gdjs.RuntimeScene.prototype.addObject = function(obj) { @@ -478,8 +464,7 @@ gdjs.RuntimeScene.prototype.addObject = function(obj) { /** * Get all the instances of the object called name. - * @method getObjects - * @param name Name of the object the instances must be returned. + * @param {string} name Name of the object for which the instances must be returned. */ gdjs.RuntimeScene.prototype.getObjects = function(name){ if ( !this._instances.containsKey(name) ) { @@ -493,7 +478,7 @@ gdjs.RuntimeScene.prototype.getObjects = function(name){ /** * Create a new object from its name. The object is also added to the instances * living on the scene ( No need to call RuntimeScene.addObject ) - * @param objectName {String} The name of the object to be created + * @param {string} objectName The name of the object to be created * @return The created object */ gdjs.RuntimeScene.prototype.createObject = function(objectName){ @@ -522,7 +507,6 @@ gdjs.RuntimeScene.prototype.createObject = function(objectName){ /** * Must be called whenever an object must be removed from the scene. - * @method markObjectForDeletion * @param object The object to be removed. */ gdjs.RuntimeScene.prototype.markObjectForDeletion = function(obj) { @@ -558,7 +542,6 @@ gdjs.RuntimeScene.prototype.markObjectForDeletion = function(obj) { /** * Create an identifier for a new object of the scene. - * @method createNewUniqueId */ gdjs.RuntimeScene.prototype.createNewUniqueId = function() { this._lastId++; @@ -567,7 +550,6 @@ gdjs.RuntimeScene.prototype.createNewUniqueId = function() { /** * Get the renderer associated to the RuntimeScene. - * @method getRenderer */ gdjs.RuntimeScene.prototype.getRenderer = function() { return this._renderer; @@ -575,7 +557,6 @@ gdjs.RuntimeScene.prototype.getRenderer = function() { /** * Get the runtimeGame associated to the RuntimeScene. - * @method getGame */ gdjs.RuntimeScene.prototype.getGame = function() { return this._runtimeGame; @@ -583,7 +564,6 @@ gdjs.RuntimeScene.prototype.getGame = function() { /** * Get the variables of the runtimeScene. - * @method getVariables * @return The container holding the variables of the scene. */ gdjs.RuntimeScene.prototype.getVariables = function() { @@ -592,8 +572,7 @@ gdjs.RuntimeScene.prototype.getVariables = function() { /** * Get the data representing the initial shared data of the scene for the specified behavior. - * @method getInitialSharedDataForBehavior - * @param name {String} The name of the behavior + * @param {string} name The name of the behavior */ gdjs.RuntimeScene.prototype.getInitialSharedDataForBehavior = function(name) { if ( this._initialBehaviorSharedData.containsKey(name) ) { @@ -644,7 +623,6 @@ gdjs.RuntimeScene.STOP_GAME = 5; /** * Return the value of the scene change that is requested. - * @method getRequestedChange */ gdjs.RuntimeScene.prototype.getRequestedChange = function() { return this._requestedChange; @@ -654,7 +632,6 @@ gdjs.RuntimeScene.prototype.getRequestedChange = function() { * Return the name of the new scene to be launched. * * See requestChange. - * @method getRequestedScene */ gdjs.RuntimeScene.prototype.getRequestedScene = function() { return this._requestedScene; @@ -665,7 +642,6 @@ gdjs.RuntimeScene.prototype.getRequestedScene = function() { * thanks to getRequestedChange and getRequestedScene methods. * @param change One of gdjs.RuntimeScene.CONTINUE|PUSH_SCENE|POP_SCENE|REPLACE_SCENE|CLEAR_SCENES|STOP_GAME. * @param sceneName The name of the new scene to launch, if applicable. - * @method requestChange */ gdjs.RuntimeScene.prototype.requestChange = function(change, sceneName) { this._requestedChange = change; @@ -674,7 +650,6 @@ gdjs.RuntimeScene.prototype.requestChange = function(change, sceneName) { /** * Get the profiler associated with the scene, or null if none. - * @method getProfiler */ gdjs.RuntimeScene.prototype.getProfiler = function() { return this._profiler; @@ -684,7 +659,6 @@ gdjs.RuntimeScene.prototype.getProfiler = function() { * Start a new profiler to measures the time passed in sections of the engine * in the scene. * @param onProfilerStopped Function to be called when the profiler is stopped. Will be passed the profiler as argument. - * @method startProfiler */ gdjs.RuntimeScene.prototype.startProfiler = function(onProfilerStopped) { if (this._profiler) return; @@ -695,7 +669,6 @@ gdjs.RuntimeScene.prototype.startProfiler = function(onProfilerStopped) { /** * Stop the profiler being run on the scene. - * @method stopProfiler */ gdjs.RuntimeScene.prototype.stopProfiler = function() { if (!this._profiler) return null; diff --git a/GDJS/Runtime/scenestack.js b/GDJS/Runtime/scenestack.js index a31dce885..4965a707d 100644 --- a/GDJS/Runtime/scenestack.js +++ b/GDJS/Runtime/scenestack.js @@ -2,7 +2,7 @@ /** * Hold the stack of scenes (gdjs.RuntimeScene) being played. * - * @namespace gdjs + * @memberof gdjs * @class SceneStack */ gdjs.SceneStack = function(runtimeGame) { diff --git a/GDJS/Runtime/spriteruntimeobject.js b/GDJS/Runtime/spriteruntimeobject.js index b24f57525..bd02d1946 100644 --- a/GDJS/Runtime/spriteruntimeobject.js +++ b/GDJS/Runtime/spriteruntimeobject.js @@ -5,14 +5,13 @@ */ /** - * A frame used by a SpriteAnimation in a SpriteRuntimeObject. + * A frame used by a SpriteAnimation in a {@link SpriteRuntimeObject}. * * It contains the texture displayed as well as information like the points position * or the collision mask. * - * @namespace gdjs + * @memberof gdjs * @class SpriteAnimationFrame - * @constructor */ gdjs.SpriteAnimationFrame = function(imageManager, frameData) { @@ -81,7 +80,6 @@ gdjs.SpriteAnimationFrame = function(imageManager, frameData) * Get a point of the frame.
* If the point does not exist, the origin is returned. * - * @method getPoint * @return The requested point. */ gdjs.SpriteAnimationFrame.prototype.getPoint = function(name) { @@ -92,11 +90,10 @@ gdjs.SpriteAnimationFrame.prototype.getPoint = function(name) { }; /** - * Represents a direction of an animation of a SpriteRuntimeObject. + * Represents a direction of an animation of a {@link SpriteRuntimeObject}. * * @class SpriteAnimationDirection - * @namespace gdjs - * @constructor + * @memberof gdjs */ gdjs.SpriteAnimationDirection = function(imageManager, directionData) { @@ -117,11 +114,10 @@ gdjs.SpriteAnimationDirection = function(imageManager, directionData) }; /** - * Represents an animation of a SpriteRuntimeObject. + * Represents an animation of a {@link SpriteRuntimeObject}. * * @class SpriteAnimation - * @namespace gdjs - * @constructor + * @memberof gdjs */ gdjs.SpriteAnimation = function(imageManager, animData) { @@ -144,7 +140,7 @@ gdjs.SpriteAnimation = function(imageManager, animData) * The SpriteRuntimeObject represents an object that can display images. * * @class SpriteRuntimeObject - * @namespace gdjs + * @memberof gdjs * @extends gdjs.RuntimeObject */ gdjs.SpriteRuntimeObject = function(runtimeScene, objectData) @@ -213,7 +209,6 @@ gdjs.SpriteRuntimeObject.prototype.extraInitializationFromInitialInstance = func /** * Update the current frame of the object according to the elapsed time on the scene. - * @method update */ gdjs.SpriteRuntimeObject.prototype.update = function(runtimeScene) { //Playing the animation of all objects including the ones outside the screen can be @@ -285,7 +280,6 @@ gdjs.SpriteRuntimeObject.prototype.getRendererObject = function() { * Fallback to the default implementation (rotated bounding box) if there is no custom * hitboxes defined for the current animation frame. * - * @method updateHitBoxes */ gdjs.SpriteRuntimeObject.prototype.updateHitBoxes = function() { if ( this._frameDirty ) this._updateFrame(); //Beware, _animationFrame could be invalid if this._frameDirty === true. @@ -499,7 +493,6 @@ gdjs.SpriteRuntimeObject.prototype.getPointY = function(name) { * in global coordinates) * @return An array containing the x and y position of the point in global coordinates. If result parameter is * defined, nothing is returned by the method. - * @method _transformToGlobal * @private */ gdjs.SpriteRuntimeObject.prototype._transformToGlobal = function(x, y, result) { @@ -739,7 +732,6 @@ gdjs.SpriteRuntimeObject.prototype.getScaleX = function() { //Other : /** - * @method turnTowardObject * @param obj The target object * @param scene The scene containing the object * @deprecated diff --git a/GDJS/Runtime/timemanager.js b/GDJS/Runtime/timemanager.js index 3bb1e1b7e..636e5d95c 100644 --- a/GDJS/Runtime/timemanager.js +++ b/GDJS/Runtime/timemanager.js @@ -9,8 +9,7 @@ * frame, since the beginning of the scene and other time related values. * * @class TimeManager - * @namespace gdjs - * @constructor + * @memberof gdjs */ gdjs.TimeManager = function() { @@ -47,8 +46,7 @@ gdjs.TimeManager.prototype.update = function(elapsedTime, minimumFPS) { /** * Set the time scale: time will be slower if time scale is < 1, * faster if > 1. - * @method setTimeScale - * @param timeScale {Number} The new time scale (must be positive). + * @param {number} timeScale The new time scale (must be positive). */ gdjs.TimeManager.prototype.setTimeScale = function(timeScale) { if ( timeScale >= 0 ) this._timeScale = timeScale; @@ -56,7 +54,7 @@ gdjs.TimeManager.prototype.setTimeScale = function(timeScale) { /** * Get the time scale. - * @method getTimeScale + * @return {number} The time scale (positive, 1 is normal speed). */ gdjs.TimeManager.prototype.getTimeScale = function() { return this._timeScale; @@ -65,7 +63,6 @@ gdjs.TimeManager.prototype.getTimeScale = function() { /** * Get the time since the instanciation of the manager (i.e: since * the beginning of the scene most of the time), in milliseconds. - * @method getTimeFromStart */ gdjs.TimeManager.prototype.getTimeFromStart = function() { return this._timeFromStart; @@ -74,7 +71,6 @@ gdjs.TimeManager.prototype.getTimeFromStart = function() { /** * Return true if update was called only once (i.e: if the scene * is rendering its first frame). - * @method isFirstFrame */ gdjs.TimeManager.prototype.isFirstFrame = function() { return this._firstFrame; @@ -83,7 +79,6 @@ gdjs.TimeManager.prototype.isFirstFrame = function() { /** * Return the time elapsed since the last call to update * (i.e: the last frame), in milliseconds. - * @method getElapsedTime */ gdjs.TimeManager.prototype.getElapsedTime = function() { return this._elapsedTime; diff --git a/GDJS/Runtime/timer.js b/GDJS/Runtime/timer.js index cc0d8d8d6..b9f7979ce 100644 --- a/GDJS/Runtime/timer.js +++ b/GDJS/Runtime/timer.js @@ -5,11 +5,11 @@ */ /** - * Represents a timer which must be updated manually. + * Represents a timer, which must be updated manually with {@link gdjs.Timer#updateTime}. * * @class Timer - * @namespace gdjs - * @constructor + * @memberof gdjs + * @param {string} name The name of the timer. */ gdjs.Timer = function(name) { @@ -20,8 +20,7 @@ gdjs.Timer = function(name) /** * Get the name of the timer - * @method getName - * @return {String} The name of the timer + * @return {string} The name of the timer */ gdjs.Timer.prototype.getName = function() { return this._name; @@ -29,16 +28,14 @@ gdjs.Timer.prototype.getName = function() { /** * Get the time elapsed - * @method getTime - * @return {String} The time of the timer + * @return {string} The time of the timer */ gdjs.Timer.prototype.getTime = function() { return this._time; } /** - * Notify the timer that some time elapsed. - * @method updateTime + * Notify the timer that some time has passed. */ gdjs.Timer.prototype.updateTime = function(time) { if ( !this._paused ) this._time += time; @@ -46,7 +43,6 @@ gdjs.Timer.prototype.updateTime = function(time) { /** * Change the time. - * @method setTime */ gdjs.Timer.prototype.setTime = function(time) { this._time = time; @@ -54,7 +50,6 @@ gdjs.Timer.prototype.setTime = function(time) { /** * Set time to zero. - * @method reset */ gdjs.Timer.prototype.reset = function(time) { this.setTime(0); @@ -62,7 +57,6 @@ gdjs.Timer.prototype.reset = function(time) { /** * Set if the timer is paused. - * @method setPaused */ gdjs.Timer.prototype.setPaused = function(enable) { this._paused = enable; @@ -70,7 +64,6 @@ gdjs.Timer.prototype.setPaused = function(enable) { /** * Check if the timer is paused. - * @method isPaused */ gdjs.Timer.prototype.isPaused = function() { return this._paused; diff --git a/GDJS/Runtime/variable.js b/GDJS/Runtime/variable.js index e1179aa0a..992ed5231 100644 --- a/GDJS/Runtime/variable.js +++ b/GDJS/Runtime/variable.js @@ -7,10 +7,9 @@ /** * A Variable is an object storing a value (number or a string) or children variables. * - * @constructor - * @namespace gdjs + * @memberof gdjs * @class Variable - * @param varData optional object used to initialize the variable. + * @param {Object} varData optional object used to initialize the variable. */ gdjs.Variable = function(varData) { @@ -56,9 +55,9 @@ gdjs.Variable = function(varData) /** - * Used ( usually by VariablesContainer ) to set that the variable must be + * Used (usually by gdjs.VariablesContainer) to set that the variable must be * considered as not existing in the container. - * @method setUndefinedInContainer + * @private */ gdjs.Variable.prototype.setUndefinedInContainer = function() { this._undefinedInContainer = true; @@ -66,8 +65,8 @@ gdjs.Variable.prototype.setUndefinedInContainer = function() { /** * Check if the variable must be considered as not existing in its container - * ( Usually a VariablesContainer ). - * @method isUndefinedInContainer + * (usually a gdjs.VariablesContainer). + * @private * @return true if the container must consider that the variable does not exist. */ gdjs.Variable.prototype.isUndefinedInContainer = function() { @@ -79,7 +78,6 @@ gdjs.Variable.prototype.isUndefinedInContainer = function() { * * If the variable has not the specified child, an empty variable with the specified name * is added as child. - * @method getChild */ gdjs.Variable.prototype.getChild = function(childName) { @@ -95,7 +93,6 @@ gdjs.Variable.prototype.getChild = function(childName) { * Return the child in a variable. * * Check if the variable has the specified children - * @method hasChild * @return true if variable has the children with the specified name */ gdjs.Variable.prototype.hasChild = function(childName) { @@ -106,7 +103,6 @@ gdjs.Variable.prototype.hasChild = function(childName) { * Remove the child with the specified name. * * If the variable has not the specified child, nothing is done. - * @method removeChild * @param childName The name of the child to be removed */ gdjs.Variable.prototype.removeChild = function(childName) { @@ -118,7 +114,6 @@ gdjs.Variable.prototype.removeChild = function(childName) { * Remove all the children. * * If the variable is not a structure, nothing is done. - * @method clearChildren */ gdjs.Variable.prototype.clearChildren = function() { if ( !this._isStructure ) return; @@ -132,7 +127,6 @@ gdjs.Variable.prototype.clearChildren = function() { /** * Get the value of the variable, considered as a number - * @method getAsNumber * @return {Number} The number stored */ gdjs.Variable.prototype.getAsNumber = function() { @@ -147,7 +141,6 @@ gdjs.Variable.prototype.getAsNumber = function() { /** * Change the value of the variable, considered as a number - * @method setNumber * @param newValue {Number} The new value to be set */ gdjs.Variable.prototype.setNumber = function(newValue) { @@ -158,7 +151,6 @@ gdjs.Variable.prototype.setNumber = function(newValue) { /** * Get the value of the variable, considered as a string - * @method getAsString * @return {String} The number stored */ gdjs.Variable.prototype.getAsString = function() { @@ -172,7 +164,6 @@ gdjs.Variable.prototype.getAsString = function() { /** * Change the value of the variable, considered as a string - * @method setString * @param newValue {String} The new string to be set */ gdjs.Variable.prototype.setString = function(newValue) { @@ -183,7 +174,6 @@ gdjs.Variable.prototype.setString = function(newValue) { /** * Return true if the variable is a structure. - * @method isStructure */ gdjs.Variable.prototype.isStructure = function() { return this._isStructure; @@ -191,7 +181,6 @@ gdjs.Variable.prototype.isStructure = function() { /** * Return true if the variable is a number. - * @method isNumber */ gdjs.Variable.prototype.isNumber = function() { return !this._isStructure && !this._numberDirty; @@ -199,7 +188,6 @@ gdjs.Variable.prototype.isNumber = function() { /** * Return the object containing all the children of the variable - * @method getAllChildren */ gdjs.Variable.prototype.getAllChildren = function() { return this._children; diff --git a/GDJS/Runtime/variablescontainer.js b/GDJS/Runtime/variablescontainer.js index baba64bf6..6e7027836 100644 --- a/GDJS/Runtime/variablescontainer.js +++ b/GDJS/Runtime/variablescontainer.js @@ -8,10 +8,9 @@ * VariablesContainer stores variables, usually for a a RuntimeGame, a RuntimeScene * or a RuntimeObject. * - * @namespace gdjs + * @memberof gdjs * @class VariablesContainer - * @constructor - * @param initialVariablesData Optional object containing initial variables. + * @param {Object} initialVariablesData Optional object containing initial variables. */ gdjs.VariablesContainer = function(initialVariablesData) { @@ -23,14 +22,13 @@ gdjs.VariablesContainer = function(initialVariablesData) /** * Initialize variables from a container data.
- * If keepOldVariables is set to false ( by default ), all already existing variables will be + * If `keepOldVariables` is set to false (by default), all already existing variables will be * erased, but the new variables will be accessible thanks to getFromIndex.
- * if keepOldVariables is set to true, already existing variables won't be erased and will be + * if `keepOldVariables` is set to true, already existing variables won't be erased and will be * still accessible thanks to getFromIndex. * - * @method initFrom * @param data The object containing the variables. - * @param keepOldVariables {Boolean} If set to true, already existing variables won't be erased. + * @param {Boolean} keepOldVariables If set to true, already existing variables won't be erased. */ gdjs.VariablesContainer.prototype.initFrom = function(data, keepOldVariables) { if ( keepOldVariables == undefined ) keepOldVariables = false; @@ -79,7 +77,6 @@ gdjs.VariablesContainer.prototype.initFrom = function(data, keepOldVariables) { /** * Add a new variable. - * @method add * @param name {String} Variable name * @param variable The variable to be added */ @@ -90,7 +87,6 @@ gdjs.VariablesContainer.prototype.add = function(name, variable) { /** * Remove a variable.
* ( In fact, the variable is not really removed from the container to avoid creating garbage ) - * @method remove * @param name {String} Variable to be removed */ gdjs.VariablesContainer.prototype.remove = function(name) { @@ -101,7 +97,6 @@ gdjs.VariablesContainer.prototype.remove = function(name) { /** * Get a variable. - * @method get * @param name {String} The variable's name * @return The specified variable. If not found, an empty variable is added to the container. */ @@ -128,7 +123,6 @@ gdjs.VariablesContainer.prototype.get = function(name) { * This method is generally used by events generated code to increase lookup speed for variables.
* If you're unsure about how to use this method, prefer to use get. * - * @method getFromIndex * @param id {Number} The variable index * @return The specified variable. If not found, an empty variable is added to the container, but it * should not happen. @@ -149,7 +143,6 @@ gdjs.VariablesContainer.prototype.getFromIndex = function(id) { /** * Check if a variable exists in the container - * @method has * @param name {String} The variable's name * @return true if the variable exists. */ diff --git a/GDJS/Runtime/websocket-debugger-client/websocket-debugger-client.js b/GDJS/Runtime/websocket-debugger-client/websocket-debugger-client.js index aa124b822..0af2954f7 100644 --- a/GDJS/Runtime/websocket-debugger-client/websocket-debugger-client.js +++ b/GDJS/Runtime/websocket-debugger-client/websocket-debugger-client.js @@ -2,7 +2,10 @@ * This DebuggerClient connects to a websocket server and can dump * the data of the current game, and receive message to change a field or * call a function on an object of the specified runtimeGame. - * @param {*} runtimegame + * + * @memberof gdjs + * @class WebsocketDebuggerClient + * @param {gdjs.RuntimeGame} The `gdjs.RuntimeGame` to be debug */ gdjs.WebsocketDebuggerClient = function(runtimegame) { this._runtimegame = runtimegame; diff --git a/GDJS/docs/jsdoc.conf.json b/GDJS/docs/jsdoc.conf.json new file mode 100644 index 000000000..e7cc5673c --- /dev/null +++ b/GDJS/docs/jsdoc.conf.json @@ -0,0 +1,54 @@ +{ + "tags": { + "allowUnknownTags": false + }, + "source": { + "include": [ + "./Runtime/" + ], + "exclude": [ + "./Runtime/Cocos2d/", + "./Runtime/Cordova/", + "./Runtime/Electron/", + "./Runtime/FacebookInstantGames/" + ], + "includePattern": ".+\\.js(doc)?$", + "excludePattern": "(^|\\/|\\\\)_" + }, + "plugins": [ + "plugins/markdown" + ], + "templates": { + "default" : { + "outputSourceFiles" : true + }, + "applicationName": "GDevelop JS Runtime", + "footer" : "Made with ♥ by Goodboy Digital (goodboydigital.com)", + "copyright" : "GDevelop Copyright © 2008-2018 Florian Rival", + "googleAnalytics": "TODO", + "openGraph": { + "title": "GDevelop JS Runtime Documentation", + "type": "website", + "image": "", + "site_name": "", + "url": "" + }, + "meta": { + "title": "GDevelop JS Runtime Documentation", + "description": "Documentation for the GDevelop JavaScript game engine", + "keyword": "docs, documentation, gdevelop, game, engine, html5, javascript" + }, + "linenums" : true + }, + "markdown" : { + "parser" : "gfm", + "hardwrap" : false + }, + "opts": { + "encoding" : "utf8", + "recurse" : true, + "private" : false, + "lenient" : true, + "destination" : "./test-docs" + } +} \ No newline at end of file diff --git a/GDJS/test-docs/scripts/linenumber.js b/GDJS/test-docs/scripts/linenumber.js new file mode 100644 index 000000000..8d52f7eaf --- /dev/null +++ b/GDJS/test-docs/scripts/linenumber.js @@ -0,0 +1,25 @@ +/*global document */ +(function() { + var source = document.getElementsByClassName('prettyprint source linenums'); + var i = 0; + var lineNumber = 0; + var lineId; + var lines; + var totalLines; + var anchorHash; + + if (source && source[0]) { + anchorHash = document.location.hash.substring(1); + lines = source[0].getElementsByTagName('li'); + totalLines = lines.length; + + for (; i < totalLines; i++) { + lineNumber++; + lineId = 'line' + lineNumber; + lines[i].id = lineId; + if (lineId === anchorHash) { + lines[i].className += ' selected'; + } + } + } +})(); diff --git a/GDJS/test-docs/scripts/prettify/lang-css.js b/GDJS/test-docs/scripts/prettify/lang-css.js new file mode 100644 index 000000000..041e1f590 --- /dev/null +++ b/GDJS/test-docs/scripts/prettify/lang-css.js @@ -0,0 +1,2 @@ +PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", +/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/GDJS/test-docs/scripts/prettify/prettify.js b/GDJS/test-docs/scripts/prettify/prettify.js new file mode 100644 index 000000000..eef5ad7e6 --- /dev/null +++ b/GDJS/test-docs/scripts/prettify/prettify.js @@ -0,0 +1,28 @@ +var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= +[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], +J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), +["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", +/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p