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,462 lines (1,461 loc) 1.11 MB
{ "type": "File", "start": 0, "end": 7626, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 193, "column": 30 } }, "program": { "type": "Program", "start": 0, "end": 7626, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 193, "column": 30 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 32, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 32 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 14, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 14 } }, "local": { "type": "Identifier", "start": 7, "end": 14, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 14 }, "identifierName": "Manager" }, "name": "Manager" } } ], "source": { "type": "StringLiteral", "start": 20, "end": 31, "loc": { "start": { "line": 1, "column": 20 }, "end": { "line": 1, "column": 31 } }, "extra": { "rawValue": "./Manager", "raw": "'./Manager'" }, "value": "./Manager" } }, { "type": "ImportDeclaration", "start": 33, "end": 71, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 38 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 40, "end": 50, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 17 } }, "local": { "type": "Identifier", "start": 40, "end": 50, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 17 }, "identifierName": "DOMManager" }, "name": "DOMManager" } } ], "source": { "type": "StringLiteral", "start": 56, "end": 70, "loc": { "start": { "line": 2, "column": 23 }, "end": { "line": 2, "column": 37 } }, "extra": { "rawValue": "./DOMManager", "raw": "'./DOMManager'" }, "value": "./DOMManager" } }, { "type": "ImportDeclaration", "start": 72, "end": 114, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 42 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 79, "end": 91, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 19 } }, "local": { "type": "Identifier", "start": 79, "end": 91, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 19 }, "identifierName": "AudioManager" }, "name": "AudioManager" } } ], "source": { "type": "StringLiteral", "start": 97, "end": 113, "loc": { "start": { "line": 3, "column": 25 }, "end": { "line": 3, "column": 41 } }, "extra": { "rawValue": "./AudioManager", "raw": "'./AudioManager'" }, "value": "./AudioManager" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Manages textures in the engine so the RendererManager and Renderables\n * can reference one location for Textures. Essentially a texture library.\n ", "start": 117, "end": 272, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 9, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "start": 273, "end": 7487, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 187, "column": 1 } }, "specifiers": [], "source": null, "declaration": { "type": "ClassDeclaration", "start": 280, "end": 7487, "loc": { "start": { "line": 10, "column": 7 }, "end": { "line": 187, "column": 1 } }, "id": { "type": "Identifier", "start": 286, "end": 301, "loc": { "start": { "line": 10, "column": 13 }, "end": { "line": 10, "column": 28 }, "identifierName": "_TextureManager" }, "name": "_TextureManager", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 310, "end": 317, "loc": { "start": { "line": 10, "column": 37 }, "end": { "line": 10, "column": 44 }, "identifierName": "Manager" }, "name": "Manager" }, "body": { "type": "ClassBody", "start": 318, "end": 7487, "loc": { "start": { "line": 10, "column": 45 }, "end": { "line": 187, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 324, "end": 420, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 15, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 324, "end": 335, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 15 }, "identifierName": "constructor" }, "name": "constructor" }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 338, "end": 420, "loc": { "start": { "line": 11, "column": 18 }, "end": { "line": 15, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 348, "end": 356, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 16 } }, "expression": { "type": "CallExpression", "start": 348, "end": 355, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 15 } }, "callee": { "type": "Super", "start": 348, "end": 353, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 13 } } }, "arguments": [] } }, { "type": "ExpressionStatement", "start": 365, "end": 384, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 27 } }, "expression": { "type": "AssignmentExpression", "start": 365, "end": 383, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 26 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 365, "end": 378, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 21 } }, "object": { "type": "ThisExpression", "start": 365, "end": 369, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 12 } } }, "property": { "type": "Identifier", "start": 370, "end": 378, "loc": { "start": { "line": 13, "column": 13 }, "end": { "line": 13, "column": 21 }, "identifierName": "textures" }, "name": "textures" }, "computed": false }, "right": { "type": "ObjectExpression", "start": 381, "end": 383, "loc": { "start": { "line": 13, "column": 24 }, "end": { "line": 13, "column": 26 } }, "properties": [] } } }, { "type": "ExpressionStatement", "start": 393, "end": 414, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 29 } }, "expression": { "type": "AssignmentExpression", "start": 393, "end": 413, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 28 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 393, "end": 408, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 23 } }, "object": { "type": "ThisExpression", "start": 393, "end": 397, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 12 } } }, "property": { "type": "Identifier", "start": 398, "end": 408, "loc": { "start": { "line": 14, "column": 13 }, "end": { "line": 14, "column": 23 }, "identifierName": "textureIDs" }, "name": "textureIDs" }, "computed": false }, "right": { "type": "ArrayExpression", "start": 411, "end": 413, "loc": { "start": { "line": 14, "column": 26 }, "end": { "line": 14, "column": 28 } }, "elements": [] } } } ], "directives": [], "trailingComments": null }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Returns a texture JSON Object containing the texture, texture data, name and id.\n * \n * @param {number} texID Name of the texture.\n * \n * @returns {Texture Object} Returns a JSON object with Texture data.\n ", "start": 426, "end": 665, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 23, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 670, "end": 799, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 28, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 670, "end": 680, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 24, "column": 14 }, "identifierName": "getTexture" }, "name": "getTexture", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 681, "end": 686, "loc": { "start": { "line": 24, "column": 15 }, "end": { "line": 24, "column": 20 }, "identifierName": "texID" }, "name": "texID" } ], "body": { "type": "BlockStatement", "start": 688, "end": 799, "loc": { "start": { "line": 24, "column": 22 }, "end": { "line": 28, "column": 5 } }, "body": [ { "type": "IfStatement", "start": 698, "end": 756, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 26, "column": 24 } }, "test": { "type": "BinaryExpression", "start": 702, "end": 730, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 40 } }, "left": { "type": "MemberExpression", "start": 702, "end": 722, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 32 } }, "object": { "type": "MemberExpression", "start": 702, "end": 715, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 25 } }, "object": { "type": "ThisExpression", "start": 702, "end": 706, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 16 } } }, "property": { "type": "Identifier", "start": 707, "end": 715, "loc": { "start": { "line": 25, "column": 17 }, "end": { "line": 25, "column": 25 }, "identifierName": "textures" }, "name": "textures" }, "computed": false }, "property": { "type": "Identifier", "start": 716, "end": 721, "loc": { "start": { "line": 25, "column": 26 }, "end": { "line": 25, "column": 31 }, "identifierName": "texID" }, "name": "texID" }, "computed": true }, "operator": "==", "right": { "type": "NullLiteral", "start": 726, "end": 730, "loc": { "start": { "line": 25, "column": 36 }, "end": { "line": 25, "column": 40 } } } }, "consequent": { "type": "ReturnStatement", "start": 744, "end": 756, "loc": { "start": { "line": 26, "column": 12 }, "end": { "line": 26, "column": 24 } }, "argument": { "type": "NullLiteral", "start": 751, "end": 755, "loc": { "start": { "line": 26, "column": 19 }, "end": { "line": 26, "column": 23 } } } }, "alternate": null }, { "type": "ReturnStatement", "start": 765, "end": 793, "loc": { "start": { "line": 27, "column": 8 }, "end": { "line": 27, "column": 36 } }, "argument": { "type": "MemberExpression", "start": 772, "end": 792, "loc": { "start": { "line": 27, "column": 15 }, "end": { "line": 27, "column": 35 } }, "object": { "type": "MemberExpression", "start": 772, "end": 785, "loc": { "start": { "line": 27, "column": 15 }, "end": { "line": 27, "column": 28 } }, "object": { "type": "ThisExpression", "start": 772, "end": 776, "loc": { "start": { "line": 27, "column": 15 }, "end": { "line": 27, "column": 19 } } }, "property": { "type": "Identifier", "start": 777, "end": 785, "loc": { "start": { "line": 27, "column": 20 }, "end": { "line": 27, "column": 28 }, "identifierName": "textures" }, "name": "textures" }, "computed": false }, "property": { "type": "Identifier", "start": 786, "end": 791, "loc": { "start": { "line": 27, "column": 29 }, "end": { "line": 27, "column": 34 }, "identifierName": "texID" }, "name": "texID" }, "computed": true } } ], "directives": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Returns a texture JSON Object containing the texture, texture data, name and id.\n * \n * @param {number} texID Name of the texture.\n * \n * @returns {Texture Object} Returns a JSON object with Texture data.\n ", "start": 426, "end": 665, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 23, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 805, "end": 1095, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 38, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 805, "end": 827, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 26 }, "identifierName": "_setAvailableTextureID" }, "name": "_setAvailableTextureID" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 830, "end": 1095, "loc": { "start": { "line": 30, "column": 29 }, "end": { "line": 38, "column": 5 } }, "body": [ { "type": "ForStatement", "start": 840, "end": 1010, "loc": { "start": { "line": 31, "column": 8 }, "end": { "line": 35, "column": 13 } }, "init": { "type": "VariableDeclaration", "start": 845, "end": 854, "loc": { "start": { "line": 31, "column": 13 }, "end": { "line": 31, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", "start": 849, "end": 854, "loc": { "start": { "line": 31, "column": 17 }, "end": { "line": 31, "column": 22 } }, "id": { "type": "Identifier", "start": 849, "end": 850, "loc": { "start": { "line": 31, "column": 17 }, "end": { "line": 31, "column": 18 }, "identifierName": "i" }, "name": "i" }, "init": { "type": "NumericLiteral", "start": 853, "end": 854, "loc": { "start": { "line": 31, "column": 21 }, "end": { "line": 31, "column": 22 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } } ], "kind": "let" }, "test": { "type": "BinaryExpression", "start": 856, "end": 882, "loc": { "start": { "line": 31, "column": 24 }, "end": { "line": 31, "column": 50 } }, "left": { "type": "Identifier", "start": 856, "end": 857, "loc": { "start": { "line": 31, "column": 24 }, "end": { "line": 31, "column": 25 }, "identifierName": "i" }, "name": "i" }, "operator": "<", "right": { "type": "MemberExpression", "start": 860, "end": 882, "loc": { "start": { "line": 31, "column": 28 }, "end": { "line": 31, "column": 50 } }, "object": { "type": "MemberExpression", "start": 860, "end": 875, "loc": { "start": { "line": 31, "column": 28 }, "end": { "line": 31, "column": 43 } }, "object": { "type": "ThisExpression", "start": 860, "end": 864, "loc": { "start": { "line": 31, "column": 28 }, "end": { "line": 31, "column": 32 } } }, "property": { "type": "Identifier", "start": 865, "end": 875, "loc": { "start": { "line": 31, "column": 33 }, "end": { "line": 31, "column": 43 }, "identifierName": "textureIDs" }, "name": "textureIDs" }, "computed": false }, "property": { "type": "Identifier", "start": 876, "end": 882, "loc": { "start": { "line": 31, "column": 44 }, "end": { "line": 31, "column": 50 }, "identifierName": "length" }, "name": "length" }, "computed": false } }, "update": { "type": "UpdateExpression", "start": 884, "end": 887, "loc": { "start": { "line": 31, "column": 52 }, "end": { "line": 31, "column": 55 } }, "operator": "++", "prefix": false, "argument": { "type": "Identifier", "start": 884, "end": 885, "loc": { "start": { "line": 31, "column": 52 }, "end": { "line": 31, "column": 53 }, "identifierName": "i" }, "name": "i" } }, "body": { "type": "IfStatement", "start": 901, "end": 1010, "loc": { "start": { "line": 32, "column": 12 }, "end": { "line": 35, "column": 13 } }, "test": { "type": "UnaryExpression", "start": 905, "end": 924, "loc": { "start": { "line": 32, "column": 16 }, "end": { "line": 32, "column": 35 } }, "operator": "!", "prefix": true, "argument": { "type": "MemberExpression", "start": 906, "end": 924, "loc": { "start": { "line": 32, "column": 17 }, "end": { "line": 32, "column": 35 } }, "object": { "type": "MemberExpression", "start": 906, "end": 921, "loc": { "start": { "line": 32, "column": 17 }, "end": { "line": 32, "column": 32 } }, "object": { "type": "ThisExpression", "start": 906, "end": 910, "loc": { "start": { "line": 32, "column": 17 }, "end": { "line": 32, "column": 21 } } }, "property": { "type": "Identifier", "start": 911, "end": 921, "loc": { "start": { "line": 32, "column": 22 }, "end": { "line": 32, "column": 32 }, "identifierName": "textureIDs" }, "name": "textureIDs" }, "computed": false }, "property": { "type": "Identifier", "start": 922, "end": 923, "loc": { "start": { "line": 32, "column": 33 }, "end": { "line": 32, "column": 34 }, "identifierName": "i" }, "name": "i" }, "computed": true }, "extra": { "parenthesizedArgument": false } }, "consequent": { "type": "BlockStatement", "start": 926, "end": 1010, "loc": { "start": { "line": 32, "column": 37 }, "end": { "line": 35, "column": 13 } }, "body": [ { "type": "ExpressionStatement", "start": 944, "end": 970, "loc": { "start": { "line": 33, "column": 16 }, "end": { "line": 33, "column": 42 } }, "expression": { "type": "AssignmentExpression", "start": 944, "end": 969, "loc": { "start": { "line": 33, "column": 16 }, "end": { "line": 33, "column": 41 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 944, "end": 962, "loc": { "start": { "line": 33, "column": 16 }, "end": { "line": 33, "column": 34 } }, "object": { "type": "MemberExpression", "start": 944, "end": 959, "loc": {