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,479 lines (1,478 loc) • 462 kB
JSON
{
"type": "File",
"start": 0,
"end": 2101,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 54,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 2101,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 54,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 108,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 108
}
},
"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": 77,
"loc": {
"start": {
"line": 1,
"column": 71
},
"end": {
"line": 1,
"column": 77
}
},
"imported": {
"type": "Identifier",
"start": 71,
"end": 77,
"loc": {
"start": {
"line": 1,
"column": 71
},
"end": {
"line": 1,
"column": 77
},
"identifierName": "UIText"
},
"name": "UIText"
},
"local": {
"type": "Identifier",
"start": 71,
"end": 77,
"loc": {
"start": {
"line": 1,
"column": 71
},
"end": {
"line": 1,
"column": 77
},
"identifierName": "UIText"
},
"name": "UIText"
}
},
{
"type": "ImportSpecifier",
"start": 79,
"end": 86,
"loc": {
"start": {
"line": 1,
"column": 79
},
"end": {
"line": 1,
"column": 86
}
},
"imported": {
"type": "Identifier",
"start": 79,
"end": 86,
"loc": {
"start": {
"line": 1,
"column": 79
},
"end": {
"line": 1,
"column": 86
},
"identifierName": "UIPanel"
},
"name": "UIPanel"
},
"local": {
"type": "Identifier",
"start": 79,
"end": 86,
"loc": {
"start": {
"line": 1,
"column": 79
},
"end": {
"line": 1,
"column": 86
},
"identifierName": "UIPanel"
},
"name": "UIPanel"
}
}
],
"source": {
"type": "StringLiteral",
"start": 94,
"end": 107,
"loc": {
"start": {
"line": 1,
"column": 94
},
"end": {
"line": 1,
"column": 107
}
},
"extra": {
"rawValue": "../../entry",
"raw": "'../../entry'"
},
"value": "../../entry"
}
},
{
"type": "ExportDefaultDeclaration",
"start": 110,
"end": 2101,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 54,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 125,
"end": 2101,
"loc": {
"start": {
"line": 3,
"column": 15
},
"end": {
"line": 54,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 131,
"end": 139,
"loc": {
"start": {
"line": 3,
"column": 21
},
"end": {
"line": 3,
"column": 29
},
"identifierName": "UIButton"
},
"name": "UIButton"
},
"superClass": {
"type": "Identifier",
"start": 148,
"end": 154,
"loc": {
"start": {
"line": 3,
"column": 38
},
"end": {
"line": 3,
"column": 44
},
"identifierName": "UIText"
},
"name": "UIText"
},
"body": {
"type": "ClassBody",
"start": 155,
"end": 2101,
"loc": {
"start": {
"line": 3,
"column": 45
},
"end": {
"line": 54,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 161,
"end": 1548,
"loc": {
"start": {
"line": 4,
"column": 4
},
"end": {
"line": 33,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 161,
"end": 172,
"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": 173,
"end": 181,
"loc": {
"start": {
"line": 4,
"column": 16
},
"end": {
"line": 4,
"column": 24
},
"identifierName": "viewport"
},
"name": "viewport"
},
{
"type": "Identifier",
"start": 183,
"end": 184,
"loc": {
"start": {
"line": 4,
"column": 26
},
"end": {
"line": 4,
"column": 27
},
"identifierName": "x"
},
"name": "x"
},
{
"type": "Identifier",
"start": 186,
"end": 187,
"loc": {
"start": {
"line": 4,
"column": 29
},
"end": {
"line": 4,
"column": 30
},
"identifierName": "y"
},
"name": "y"
},
{
"type": "Identifier",
"start": 189,
"end": 190,
"loc": {
"start": {
"line": 4,
"column": 32
},
"end": {
"line": 4,
"column": 33
},
"identifierName": "w"
},
"name": "w"
},
{
"type": "Identifier",
"start": 192,
"end": 193,
"loc": {
"start": {
"line": 4,
"column": 35
},
"end": {
"line": 4,
"column": 36
},
"identifierName": "h"
},
"name": "h"
},
{
"type": "Identifier",
"start": 195,
"end": 199,
"loc": {
"start": {
"line": 4,
"column": 38
},
"end": {
"line": 4,
"column": 42
},
"identifierName": "text"
},
"name": "text"
},
{
"type": "Identifier",
"start": 201,
"end": 207,
"loc": {
"start": {
"line": 4,
"column": 44
},
"end": {
"line": 4,
"column": 50
},
"identifierName": "onLeft"
},
"name": "onLeft"
},
{
"type": "AssignmentPattern",
"start": 209,
"end": 227,
"loc": {
"start": {
"line": 4,
"column": 52
},
"end": {
"line": 4,
"column": 70
}
},
"left": {
"type": "Identifier",
"start": 209,
"end": 216,
"loc": {
"start": {
"line": 4,
"column": 52
},
"end": {
"line": 4,
"column": 59
},
"identifierName": "onRight"
},
"name": "onRight"
},
"right": {
"type": "ArrowFunctionExpression",
"start": 219,
"end": 227,
"loc": {
"start": {
"line": 4,
"column": 62
},
"end": {
"line": 4,
"column": 70
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 225,
"end": 227,
"loc": {
"start": {
"line": 4,
"column": 68
},
"end": {
"line": 4,
"column": 70
}
},
"body": [],
"directives": []
}
}
}
],
"body": {
"type": "BlockStatement",
"start": 229,
"end": 1548,
"loc": {
"start": {
"line": 4,
"column": 72
},
"end": {
"line": 33,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 239,
"end": 300,
"loc": {
"start": {
"line": 5,
"column": 8
},
"end": {
"line": 5,
"column": 69
}
},
"expression": {
"type": "CallExpression",
"start": 239,
"end": 299,
"loc": {
"start": {
"line": 5,
"column": 8
},
"end": {
"line": 5,
"column": 68
}
},
"callee": {
"type": "Super",
"start": 239,
"end": 244,
"loc": {
"start": {
"line": 5,
"column": 8
},
"end": {
"line": 5,
"column": 13
}
}
},
"arguments": [
{
"type": "Identifier",
"start": 245,
"end": 253,
"loc": {
"start": {
"line": 5,
"column": 14
},
"end": {
"line": 5,
"column": 22
},
"identifierName": "viewport"
},
"name": "viewport"
},
{
"type": "BinaryExpression",
"start": 255,
"end": 267,
"loc": {
"start": {
"line": 5,
"column": 24
},
"end": {
"line": 5,
"column": 36
}
},
"left": {
"type": "Identifier",
"start": 255,
"end": 256,
"loc": {
"start": {
"line": 5,
"column": 24
},
"end": {
"line": 5,
"column": 25
},
"identifierName": "x"
},
"name": "x"
},
"operator": "+",
"right": {
"type": "BinaryExpression",
"start": 260,
"end": 266,
"loc": {
"start": {
"line": 5,
"column": 29
},
"end": {
"line": 5,
"column": 35
}
},
"left": {
"type": "Identifier",
"start": 260,
"end": 261,
"loc": {
"start": {
"line": 5,
"column": 29
},
"end": {
"line": 5,
"column": 30
},
"identifierName": "w"
},
"name": "w"
},
"operator": "*",
"right": {
"type": "NumericLiteral",
"start": 264,
"end": 266,
"loc": {
"start": {
"line": 5,
"column": 33
},
"end": {
"line": 5,
"column": 35
}
},
"extra": {
"rawValue": 0.1,
"raw": ".1"
},
"value": 0.1
},
"extra": {
"parenthesized": true,
"parenStart": 259
}
}
},
{
"type": "BinaryExpression",
"start": 269,
"end": 281,
"loc": {
"start": {
"line": 5,
"column": 38
},
"end": {
"line": 5,
"column": 50
}
},
"left": {
"type": "Identifier",
"start": 269,
"end": 270,
"loc": {
"start": {
"line": 5,
"column": 38
},
"end": {
"line": 5,
"column": 39
},
"identifierName": "y"
},
"name": "y"
},
"operator": "+",
"right": {
"type": "BinaryExpression",
"start": 274,
"end": 280,
"loc": {
"start": {
"line": 5,
"column": 43
},
"end": {
"line": 5,
"column": 49
}
},
"left": {
"type": "Identifier",
"start": 274,
"end": 275,
"loc": {
"start": {
"line": 5,
"column": 43
},
"end": {
"line": 5,
"column": 44
},
"identifierName": "h"
},
"name": "h"
},
"operator": "*",
"right": {
"type": "NumericLiteral",
"start": 278,
"end": 280,
"loc": {
"start": {
"line": 5,
"column": 47
},
"end": {
"line": 5,
"column": 49
}
},
"extra": {
"rawValue": 0.1,
"raw": ".1"
},
"value": 0.1
},
"extra": {
"parenthesized": true,
"parenStart": 273
}
}
},
{
"type": "Identifier",
"start": 283,
"end": 284,
"loc": {
"start": {
"line": 5,
"column": 52
},
"end": {
"line": 5,
"column": 53
},
"identifierName": "w"
},
"name": "w"
},
{
"type": "BinaryExpression",
"start": 286,
"end": 292,
"loc": {
"start": {
"line": 5,
"column": 55
},
"end": {
"line": 5,
"column": 61
}
},
"left": {
"type": "Identifier",
"start": 286,
"end": 287,
"loc": {
"start": {
"line": 5,
"column": 55
},
"end": {
"line": 5,
"column": 56
},
"identifierName": "h"
},
"name": "h"
},
"operator": "*",
"right": {
"type": "NumericLiteral",
"start": 290,
"end": 292,
"loc": {
"start": {
"line": 5,
"column": 59
},
"end": {
"line": 5,
"column": 61
}
},
"extra": {
"rawValue": 0.8,
"raw": ".8"
},
"value": 0.8
}
},
{
"type": "Identifier",
"start": 294,
"end": 298,
"loc": {
"start": {
"line": 5,
"column": 63
},
"end": {
"line": 5,
"column": 67
},
"identifierName": "text"
},
"name": "text"
}
]
}
},
{
"type": "ExpressionStatement",
"start": 310,
"end": 392,
"loc": {
"start": {
"line": 7,
"column": 8
},
"end": {
"line": 7,
"column": 90
}
},
"expression": {
"type": "AssignmentExpression",
"start": 310,
"end": 391,
"loc": {
"start": {
"line": 7,
"column": 8
},
"end": {
"line": 7,
"column": 89
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 310,
"end": 327,
"loc": {
"start": {
"line": 7,
"column": 8
},
"end": {
"line": 7,
"column": 25
}
},
"object": {
"type": "ThisExpression",
"start": 310,
"end": 314,
"loc": {
"start": {
"line": 7,
"column": 8
},
"end": {
"line": 7,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 315,
"end": 327,
"loc": {
"start": {
"line": 7,
"column": 13
},
"end": {
"line": 7,
"column": 25
},
"identifierName": "buttonObject"
},
"name": "buttonObject"
},
"computed": false
},
"right": {
"type": "NewExpression",
"start": 330,
"end": 391,
"loc": {
"start": {
"line": 7,
"column": 28
},
"end": {
"line": 7,
"column": 89
}
},
"callee": {
"type": "Identifier",
"start": 334,
"end": 341,
"loc": {
"start": {
"line": 7,
"column": 32
},
"end": {
"line": 7,
"column": 39
},
"identifierName": "UIPanel"
},
"name": "UIPanel"
},
"arguments": [
{
"type": "Identifier",
"start": 342,
"end": 350,
"loc": {
"start": {
"line": 7,
"column": 40
},
"end": {
"line": 7,
"column": 48
},
"identifierName": "viewport"
},
"name": "viewport"
},
{
"type": "Identifier",
"start": 352,
"end": 353,
"loc": {
"start": {
"line": 7,
"column": 50
},
"end": {
"line": 7,
"column": 51
},
"identifierName": "x"
},
"name": "x"
},
{
"type": "Identifier",
"start": 355,
"end": 356,
"loc": {
"start": {
"line": 7,
"column": 53
},
"end": {
"line": 7,
"column": 54
},
"identifierName": "y"
},
"name": "y"
},
{
"type": "Identifier",
"start": 358,
"end": 359,
"loc": {
"start": {
"line": 7,
"column": 56
},
"end": {
"line": 7,
"column": 57
},
"identifierName": "w"
},
"name": "w"
},
{
"type": "Identifier",
"start": 361,
"end": 362,
"loc": {
"start": {
"line": 7,
"column": 59
},
"end": {
"line": 7,
"column": 60
},
"identifierName": "h"
},
"name": "h"
},
{
"type": "MemberExpression",
"start": 364,
"end": 390,
"loc": {
"start": {
"line": 7,
"column": 62
},
"end": {
"line": 7,
"column": 88
}
},
"object": {
"type": "MemberExpression",
"start": 364,
"end": 376,
"loc": {
"start": {
"line": 7,
"column": 62
},
"end": {
"line": 7,
"column": 74
}
},
"object": {
"type": "ThisExpression",
"start": 364,
"end": 368,
"loc": {
"start": {
"line": 7,
"column": 62
},
"end": {
"line": 7,
"column": 66
}
}
},
"property": {
"type": "Identifier",
"start": 369,
"end": 376,
"loc": {
"start": {
"line": 7,
"column": 67
},
"end": {
"line": 7,
"column": 74
},
"identifierName": "uiStyle"
},
"name": "uiStyle"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 377,
"end": 390,
"loc": {
"start": {
"line": 7,
"column": 75
},
"end": {
"line": 7,
"column": 88
},
"identifierName": "buttonTexture"
},
"name": "buttonTexture"
},
"computed": false
}
]
}
}
},
{
"type": "ExpressionStatement",
"start": 401,
"end": 460,
"loc": {
"start": {
"line": 8,
"column": 8
},
"end": {
"line": 8,
"column": 67
}
},
"expression": {
"type": "CallExpression",
"start": 401,
"end": 459,
"loc": {
"start": {
"line": 8,
"column": 8
},
"end": {
"line": 8,
"column": 66
}
},
"callee": {
"type": "MemberExpression",
"start": 401,
"end": 430,
"loc": {
"start": {
"line": 8,
"column": 8
},
"end": {
"line": 8,
"column": 37
}
},
"object": {
"type": "MemberExpression",
"start": 401,
"end": 418,
"loc": {
"start": {
"line": 8,
"column": 8
},
"end": {
"line": 8,
"column": 25
}
},
"object": {
"type": "ThisExpression",
"start": 401,
"end": 405,
"loc": {
"start": {
"line": 8,
"column": 8
},
"end": {
"line": 8,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 406,
"end": 418,
"loc": {
"start": {
"line": 8,
"column": 13
},
"end": {
"line": 8,
"column": 25
},
"identifierName": "buttonObject"
},
"name": "buttonObject"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 419,
"end": 430,
"loc": {
"start": {
"line": 8,
"column": 26
},
"end": {
"line": 8,
"column": 37
},
"identifierName": "setSubIndex"
},
"name": "setSubIndex"
},
"computed": false
},
"arguments": [
{
"type": "MemberExpression",
"start": 431,
"end": 458,
"loc": {
"start": {
"line": 8,
"column": 38
},
"end": {
"line": 8,
"column": 65
}
},
"object": {
"type": "MemberExpression",
"start": 431,
"end": 443,
"loc": {
"start": {
"line": 8,
"column": 38
},
"end": {
"line": 8,
"column": 50
}
},