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,461 lines (1,460 loc) 623 kB
{ "type": "File", "start": 0, "end": 4390, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 128, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 4390, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 128, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 38, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 38 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 17, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 17 } }, "local": { "type": "Identifier", "start": 7, "end": 17, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 17 }, "identifierName": "Renderable" }, "name": "Renderable" } } ], "source": { "type": "StringLiteral", "start": 23, "end": 37, "loc": { "start": { "line": 1, "column": 23 }, "end": { "line": 1, "column": 37 } }, "extra": { "rawValue": "./Renderable", "raw": "'./Renderable'" }, "value": "./Renderable" } }, { "type": "ImportDeclaration", "start": 39, "end": 85, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 46 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 46, "end": 53, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 46, "end": 53, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "Matrix3" }, "name": "Matrix3" } } ], "source": { "type": "StringLiteral", "start": 59, "end": 84, "loc": { "start": { "line": 2, "column": 20 }, "end": { "line": 2, "column": 45 } }, "extra": { "rawValue": "../render/WebGL/Matrix3", "raw": "'../render/WebGL/Matrix3'" }, "value": "../render/WebGL/Matrix3" } }, { "type": "ImportDeclaration", "start": 86, "end": 141, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 55 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 93, "end": 107, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 21 } }, "local": { "type": "Identifier", "start": 93, "end": 107, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 21 }, "identifierName": "ProgramManager" }, "name": "ProgramManager" } } ], "source": { "type": "StringLiteral", "start": 113, "end": 140, "loc": { "start": { "line": 3, "column": 27 }, "end": { "line": 3, "column": 54 } }, "extra": { "rawValue": "../manager/ProgramManager", "raw": "'../manager/ProgramManager'" }, "value": "../manager/ProgramManager" } }, { "type": "ImportDeclaration", "start": 142, "end": 197, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 55 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 149, "end": 163, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 21 } }, "local": { "type": "Identifier", "start": 149, "end": 163, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 21 }, "identifierName": "TextureManager" }, "name": "TextureManager" } } ], "source": { "type": "StringLiteral", "start": 169, "end": 196, "loc": { "start": { "line": 4, "column": 27 }, "end": { "line": 4, "column": 54 } }, "extra": { "rawValue": "../manager/TextureManager", "raw": "'../manager/TextureManager'" }, "value": "../manager/TextureManager" } }, { "type": "ImportDeclaration", "start": 198, "end": 251, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 53 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 205, "end": 218, "loc": { "start": { "line": 5, "column": 7 }, "end": { "line": 5, "column": 20 } }, "local": { "type": "Identifier", "start": 205, "end": 218, "loc": { "start": { "line": 5, "column": 7 }, "end": { "line": 5, "column": 20 }, "identifierName": "RenderManager" }, "name": "RenderManager" } } ], "source": { "type": "StringLiteral", "start": 224, "end": 250, "loc": { "start": { "line": 5, "column": 26 }, "end": { "line": 5, "column": 52 } }, "extra": { "rawValue": "../manager/RenderManager", "raw": "'../manager/RenderManager'" }, "value": "../manager/RenderManager" } }, { "type": "ImportDeclaration", "start": 252, "end": 310, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 58 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 259, "end": 279, "loc": { "start": { "line": 6, "column": 7 }, "end": { "line": 6, "column": 27 } }, "local": { "type": "Identifier", "start": 259, "end": 279, "loc": { "start": { "line": 6, "column": 7 }, "end": { "line": 6, "column": 27 }, "identifierName": "Renderable2DMultitex" }, "name": "Renderable2DMultitex" } } ], "source": { "type": "StringLiteral", "start": 285, "end": 309, "loc": { "start": { "line": 6, "column": 33 }, "end": { "line": 6, "column": 57 } }, "extra": { "rawValue": "./Renderable2DMultitex", "raw": "'./Renderable2DMultitex'" }, "value": "./Renderable2DMultitex" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * RenderableText is a renderable component which renders a line of text from a \n * collection of string data. The string data is loaded into the GPU using textures\n ", "start": 312, "end": 484, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 11, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 485, "end": 4390, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 128, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 500, "end": 4390, "loc": { "start": { "line": 12, "column": 15 }, "end": { "line": 128, "column": 1 } }, "id": { "type": "Identifier", "start": 506, "end": 520, "loc": { "start": { "line": 12, "column": 21 }, "end": { "line": 12, "column": 35 }, "identifierName": "RenderableText" }, "name": "RenderableText", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 529, "end": 549, "loc": { "start": { "line": 12, "column": 44 }, "end": { "line": 12, "column": 64 }, "identifierName": "Renderable2DMultitex" }, "name": "Renderable2DMultitex" }, "body": { "type": "ClassBody", "start": 550, "end": 4390, "loc": { "start": { "line": 12, "column": 65 }, "end": { "line": 128, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 557, "end": 1792, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 49, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 557, "end": 568, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 15 }, "identifierName": "constructor" }, "name": "constructor" }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 569, "end": 580, "loc": { "start": { "line": 14, "column": 16 }, "end": { "line": 14, "column": 27 }, "identifierName": "fontTexture" }, "name": "fontTexture" } ], "body": { "type": "BlockStatement", "start": 582, "end": 1792, "loc": { "start": { "line": 14, "column": 29 }, "end": { "line": 49, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 592, "end": 635, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 51 } }, "expression": { "type": "CallExpression", "start": 592, "end": 634, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 50 } }, "callee": { "type": "Super", "start": 592, "end": 597, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 13 } } }, "arguments": [ { "type": "CallExpression", "start": 598, "end": 633, "loc": { "start": { "line": 15, "column": 14 }, "end": { "line": 15, "column": 49 } }, "callee": { "type": "MemberExpression", "start": 598, "end": 623, "loc": { "start": { "line": 15, "column": 14 }, "end": { "line": 15, "column": 39 } }, "object": { "type": "Identifier", "start": 598, "end": 612, "loc": { "start": { "line": 15, "column": 14 }, "end": { "line": 15, "column": 28 }, "identifierName": "ProgramManager" }, "name": "ProgramManager" }, "property": { "type": "Identifier", "start": 613, "end": 623, "loc": { "start": { "line": 15, "column": 29 }, "end": { "line": 15, "column": 39 }, "identifierName": "getProgram" }, "name": "getProgram" }, "computed": false }, "arguments": [ { "type": "StringLiteral", "start": 624, "end": 632, "loc": { "start": { "line": 15, "column": 40 }, "end": { "line": 15, "column": 48 } }, "extra": { "rawValue": "2DGrid", "raw": "'2DGrid'" }, "value": "2DGrid" } ] } ] } }, { "type": "ExpressionStatement", "start": 644, "end": 678, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 42 } }, "expression": { "type": "AssignmentExpression", "start": 644, "end": 677, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 41 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 644, "end": 658, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 22 } }, "object": { "type": "ThisExpression", "start": 644, "end": 648, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 12 } } }, "property": { "type": "Identifier", "start": 649, "end": 658, "loc": { "start": { "line": 16, "column": 13 }, "end": { "line": 16, "column": 22 }, "identifierName": "className" }, "name": "className" }, "computed": false }, "right": { "type": "StringLiteral", "start": 661, "end": 677, "loc": { "start": { "line": 16, "column": 25 }, "end": { "line": 16, "column": 41 } }, "extra": { "rawValue": "RenderableText", "raw": "'RenderableText'" }, "value": "RenderableText" } } }, { "type": "ExpressionStatement", "start": 687, "end": 714, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 35 } }, "expression": { "type": "AssignmentExpression", "start": 687, "end": 713, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 34 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 687, "end": 708, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 29 } }, "object": { "type": "ThisExpression", "start": 687, "end": 691, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 12 } } }, "property": { "type": "Identifier", "start": 692, "end": 708, "loc": { "start": { "line": 17, "column": 13 }, "end": { "line": 17, "column": 29 }, "identifierName": "renderableTextID" }, "name": "renderableTextID" }, "computed": false }, "right": { "type": "UnaryExpression", "start": 711, "end": 713, "loc": { "start": { "line": 17, "column": 32 }, "end": { "line": 17, "column": 34 } }, "operator": "-", "prefix": true, "argument": { "type": "NumericLiteral", "start": 712, "end": 713, "loc": { "start": { "line": 17, "column": 33 }, "end": { "line": 17, "column": 34 } }, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 }, "extra": { "parenthesizedArgument": false } } } }, { "type": "ExpressionStatement", "start": 723, "end": 1084, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 27, "column": 10 } }, "expression": { "type": "AssignmentExpression", "start": 723, "end": 1083, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 27, "column": 9 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 723, "end": 736, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 21 } }, "object": { "type": "ThisExpression", "start": 723, "end": 727, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } } }, "property": { "type": "Identifier", "start": 728, "end": 736, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 21 }, "identifierName": "textData" }, "name": "textData" }, "computed": false }, "right": { "type": "ObjectExpression", "start": 739, "end": 1083, "loc": { "start": { "line": 18, "column": 24 }, "end": { "line": 27, "column": 9 } }, "properties": [ { "type": "ObjectProperty", "start": 787, "end": 795, "loc": { "start": { "line": 20, "column": 12 }, "end": { "line": 20, "column": 20 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 787, "end": 791, "loc": { "start": { "line": 20, "column": 12 }, "end": { "line": 20, "column": 16 }, "identifierName": "text" }, "name": "text", "leadingComments": null }, "value": { "type": "StringLiteral", "start": 793, "end": 795, "loc": { "start": { "line": 20, "column": 18 }, "end": { "line": 20, "column": 20 } }, "extra": { "rawValue": "", "raw": "''" }, "value": "" }, "leadingComments": [ { "type": "CommentLine", "value": "text in string form", "start": 753, "end": 774, "loc": { "start": { "line": 19, "column": 12 }, "end": { "line": 19, "column": 33 } } } ] }, { "type": "ObjectProperty", "start": 956, "end": 974, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 30 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 956, "end": 970, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 26 }, "identifierName": "textPixelArray" }, "name": "textPixelArray", "leadingComments": null }, "value": { "type": "ArrayExpression", "start": 972, "end": 974, "loc": { "start": { "line": 23, "column": 28 }, "end": { "line": 23, "column": 30 } }, "elements": [] }, "leadingComments": [ { "type": "CommentLine", "value": "text in indexable columns of the font texture. Represents an x value and a range of y values (automatically handled by the shader).", "start": 810, "end": 943, "loc": { "start": { "line": 22, "column": 12 }, "end": { "line": 22, "column": 145 } } } ] }, { "type": "ObjectProperty", "start": 1056, "end": 1073, "loc": { "start": { "line": 26, "column": 12 }, "end": { "line": 26, "column": 29 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1056, "end": 1070, "loc": { "start": { "line": 26, "column": 12 }, "end": { "line": 26, "column": 26 }, "identifierName": "textPixelWidth" }, "name": "textPixelWidth", "leadingComments": null }, "value": { "type": "NumericLiteral", "start": 1072, "end": 1073, "loc": { "start": { "line": 26, "column": 28 }, "end": { "line": 26, "column": 29 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 }, "leadingComments": [ { "type": "CommentLine", "value": "width of the entire string and and formatting in px.", "start": 989, "end": 1043, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 66 } } } ] } ] } }, "trailingComments": [ { "type": "CommentBlock", "value": "\n An array representing a matrix4. Should be replaced with a Matrix4 instance.\n\n [0][0] = 0 = Map data tiles width.\n [0][1] = 1 = Map data tiles height.\n [0][2] = 2 = Map tiles in the texture width.\n [0][3] = 3 = Map tiles in the texture height.\n\n [1][0] = 4 = Map viewport width.\n [1][1] = 5 = Map viewport height.\n [1][2] = 6 = Map viewport x1.\n [1][3] = 7 = Map viewport y1.\n\n [2][0] = 8 = TileSize width normalized.\n [2][1] = 9 = TileSize height normalized. \n ", "start": 1094, "end": 1646, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 44, "column": 10 } } } ] }, { "type": "ExpressionStatement", "start": 1655, "end": 1680, "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 33 } }, "expression": { "type": "AssignmentExpression", "start": 1655, "end": 1679, "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 32 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 1655, "end": 1674, "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 27 } }, "object": { "type": "ThisExpression", "start": 1655, "end": 1659, "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 1660, "end": 1674, "loc": { "start": { "line": 45, "column": 13 }, "end": { "line": 45, "column": 27 }, "identifierName": "shaderFontData" }, "name": "shaderFontData" }, "computed": false, "leadingComments": null }, "right": { "type": "ArrayExpression", "start": 1677, "end": 1679, "loc": { "start": { "line": 45, "column": 30 }, "end": { "line": 45, "column": 32 } }, "elements": [] }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "\n An array representing a matrix4. Should be replaced with a Matrix4 instance.\n\n [0][0] = 0 = Map data tiles width.\n [0][1] = 1 = Map data tiles height.\n [0][2] = 2 = Map tiles in the texture width.\n [0][3] = 3 = Map tiles in the texture height.\n\n [1][0] = 4 = Map viewport width.\n [1][1] = 5 = Map viewport height.\n [1][2] = 6 = Map viewport x1.\n [1][3] = 7 = Map viewport y1.\n\n [2][0] = 8 = TileSize width normalized.\n [2][1] = 9 = TileSize height normalized. \n ", "start": 1094, "end": 1646, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 44, "column": 10 } } } ] }, { "type": "ExpressionStatement", "start": 1689, "end": 1720, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 39 } }, "expression": { "type": "AssignmentExpression", "start": 1689, "end": 1719, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 38 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 1689, "end": 1705, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 24 } }, "object": { "type": "ThisExpression", "start": 1689, "end": 1693, "loc": {