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,619 lines (1,618 loc) • 1.16 MB
JSON
{
"type": "File",
"start": 0,
"end": 6795,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 183,
"column": 29
}
},
"program": {
"type": "Program",
"start": 0,
"end": 6795,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 183,
"column": 29
}
},
"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": 118,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 46
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 79,
"end": 93,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 21
}
},
"local": {
"type": "Identifier",
"start": 79,
"end": 93,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 21
},
"identifierName": "ProgramManager"
},
"name": "ProgramManager"
}
}
],
"source": {
"type": "StringLiteral",
"start": 99,
"end": 117,
"loc": {
"start": {
"line": 3,
"column": 27
},
"end": {
"line": 3,
"column": 45
}
},
"extra": {
"rawValue": "./ProgramManager",
"raw": "'./ProgramManager'"
},
"value": "./ProgramManager"
}
},
{
"type": "ImportDeclaration",
"start": 119,
"end": 161,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 42
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 126,
"end": 138,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 19
}
},
"local": {
"type": "Identifier",
"start": 126,
"end": 138,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 19
},
"identifierName": "SceneManager"
},
"name": "SceneManager"
}
}
],
"source": {
"type": "StringLiteral",
"start": 144,
"end": 160,
"loc": {
"start": {
"line": 4,
"column": 25
},
"end": {
"line": 4,
"column": 41
}
},
"extra": {
"rawValue": "./SceneManager",
"raw": "'./SceneManager'"
},
"value": "./SceneManager"
}
},
{
"type": "ImportDeclaration",
"start": 162,
"end": 216,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 54
}
},
"specifiers": [
{
"type": "ImportNamespaceSpecifier",
"start": 169,
"end": 186,
"loc": {
"start": {
"line": 5,
"column": 7
},
"end": {
"line": 5,
"column": 24
}
},
"local": {
"type": "Identifier",
"start": 174,
"end": 186,
"loc": {
"start": {
"line": 5,
"column": 12
},
"end": {
"line": 5,
"column": 24
},
"identifierName": "VertexShader"
},
"name": "VertexShader"
}
}
],
"source": {
"type": "StringLiteral",
"start": 192,
"end": 215,
"loc": {
"start": {
"line": 5,
"column": 30
},
"end": {
"line": 5,
"column": 53
}
},
"extra": {
"rawValue": "../const/VertexShader",
"raw": "'../const/VertexShader'"
},
"value": "../const/VertexShader"
}
},
{
"type": "ImportDeclaration",
"start": 217,
"end": 275,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 58
}
},
"specifiers": [
{
"type": "ImportNamespaceSpecifier",
"start": 224,
"end": 243,
"loc": {
"start": {
"line": 6,
"column": 7
},
"end": {
"line": 6,
"column": 26
}
},
"local": {
"type": "Identifier",
"start": 229,
"end": 243,
"loc": {
"start": {
"line": 6,
"column": 12
},
"end": {
"line": 6,
"column": 26
},
"identifierName": "FragmentShader"
},
"name": "FragmentShader"
}
}
],
"source": {
"type": "StringLiteral",
"start": 249,
"end": 274,
"loc": {
"start": {
"line": 6,
"column": 32
},
"end": {
"line": 6,
"column": 57
}
},
"extra": {
"rawValue": "../const/FragmentShader",
"raw": "'../const/FragmentShader'"
},
"value": "../const/FragmentShader"
}
},
{
"type": "ImportDeclaration",
"start": 276,
"end": 322,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 7,
"column": 46
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 283,
"end": 290,
"loc": {
"start": {
"line": 7,
"column": 7
},
"end": {
"line": 7,
"column": 14
}
},
"local": {
"type": "Identifier",
"start": 283,
"end": 290,
"loc": {
"start": {
"line": 7,
"column": 7
},
"end": {
"line": 7,
"column": 14
},
"identifierName": "Matrix3"
},
"name": "Matrix3"
}
}
],
"source": {
"type": "StringLiteral",
"start": 296,
"end": 321,
"loc": {
"start": {
"line": 7,
"column": 20
},
"end": {
"line": 7,
"column": 45
}
},
"extra": {
"rawValue": "../render/WebGL/Matrix3",
"raw": "'../render/WebGL/Matrix3'"
},
"value": "../render/WebGL/Matrix3"
}
},
{
"type": "ImportDeclaration",
"start": 323,
"end": 365,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 8,
"column": 42
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 332,
"end": 346,
"loc": {
"start": {
"line": 8,
"column": 9
},
"end": {
"line": 8,
"column": 23
}
},
"imported": {
"type": "Identifier",
"start": 332,
"end": 346,
"loc": {
"start": {
"line": 8,
"column": 9
},
"end": {
"line": 8,
"column": 23
},
"identifierName": "TextureManager"
},
"name": "TextureManager"
},
"local": {
"type": "Identifier",
"start": 332,
"end": 346,
"loc": {
"start": {
"line": 8,
"column": 9
},
"end": {
"line": 8,
"column": 23
},
"identifierName": "TextureManager"
},
"name": "TextureManager"
}
}
],
"source": {
"type": "StringLiteral",
"start": 354,
"end": 364,
"loc": {
"start": {
"line": 8,
"column": 31
},
"end": {
"line": 8,
"column": 41
}
},
"extra": {
"rawValue": "../entry",
"raw": "'../entry'"
},
"value": "../entry"
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Manages the WebGL2 rendering of all renderable components in the scene.\n * This manager is not intended to be referenced directly.\n ",
"start": 367,
"end": 508,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 13,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"start": 509,
"end": 6663,
"loc": {
"start": {
"line": 14,
"column": 0
},
"end": {
"line": 177,
"column": 1
}
},
"specifiers": [],
"source": null,
"declaration": {
"type": "ClassDeclaration",
"start": 516,
"end": 6663,
"loc": {
"start": {
"line": 14,
"column": 7
},
"end": {
"line": 177,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 522,
"end": 536,
"loc": {
"start": {
"line": 14,
"column": 13
},
"end": {
"line": 14,
"column": 27
},
"identifierName": "_RenderManager"
},
"name": "_RenderManager",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 545,
"end": 552,
"loc": {
"start": {
"line": 14,
"column": 36
},
"end": {
"line": 14,
"column": 43
},
"identifierName": "Manager"
},
"name": "Manager"
},
"body": {
"type": "ClassBody",
"start": 553,
"end": 6663,
"loc": {
"start": {
"line": 14,
"column": 44
},
"end": {
"line": 177,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 559,
"end": 816,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 26,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 559,
"end": 570,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 15
},
"identifierName": "constructor"
},
"name": "constructor"
},
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 573,
"end": 816,
"loc": {
"start": {
"line": 15,
"column": 18
},
"end": {
"line": 26,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 583,
"end": 591,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 16
}
},
"expression": {
"type": "CallExpression",
"start": 583,
"end": 590,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 15
}
},
"callee": {
"type": "Super",
"start": 583,
"end": 588,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 13
}
}
},
"arguments": []
}
},
{
"type": "ExpressionStatement",
"start": 600,
"end": 615,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 23
}
},
"expression": {
"type": "AssignmentExpression",
"start": 600,
"end": 614,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 22
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 600,
"end": 607,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 15
}
},
"object": {
"type": "ThisExpression",
"start": 600,
"end": 604,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 605,
"end": 607,
"loc": {
"start": {
"line": 17,
"column": 13
},
"end": {
"line": 17,
"column": 15
},
"identifierName": "GL"
},
"name": "GL"
},
"computed": false
},
"right": {
"type": "NullLiteral",
"start": 610,
"end": 614,
"loc": {
"start": {
"line": 17,
"column": 18
},
"end": {
"line": 17,
"column": 22
}
}
}
}
},
{
"type": "ExpressionStatement",
"start": 624,
"end": 651,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 35
}
},
"expression": {
"type": "AssignmentExpression",
"start": 624,
"end": 650,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 34
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 624,
"end": 643,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 27
}
},
"object": {
"type": "ThisExpression",
"start": 624,
"end": 628,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 629,
"end": 643,
"loc": {
"start": {
"line": 18,
"column": 13
},
"end": {
"line": 18,
"column": 27
},
"identifierName": "currentProgram"
},
"name": "currentProgram"
},
"computed": false
},
"right": {
"type": "NullLiteral",
"start": 646,
"end": 650,
"loc": {
"start": {
"line": 18,
"column": 30
},
"end": {
"line": 18,
"column": 34
}
}
}
}
},
{
"type": "ExpressionStatement",
"start": 660,
"end": 687,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 35
}
},
"expression": {
"type": "AssignmentExpression",
"start": 660,
"end": 686,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 34
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 660,
"end": 681,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 29
}
},
"object": {
"type": "ThisExpression",
"start": 660,
"end": 664,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 665,
"end": 681,
"loc": {
"start": {
"line": 19,
"column": 13
},
"end": {
"line": 19,
"column": 29
},
"identifierName": "activeTextureIDs"
},
"name": "activeTextureIDs"
},
"computed": false
},
"right": {
"type": "ArrayExpression",
"start": 684,
"end": 686,
"loc": {
"start": {
"line": 19,
"column": 32
},
"end": {
"line": 19,
"column": 34
}
},
"elements": []
}
},
"trailingComments": [
{
"type": "CommentLine",
"value": "text",
"start": 697,
"end": 703,
"loc": {
"start": {
"line": 21,
"column": 8
},
"end": {
"line": 21,
"column": 14
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 712,
"end": 745,
"loc": {
"start": {
"line": 22,
"column": 8
},
"end": {
"line": 22,
"column": 41
}
},
"expression": {
"type": "AssignmentExpression",
"start": 712,
"end": 744,
"loc": {
"start": {
"line": 22,
"column": 8
},
"end": {
"line": 22,
"column": 40
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 712,
"end": 740,
"loc": {
"start": {
"line": 22,
"column": 8
},
"end": {
"line": 22,
"column": 36
}
},
"object": {
"type": "ThisExpression",
"start": 712,
"end": 716,
"loc": {
"start": {
"line": 22,
"column": 8
},
"end": {
"line": 22,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 717,
"end": 740,
"loc": {
"start": {
"line": 22,
"column": 13
},
"end": {
"line": 22,
"column": 36
},
"identifierName": "RenderableTextIDCounter"
},
"name": "RenderableTextIDCounter"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "NumericLiteral",
"start": 743,
"end": 744,
"loc": {
"start": {
"line": 22,
"column": 39
},
"end": {
"line": 22,
"column": 40
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentLine",
"value": "text",
"start": 697,
"end": 703,
"loc": {
"start": {
"line": 21,
"column": 8
},
"end": {
"line": 21,
"column": 14
}
}
}
],
"trailingComments": [
{
"type": "CommentLine",
"value": "last update microsecond",
"start": 755,
"end": 780,
"loc": {
"start": {
"line": 24,
"column": 8
},
"end": {
"line": 24,
"column": 33
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 789,
"end": 810,
"loc": {
"start": {
"line": 25,
"column": 8
},
"end": {
"line": 25,
"column": 29
}
},
"expression": {
"type": "AssignmentExpression",
"start": 789,
"end": 809,
"loc": {
"start": {
"line": 25,
"column": 8
},
"end": {
"line": 25,
"column": 28
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 789,
"end": 804,
"loc": {
"start": {
"line": 25,
"column": 8
},
"end": {
"line": 25,
"column": 23
}
},
"object": {
"type": "ThisExpression",
"start": 789,
"end": 793,
"loc": {
"start": {
"line": 25,
"column": 8
},
"end": {
"line": 25,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 794,
"end": 804,
"loc": {
"start": {
"line": 25,
"column": 13
},
"end": {
"line": 25,
"column": 23
},
"identifierName": "lastUpdate"
},
"name": "lastUpdate"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "UnaryExpression",
"start": 807,
"end": 809,
"loc": {
"start": {
"line": 25,
"column": 26
},
"end": {
"line": 25,
"column": 28
}
},
"operator": "-",
"prefix": true,
"argument": {
"type": "NumericLiteral",
"start": 808,
"end": 809,
"loc": {
"start": {
"line": 25,
"column": 27
},
"end": {
"line": 25,
"column": 28
}
},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
},
"extra": {
"parenthesizedArgument": false
}
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentLine",
"value": "last update microsecond",
"start": 755,
"end": 780,
"loc": {
"start": {
"line": 24,
"column": 8
},
"end": {
"line": 24,
"column": 33
}
}
}
]
}
],
"directives": [],
"trailingComments": null
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Initial setup on GL rendering. \n ",
"start": 822,
"end": 872,
"loc": {
"start": {
"line": 28,
"column": 4
},
"end": {
"line": 30,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 877,
"end": 3205,
"loc": {
"start": {
"line": 31,
"column": 4
},
"end": {
"line": 84,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 877,
"end": 882,
"loc": {
"start": {
"line": 31,
"column": 4
},
"end": {
"line": 31,
"column": 9
},
"identifierName": "start"
},
"name": "start",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 885,
"end": 3205,
"loc": {
"start": {
"line": 31,
"column": 12
},
"end": {
"line": 84,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 895,
"end": 919,
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 32,
"column": 32
}
},
"expression": {
"type": "AssignmentExpression",
"start": 895,
"end": 918,
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 32,
"column": 31
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 895,
"end": 902,
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 32,
"column": 15
}
},
"object": {
"type": "ThisExpression",
"start": 895,
"end": 899,
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 32,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 900,
"end": 902,
"loc": {
"start": {
"line": 32,
"column": 13
},
"end": {
"line": 32,
"column": 15
},
"identifierName": "GL"
},
"name": "GL"
},
"computed": false
},
"right": {
"type": "MemberExpression",
"start": 905,
"end": 918,
"loc": {
"start": {
"line": 32,
"column": 18
},
"end": {
"line": 32,
"column": 31
}
},
"object": {
"type": "Identifier",
"start": 905,
"end": 915,
"loc": {
"start": {
"line": 32,
"column": 18
},
"end": {
"line": 32,
"column": 28
},
"identifierName": "DOMManager"
},
"name": "DOMManager"
},
"property": {
"type": "Identifier",
"start": 916,
"end": 918,
"loc": {
"start": {
"line": 32,
"column": 29
},
"end": {
"line": 32,
"column": 31
},
"identifierName": "GL"
},
"name": "GL"
},
"computed": false
}
}
},
{
"type": "IfStatement",
"start": 928,
"end": 968,
"loc": {
"start": {
"line": 33,
"column": 8
},
"end": {
"line": 34,
"column": 19
}
},
"test": {
"type": "BinaryExpression",
"start": 932,
"end": 947,
"loc": {
"start": {
"line": 33,
"column": 12
},
"end": {
"line": 33,
"column": 27
}
},
"left": {
"type": "MemberExpression",
"start": 932,
"end": 939,
"loc": {
"start": {
"line": 33,