UNPKG

seed-engine

Version:

A Lightweight 2D game engine using WebGL2. The engine is designed on the focus of creating a bridge between creating and publishing games to the Seed Network as modules.

1,862 lines 83.9 kB
{ "type": "File", "start": 0, "end": 822, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 50, "column": 22 } }, "program": { "type": "Program", "start": 0, "end": 822, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 50, "column": 22 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 15, "end": 67, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 52 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 22, "end": 35, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 20 } }, "local": { "type": "Identifier", "start": 22, "end": 35, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 20 }, "identifierName": "EngineManager" }, "name": "EngineManager" } } ], "source": { "type": "StringLiteral", "start": 41, "end": 66, "loc": { "start": { "line": 3, "column": 26 }, "end": { "line": 3, "column": 51 } }, "extra": { "rawValue": "./manager/EngineManager", "raw": "'./manager/EngineManager'" }, "value": "./manager/EngineManager" } }, { "type": "ImportDeclaration", "start": 68, "end": 108, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 40 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 75, "end": 82, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 14 } }, "local": { "type": "Identifier", "start": 75, "end": 82, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 14 }, "identifierName": "Manager" }, "name": "Manager" } } ], "source": { "type": "StringLiteral", "start": 88, "end": 107, "loc": { "start": { "line": 4, "column": 20 }, "end": { "line": 4, "column": 39 } }, "extra": { "rawValue": "./manager/Manager", "raw": "'./manager/Manager'" }, "value": "./manager/Manager" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Engine Singleton class. Entry point reference to access managers and\n * to start and stop the Engine.\n ", "start": 110, "end": 222, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 9, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "start": 223, "end": 722, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 44, "column": 1 } }, "specifiers": [], "source": null, "declaration": { "type": "ClassDeclaration", "start": 230, "end": 722, "loc": { "start": { "line": 10, "column": 7 }, "end": { "line": 44, "column": 1 } }, "id": { "type": "Identifier", "start": 236, "end": 243, "loc": { "start": { "line": 10, "column": 13 }, "end": { "line": 10, "column": 20 }, "identifierName": "_Engine" }, "name": "_Engine", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 244, "end": 722, "loc": { "start": { "line": 10, "column": 21 }, "end": { "line": 44, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 294, "end": 315, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 15, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 294, "end": 305, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 15 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 308, "end": 315, "loc": { "start": { "line": 14, "column": 18 }, "end": { "line": 15, "column": 5 } }, "body": [], "directives": [], "leadingComments": null, "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Engine Contstructor.\n ", "start": 250, "end": 289, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 13, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Starts the engine.\n ", "start": 321, "end": 358, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 19, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 363, "end": 409, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 22, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 363, "end": 368, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 20, "column": 9 }, "identifierName": "start" }, "name": "start", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 371, "end": 409, "loc": { "start": { "line": 20, "column": 12 }, "end": { "line": 22, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 381, "end": 403, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 21, "column": 30 } }, "expression": { "type": "CallExpression", "start": 381, "end": 402, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 21, "column": 29 } }, "callee": { "type": "MemberExpression", "start": 381, "end": 400, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 21, "column": 27 } }, "object": { "type": "Identifier", "start": 381, "end": 394, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 21, "column": 21 }, "identifierName": "EngineManager" }, "name": "EngineManager" }, "property": { "type": "Identifier", "start": 395, "end": 400, "loc": { "start": { "line": 21, "column": 22 }, "end": { "line": 21, "column": 27 }, "identifierName": "start" }, "name": "start" }, "computed": false }, "arguments": [] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Starts the engine.\n ", "start": 321, "end": 358, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 19, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Stops the engine and cleans up code.\n ", "start": 415, "end": 470, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 26, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 475, "end": 517, "loc": { "start": { "line": 27, "column": 4 }, "end": { "line": 29, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 475, "end": 478, "loc": { "start": { "line": 27, "column": 4 }, "end": { "line": 27, "column": 7 }, "identifierName": "end" }, "name": "end", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 481, "end": 517, "loc": { "start": { "line": 27, "column": 10 }, "end": { "line": 29, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 491, "end": 511, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 28, "column": 28 } }, "expression": { "type": "CallExpression", "start": 491, "end": 510, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 28, "column": 27 } }, "callee": { "type": "MemberExpression", "start": 491, "end": 508, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 28, "column": 25 } }, "object": { "type": "Identifier", "start": 491, "end": 504, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 28, "column": 21 }, "identifierName": "EngineManager" }, "name": "EngineManager" }, "property": { "type": "Identifier", "start": 505, "end": 508, "loc": { "start": { "line": 28, "column": 22 }, "end": { "line": 28, "column": 25 }, "identifierName": "end" }, "name": "end" }, "computed": false }, "arguments": [] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Stops the engine and cleans up code.\n ", "start": 415, "end": 470, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 26, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Pauses the entire engine.\n ", "start": 523, "end": 567, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 33, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 572, "end": 618, "loc": { "start": { "line": 34, "column": 4 }, "end": { "line": 36, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 572, "end": 577, "loc": { "start": { "line": 34, "column": 4 }, "end": { "line": 34, "column": 9 }, "identifierName": "pause" }, "name": "pause", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 580, "end": 618, "loc": { "start": { "line": 34, "column": 12 }, "end": { "line": 36, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 590, "end": 612, "loc": { "start": { "line": 35, "column": 8 }, "end": { "line": 35, "column": 30 } }, "expression": { "type": "CallExpression", "start": 590, "end": 611, "loc": { "start": { "line": 35, "column": 8 }, "end": { "line": 35, "column": 29 } }, "callee": { "type": "MemberExpression", "start": 590, "end": 609, "loc": { "start": { "line": 35, "column": 8 }, "end": { "line": 35, "column": 27 } }, "object": { "type": "Identifier", "start": 590, "end": 603, "loc": { "start": { "line": 35, "column": 8 }, "end": { "line": 35, "column": 21 }, "identifierName": "EngineManager" }, "name": "EngineManager" }, "property": { "type": "Identifier", "start": 604, "end": 609, "loc": { "start": { "line": 35, "column": 22 }, "end": { "line": 35, "column": 27 }, "identifierName": "pause" }, "name": "pause" }, "computed": false }, "arguments": [] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Pauses the entire engine.\n ", "start": 523, "end": 567, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 33, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Resumes to the Engine.\n ", "start": 624, "end": 665, "loc": { "start": { "line": 38, "column": 4 }, "end": { "line": 40, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 670, "end": 720, "loc": { "start": { "line": 41, "column": 4 }, "end": { "line": 43, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 670, "end": 677, "loc": { "start": { "line": 41, "column": 4 }, "end": { "line": 41, "column": 11 }, "identifierName": "unpause" }, "name": "unpause", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 680, "end": 720, "loc": { "start": { "line": 41, "column": 14 }, "end": { "line": 43, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 690, "end": 714, "loc": { "start": { "line": 42, "column": 8 }, "end": { "line": 42, "column": 32 } }, "expression": { "type": "CallExpression", "start": 690, "end": 713, "loc": { "start": { "line": 42, "column": 8 }, "end": { "line": 42, "column": 31 } }, "callee": { "type": "MemberExpression", "start": 690, "end": 711, "loc": { "start": { "line": 42, "column": 8 }, "end": { "line": 42, "column": 29 } }, "object": { "type": "Identifier", "start": 690, "end": 703, "loc": { "start": { "line": 42, "column": 8 }, "end": { "line": 42, "column": 21 }, "identifierName": "EngineManager" }, "name": "EngineManager" }, "property": { "type": "Identifier", "start": 704, "end": 711, "loc": { "start": { "line": 42, "column": 22 }, "end": { "line": 42, "column": 29 }, "identifierName": "unpause" }, "name": "unpause" }, "computed": false }, "arguments": [] } } ], "directives": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Resumes to the Engine.\n ", "start": 624, "end": 665, "loc": { "start": { "line": 38, "column": 4 }, "end": { "line": 40, "column": 7 } } } ] } ], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Engine Singleton class. Entry point reference to access managers and\n * to start and stop the Engine.\n ", "start": 110, "end": 222, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 9, "column": 3 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Singleton reference to the Engine.\n ", "start": 724, "end": 769, "loc": { "start": { "line": 46, "column": 0 }, "end": { "line": 48, "column": 3 } } } ] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Engine Singleton class. Entry point reference to access managers and\n * to start and stop the Engine.\n ", "start": 110, "end": 222, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 9, "column": 3 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Singleton reference to the Engine.\n ", "start": 724, "end": 769, "loc": { "start": { "line": 46, "column": 0 }, "end": { "line": 48, "column": 3 } } } ] }, { "type": "Identifier", "start": 770, "end": 799, "loc": { "start": { "line": 49, "column": 0 }, "end": { "line": 49, "column": 29 } }, "declarations": [ { "type": "VariableDeclarator", "start": 776, "end": 798, "loc": { "start": { "line": 49, "column": 6 }, "end": { "line": 49, "column": 28 } }, "id": { "type": "Identifier", "start": 776, "end": 782, "loc": { "start": { "line": 49, "column": 6 }, "end": { "line": 49, "column": 12 }, "identifierName": "Engine" }, "name": "Engine", "leadingComments": null }, "init": { "type": "NewExpression", "start": 785, "end": 798, "loc": { "start": { "line": 49, "column": 15 }, "end": { "line": 49, "column": 28 } }, "callee": { "type": "Identifier", "start": 789, "end": 796, "loc": { "start": { "line": 49, "column": 19 }, "end": { "line": 49, "column": 26 }, "identifierName": "_Engine" }, "name": "_Engine" }, "arguments": [] }, "leadingComments": null } ], "kind": "const", "leadingComments": [], "name": "_", "trailingComments": [] }, { "type": "Identifier", "start": 800, "end": 822, "loc": { "start": { "line": 50, "column": 0 }, "end": { "line": 50, "column": 22 } }, "declaration": { "type": "Identifier", "start": 815, "end": 821, "loc": { "start": { "line": 50, "column": 15 }, "end": { "line": 50, "column": 21 }, "identifierName": "Engine" }, "name": "Engine" }, "name": "_", "leadingComments": [], "trailingComments": [] }, { "type": "ExportDefaultDeclaration", "start": 800, "end": 822, "loc": { "start": { "line": 50, "column": 0 }, "end": { "line": 50, "column": 22 } }, "declaration": { "type": "VariableDeclaration", "kind": "let", "loc": { "start": { "line": 50, "column": 0 }, "end": { "line": 50, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "Engine" }, "init": { "type": "NewExpression", "callee": { "type": "Identifier", "name": "_Engine" } } } ], "leadingComments": [], "trailingComments": [] } } ], "directives": [ { "type": "Directive", "start": 0, "end": 13, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 13 } }, "value": { "type": "DirectiveLiteral", "start": 0, "end": 12, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 12 } }, "value": "use-strict", "extra": { "raw": "'use-strict'", "rawValue": "use-strict" } } } ] }, "comments": [ { "type": "CommentBlock", "value": "*\n * Engine Singleton class. Entry point reference to access managers and\n * to start and stop the Engine.\n ", "start": 110, "end": 222, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 9, "column": 3 } } }, { "type": "CommentBlock", "value": "*\n * Engine Contstructor.\n ", "start": 250, "end": 289, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 13, "column": 7 } } }, { "type": "CommentBlock", "value": "*\n * Starts the engine.\n ", "start": 321, "end": 358, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 19, "column": 7 } } }, { "type": "CommentBlock", "value": "*\n * Stops the engine and cleans up code.\n ", "start": 415, "end": 470, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 26, "column": 7 } } }, { "type": "CommentBlock", "value": "*\n * Pauses the entire engine.\n ", "start": 523, "end": 567, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 33, "column": 7 } } }, { "type": "CommentBlock", "value": "*\n * Resumes to the Engine.\n ", "start": 624, "end": 665, "loc": { "start": { "line": 38, "column": 4 }, "end": { "line": 40, "column": 7 } } }, { "type": "CommentBlock", "value": "*\n * Singleton reference to the Engine.\n ", "start": 724, "end": 769, "loc": { "start": { "line": 46, "column": 0 }, "end": { "line": 48, "column": 3 } } } ], "tokens": [ { "type": { "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "use-strict", "start": 0, "end": 12, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 12 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 12, "end": 13, "loc": { "start": { "line": 1, "column": 12 }, "end": { "line": 1, "column": 13 } } }, { "type": { "label": "import", "keyword": "import", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "import", "start": 15, "end": 21, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 6 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "EngineManager", "start": 22, "end": 35, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 20 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "from", "start": 36, "end": 40, "loc": { "start": { "line": 3, "column": 21 }, "end": { "line": 3, "column": 25 } } }, { "type": { "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "./manager/EngineManager", "start": 41, "end": 66, "loc": { "start": { "line": 3, "column": 26 }, "end": { "line": 3, "column": 51 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 66, "end": 67, "loc": { "start": { "line": 3, "column": 51 }, "end": { "line": 3, "column": 52 } } }, { "type": { "label": "import", "keyword": "import", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "import", "start": 68, "end": 74, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 6 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "Manager", "start": 75, "end": 82, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 14 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "from", "start": 83, "end": 87, "loc": { "start": { "line": 4, "column": 15 }, "end": { "line": 4, "column": 19 } } }, { "type": { "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "./manager/Manager", "start": 88, "end": 107, "loc": { "start": { "line": 4, "column": 20 }, "end": { "line": 4, "column": 39 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 107, "end": 108, "loc": { "start": { "line": 4, "column": 39 }, "end": { "line": 4, "column": 40 } } }, { "type": "CommentBlock", "value": "*\n * Engine Singleton class. Entry point reference to access managers and\n * to start and stop the Engine.\n ", "start": 110, "end": 222, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 9, "column": 3 } } }, { "type": { "label": "export", "keyword": "export", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "export", "start": 223, "end": 229, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 10, "column": 6 } } }, { "type": { "label": "class", "keyword": "class", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "class", "start": 230, "end": 235, "loc": { "start": { "line": 10, "column": 7 }, "end": { "line": 10, "column": 12 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "_Engine", "start": 236, "end": 243, "loc": { "start": { "line": 10, "column": 13 }, "end": { "line": 10, "column": 20 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": fa