oxygen-core
Version:
Oxygen game engine (Xenon Core for browsers)
1,468 lines • 817 kB
JSON
{
"type": "File",
"start": 0,
"end": 5148,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 234,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 5148,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 234,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 34
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 15
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "Camera2D"
},
"name": "Camera2D"
}
}
],
"source": {
"type": "StringLiteral",
"start": 21,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 33
}
},
"extra": {
"rawValue": "./Camera2D",
"raw": "'./Camera2D'"
},
"value": "./Camera2D"
}
},
{
"type": "ImportDeclaration",
"start": 36,
"end": 94,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 58
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 43,
"end": 52,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 16
}
},
"local": {
"type": "Identifier",
"start": 43,
"end": 52,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 16
},
"identifierName": "Component"
},
"name": "Component"
}
}
],
"source": {
"type": "StringLiteral",
"start": 58,
"end": 93,
"loc": {
"start": {
"line": 2,
"column": 22
},
"end": {
"line": 2,
"column": 57
}
},
"extra": {
"rawValue": "../systems/EntitySystem/Component",
"raw": "'../systems/EntitySystem/Component'"
},
"value": "../systems/EntitySystem/Component"
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Control multiple 2D cameras with one director.\r\n *\r\n * @example\r\n * const component = new CameraDirector2D();\r\n * component.deserialize({ zoomOut: 1024, zoomMode: 'keep-aspect', cameras: [ './cameraA', './cameraB' ] });\r\n ",
"start": 98,
"end": 330,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 10,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 332,
"end": 5146,
"loc": {
"start": {
"line": 11,
"column": 0
},
"end": {
"line": 233,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 347,
"end": 5146,
"loc": {
"start": {
"line": 11,
"column": 15
},
"end": {
"line": 233,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 353,
"end": 369,
"loc": {
"start": {
"line": 11,
"column": 21
},
"end": {
"line": 11,
"column": 37
},
"identifierName": "CameraDirector2D"
},
"name": "CameraDirector2D",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 378,
"end": 387,
"loc": {
"start": {
"line": 11,
"column": 46
},
"end": {
"line": 11,
"column": 55
},
"identifierName": "Component"
},
"name": "Component"
},
"body": {
"type": "ClassBody",
"start": 388,
"end": 5146,
"loc": {
"start": {
"line": 11,
"column": 56
},
"end": {
"line": 233,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 493,
"end": 552,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 20,
"column": 3
}
},
"static": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 500,
"end": 507,
"loc": {
"start": {
"line": 18,
"column": 9
},
"end": {
"line": 18,
"column": 16
},
"identifierName": "factory"
},
"name": "factory"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 510,
"end": 552,
"loc": {
"start": {
"line": 18,
"column": 19
},
"end": {
"line": 20,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 517,
"end": 547,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 34
}
},
"argument": {
"type": "NewExpression",
"start": 524,
"end": 546,
"loc": {
"start": {
"line": 19,
"column": 11
},
"end": {
"line": 19,
"column": 33
}
},
"callee": {
"type": "Identifier",
"start": 528,
"end": 544,
"loc": {
"start": {
"line": 19,
"column": 15
},
"end": {
"line": 19,
"column": 31
},
"identifierName": "CameraDirector2D"
},
"name": "CameraDirector2D"
},
"arguments": []
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Componeny factory.\r\n *\r\n * @return {CameraDirector2D} Component instance.\r\n ",
"start": 395,
"end": 489,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 17,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {*} ",
"start": 558,
"end": 574,
"loc": {
"start": {
"line": 22,
"column": 2
},
"end": {
"line": 22,
"column": 18
}
}
}
]
},
{
"type": "ClassMethod",
"start": 578,
"end": 878,
"loc": {
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 34,
"column": 3
}
},
"static": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 589,
"end": 599,
"loc": {
"start": {
"line": 23,
"column": 13
},
"end": {
"line": 23,
"column": 23
},
"identifierName": "propsTypes"
},
"name": "propsTypes"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 602,
"end": 878,
"loc": {
"start": {
"line": 23,
"column": 26
},
"end": {
"line": 34,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 609,
"end": 873,
"loc": {
"start": {
"line": 24,
"column": 4
},
"end": {
"line": 33,
"column": 6
}
},
"argument": {
"type": "ObjectExpression",
"start": 616,
"end": 872,
"loc": {
"start": {
"line": 24,
"column": 11
},
"end": {
"line": 33,
"column": 5
}
},
"properties": [
{
"type": "SpreadProperty",
"start": 625,
"end": 648,
"loc": {
"start": {
"line": 25,
"column": 6
},
"end": {
"line": 25,
"column": 29
}
},
"argument": {
"type": "MemberExpression",
"start": 628,
"end": 648,
"loc": {
"start": {
"line": 25,
"column": 9
},
"end": {
"line": 25,
"column": 29
}
},
"object": {
"type": "Identifier",
"start": 628,
"end": 637,
"loc": {
"start": {
"line": 25,
"column": 9
},
"end": {
"line": 25,
"column": 18
},
"identifierName": "Component"
},
"name": "Component"
},
"property": {
"type": "Identifier",
"start": 638,
"end": 648,
"loc": {
"start": {
"line": 25,
"column": 19
},
"end": {
"line": 25,
"column": 29
},
"identifierName": "propsTypes"
},
"name": "propsTypes"
},
"computed": false
}
},
{
"type": "ObjectProperty",
"start": 657,
"end": 671,
"loc": {
"start": {
"line": 26,
"column": 6
},
"end": {
"line": 26,
"column": 20
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 657,
"end": 661,
"loc": {
"start": {
"line": 26,
"column": 6
},
"end": {
"line": 26,
"column": 10
},
"identifierName": "zoom"
},
"name": "zoom"
},
"value": {
"type": "StringLiteral",
"start": 663,
"end": 671,
"loc": {
"start": {
"line": 26,
"column": 12
},
"end": {
"line": 26,
"column": 20
}
},
"extra": {
"rawValue": "number",
"raw": "'number'"
},
"value": "number"
}
},
{
"type": "ObjectProperty",
"start": 680,
"end": 697,
"loc": {
"start": {
"line": 27,
"column": 6
},
"end": {
"line": 27,
"column": 23
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 680,
"end": 687,
"loc": {
"start": {
"line": 27,
"column": 6
},
"end": {
"line": 27,
"column": 13
},
"identifierName": "zoomOut"
},
"name": "zoomOut"
},
"value": {
"type": "StringLiteral",
"start": 689,
"end": 697,
"loc": {
"start": {
"line": 27,
"column": 15
},
"end": {
"line": 27,
"column": 23
}
},
"extra": {
"rawValue": "number",
"raw": "'number'"
},
"value": "number"
}
},
{
"type": "ObjectProperty",
"start": 706,
"end": 720,
"loc": {
"start": {
"line": 28,
"column": 6
},
"end": {
"line": 28,
"column": 20
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 706,
"end": 710,
"loc": {
"start": {
"line": 28,
"column": 6
},
"end": {
"line": 28,
"column": 10
},
"identifierName": "near"
},
"name": "near"
},
"value": {
"type": "StringLiteral",
"start": 712,
"end": 720,
"loc": {
"start": {
"line": 28,
"column": 12
},
"end": {
"line": 28,
"column": 20
}
},
"extra": {
"rawValue": "number",
"raw": "'number'"
},
"value": "number"
}
},
{
"type": "ObjectProperty",
"start": 729,
"end": 742,
"loc": {
"start": {
"line": 29,
"column": 6
},
"end": {
"line": 29,
"column": 19
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 729,
"end": 732,
"loc": {
"start": {
"line": 29,
"column": 6
},
"end": {
"line": 29,
"column": 9
},
"identifierName": "far"
},
"name": "far"
},
"value": {
"type": "StringLiteral",
"start": 734,
"end": 742,
"loc": {
"start": {
"line": 29,
"column": 11
},
"end": {
"line": 29,
"column": 19
}
},
"extra": {
"rawValue": "number",
"raw": "'number'"
},
"value": "number"
}
},
{
"type": "ObjectProperty",
"start": 751,
"end": 795,
"loc": {
"start": {
"line": 30,
"column": 6
},
"end": {
"line": 30,
"column": 50
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 751,
"end": 759,
"loc": {
"start": {
"line": 30,
"column": 6
},
"end": {
"line": 30,
"column": 14
},
"identifierName": "zoomMode"
},
"name": "zoomMode"
},
"value": {
"type": "StringLiteral",
"start": 761,
"end": 795,
"loc": {
"start": {
"line": 30,
"column": 16
},
"end": {
"line": 30,
"column": 50
}
},
"extra": {
"rawValue": "enum(pixel-perfect, keep-aspect)",
"raw": "'enum(pixel-perfect, keep-aspect)'"
},
"value": "enum(pixel-perfect, keep-aspect)"
}
},
{
"type": "ObjectProperty",
"start": 804,
"end": 832,
"loc": {
"start": {
"line": 31,
"column": 6
},
"end": {
"line": 31,
"column": 34
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 804,
"end": 817,
"loc": {
"start": {
"line": 31,
"column": 6
},
"end": {
"line": 31,
"column": 19
},
"identifierName": "captureEntity"
},
"name": "captureEntity"
},
"value": {
"type": "StringLiteral",
"start": 819,
"end": 832,
"loc": {
"start": {
"line": 31,
"column": 21
},
"end": {
"line": 31,
"column": 34
}
},
"extra": {
"rawValue": "string_null",
"raw": "'string_null'"
},
"value": "string_null"
}
},
{
"type": "ObjectProperty",
"start": 841,
"end": 865,
"loc": {
"start": {
"line": 32,
"column": 6
},
"end": {
"line": 32,
"column": 30
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 841,
"end": 848,
"loc": {
"start": {
"line": 32,
"column": 6
},
"end": {
"line": 32,
"column": 13
},
"identifierName": "cameras"
},
"name": "cameras"
},
"value": {
"type": "StringLiteral",
"start": 850,
"end": 865,
"loc": {
"start": {
"line": 32,
"column": 15
},
"end": {
"line": 32,
"column": 30
}
},
"extra": {
"rawValue": "array(string)",
"raw": "'array(string)'"
},
"value": "array(string)"
}
}
]
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {*} ",
"start": 558,
"end": 574,
"loc": {
"start": {
"line": 22,
"column": 2
},
"end": {
"line": 22,
"column": 18
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {*} ",
"start": 884,
"end": 900,
"loc": {
"start": {
"line": 36,
"column": 2
},
"end": {
"line": 36,
"column": 18
}
}
}
]
},
{
"type": "ClassMethod",
"start": 904,
"end": 963,
"loc": {
"start": {
"line": 37,
"column": 2
},
"end": {
"line": 39,
"column": 3
}
},
"static": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 915,
"end": 923,
"loc": {
"start": {
"line": 37,
"column": 13
},
"end": {
"line": 37,
"column": 21
},
"identifierName": "ZoomMode"
},
"name": "ZoomMode"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 926,
"end": 963,
"loc": {
"start": {
"line": 37,
"column": 24
},
"end": {
"line": 39,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 933,
"end": 958,
"loc": {
"start": {
"line": 38,
"column": 4
},
"end": {
"line": 38,
"column": 29
}
},
"argument": {
"type": "MemberExpression",
"start": 940,
"end": 957,
"loc": {
"start": {
"line": 38,
"column": 11
},
"end": {
"line": 38,
"column": 28
}
},
"object": {
"type": "Identifier",
"start": 940,
"end": 948,
"loc": {
"start": {
"line": 38,
"column": 11
},
"end": {
"line": 38,
"column": 19
},
"identifierName": "Camera2D"
},
"name": "Camera2D"
},
"property": {
"type": "Identifier",
"start": 949,
"end": 957,
"loc": {
"start": {
"line": 38,
"column": 20
},
"end": {
"line": 38,
"column": 28
},
"identifierName": "ZoomMode"
},
"name": "ZoomMode"
},
"computed": false
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {*} ",
"start": 884,
"end": 900,
"loc": {
"start": {
"line": 36,
"column": 2
},
"end": {
"line": 36,
"column": 18
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {number} ",
"start": 969,
"end": 990,
"loc": {
"start": {
"line": 41,
"column": 2
},
"end": {
"line": 41,
"column": 23
}
}
}
]
},
{
"type": "ClassMethod",
"start": 994,
"end": 1035,
"loc": {
"start": {
"line": 42,
"column": 2
},
"end": {
"line": 44,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 998,
"end": 1002,
"loc": {
"start": {
"line": 42,
"column": 6
},
"end": {
"line": 42,
"column": 10
},
"identifierName": "zoom"
},
"name": "zoom"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 1005,
"end": 1035,
"loc": {
"start": {
"line": 42,
"column": 13
},
"end": {
"line": 44,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1012,
"end": 1030,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 22
}
},
"argument": {
"type": "MemberExpression",
"start": 1019,
"end": 1029,
"loc": {
"start": {
"line": 43,
"column": 11
},
"end": {
"line": 43,
"column": 21
}
},
"object": {
"type": "ThisExpression",
"start": 1019,
"end": 1023,
"loc": {
"start": {
"line": 43,
"column": 11
},
"end": {
"line": 43,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 1024,
"end": 1029,
"loc": {
"start": {
"line": 43,
"column": 16
},
"end": {
"line": 43,
"column": 21
},
"identifierName": "_zoom"
},
"name": "_zoom"
},
"computed": false
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {number} ",
"start": 969,
"end": 990,
"loc": {
"start": {
"line": 41,
"column": 2
},
"end": {
"line": 41,
"column": 23
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {number} ",
"start": 1041,
"end": 1062,
"loc": {
"start": {
"line": 46,
"column": 2
},
"end": {
"line": 46,
"column": 23
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1066,
"end": 1217,
"loc": {
"start": {
"line": 47,
"column": 2
},
"end": {
"line": 53,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1070,
"end": 1074,
"loc": {
"start": {
"line": 47,
"column": 6
},
"end": {
"line": 47,
"column": 10
},
"identifierName": "zoom"
},
"name": "zoom"
},
"kind": "set",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1075,
"end": 1080,
"loc": {
"start": {
"line": 47,
"column": 11
},
"end": {
"line": 47,
"column": 16
},
"identifierName": "value"
},
"name": "value"
}
],
"body": {
"type": "BlockStatement",
"start": 1082,
"end": 1217,
"loc": {
"start": {
"line": 47,
"column": 18
},
"end": {
"line": 53,
"column": 3
}
},
"body": [
{
"type": "IfStatement",
"start": 1089,
"end": 1185,
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 50,
"column": 5
}
},
"test": {
"type": "BinaryExpression",
"start": 1093,
"end": 1118,
"loc": {
"start": {
"line": 48,
"column": 8
},
"end": {
"line": 48,
"column": 33
}
},
"left": {
"type": "UnaryExpression",
"start": 1093,
"end": 1105,
"loc": {
"start": {
"line": 48,
"column": 8
},
"end": {
"line": 48,
"column": 20
}
},
"operator": "typeof",
"prefix": true,
"argument": {
"type": "Identifier",
"start": 1100,
"end": 1105,
"loc": {
"start": {
"line": 48,
"column": 15
},
"end": {
"line": 48,
"column": 20
},
"identifierName": "value"
},
"name": "value"
},
"extra": {
"parenthesizedArgument": false
}
},
"operator": "!==",
"right": {
"type": "StringLiteral",
"start": 1110,
"end": 1118,
"loc": {
"start": {
"line": 48,
"column": 25
},
"end": {
"line": 48,
"column": 33
}
},
"extra": {
"rawValue": "number",
"raw": "'number'"
},
"value": "number"
}
},
"consequent": {
"type": "BlockStatement",
"start": 1120,
"end": 1185,
"loc": {
"start": {
"line": 48,