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,554 lines (1,553 loc) • 796 kB
JSON
{
"type": "File",
"start": 0,
"end": 6127,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 186,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 6127,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 186,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 36
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 16
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 16
},
"identifierName": "Component"
},
"name": "Component"
}
}
],
"source": {
"type": "StringLiteral",
"start": 22,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 35
}
},
"extra": {
"rawValue": "./Component",
"raw": "'./Component'"
},
"value": "./Component"
}
},
{
"type": "ImportDeclaration",
"start": 37,
"end": 88,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 51
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 44,
"end": 56,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 19
}
},
"local": {
"type": "Identifier",
"start": 44,
"end": 56,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 19
},
"identifierName": "SceneManager"
},
"name": "SceneManager"
}
}
],
"source": {
"type": "StringLiteral",
"start": 62,
"end": 87,
"loc": {
"start": {
"line": 2,
"column": 25
},
"end": {
"line": 2,
"column": 50
}
},
"extra": {
"rawValue": "../manager/SceneManager",
"raw": "'../manager/SceneManager'"
},
"value": "../manager/SceneManager"
}
},
{
"type": "ImportDeclaration",
"start": 89,
"end": 142,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 53
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 96,
"end": 109,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 20
}
},
"local": {
"type": "Identifier",
"start": 96,
"end": 109,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 20
},
"identifierName": "RenderManager"
},
"name": "RenderManager"
}
}
],
"source": {
"type": "StringLiteral",
"start": 115,
"end": 141,
"loc": {
"start": {
"line": 3,
"column": 26
},
"end": {
"line": 3,
"column": 52
}
},
"extra": {
"rawValue": "../manager/RenderManager",
"raw": "'../manager/RenderManager'"
},
"value": "../manager/RenderManager"
}
},
{
"type": "ImportDeclaration",
"start": 143,
"end": 198,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 55
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 150,
"end": 164,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 21
}
},
"local": {
"type": "Identifier",
"start": 150,
"end": 164,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 21
},
"identifierName": "ProgramManager"
},
"name": "ProgramManager"
}
}
],
"source": {
"type": "StringLiteral",
"start": 170,
"end": 197,
"loc": {
"start": {
"line": 4,
"column": 27
},
"end": {
"line": 4,
"column": 54
}
},
"extra": {
"rawValue": "../manager/ProgramManager",
"raw": "'../manager/ProgramManager'"
},
"value": "../manager/ProgramManager"
}
},
{
"type": "ImportDeclaration",
"start": 199,
"end": 245,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 46
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 206,
"end": 213,
"loc": {
"start": {
"line": 5,
"column": 7
},
"end": {
"line": 5,
"column": 14
}
},
"local": {
"type": "Identifier",
"start": 206,
"end": 213,
"loc": {
"start": {
"line": 5,
"column": 7
},
"end": {
"line": 5,
"column": 14
},
"identifierName": "Matrix3"
},
"name": "Matrix3"
}
}
],
"source": {
"type": "StringLiteral",
"start": 219,
"end": 244,
"loc": {
"start": {
"line": 5,
"column": 20
},
"end": {
"line": 5,
"column": 45
}
},
"extra": {
"rawValue": "../render/WebGL/Matrix3",
"raw": "'../render/WebGL/Matrix3'"
},
"value": "../render/WebGL/Matrix3"
}
},
{
"type": "ImportDeclaration",
"start": 246,
"end": 284,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 38
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 253,
"end": 258,
"loc": {
"start": {
"line": 6,
"column": 7
},
"end": {
"line": 6,
"column": 12
}
},
"local": {
"type": "Identifier",
"start": 253,
"end": 258,
"loc": {
"start": {
"line": 6,
"column": 7
},
"end": {
"line": 6,
"column": 12
},
"identifierName": "Color"
},
"name": "Color"
}
}
],
"source": {
"type": "StringLiteral",
"start": 264,
"end": 283,
"loc": {
"start": {
"line": 6,
"column": 18
},
"end": {
"line": 6,
"column": 37
}
},
"extra": {
"rawValue": "../internal/Color",
"raw": "'../internal/Color'"
},
"value": "../internal/Color"
}
},
{
"type": "VariableDeclaration",
"start": 286,
"end": 314,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 8,
"column": 28
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 292,
"end": 313,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 8,
"column": 27
}
},
"id": {
"type": "Identifier",
"start": 292,
"end": 302,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 8,
"column": 16
},
"identifierName": "DepthRange"
},
"name": "DepthRange"
},
"init": {
"type": "NumericLiteral",
"start": 305,
"end": 313,
"loc": {
"start": {
"line": 8,
"column": 19
},
"end": {
"line": 8,
"column": 27
}
},
"extra": {
"rawValue": 10000000,
"raw": "10000000"
},
"value": 10000000
}
}
],
"kind": "const",
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Base Renderable Component for all Components that want to draw to the screen. If\n * you want to show something on screen, it should derive Renderable.\n * \n * Contained in the class are functions for attaching the Renderable to viewports,\n * and updating Transform data into matricies for use with the Render Manager.\n * \n * The Renderable Component contains data on how the Renderable expects to be rendered.\n * Programs, render vectors, shader data, and other data that is on a per-object basis\n * for rendering is defined here.\n * \n * Classes which derive a Renderable should handle all base data and add or modify data\n * as needed to achieve certain effects.\n ",
"start": 316,
"end": 989,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 23,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 990,
"end": 6127,
"loc": {
"start": {
"line": 24,
"column": 0
},
"end": {
"line": 186,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 1005,
"end": 6127,
"loc": {
"start": {
"line": 24,
"column": 15
},
"end": {
"line": 186,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 1011,
"end": 1021,
"loc": {
"start": {
"line": 24,
"column": 21
},
"end": {
"line": 24,
"column": 31
},
"identifierName": "Renderable"
},
"name": "Renderable",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 1030,
"end": 1039,
"loc": {
"start": {
"line": 24,
"column": 40
},
"end": {
"line": 24,
"column": 49
},
"identifierName": "Component"
},
"name": "Component"
},
"body": {
"type": "ClassBody",
"start": 1040,
"end": 6127,
"loc": {
"start": {
"line": 24,
"column": 50
},
"end": {
"line": 186,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 1278,
"end": 1970,
"loc": {
"start": {
"line": 31,
"column": 4
},
"end": {
"line": 51,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1278,
"end": 1289,
"loc": {
"start": {
"line": 31,
"column": 4
},
"end": {
"line": 31,
"column": 15
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "AssignmentPattern",
"start": 1290,
"end": 1336,
"loc": {
"start": {
"line": 31,
"column": 16
},
"end": {
"line": 31,
"column": 62
}
},
"left": {
"type": "Identifier",
"start": 1290,
"end": 1297,
"loc": {
"start": {
"line": 31,
"column": 16
},
"end": {
"line": 31,
"column": 23
},
"identifierName": "program"
},
"name": "program"
},
"right": {
"type": "CallExpression",
"start": 1300,
"end": 1336,
"loc": {
"start": {
"line": 31,
"column": 26
},
"end": {
"line": 31,
"column": 62
}
},
"callee": {
"type": "MemberExpression",
"start": 1300,
"end": 1325,
"loc": {
"start": {
"line": 31,
"column": 26
},
"end": {
"line": 31,
"column": 51
}
},
"object": {
"type": "Identifier",
"start": 1300,
"end": 1314,
"loc": {
"start": {
"line": 31,
"column": 26
},
"end": {
"line": 31,
"column": 40
},
"identifierName": "ProgramManager"
},
"name": "ProgramManager"
},
"property": {
"type": "Identifier",
"start": 1315,
"end": 1325,
"loc": {
"start": {
"line": 31,
"column": 41
},
"end": {
"line": 31,
"column": 51
},
"identifierName": "getProgram"
},
"name": "getProgram"
},
"computed": false
},
"arguments": [
{
"type": "StringLiteral",
"start": 1326,
"end": 1335,
"loc": {
"start": {
"line": 31,
"column": 52
},
"end": {
"line": 31,
"column": 61
}
},
"extra": {
"rawValue": "Default",
"raw": "'Default'"
},
"value": "Default"
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 1338,
"end": 1970,
"loc": {
"start": {
"line": 31,
"column": 64
},
"end": {
"line": 51,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 1348,
"end": 1360,
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 32,
"column": 20
}
},
"expression": {
"type": "CallExpression",
"start": 1348,
"end": 1359,
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 32,
"column": 19
}
},
"callee": {
"type": "Super",
"start": 1348,
"end": 1353,
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 32,
"column": 13
}
}
},
"arguments": [
{
"type": "BooleanLiteral",
"start": 1354,
"end": 1358,
"loc": {
"start": {
"line": 32,
"column": 14
},
"end": {
"line": 32,
"column": 18
}
},
"value": true
}
]
}
},
{
"type": "ExpressionStatement",
"start": 1369,
"end": 1399,
"loc": {
"start": {
"line": 33,
"column": 8
},
"end": {
"line": 33,
"column": 38
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1369,
"end": 1398,
"loc": {
"start": {
"line": 33,
"column": 8
},
"end": {
"line": 33,
"column": 37
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1369,
"end": 1393,
"loc": {
"start": {
"line": 33,
"column": 8
},
"end": {
"line": 33,
"column": 32
}
},
"object": {
"type": "ThisExpression",
"start": 1369,
"end": 1373,
"loc": {
"start": {
"line": 33,
"column": 8
},
"end": {
"line": 33,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 1374,
"end": 1393,
"loc": {
"start": {
"line": 33,
"column": 13
},
"end": {
"line": 33,
"column": 32
},
"identifierName": "deregisterViewports"
},
"name": "deregisterViewports"
},
"computed": false
},
"right": {
"type": "ObjectExpression",
"start": 1396,
"end": 1398,
"loc": {
"start": {
"line": 33,
"column": 35
},
"end": {
"line": 33,
"column": 37
}
},
"properties": []
}
},
"trailingComments": [
{
"type": "CommentLine",
"value": "currently unused",
"start": 1409,
"end": 1427,
"loc": {
"start": {
"line": 35,
"column": 8
},
"end": {
"line": 35,
"column": 26
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 1436,
"end": 1459,
"loc": {
"start": {
"line": 36,
"column": 8
},
"end": {
"line": 36,
"column": 31
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1436,
"end": 1458,
"loc": {
"start": {
"line": 36,
"column": 8
},
"end": {
"line": 36,
"column": 30
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1436,
"end": 1448,
"loc": {
"start": {
"line": 36,
"column": 8
},
"end": {
"line": 36,
"column": 20
}
},
"object": {
"type": "ThisExpression",
"start": 1436,
"end": 1440,
"loc": {
"start": {
"line": 36,
"column": 8
},
"end": {
"line": 36,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 1441,
"end": 1448,
"loc": {
"start": {
"line": 36,
"column": 13
},
"end": {
"line": 36,
"column": 20
},
"identifierName": "program"
},
"name": "program"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 1451,
"end": 1458,
"loc": {
"start": {
"line": 36,
"column": 23
},
"end": {
"line": 36,
"column": 30
},
"identifierName": "program"
},
"name": "program"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentLine",
"value": "currently unused",
"start": 1409,
"end": 1427,
"loc": {
"start": {
"line": 35,
"column": 8
},
"end": {
"line": 35,
"column": 26
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 1468,
"end": 1505,
"loc": {
"start": {
"line": 37,
"column": 8
},
"end": {
"line": 37,
"column": 45
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1468,
"end": 1504,
"loc": {
"start": {
"line": 37,
"column": 8
},
"end": {
"line": 37,
"column": 44
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1468,
"end": 1488,
"loc": {
"start": {
"line": 37,
"column": 8
},
"end": {
"line": 37,
"column": 28
}
},
"object": {
"type": "ThisExpression",
"start": 1468,
"end": 1472,
"loc": {
"start": {
"line": 37,
"column": 8
},
"end": {
"line": 37,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 1473,
"end": 1488,
"loc": {
"start": {
"line": 37,
"column": 13
},
"end": {
"line": 37,
"column": 28
},
"identifierName": "_matrixPosition"
},
"name": "_matrixPosition"
},
"computed": false
},
"right": {
"type": "NewExpression",
"start": 1491,
"end": 1504,
"loc": {
"start": {
"line": 37,
"column": 31
},
"end": {
"line": 37,
"column": 44
}
},
"callee": {
"type": "Identifier",
"start": 1495,
"end": 1502,
"loc": {
"start": {
"line": 37,
"column": 35
},
"end": {
"line": 37,
"column": 42
},
"identifierName": "Matrix3"
},
"name": "Matrix3"
},
"arguments": []
}
}
},
{
"type": "ExpressionStatement",
"start": 1514,
"end": 1548,
"loc": {
"start": {
"line": 38,
"column": 8
},
"end": {
"line": 38,
"column": 42
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1514,
"end": 1547,
"loc": {
"start": {
"line": 38,
"column": 8
},
"end": {
"line": 38,
"column": 41
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1514,
"end": 1531,
"loc": {
"start": {
"line": 38,
"column": 8
},
"end": {
"line": 38,
"column": 25
}
},
"object": {
"type": "ThisExpression",
"start": 1514,
"end": 1518,
"loc": {
"start": {
"line": 38,
"column": 8
},
"end": {
"line": 38,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 1519,
"end": 1531,
"loc": {
"start": {
"line": 38,
"column": 13
},
"end": {
"line": 38,
"column": 25
},
"identifierName": "_matrixScale"
},
"name": "_matrixScale"
},
"computed": false
},
"right": {
"type": "NewExpression",
"start": 1534,
"end": 1547,
"loc": {
"start": {
"line": 38,
"column": 28
},
"end": {
"line": 38,
"column": 41
}
},
"callee": {
"type": "Identifier",
"start": 1538,
"end": 1545,
"loc": {
"start": {
"line": 38,
"column": 32
},
"end": {
"line": 38,
"column": 39
},
"identifierName": "Matrix3"
},
"name": "Matrix3"
},
"arguments": []
}
}
},
{
"type": "ExpressionStatement",
"start": 1557,
"end": 1594,
"loc": {
"start": {
"line": 39,
"column": 8
},
"end": {
"line": 39,
"column": 45
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1557,
"end": 1593,
"loc": {
"start": {
"line": 39,
"column": 8
},
"end": {
"line": 39,
"column": 44
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1557,
"end": 1577,
"loc": {
"start": {
"line": 39,
"column": 8
},
"end": {
"line": 39,
"column": 28
}
},
"object": {
"type": "ThisExpression",
"start": 1557,
"end": 1561,
"loc": {
"start": {
"line": 39,
"column": 8
},
"end": {
"line": 39,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 1562,
"end": 1577,
"loc": {
"start": {
"line": 39,
"column": 13
},
"end": {
"line": 39,
"column": 28
},
"identifierName": "_matrixRotation"
},
"name": "_matrixRotation"
},
"computed": false
},
"right": {
"type": "NewExpression",
"start": 1580,
"end": 1593,
"loc": {
"start": {
"line": 39,
"column": 31
},
"end": {
"line": 39,
"column": 44
}
},
"callee": {
"type": "Identifier",
"start": 1584,
"end": 1591,
"loc": {
"start": {
"line": 39,
"column": 35
},
"end": {
"line": 39,
"column": 42
},
"identifierName": "Matrix3"
},
"name": "Matrix3"
},
"arguments": []
}
}
},
{
"type": "ExpressionStatement",
"start": 1603,
"end": 1644,
"loc": {
"start": {
"line": 40,
"column": 8
},
"end": {
"line": 40,
"column": 49
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1603,
"end": 1643,
"loc": {
"start": {
"line": 40,
"column": 8
},
"end": {
"line": 40,
"column": 48
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1603,
"end": 1627,
"loc": {
"start": {
"line": 40,
"column": 8
},
"end": {
"line": 40,
"column": 32
}
},
"object": {
"type": "ThisExpression",
"start": 1603,
"end": 1607,
"loc": {
"start": {
"line": 40,
"column": 8
},
"end": {
"line": 40,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 1608,
"end": 1627,
"loc": {
"start": {
"line": 40,
"column": 13
},
"end": {
"line": 40,
"column": 32
},
"identifierName": "_matrixOriginOffset"
},
"name": "_matrixOriginOffset"
},
"computed": false
},
"right": {
"type": "NewExpression",
"start": 1630,
"end": 1643,
"loc": {
"start": {
"line": 40,
"column": 35
},
"end": {
"line": 40,
"column": 48
}
},
"callee": {
"type": "Identifier",
"start": 1634,
"end": 1641,
"loc": {
"start": {
"line": 40,
"column": 39
},
"end": {
"line": 40,
"column": 46
},
"identifierName": "Matrix3"
},
"name": "Matrix3"
},
"arguments": []
}
}
},
{
"type": "ExpressionStatement",
"start": 1653,
"end": 1678,
"loc": {
"start": {
"line": 41,
"column": 8
},
"end": {
"line": 41,
"column": 33
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1653,
"end": 1677,
"loc": {
"start": {
"line": 41,
"column": 8
},
"end": {
"line": 41,
"column": 32
}