Switch the game engine documentation to TypeDoc (#3593)

* This adds link between types, a more readable rendering, a better search and, more generally, makes the [game engine documentation](https://docs.gdevelop-app.com/GDJS%20Runtime%20Documentation/index.html) much easier to browse.
This commit is contained in:
Florian Rival
2022-02-03 13:58:44 +01:00
committed by GitHub
parent 5d2e0786ee
commit 2c4fa1d1c2
15 changed files with 781 additions and 498 deletions
+1 -2
View File
@@ -211,8 +211,7 @@ namespace gdjs {
};
/**
* Gets an event from {@link events}
* or creates it if it doesn't exist.
* Get an event or creates it if it doesn't exist.
*/
export const getEvent = (name: string) => {
if (!events.hasOwnProperty(name)) events[name] = new Event();
+1 -1
View File
@@ -5,7 +5,7 @@
*/
namespace gdjs {
/**
* Represents a timer, which must be updated manually with {@link gdjs.Timer#updateTime}.
* Represents a timer, which must be updated manually with {@link gdjs.Timer.updateTime}.
*/
export class Timer {
_name: string;
-21
View File
@@ -1,21 +0,0 @@
# GDevelop JavaScript game engine reference
This is the documentation for the JavaScript game engine used in GDevelop.
GDevelop is an **open-source**, cross-platform **game creator** designed *to be used by everyone*. Download it on [gdevelop-app.com](https://gdevelop-app.com/) if you don't have it yet!
## Using JavaScript in your GDevelop game
When you're developing a game with GDevelop, the game is powered by this game engine
and events of the game are using it.
If you want to use JavaScript in your game, insert a [JavaScript event](http://wiki.compilgames.net/doku.php/gdevelop5/events/js-code). Then, you'll be interested in using these classes:
* {@link RuntimeScene} for interacting with the scene.
* {@link RuntimeObject} is the base class for object instances living on the scene.
* {@link RuntimeBehavior} is the base class for behaviors attached to objects.
* {@link Variable}s are stored inside the game, scene and objects in {@link VariablesContainer}.
## Development of the game engine (advanced)
If you want to work on the engine directly, follow the [guide about development of the game engine](https://github.com/4ian/GD/blob/master/newIDE/README.md#development-of-the-game-engine) to get started. Refer to this documentation to know more about the engine.
+1
View File
@@ -8,6 +8,7 @@
```bash
cd <GDevelop repository>/GDJS
npm install
npm run generate-doc
```
-47
View File
@@ -1,47 +0,0 @@
{
"tags": {
"allowUnknownTags": true
},
"source": {
"include": ["./Runtime/", "../Extensions"],
"exclude": [
"./Runtime/Cocos2d/",
"./Runtime/cocos-renderers/",
"./Runtime/cocos-sound-manager/",
"./Runtime/Cordova/",
"./Runtime/Electron/",
"./Runtime/FacebookInstantGames/"
],
"includePattern": "\\.ts$",
"excludePattern": "((^|\\/|\\\\)_|\\cocos-renderer\\.ts$)"
},
"plugins": [
"plugins/markdown",
"../node_modules/jsdoc-plugin-intersection",
"../node_modules/jsdoc-autoprivate",
"../node_modules/better-docs/typescript",
"../node_modules/better-docs/typedef-import",
"../node_modules/jsdoc-typeof-plugin"
],
"templates": {
"referenceTitle": "GDevelop JavaScript reference",
"disableSort": false,
"collapse": false,
"resources": {
"Github -": "https://github.com/4ian/GDevelop",
"GDevelop Documentation": "http://wiki.compilgames.net/doku.php/gdevelop5/start"
}
},
"markdown": {
"parser": "gfm",
"hardwrap": false
},
"opts": {
"encoding": "utf8",
"recurse": true,
"private": false,
"lenient": true,
"template": "../node_modules/jsdoc-fresh",
"destination": "../docs/GDJS Runtime Documentation"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

+26
View File
@@ -0,0 +1,26 @@
![GDevelop logo](media/GDevelop%20banner.png "GDevelop logo")
# GDevelop JavaScript game engine reference
This is the documentation for the TypeScript/JavaScript game engine used in GDevelop.
GDevelop is an **open-source**, cross-platform **game creator** designed *to be used by everyone*. Download it at [gdevelop.io](https://gdevelop.io) to start making games.
## Using JavaScript in your GDevelop game
When you're developing a game with GDevelop, the game is powered by this game engine and events of the game are using it.
If you want to use JavaScript in your game, insert a [JavaScript event](https://wiki.gdevelop.io/gdevelop5/events/js-code).
![GDevelop JavaScript events](media/GDevelop%20JavaScript%20events.png "GDevelop JavaScript events")
Then, you'll be interested in using these classes:
* {@link gdjs.RuntimeScene} for interacting with the scene.
* {@link gdjs.RuntimeObject} is the base class for object instances living on the scene.
* {@link gdjs.RuntimeBehavior} is the base class for behaviors attached to objects.
* {@link gdjs.Variable}s are stored inside the game, scene and objects in {@link gdjs.VariablesContainer}.
## Development of the TypeScript game engine (advanced)
If you want to work on the engine directly, follow the [guide about development of the game engine](https://github.com/4ian/GD/blob/master/newIDE/README.md#development-of-the-game-engine) to get started. Refer to this documentation to know more about the engine.
+22
View File
@@ -0,0 +1,22 @@
{
"tsconfig": "../../tsconfig.json",
"entryPoints": ["../Runtime/gd.ts"],
"entryPointStrategy": "expand",
"externalPattern": [
"Runtime/Cordova/",
"Runtime/Electron/",
"Runtime/FacebookInstantGames/"
],
"excludeExternals": true,
"excludeInternal": true,
"validation": {
"invalidLink": true
},
"out": "../../docs/GDJS Runtime Documentation",
"sort": ["visibility", "alphabetical"],
"name": "GDevelop JavaScript game engine",
"readme": "./typedoc-main-page.md",
"media": "media",
"gaID": "G-4K6TTDG4TT",
"excludedFunctionOrMethod": ["^_"]
}
+705 -418
View File
File diff suppressed because it is too large Load Diff
+5 -6
View File
@@ -12,25 +12,24 @@
"@types/node": "^14.11.1",
"better-docs": "^2.3.2",
"esbuild": "^0.13.12",
"jsdoc": "^3.6.6",
"jsdoc-autoprivate": "0.0.1",
"jsdoc-fresh": "^1.0.5",
"jsdoc-plugin-intersection": "^1.0.2",
"jsdoc-typeof-plugin": "^1.0.0",
"lebab": "^3.1.0",
"minimist": "^1.2.5",
"patch-package": "^6.4.7",
"pixi.js": "^6.1.2",
"prettier": "2.1.2",
"recursive-readdir": "^2.2.2",
"shelljs": "^0.8.4",
"typedoc": "^0.22.11",
"typedoc-plugin-reference-excluder": "^1.0.0",
"typescript": "4.3.2"
},
"scripts": {
"postinstall": "patch-package",
"check-types": "tsc",
"build": "node scripts/build.js",
"test": "cd tests && npm run test-benchmark",
"format": "prettier --write \"Runtime/**/*.ts\" \"../Extensions/**/*.ts\" \"../Extensions/**/*.spec.js\"",
"check-format": "prettier --list-different \"Runtime/**/*.ts\" \"../Extensions/**/*.ts\" \"../Extensions/**/*.spec.js\"",
"generate-doc": "jsdoc -c docs/jsdoc.conf.json docs/DocMainPage.md"
"generate-doc": "typedoc --options docs/typedoc.json"
}
}
@@ -0,0 +1,13 @@
diff --git a/node_modules/typedoc-plugin-reference-excluder/dist/plugin.js b/node_modules/typedoc-plugin-reference-excluder/dist/plugin.js
index e1d5219..3ef8195 100644
--- a/node_modules/typedoc-plugin-reference-excluder/dist/plugin.js
+++ b/node_modules/typedoc-plugin-reference-excluder/dist/plugin.js
@@ -24,7 +24,7 @@ class RegExpExcludePlugin {
}
onDeclaration(context, reflection, node) {
if (this.excludedFunctionOrMethodRegEx) {
- if (reflection.kindOf(typedoc_1.ReflectionKind.FunctionOrMethod) || reflection.kindOf(typedoc_1.ReflectionKind.Accessor)) {
+ if (reflection.kindOf(typedoc_1.ReflectionKind.FunctionOrMethod) || reflection.kindOf(typedoc_1.ReflectionKind.Accessor) || reflection.kindOf(typedoc_1.ReflectionKind.VariableOrProperty)) {
let isMatch = this.excludedFunctionOrMethodRegEx.some(exp => exp.test(reflection.name));
if (isMatch) {
this.excludeReflection(reflection);
@@ -3,6 +3,7 @@
/**
* Create and return a game with a few assets loaded, to be used in tests
* needing real images.
* @internal
* @returns {Promise<gdjs.RuntimeGame>} A promise resolving with the game with loaded assets.
*/
gdjs.getPixiRuntimeGameWithAssets = () => {
@@ -89,5 +90,8 @@ gdjs.getPixiRuntimeGameWithAssets = () => {
return gdjs.getPixiRuntimeGameWithAssets._pixiRuntimeGameWithAssetsPromise;
};
/** @type {?Promise<gdjs.RuntimeGame>} */
/**
* @type {?Promise<gdjs.RuntimeGame>}
* @internal
*/
gdjs.getPixiRuntimeGameWithAssets._pixiRuntimeGameWithAssetsPromise = null;
+1 -1
View File
@@ -37,7 +37,7 @@ Status of the tests and builds: [![macOS and Linux build status](https://circlec
- [GDevelop forums](https://forum.gdevelop-app.com) and [Discord chat](https://discord.gg/gdevelop).
- [GDevelop homepage](https://gdevelop.io)
- [GDevelop wiki (documentation)](http://wiki.compilgames.net/doku.php/gdevelop5/start)
- [GDevelop wiki (documentation)](https://wiki.gdevelop.io/gdevelop5/start)
- Help translate GDevelop in your language: [GDevelop project on Crowdin](https://crowdin.com/project/gdevelop).
### Development Roadmap
+1 -1
View File
@@ -1,6 +1,6 @@
@echo off
rem Script launching the generation of the documentations of all modules
rem Install globally doxgen and jsdoc before starting it.
rem Install globally doxgen before starting it.
echo Generating all docs...
cd ..
cd Core\docs