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,473 lines (1,472 loc) 447 kB
{ "type": "File", "start": 0, "end": 1912, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 65, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 1912, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 65, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 118, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 118 } }, "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" } }, { "type": "ImportSpecifier", "start": 71, "end": 80, "loc": { "start": { "line": 1, "column": 71 }, "end": { "line": 1, "column": 80 } }, "imported": { "type": "Identifier", "start": 71, "end": 80, "loc": { "start": { "line": 1, "column": 71 }, "end": { "line": 1, "column": 80 }, "identifierName": "UIElement" }, "name": "UIElement" }, "local": { "type": "Identifier", "start": 71, "end": 80, "loc": { "start": { "line": 1, "column": 71 }, "end": { "line": 1, "column": 80 }, "identifierName": "UIElement" }, "name": "UIElement" } }, { "type": "ImportSpecifier", "start": 82, "end": 96, "loc": { "start": { "line": 1, "column": 82 }, "end": { "line": 1, "column": 96 } }, "imported": { "type": "Identifier", "start": 82, "end": 96, "loc": { "start": { "line": 1, "column": 82 }, "end": { "line": 1, "column": 96 }, "identifierName": "RenderableText" }, "name": "RenderableText" }, "local": { "type": "Identifier", "start": 82, "end": 96, "loc": { "start": { "line": 1, "column": 82 }, "end": { "line": 1, "column": 96 }, "identifierName": "RenderableText" }, "name": "RenderableText" } } ], "source": { "type": "StringLiteral", "start": 104, "end": 117, "loc": { "start": { "line": 1, "column": 104 }, "end": { "line": 1, "column": 117 } }, "extra": { "rawValue": "../../entry", "raw": "'../../entry'" }, "value": "../../entry" } }, { "type": "ExportDefaultDeclaration", "start": 120, "end": 1912, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 65, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 135, "end": 1912, "loc": { "start": { "line": 3, "column": 15 }, "end": { "line": 65, "column": 1 } }, "id": { "type": "Identifier", "start": 141, "end": 147, "loc": { "start": { "line": 3, "column": 21 }, "end": { "line": 3, "column": 27 }, "identifierName": "UIText" }, "name": "UIText" }, "superClass": { "type": "Identifier", "start": 156, "end": 165, "loc": { "start": { "line": 3, "column": 36 }, "end": { "line": 3, "column": 45 }, "identifierName": "UIElement" }, "name": "UIElement" }, "body": { "type": "ClassBody", "start": 166, "end": 1912, "loc": { "start": { "line": 3, "column": 46 }, "end": { "line": 65, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 172, "end": 773, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 16, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 172, "end": 183, "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": 184, "end": 192, "loc": { "start": { "line": 4, "column": 16 }, "end": { "line": 4, "column": 24 }, "identifierName": "viewport" }, "name": "viewport" }, { "type": "Identifier", "start": 194, "end": 195, "loc": { "start": { "line": 4, "column": 26 }, "end": { "line": 4, "column": 27 }, "identifierName": "x" }, "name": "x" }, { "type": "Identifier", "start": 197, "end": 198, "loc": { "start": { "line": 4, "column": 29 }, "end": { "line": 4, "column": 30 }, "identifierName": "y" }, "name": "y" }, { "type": "Identifier", "start": 200, "end": 201, "loc": { "start": { "line": 4, "column": 32 }, "end": { "line": 4, "column": 33 }, "identifierName": "w" }, "name": "w" }, { "type": "Identifier", "start": 203, "end": 204, "loc": { "start": { "line": 4, "column": 35 }, "end": { "line": 4, "column": 36 }, "identifierName": "h" }, "name": "h" }, { "type": "Identifier", "start": 206, "end": 210, "loc": { "start": { "line": 4, "column": 38 }, "end": { "line": 4, "column": 42 }, "identifierName": "text" }, "name": "text" } ], "body": { "type": "BlockStatement", "start": 212, "end": 773, "loc": { "start": { "line": 4, "column": 44 }, "end": { "line": 16, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 222, "end": 271, "loc": { "start": { "line": 5, "column": 8 }, "end": { "line": 5, "column": 57 } }, "expression": { "type": "CallExpression", "start": 222, "end": 270, "loc": { "start": { "line": 5, "column": 8 }, "end": { "line": 5, "column": 56 } }, "callee": { "type": "Super", "start": 222, "end": 227, "loc": { "start": { "line": 5, "column": 8 }, "end": { "line": 5, "column": 13 } } }, "arguments": [ { "type": "NewExpression", "start": 228, "end": 246, "loc": { "start": { "line": 5, "column": 14 }, "end": { "line": 5, "column": 32 } }, "callee": { "type": "Identifier", "start": 232, "end": 237, "loc": { "start": { "line": 5, "column": 18 }, "end": { "line": 5, "column": 23 }, "identifierName": "Point" }, "name": "Point" }, "arguments": [ { "type": "Identifier", "start": 238, "end": 239, "loc": { "start": { "line": 5, "column": 24 }, "end": { "line": 5, "column": 25 }, "identifierName": "x" }, "name": "x" }, { "type": "Identifier", "start": 241, "end": 242, "loc": { "start": { "line": 5, "column": 27 }, "end": { "line": 5, "column": 28 }, "identifierName": "y" }, "name": "y" }, { "type": "NumericLiteral", "start": 244, "end": 245, "loc": { "start": { "line": 5, "column": 30 }, "end": { "line": 5, "column": 31 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } ] }, { "type": "NewExpression", "start": 248, "end": 266, "loc": { "start": { "line": 5, "column": 34 }, "end": { "line": 5, "column": 52 } }, "callee": { "type": "Identifier", "start": 252, "end": 257, "loc": { "start": { "line": 5, "column": 38 }, "end": { "line": 5, "column": 43 }, "identifierName": "Point" }, "name": "Point" }, "arguments": [ { "type": "Identifier", "start": 258, "end": 259, "loc": { "start": { "line": 5, "column": 44 }, "end": { "line": 5, "column": 45 }, "identifierName": "w" }, "name": "w" }, { "type": "Identifier", "start": 261, "end": 262, "loc": { "start": { "line": 5, "column": 47 }, "end": { "line": 5, "column": 48 }, "identifierName": "h" }, "name": "h" }, { "type": "NumericLiteral", "start": 264, "end": 265, "loc": { "start": { "line": 5, "column": 50 }, "end": { "line": 5, "column": 51 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } ] }, { "type": "NumericLiteral", "start": 268, "end": 269, "loc": { "start": { "line": 5, "column": 54 }, "end": { "line": 5, "column": 55 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } ] } }, { "type": "ExpressionStatement", "start": 281, "end": 298, "loc": { "start": { "line": 7, "column": 8 }, "end": { "line": 7, "column": 25 } }, "expression": { "type": "AssignmentExpression", "start": 281, "end": 297, "loc": { "start": { "line": 7, "column": 8 }, "end": { "line": 7, "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 281, "end": 290, "loc": { "start": { "line": 7, "column": 8 }, "end": { "line": 7, "column": 17 } }, "object": { "type": "ThisExpression", "start": 281, "end": 285, "loc": { "start": { "line": 7, "column": 8 }, "end": { "line": 7, "column": 12 } } }, "property": { "type": "Identifier", "start": 286, "end": 290, "loc": { "start": { "line": 7, "column": 13 }, "end": { "line": 7, "column": 17 }, "identifierName": "text" }, "name": "text" }, "computed": false }, "right": { "type": "Identifier", "start": 293, "end": 297, "loc": { "start": { "line": 7, "column": 20 }, "end": { "line": 7, "column": 24 }, "identifierName": "text" }, "name": "text" } } }, { "type": "ExpressionStatement", "start": 307, "end": 333, "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 34 } }, "expression": { "type": "AssignmentExpression", "start": 307, "end": 332, "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 33 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 307, "end": 328, "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 29 } }, "object": { "type": "ThisExpression", "start": 307, "end": 311, "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 12 } } }, "property": { "type": "Identifier", "start": 312, "end": 328, "loc": { "start": { "line": 8, "column": 13 }, "end": { "line": 8, "column": 29 }, "identifierName": "currentTextScale" }, "name": "currentTextScale" }, "computed": false }, "right": { "type": "NumericLiteral", "start": 331, "end": 332, "loc": { "start": { "line": 8, "column": 32 }, "end": { "line": 8, "column": 33 } }, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } } }, { "type": "ExpressionStatement", "start": 343, "end": 420, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 85 } }, "expression": { "type": "AssignmentExpression", "start": 343, "end": 419, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 84 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 343, "end": 358, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 23 } }, "object": { "type": "ThisExpression", "start": 343, "end": 347, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 12 } } }, "property": { "type": "Identifier", "start": 348, "end": 358, "loc": { "start": { "line": 10, "column": 13 }, "end": { "line": 10, "column": 23 }, "identifierName": "textObject" }, "name": "textObject" }, "computed": false }, "right": { "type": "NewExpression", "start": 361, "end": 419, "loc": { "start": { "line": 10, "column": 26 }, "end": { "line": 10, "column": 84 } }, "callee": { "type": "Identifier", "start": 365, "end": 376, "loc": { "start": { "line": 10, "column": 30 }, "end": { "line": 10, "column": 41 }, "identifierName": "SceneObject" }, "name": "SceneObject" }, "arguments": [ { "type": "NewExpression", "start": 377, "end": 395, "loc": { "start": { "line": 10, "column": 42 }, "end": { "line": 10, "column": 60 } }, "callee": { "type": "Identifier", "start": 381, "end": 386, "loc": { "start": { "line": 10, "column": 46 }, "end": { "line": 10, "column": 51 }, "identifierName": "Point" }, "name": "Point" }, "arguments": [ { "type": "Identifier", "start": 387, "end": 388, "loc": { "start": { "line": 10, "column": 52 }, "end": { "line": 10, "column": 53 }, "identifierName": "x" }, "name": "x" }, { "type": "Identifier", "start": 390, "end": 391, "loc": { "start": { "line": 10, "column": 55 }, "end": { "line": 10, "column": 56 }, "identifierName": "y" }, "name": "y" }, { "type": "NumericLiteral", "start": 393, "end": 394, "loc": { "start": { "line": 10, "column": 58 }, "end": { "line": 10, "column": 59 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } ] }, { "type": "NewExpression", "start": 397, "end": 415, "loc": { "start": { "line": 10, "column": 62 }, "end": { "line": 10, "column": 80 } }, "callee": { "type": "Identifier", "start": 401, "end": 406, "loc": { "start": { "line": 10, "column": 66 }, "end": { "line": 10, "column": 71 }, "identifierName": "Point" }, "name": "Point" }, "arguments": [ { "type": "Identifier", "start": 407, "end": 408, "loc": { "start": { "line": 10, "column": 72 }, "end": { "line": 10, "column": 73 }, "identifierName": "w" }, "name": "w" }, { "type": "Identifier", "start": 410, "end": 411, "loc": { "start": { "line": 10, "column": 75 }, "end": { "line": 10, "column": 76 }, "identifierName": "h" }, "name": "h" }, { "type": "NumericLiteral", "start": 413, "end": 414, "loc": { "start": { "line": 10, "column": 78 }, "end": { "line": 10, "column": 79 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } ] }, { "type": "NumericLiteral", "start": 417, "end": 418, "loc": { "start": { "line": 10, "column": 82 }, "end": { "line": 10, "column": 83 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } ] } } }, { "type": "ExpressionStatement", "start": 429, "end": 507, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 86 } }, "expression": { "type": "AssignmentExpression", "start": 429, "end": 506, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 85 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 429, "end": 459, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 38 } }, "object": { "type": "MemberExpression", "start": 429, "end": 444, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 23 } }, "object": { "type": "ThisExpression", "start": 429, "end": 433, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 12 } } }, "property": { "type": "Identifier", "start": 434, "end": 444, "loc": { "start": { "line": 11, "column": 13 },