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,464 lines (1,463 loc) • 359 kB
JSON
{
"type": "File",
"start": 0,
"end": 1492,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 51,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1492,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 51,
"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": "TextureManager"
},
"name": "TextureManager"
},
"local": {
"type": "Identifier",
"start": 82,
"end": 96,
"loc": {
"start": {
"line": 1,
"column": 82
},
"end": {
"line": 1,
"column": 96
},
"identifierName": "TextureManager"
},
"name": "TextureManager"
}
}
],
"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": 1492,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 51,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 135,
"end": 1492,
"loc": {
"start": {
"line": 3,
"column": 15
},
"end": {
"line": 51,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 141,
"end": 148,
"loc": {
"start": {
"line": 3,
"column": 21
},
"end": {
"line": 3,
"column": 28
},
"identifierName": "UIPanel"
},
"name": "UIPanel"
},
"superClass": {
"type": "Identifier",
"start": 157,
"end": 166,
"loc": {
"start": {
"line": 3,
"column": 37
},
"end": {
"line": 3,
"column": 46
},
"identifierName": "UIElement"
},
"name": "UIElement"
},
"body": {
"type": "ClassBody",
"start": 167,
"end": 1492,
"loc": {
"start": {
"line": 3,
"column": 47
},
"end": {
"line": 51,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 173,
"end": 665,
"loc": {
"start": {
"line": 4,
"column": 4
},
"end": {
"line": 13,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 173,
"end": 184,
"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": 185,
"end": 193,
"loc": {
"start": {
"line": 4,
"column": 16
},
"end": {
"line": 4,
"column": 24
},
"identifierName": "viewport"
},
"name": "viewport"
},
{
"type": "Identifier",
"start": 195,
"end": 196,
"loc": {
"start": {
"line": 4,
"column": 26
},
"end": {
"line": 4,
"column": 27
},
"identifierName": "x"
},
"name": "x"
},
{
"type": "Identifier",
"start": 198,
"end": 199,
"loc": {
"start": {
"line": 4,
"column": 29
},
"end": {
"line": 4,
"column": 30
},
"identifierName": "y"
},
"name": "y"
},
{
"type": "Identifier",
"start": 201,
"end": 202,
"loc": {
"start": {
"line": 4,
"column": 32
},
"end": {
"line": 4,
"column": 33
},
"identifierName": "w"
},
"name": "w"
},
{
"type": "Identifier",
"start": 204,
"end": 205,
"loc": {
"start": {
"line": 4,
"column": 35
},
"end": {
"line": 4,
"column": 36
},
"identifierName": "h"
},
"name": "h"
},
{
"type": "Identifier",
"start": 207,
"end": 214,
"loc": {
"start": {
"line": 4,
"column": 38
},
"end": {
"line": 4,
"column": 45
},
"identifierName": "texture"
},
"name": "texture"
}
],
"body": {
"type": "BlockStatement",
"start": 216,
"end": 665,
"loc": {
"start": {
"line": 4,
"column": 47
},
"end": {
"line": 13,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 226,
"end": 275,
"loc": {
"start": {
"line": 5,
"column": 8
},
"end": {
"line": 5,
"column": 57
}
},
"expression": {
"type": "CallExpression",
"start": 226,
"end": 274,
"loc": {
"start": {
"line": 5,
"column": 8
},
"end": {
"line": 5,
"column": 56
}
},
"callee": {
"type": "Super",
"start": 226,
"end": 231,
"loc": {
"start": {
"line": 5,
"column": 8
},
"end": {
"line": 5,
"column": 13
}
}
},
"arguments": [
{
"type": "NewExpression",
"start": 232,
"end": 250,
"loc": {
"start": {
"line": 5,
"column": 14
},
"end": {
"line": 5,
"column": 32
}
},
"callee": {
"type": "Identifier",
"start": 236,
"end": 241,
"loc": {
"start": {
"line": 5,
"column": 18
},
"end": {
"line": 5,
"column": 23
},
"identifierName": "Point"
},
"name": "Point"
},
"arguments": [
{
"type": "Identifier",
"start": 242,
"end": 243,
"loc": {
"start": {
"line": 5,
"column": 24
},
"end": {
"line": 5,
"column": 25
},
"identifierName": "x"
},
"name": "x"
},
{
"type": "Identifier",
"start": 245,
"end": 246,
"loc": {
"start": {
"line": 5,
"column": 27
},
"end": {
"line": 5,
"column": 28
},
"identifierName": "y"
},
"name": "y"
},
{
"type": "NumericLiteral",
"start": 248,
"end": 249,
"loc": {
"start": {
"line": 5,
"column": 30
},
"end": {
"line": 5,
"column": 31
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
]
},
{
"type": "NewExpression",
"start": 252,
"end": 270,
"loc": {
"start": {
"line": 5,
"column": 34
},
"end": {
"line": 5,
"column": 52
}
},
"callee": {
"type": "Identifier",
"start": 256,
"end": 261,
"loc": {
"start": {
"line": 5,
"column": 38
},
"end": {
"line": 5,
"column": 43
},
"identifierName": "Point"
},
"name": "Point"
},
"arguments": [
{
"type": "Identifier",
"start": 262,
"end": 263,
"loc": {
"start": {
"line": 5,
"column": 44
},
"end": {
"line": 5,
"column": 45
},
"identifierName": "w"
},
"name": "w"
},
{
"type": "Identifier",
"start": 265,
"end": 266,
"loc": {
"start": {
"line": 5,
"column": 47
},
"end": {
"line": 5,
"column": 48
},
"identifierName": "h"
},
"name": "h"
},
{
"type": "NumericLiteral",
"start": 268,
"end": 269,
"loc": {
"start": {
"line": 5,
"column": 50
},
"end": {
"line": 5,
"column": 51
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
]
},
{
"type": "NumericLiteral",
"start": 272,
"end": 273,
"loc": {
"start": {
"line": 5,
"column": 54
},
"end": {
"line": 5,
"column": 55
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
]
}
},
{
"type": "ExpressionStatement",
"start": 285,
"end": 363,
"loc": {
"start": {
"line": 7,
"column": 8
},
"end": {
"line": 7,
"column": 86
}
},
"expression": {
"type": "AssignmentExpression",
"start": 285,
"end": 362,
"loc": {
"start": {
"line": 7,
"column": 8
},
"end": {
"line": 7,
"column": 85
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 285,
"end": 301,
"loc": {
"start": {
"line": 7,
"column": 8
},
"end": {
"line": 7,
"column": 24
}
},
"object": {
"type": "ThisExpression",
"start": 285,
"end": 289,
"loc": {
"start": {
"line": 7,
"column": 8
},
"end": {
"line": 7,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 290,
"end": 301,
"loc": {
"start": {
"line": 7,
"column": 13
},
"end": {
"line": 7,
"column": 24
},
"identifierName": "panelObject"
},
"name": "panelObject"
},
"computed": false
},
"right": {
"type": "NewExpression",
"start": 304,
"end": 362,
"loc": {
"start": {
"line": 7,
"column": 27
},
"end": {
"line": 7,
"column": 85
}
},
"callee": {
"type": "Identifier",
"start": 308,
"end": 319,
"loc": {
"start": {
"line": 7,
"column": 31
},
"end": {
"line": 7,
"column": 42
},
"identifierName": "SceneObject"
},
"name": "SceneObject"
},
"arguments": [
{
"type": "NewExpression",
"start": 320,
"end": 338,
"loc": {
"start": {
"line": 7,
"column": 43
},
"end": {
"line": 7,
"column": 61
}
},
"callee": {
"type": "Identifier",
"start": 324,
"end": 329,
"loc": {
"start": {
"line": 7,
"column": 47
},
"end": {
"line": 7,
"column": 52
},
"identifierName": "Point"
},
"name": "Point"
},
"arguments": [
{
"type": "Identifier",
"start": 330,
"end": 331,
"loc": {
"start": {
"line": 7,
"column": 53
},
"end": {
"line": 7,
"column": 54
},
"identifierName": "x"
},
"name": "x"
},
{
"type": "Identifier",
"start": 333,
"end": 334,
"loc": {
"start": {
"line": 7,
"column": 56
},
"end": {
"line": 7,
"column": 57
},
"identifierName": "y"
},
"name": "y"
},
{
"type": "NumericLiteral",
"start": 336,
"end": 337,
"loc": {
"start": {
"line": 7,
"column": 59
},
"end": {
"line": 7,
"column": 60
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
]
},
{
"type": "NewExpression",
"start": 340,
"end": 358,
"loc": {
"start": {
"line": 7,
"column": 63
},
"end": {
"line": 7,
"column": 81
}
},
"callee": {
"type": "Identifier",
"start": 344,
"end": 349,
"loc": {
"start": {
"line": 7,
"column": 67
},
"end": {
"line": 7,
"column": 72
},
"identifierName": "Point"
},
"name": "Point"
},
"arguments": [
{
"type": "Identifier",
"start": 350,
"end": 351,
"loc": {
"start": {
"line": 7,
"column": 73
},
"end": {
"line": 7,
"column": 74
},
"identifierName": "w"
},
"name": "w"
},
{
"type": "Identifier",
"start": 353,
"end": 354,
"loc": {
"start": {
"line": 7,
"column": 76
},
"end": {
"line": 7,
"column": 77
},
"identifierName": "h"
},
"name": "h"
},
{
"type": "NumericLiteral",
"start": 356,
"end": 357,
"loc": {
"start": {
"line": 7,
"column": 79
},
"end": {
"line": 7,
"column": 80
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
]
},
{
"type": "NumericLiteral",
"start": 360,
"end": 361,
"loc": {
"start": {
"line": 7,
"column": 83
},
"end": {
"line": 7,
"column": 84
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
]
}
}
},
{
"type": "ExpressionStatement",
"start": 372,
"end": 421,
"loc": {
"start": {
"line": 8,
"column": 8
},
"end": {
"line": 8,
"column": 57
}
},
"expression": {
"type": "AssignmentExpression",
"start": 372,
"end": 420,
"loc": {
"start": {
"line": 8,
"column": 8
},
"end": {
"line": 8,
"column": 56
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 372,
"end": 399,
"loc": {
"start": {
"line": 8,
"column": 8
},
"end": {
"line": 8,
"column": 35
}
},
"object": {
"type": "MemberExpression",
"start": 372,
"end": 388,
"loc": {
"start": {
"line": 8,
"column": 8
},
"end": {
"line": 8,
"column": 24
}
},
"object": {
"type": "ThisExpression",
"start": 372,
"end": 376,
"loc": {
"start": {
"line": 8,
"column": 8
},
"end": {
"line": 8,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 377,
"end": 388,
"loc": {
"start": {
"line": 8,
"column": 13
},
"end": {
"line": 8,
"column": 24
},
"identifierName": "panelObject"
},
"name": "panelObject"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 389,
"end": 399,
"loc": {
"start": {
"line": 8,
"column": 25
},
"end": {
"line": 8,
"column": 35
},
"identifierName": "renderable"
},
"name": "renderable"
},
"computed": false
},
"right": {
"type": "NewExpression",
"start": 402,
"end": 420,
"loc": {
"start": {
"line": 8,
"column": 38
},
"end": {
"line": 8,
"column": 56
}
},
"callee": {
"type": "Identifier",
"start": 406,
"end": 418,
"loc": {
"start": {
"line": 8,
"column": 42
},
"end": {
"line": 8,
"column": 54
},
"identifierName": "Renderable2D"
},
"name": "Renderable2D"
},
"arguments": []
}
}
},
{
"type": "ExpressionStatement",
"start": 430,
"end": 489,
"loc": {
"start": {
"line": 9,
"column": 8
},
"end": {
"line": 9,
"column": 67
}
},
"expression": {
"type": "CallExpression",
"start": 430,
"end": 488,
"loc": {
"start": {
"line": 9,
"column": 8
},
"end": {
"line": 9,
"column": 66
}
},
"callee": {
"type": "MemberExpression",
"start": 430,
"end": 459,
"loc": {
"start": {
"line": 9,
"column": 8
},
"end": {
"line": 9,
"column": 37
}
},
"object": {
"type": "MemberExpression",
"start": 430,
"end": 446,
"loc": {
"start": {
"line": 9,
"column": 8
},
"end": {
"line": 9,
"column": 24
}
},
"object": {
"type": "ThisExpression",
"start": 430,
"end": 434,
"loc": {
"start": {
"line": 9,
"column": 8
},
"end": {
"line": 9,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 435,
"end": 446,
"loc": {
"start": {
"line": 9,
"column": 13
},
"end": {
"line": 9,
"column": 24
},
"identifierName": "panelObject"
},
"name": "panelObject"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 447,
"end": 459,
"loc": {
"start": {
"line": 9,
"column": 25
},
"end": {
"line": 9,
"column": 37
},
"identifierName": "addComponent"
},
"name": "addComponent"
},
"computed": false
},
"arguments": [
{
"type": "MemberExpression",
"start": 460,
"end": 487,
"loc": {
"start": {
"line": 9,
"column": 38
},
"end": {
"line": 9,
"column": 65