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,914 lines 72.1 kB
{ "type": "File", "start": 0, "end": 421, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 16, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 421, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 16, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 91, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 91 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 9, "end": 24, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 24 } }, "imported": { "type": "Identifier", "start": 9, "end": 24, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 24 }, "identifierName": "ClickController" }, "name": "ClickController" }, "local": { "type": "Identifier", "start": 9, "end": 24, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 24 }, "identifierName": "ClickController" }, "name": "ClickController" } }, { "type": "ImportSpecifier", "start": 26, "end": 31, "loc": { "start": { "line": 1, "column": 26 }, "end": { "line": 1, "column": 31 } }, "imported": { "type": "Identifier", "start": 26, "end": 31, "loc": { "start": { "line": 1, "column": 26 }, "end": { "line": 1, "column": 31 }, "identifierName": "Point" }, "name": "Point" }, "local": { "type": "Identifier", "start": 26, "end": 31, "loc": { "start": { "line": 1, "column": 26 }, "end": { "line": 1, "column": 31 }, "identifierName": "Point" }, "name": "Point" } }, { "type": "ImportSpecifier", "start": 33, "end": 44, "loc": { "start": { "line": 1, "column": 33 }, "end": { "line": 1, "column": 44 } }, "imported": { "type": "Identifier", "start": 33, "end": 44, "loc": { "start": { "line": 1, "column": 33 }, "end": { "line": 1, "column": 44 }, "identifierName": "SceneObject" }, "name": "SceneObject" }, "local": { "type": "Identifier", "start": 33, "end": 44, "loc": { "start": { "line": 1, "column": 33 }, "end": { "line": 1, "column": 44 }, "identifierName": "SceneObject" }, "name": "SceneObject" } }, { "type": "ImportSpecifier", "start": 46, "end": 58, "loc": { "start": { "line": 1, "column": 46 }, "end": { "line": 1, "column": 58 } }, "imported": { "type": "Identifier", "start": 46, "end": 58, "loc": { "start": { "line": 1, "column": 46 }, "end": { "line": 1, "column": 58 }, "identifierName": "Renderable2D" }, "name": "Renderable2D" }, "local": { "type": "Identifier", "start": 46, "end": 58, "loc": { "start": { "line": 1, "column": 46 }, "end": { "line": 1, "column": 58 }, "identifierName": "Renderable2D" }, "name": "Renderable2D" } }, { "type": "ImportSpecifier", "start": 60, "end": 69, "loc": { "start": { "line": 1, "column": 60 }, "end": { "line": 1, "column": 69 } }, "imported": { "type": "Identifier", "start": 60, "end": 69, "loc": { "start": { "line": 1, "column": 60 }, "end": { "line": 1, "column": 69 }, "identifierName": "UIManager" }, "name": "UIManager" }, "local": { "type": "Identifier", "start": 60, "end": 69, "loc": { "start": { "line": 1, "column": 60 }, "end": { "line": 1, "column": 69 }, "identifierName": "UIManager" }, "name": "UIManager" } } ], "source": { "type": "StringLiteral", "start": 77, "end": 90, "loc": { "start": { "line": 1, "column": 77 }, "end": { "line": 1, "column": 90 } }, "extra": { "rawValue": "../../entry", "raw": "'../../entry'" }, "value": "../../entry" } }, { "type": "ExportDefaultDeclaration", "start": 93, "end": 421, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 16, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 108, "end": 421, "loc": { "start": { "line": 3, "column": 15 }, "end": { "line": 16, "column": 1 } }, "id": { "type": "Identifier", "start": 114, "end": 123, "loc": { "start": { "line": 3, "column": 21 }, "end": { "line": 3, "column": 30 }, "identifierName": "UIElement" }, "name": "UIElement" }, "superClass": { "type": "Identifier", "start": 132, "end": 143, "loc": { "start": { "line": 3, "column": 39 }, "end": { "line": 3, "column": 50 }, "identifierName": "SceneObject" }, "name": "SceneObject" }, "body": { "type": "ClassBody", "start": 144, "end": 421, "loc": { "start": { "line": 3, "column": 51 }, "end": { "line": 16, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 150, "end": 290, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 7, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 150, "end": 161, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 15 }, "identifierName": "constructor" }, "name": "constructor" }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 162, "end": 170, "loc": { "start": { "line": 4, "column": 16 }, "end": { "line": 4, "column": 24 }, "identifierName": "position" }, "name": "position" }, { "type": "Identifier", "start": 172, "end": 177, "loc": { "start": { "line": 4, "column": 26 }, "end": { "line": 4, "column": 31 }, "identifierName": "scale" }, "name": "scale" }, { "type": "Identifier", "start": 179, "end": 187, "loc": { "start": { "line": 4, "column": 33 }, "end": { "line": 4, "column": 41 }, "identifierName": "rotation" }, "name": "rotation" } ], "body": { "type": "BlockStatement", "start": 189, "end": 290, "loc": { "start": { "line": 4, "column": 43 }, "end": { "line": 7, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 199, "end": 232, "loc": { "start": { "line": 5, "column": 8 }, "end": { "line": 5, "column": 41 } }, "expression": { "type": "CallExpression", "start": 199, "end": 231, "loc": { "start": { "line": 5, "column": 8 }, "end": { "line": 5, "column": 40 } }, "callee": { "type": "Super", "start": 199, "end": 204, "loc": { "start": { "line": 5, "column": 8 }, "end": { "line": 5, "column": 13 } } }, "arguments": [ { "type": "Identifier", "start": 205, "end": 213, "loc": { "start": { "line": 5, "column": 14 }, "end": { "line": 5, "column": 22 }, "identifierName": "position" }, "name": "position" }, { "type": "Identifier", "start": 215, "end": 220, "loc": { "start": { "line": 5, "column": 24 }, "end": { "line": 5, "column": 29 }, "identifierName": "scale" }, "name": "scale" }, { "type": "Identifier", "start": 222, "end": 230, "loc": { "start": { "line": 5, "column": 31 }, "end": { "line": 5, "column": 39 }, "identifierName": "rotation" }, "name": "rotation" } ] } }, { "type": "ExpressionStatement", "start": 241, "end": 284, "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 51 } }, "expression": { "type": "AssignmentExpression", "start": 241, "end": 283, "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 50 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 241, "end": 253, "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 20 } }, "object": { "type": "ThisExpression", "start": 241, "end": 245, "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 12 } } }, "property": { "type": "Identifier", "start": 246, "end": 253, "loc": { "start": { "line": 6, "column": 13 }, "end": { "line": 6, "column": 20 }, "identifierName": "uiStyle" }, "name": "uiStyle" }, "computed": false }, "right": { "type": "CallExpression", "start": 256, "end": 283, "loc": { "start": { "line": 6, "column": 23 }, "end": { "line": 6, "column": 50 } }, "callee": { "type": "MemberExpression", "start": 256, "end": 281, "loc": { "start": { "line": 6, "column": 23 }, "end": { "line": 6, "column": 48 } }, "object": { "type": "Identifier", "start": 256, "end": 265, "loc": { "start": { "line": 6, "column": 23 }, "end": { "line": 6, "column": 32 }, "identifierName": "UIManager" }, "name": "UIManager" }, "property": { "type": "Identifier", "start": 266, "end": 281, "loc": { "start": { "line": 6, "column": 33 }, "end": { "line": 6, "column": 48 }, "identifierName": "getCurrentStyle" }, "name": "getCurrentStyle" }, "computed": false }, "arguments": [] } } } ], "directives": [] } }, { "type": "ClassMethod", "start": 296, "end": 381, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 11, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 296, "end": 304, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 12 }, "identifierName": "setStyle" }, "name": "setStyle" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 305, "end": 316, "loc": { "start": { "line": 9, "column": 13 }, "end": { "line": 9, "column": 24 }, "identifierName": "uiStyleName" }, "name": "uiStyleName" } ], "body": { "type": "BlockStatement", "start": 318, "end": 381, "loc": { "start": { "line": 9, "column": 26 }, "end": { "line": 11, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 328, "end": 375, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 55 } }, "expression": { "type": "AssignmentExpression", "start": 328, "end": 374, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 54 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 328, "end": 340, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 20 } }, "object": { "type": "ThisExpression", "start": 328, "end": 332, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 12 } } }, "property": { "type": "Identifier", "start": 333, "end": 340, "loc": { "start": { "line": 10, "column": 13 }, "end": { "line": 10, "column": 20 }, "identifierName": "uiStyle" }, "name": "uiStyle" }, "computed": false }, "right": { "type": "CallExpression", "start": 343, "end": 374, "loc": { "start": { "line": 10, "column": 23 }, "end": { "line": 10, "column": 54 } }, "callee": { "type": "MemberExpression", "start": 343, "end": 361, "loc": { "start": { "line": 10, "column": 23 }, "end": { "line": 10, "column": 41 } }, "object": { "type": "Identifier", "start": 343, "end": 352, "loc": { "start": { "line": 10, "column": 23 }, "end": { "line": 10, "column": 32 }, "identifierName": "UIManager" }, "name": "UIManager" }, "property": { "type": "Identifier", "start": 353, "end": 361, "loc": { "start": { "line": 10, "column": 33 }, "end": { "line": 10, "column": 41 }, "identifierName": "getStyle" }, "name": "getStyle" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 362, "end": 373, "loc": { "start": { "line": 10, "column": 42 }, "end": { "line": 10, "column": 53 }, "identifierName": "uiStyleName" }, "name": "uiStyleName" } ] } } } ], "directives": [] } }, { "type": "ClassMethod", "start": 387, "end": 419, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 15, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 387, "end": 395, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 12 }, "identifierName": "setDepth" }, "name": "setDepth" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 396, "end": 401, "loc": { "start": { "line": 13, "column": 13 }, "end": { "line": 13, "column": 18 }, "identifierName": "depth" }, "name": "depth" } ], "body": { "type": "BlockStatement", "start": 403, "end": 419, "loc": { "start": { "line": 13, "column": 20 }, "end": { "line": 15, "column": 5 } }, "body": [], "directives": [] } } ] }, "leadingComments": [], "trailingComments": [] } } ], "directives": [] }, "comments": [], "tokens": [ { "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": 0, "end": 6, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 6 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 7, "end": 8, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 8 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "ClickController", "start": 9, "end": 24, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 24 } } }, { "type": { "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 24, "end": 25, "loc": { "start": { "line": 1, "column": 24 }, "end": { "line": 1, "column": 25 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "Point", "start": 26, "end": 31, "loc": { "start": { "line": 1, "column": 26 }, "end": { "line": 1, "column": 31 } } }, { "type": { "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 31, "end": 32, "loc": { "start": { "line": 1, "column": 31 }, "end": { "line": 1, "column": 32 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "SceneObject", "start": 33, "end": 44, "loc": { "start": { "line": 1, "column": 33 }, "end": { "line": 1, "column": 44 } } }, { "type": { "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 44, "end": 45, "loc": { "start": { "line": 1, "column": 44 }, "end": { "line": 1, "column": 45 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "Renderable2D", "start": 46, "end": 58, "loc": { "start": { "line": 1, "column": 46 }, "end": { "line": 1, "column": 58 } } }, { "type": { "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 58, "end": 59, "loc": { "start": { "line": 1, "column": 58 }, "end": { "line": 1, "column": 59 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "UIManager", "start": 60, "end": 69, "loc": { "start": { "line": 1, "column": 60 }, "end": { "line": 1, "column": 69 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 70, "end": 71, "loc": { "start": { "line": 1, "column": 70 }, "end": { "line": 1, "column": 71 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "from", "start": 72, "end": 76, "loc": { "start": { "line": 1, "column": 72 }, "end": { "line": 1, "column": 76 } } }, { "type": { "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "../../entry", "start": 77, "end": 90, "loc": { "start": { "line": 1, "column": 77 }, "end": { "line": 1, "column": 90 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 90, "end": 91, "loc": { "start": { "line": 1, "column": 90 }, "end": { "line": 1, "column": 91 } } }, { "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": 93, "end": 99, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 6 } } }, { "type": { "label": "default", "keyword": "default", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "default", "start": 100, "end": 107, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 14 } } }, { "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": 108, "end": 113, "loc": { "start": { "line": 3, "column": 15 }, "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": "UIElement", "start": 114, "end": 123, "loc": { "start": { "line": 3, "column": 21 }, "end": { "line": 3, "column": 30 } } }, { "type": { "label": "extends", "keyword": "extends", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "extends", "start": 124, "end": 131, "loc": { "start": { "line": 3, "column": 31 }, "end": { "line": 3, "column": 38 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "SceneObject", "start": 132, "end": 143, "loc": { "start": { "line": 3, "column": 39 }, "end": { "line": 3, "column": 50 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 144, "end": 145, "loc": { "start": { "line": 3, "column": 51 }, "end": { "line": 3, "column": 52 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "constructor", "start": 150, "end": 161, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 15 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 161, "end": 162, "loc": { "start": { "line": 4, "column": 15 }, "end": { "line": 4, "column": 16 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "position", "start": 162, "end": 170, "loc": { "start": { "line": 4, "column": 16 }, "end": { "line": 4, "column": 24 } } }, { "type": { "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 170, "end": 171, "loc": { "start": { "line": 4, "column": 24 }, "end": { "line": 4, "column": 25 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "scale", "start": 172, "end": 177, "loc": { "start": { "line": 4, "column": 26 }, "end": { "line": 4, "column": 31 } } }, { "type": { "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 177, "end": 178, "loc": { "start": { "line": 4, "column": 31 }, "end": { "line": 4, "column": 32 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "rotation", "start": 179, "end": 187, "loc": { "start": { "line": 4, "column": 33 }, "end": { "line": 4, "column": 41 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 187, "end": 188, "loc": { "start": { "line": 4, "column": 41 }, "end": { "line": 4, "column": 42 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 189, "end": 190, "loc": { "start": { "line": 4, "column": 43 }, "end": { "line": 4, "column": 44 } } }, { "type": { "label": "super", "keyword": "super", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "super", "start": 199, "end": 204, "loc": { "start": { "line": 5, "column": 8 }, "end": { "line": 5, "column": 13 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": fals