@defold-typescript/types 0.51.0 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-availability.json +4 -58
- package/api-signatures.json +2804 -3172
- package/api-targets.json +15 -5
- package/examples/translations.json +19 -71
- package/generated/b2d.d.ts +39 -39
- package/generated/b2d_body.d.ts +11 -11
- package/generated/b2d_chain.d.ts +3 -3
- package/generated/b2d_fixture.d.ts +5 -5
- package/generated/b2d_joint.d.ts +29 -29
- package/generated/b2d_shape.d.ts +13 -13
- package/generated/b2d_world.d.ts +15 -15
- package/generated/buffer.d.ts +10 -11
- package/generated/bullet3d.d.ts +6 -6
- package/generated/bullet3d_collision_object.d.ts +10 -10
- package/generated/bullet3d_constraint.d.ts +173 -71
- package/generated/bullet3d_rigid_body.d.ts +3 -3
- package/generated/bullet3d_shape.d.ts +11 -11
- package/generated/bullet3d_world.d.ts +20 -20
- package/generated/camera.d.ts +4 -4
- package/generated/collectionfactory.d.ts +2 -3
- package/generated/collectionproxy.d.ts +5 -5
- package/generated/compute.d.ts +5 -5
- package/generated/crash.d.ts +7 -7
- package/generated/editor-vm/http.d.ts +13 -13
- package/generated/editor-vm/image.d.ts +4 -4
- package/generated/editor-vm/json.d.ts +1 -1
- package/generated/editor-vm/tilemap_tiles.d.ts +9 -9
- package/generated/editor-vm/zip.d.ts +4 -4
- package/generated/editor.d.ts +183 -183
- package/generated/factory.d.ts +2 -3
- package/generated/font.d.ts +4 -4
- package/generated/go.d.ts +122 -230
- package/generated/graphics.d.ts +23 -25
- package/generated/gui.d.ts +186 -423
- package/generated/http.d.ts +3 -3
- package/generated/image.d.ts +63 -11
- package/generated/json.d.ts +4 -4
- package/generated/kinds/gui-script.d.ts +2 -0
- package/generated/kinds/render-script.d.ts +14 -15
- package/generated/label.d.ts +5 -5
- package/generated/liveupdate.d.ts +7 -3
- package/generated/material.d.ts +49 -49
- package/generated/model.d.ts +46 -14
- package/generated/particlefx.d.ts +24 -5
- package/generated/physics.d.ts +64 -20
- package/generated/profiler.d.ts +3 -5
- package/generated/render-script-modules/b2d.d.ts +711 -0
- package/generated/render-script-modules/bullet3d.d.ts +73 -0
- package/generated/render-script-modules/collectionfactory.d.ts +24 -0
- package/generated/render-script-modules/collectionproxy.d.ts +39 -0
- package/generated/render-script-modules/factory.d.ts +24 -0
- package/generated/render-script-modules/go.d.ts +434 -0
- package/generated/render-script-modules/label.d.ts +105 -0
- package/generated/render-script-modules/model.d.ts +121 -0
- package/generated/render-script-modules/particlefx.d.ts +59 -0
- package/generated/render-script-modules/physics.d.ts +333 -0
- package/generated/render-script-modules/resource.d.ts +1232 -0
- package/generated/render-script-modules/sound.d.ts +227 -0
- package/generated/render-script-modules/sprite.d.ts +68 -0
- package/generated/render-script-modules/tilemap.d.ts +43 -0
- package/generated/render.d.ts +172 -47
- package/generated/resource.d.ts +81 -61
- package/generated/socket.d.ts +18 -23
- package/generated/sound.d.ts +6 -6
- package/generated/sprite.d.ts +51 -3
- package/generated/sys.d.ts +87 -24
- package/generated/tilemap.d.ts +3 -3
- package/generated/timer.d.ts +3 -3
- package/generated/versions/defold-1.12.4/b2d.d.ts +2 -2
- package/generated/versions/defold-1.12.4/b2d_body.d.ts +2 -2
- package/generated/versions/defold-1.12.4/buffer.d.ts +8 -8
- package/generated/versions/defold-1.12.4/go.d.ts +117 -345
- package/generated/versions/defold-1.12.4/graphics.d.ts +2 -1
- package/generated/versions/defold-1.12.4/gui.d.ts +169 -532
- package/generated/versions/defold-1.12.4/http.d.ts +2 -2
- package/generated/versions/defold-1.12.4/image.d.ts +82 -2
- package/generated/versions/defold-1.12.4/index.d.ts +1 -0
- package/generated/versions/defold-1.12.4/label.d.ts +1 -1
- package/generated/versions/defold-1.12.4/liveupdate.d.ts +4 -0
- package/generated/versions/defold-1.12.4/model.d.ts +42 -10
- package/generated/versions/defold-1.12.4/particlefx.d.ts +23 -2
- package/generated/versions/defold-1.12.4/physics.d.ts +46 -2
- package/generated/versions/defold-1.12.4/render.d.ts +83 -7
- package/generated/versions/defold-1.12.4/resource.d.ts +50 -17
- package/generated/versions/defold-1.12.4/socket.d.ts +12 -12
- package/generated/versions/defold-1.12.4/sound.d.ts +1 -1
- package/generated/versions/defold-1.12.4/sprite.d.ts +59 -2
- package/generated/versions/defold-1.12.4/sys.d.ts +103 -8
- package/generated/versions/defold-1.12.4/tilemap.d.ts +1 -1
- package/generated/versions/defold-1.12.4/vmath.d.ts +0 -24
- package/generated/versions/defold-1.12.4/window.d.ts +3 -4
- package/generated/versions/defold-1.13.0/b2d.d.ts +2 -2
- package/generated/versions/defold-1.13.0/b2d_body.d.ts +2 -2
- package/generated/versions/defold-1.13.0/b2d_chain.d.ts +1 -1
- package/generated/versions/defold-1.13.0/b2d_joint.d.ts +1 -1
- package/generated/versions/defold-1.13.0/b2d_shape.d.ts +1 -1
- package/generated/versions/defold-1.13.0/buffer.d.ts +8 -8
- package/generated/versions/defold-1.13.0/camera.d.ts +1 -1
- package/generated/versions/defold-1.13.0/go.d.ts +117 -372
- package/generated/versions/defold-1.13.0/graphics.d.ts +2 -1
- package/generated/versions/defold-1.13.0/gui.d.ts +169 -532
- package/generated/versions/defold-1.13.0/http.d.ts +2 -2
- package/generated/versions/defold-1.13.0/image.d.ts +82 -2
- package/generated/versions/defold-1.13.0/index.d.ts +1 -0
- package/generated/versions/defold-1.13.0/label.d.ts +1 -1
- package/generated/versions/defold-1.13.0/liveupdate.d.ts +4 -0
- package/generated/versions/defold-1.13.0/material.d.ts +3 -1
- package/generated/versions/defold-1.13.0/model.d.ts +42 -10
- package/generated/versions/defold-1.13.0/particlefx.d.ts +23 -2
- package/generated/versions/defold-1.13.0/physics.d.ts +46 -2
- package/generated/versions/defold-1.13.0/render.d.ts +147 -9
- package/generated/versions/defold-1.13.0/resource.d.ts +50 -17
- package/generated/versions/defold-1.13.0/socket.d.ts +12 -12
- package/generated/versions/defold-1.13.0/sound.d.ts +1 -1
- package/generated/versions/defold-1.13.0/sprite.d.ts +59 -2
- package/generated/versions/defold-1.13.0/sys.d.ts +103 -8
- package/generated/versions/defold-1.13.0/tilemap.d.ts +1 -1
- package/generated/versions/defold-1.13.0/vmath.d.ts +0 -24
- package/generated/versions/defold-1.13.0/window.d.ts +3 -4
- package/generated/versions/defold-1.13.1/b2d.d.ts +2 -2
- package/generated/versions/defold-1.13.1/b2d_body.d.ts +2 -2
- package/generated/versions/defold-1.13.1/b2d_chain.d.ts +1 -1
- package/generated/versions/defold-1.13.1/b2d_joint.d.ts +1 -1
- package/generated/versions/defold-1.13.1/b2d_shape.d.ts +1 -1
- package/generated/versions/defold-1.13.1/buffer.d.ts +8 -8
- package/generated/versions/defold-1.13.1/camera.d.ts +1 -1
- package/generated/versions/defold-1.13.1/go.d.ts +117 -372
- package/generated/versions/defold-1.13.1/graphics.d.ts +2 -1
- package/generated/versions/defold-1.13.1/gui.d.ts +169 -548
- package/generated/versions/defold-1.13.1/http.d.ts +2 -2
- package/generated/versions/defold-1.13.1/image.d.ts +82 -2
- package/generated/versions/defold-1.13.1/index.d.ts +2 -0
- package/generated/versions/defold-1.13.1/label.d.ts +1 -1
- package/generated/versions/defold-1.13.1/liveupdate.d.ts +4 -0
- package/generated/versions/defold-1.13.1/material.d.ts +3 -1
- package/generated/versions/defold-1.13.1/model.d.ts +42 -10
- package/generated/versions/defold-1.13.1/particlefx.d.ts +23 -2
- package/generated/versions/defold-1.13.1/physics.d.ts +46 -2
- package/generated/versions/defold-1.13.1/render.d.ts +147 -9
- package/generated/versions/defold-1.13.1/resource.d.ts +50 -17
- package/generated/versions/defold-1.13.1/socket.d.ts +12 -12
- package/generated/versions/defold-1.13.1/sound.d.ts +1 -1
- package/generated/versions/defold-1.13.1/sprite.d.ts +59 -2
- package/generated/versions/defold-1.13.1/sys.d.ts +103 -8
- package/generated/versions/defold-1.13.1/tilemap.d.ts +1 -1
- package/generated/versions/defold-1.13.1/vmath.d.ts +0 -24
- package/generated/versions/defold-1.13.1/window.d.ts +3 -4
- package/generated/versions/defold-1.13.2/b2d.d.ts +39 -39
- package/generated/versions/defold-1.13.2/b2d_body.d.ts +11 -11
- package/generated/versions/defold-1.13.2/b2d_chain.d.ts +3 -3
- package/generated/versions/defold-1.13.2/b2d_fixture.d.ts +5 -5
- package/generated/versions/defold-1.13.2/b2d_joint.d.ts +29 -29
- package/generated/versions/defold-1.13.2/b2d_shape.d.ts +13 -13
- package/generated/versions/defold-1.13.2/b2d_world.d.ts +15 -15
- package/generated/versions/defold-1.13.2/buffer.d.ts +10 -11
- package/generated/versions/defold-1.13.2/bullet3d.d.ts +6 -6
- package/generated/versions/defold-1.13.2/bullet3d_collision_object.d.ts +10 -10
- package/generated/versions/defold-1.13.2/bullet3d_constraint.d.ts +173 -71
- package/generated/versions/defold-1.13.2/bullet3d_rigid_body.d.ts +3 -3
- package/generated/versions/defold-1.13.2/bullet3d_shape.d.ts +11 -11
- package/generated/versions/defold-1.13.2/bullet3d_world.d.ts +20 -20
- package/generated/versions/defold-1.13.2/camera.d.ts +4 -4
- package/generated/versions/defold-1.13.2/collectionfactory.d.ts +2 -3
- package/generated/versions/defold-1.13.2/collectionproxy.d.ts +5 -5
- package/generated/versions/defold-1.13.2/compute.d.ts +5 -5
- package/generated/versions/defold-1.13.2/crash.d.ts +7 -7
- package/generated/versions/defold-1.13.2/editor-vm/http.d.ts +13 -13
- package/generated/versions/defold-1.13.2/editor-vm/image.d.ts +4 -4
- package/generated/versions/defold-1.13.2/editor-vm/json.d.ts +1 -1
- package/generated/versions/defold-1.13.2/editor-vm/tilemap_tiles.d.ts +9 -9
- package/generated/versions/defold-1.13.2/editor-vm/zip.d.ts +4 -4
- package/generated/versions/defold-1.13.2/editor.d.ts +183 -183
- package/generated/versions/defold-1.13.2/factory.d.ts +2 -3
- package/generated/versions/defold-1.13.2/font.d.ts +4 -4
- package/generated/versions/defold-1.13.2/go.d.ts +122 -230
- package/generated/versions/defold-1.13.2/graphics.d.ts +22 -24
- package/generated/versions/defold-1.13.2/gui.d.ts +186 -423
- package/generated/versions/defold-1.13.2/http.d.ts +3 -3
- package/generated/versions/defold-1.13.2/image.d.ts +63 -11
- package/generated/versions/defold-1.13.2/index.d.ts +2 -0
- package/generated/versions/defold-1.13.2/json.d.ts +4 -4
- package/generated/versions/defold-1.13.2/label.d.ts +5 -5
- package/generated/versions/defold-1.13.2/liveupdate.d.ts +7 -3
- package/generated/versions/defold-1.13.2/material.d.ts +49 -49
- package/generated/versions/defold-1.13.2/model.d.ts +46 -14
- package/generated/versions/defold-1.13.2/particlefx.d.ts +24 -5
- package/generated/versions/defold-1.13.2/physics.d.ts +64 -20
- package/generated/versions/defold-1.13.2/profiler.d.ts +3 -5
- package/generated/versions/defold-1.13.2/render.d.ts +161 -46
- package/generated/versions/defold-1.13.2/resource.d.ts +81 -61
- package/generated/versions/defold-1.13.2/socket.d.ts +18 -23
- package/generated/versions/defold-1.13.2/sound.d.ts +6 -6
- package/generated/versions/defold-1.13.2/sprite.d.ts +51 -3
- package/generated/versions/defold-1.13.2/sys.d.ts +87 -24
- package/generated/versions/defold-1.13.2/tilemap.d.ts +3 -3
- package/generated/versions/defold-1.13.2/timer.d.ts +3 -3
- package/generated/versions/defold-1.13.2/vmath.d.ts +0 -25
- package/generated/versions/defold-1.13.2/window.d.ts +8 -10
- package/generated/vmath.d.ts +0 -25
- package/generated/window.d.ts +8 -10
- package/identity-vocabulary.json +86 -34
- package/index.d.ts +2 -0
- package/package.json +3 -1
- package/scripts/generate-api-availability.ts +10 -24
- package/scripts/generate-api-signatures.ts +75 -14
- package/scripts/materialize-version.ts +48 -7
- package/scripts/regen.ts +214 -19
- package/scripts/shared-handle-methods.ts +3 -2
- package/scripts/signature-store-fs.ts +1 -0
- package/scripts/target-version.ts +26 -0
- package/src/api-doc.ts +34 -0
- package/src/api-identity.ts +32 -1
- package/src/component-properties.d.ts +96 -7
- package/src/core-types.ts +71 -28
- package/src/doc-corrections.ts +62 -5
- package/src/emit-dts.ts +1423 -401
- package/src/engine-globals.d.ts +5 -1
- package/src/engine-type-name.ts +33 -0
- package/src/go-overloads.d.ts +74 -19
- package/src/gui-overloads.d.ts +489 -0
- package/src/gui-texture-removal.d.ts +41 -0
- package/src/index.ts +3 -0
- package/src/lifecycle.ts +32 -23
- package/src/msg-overloads.d.ts +25 -13
- package/src/signature-store.ts +50 -0
- package/src/socket-types.d.ts +3 -3
- package/src/timers.d.ts +2 -1
- package/src/vmath-overloads.d.ts +26 -0
package/api-targets.json
CHANGED
|
@@ -148,7 +148,8 @@
|
|
|
148
148
|
{
|
|
149
149
|
"namespace": "gui",
|
|
150
150
|
"fixture": "gui_doc.json",
|
|
151
|
-
"outFile": "gui.d.ts"
|
|
151
|
+
"outFile": "gui.d.ts",
|
|
152
|
+
"skipFunctions": ["animate", "get", "set"]
|
|
152
153
|
},
|
|
153
154
|
{
|
|
154
155
|
"namespace": "html5",
|
|
@@ -270,6 +271,7 @@
|
|
|
270
271
|
"slerp",
|
|
271
272
|
"mul_per_elem",
|
|
272
273
|
"normalize",
|
|
274
|
+
"dot",
|
|
273
275
|
"vector"
|
|
274
276
|
]
|
|
275
277
|
},
|
|
@@ -539,7 +541,8 @@
|
|
|
539
541
|
{
|
|
540
542
|
"namespace": "gui",
|
|
541
543
|
"fixture": "gui_doc.json",
|
|
542
|
-
"outFile": "gui.d.ts"
|
|
544
|
+
"outFile": "gui.d.ts",
|
|
545
|
+
"skipFunctions": ["animate", "get", "set"]
|
|
543
546
|
},
|
|
544
547
|
{
|
|
545
548
|
"namespace": "html5",
|
|
@@ -661,6 +664,7 @@
|
|
|
661
664
|
"slerp",
|
|
662
665
|
"mul_per_elem",
|
|
663
666
|
"normalize",
|
|
667
|
+
"dot",
|
|
664
668
|
"vector"
|
|
665
669
|
]
|
|
666
670
|
},
|
|
@@ -900,7 +904,8 @@
|
|
|
900
904
|
{
|
|
901
905
|
"namespace": "gui",
|
|
902
906
|
"fixture": "gui_doc.json",
|
|
903
|
-
"outFile": "gui.d.ts"
|
|
907
|
+
"outFile": "gui.d.ts",
|
|
908
|
+
"skipFunctions": ["animate", "get", "set"]
|
|
904
909
|
},
|
|
905
910
|
{
|
|
906
911
|
"namespace": "html5",
|
|
@@ -1021,6 +1026,7 @@
|
|
|
1021
1026
|
"slerp",
|
|
1022
1027
|
"mul_per_elem",
|
|
1023
1028
|
"normalize",
|
|
1029
|
+
"dot",
|
|
1024
1030
|
"vector"
|
|
1025
1031
|
]
|
|
1026
1032
|
},
|
|
@@ -1260,7 +1266,8 @@
|
|
|
1260
1266
|
{
|
|
1261
1267
|
"namespace": "gui",
|
|
1262
1268
|
"fixture": "gui_doc.json",
|
|
1263
|
-
"outFile": "gui.d.ts"
|
|
1269
|
+
"outFile": "gui.d.ts",
|
|
1270
|
+
"skipFunctions": ["animate", "get", "set"]
|
|
1264
1271
|
},
|
|
1265
1272
|
{
|
|
1266
1273
|
"namespace": "html5",
|
|
@@ -1381,6 +1388,7 @@
|
|
|
1381
1388
|
"slerp",
|
|
1382
1389
|
"mul_per_elem",
|
|
1383
1390
|
"normalize",
|
|
1391
|
+
"dot",
|
|
1384
1392
|
"vector"
|
|
1385
1393
|
]
|
|
1386
1394
|
},
|
|
@@ -1563,7 +1571,8 @@
|
|
|
1563
1571
|
{
|
|
1564
1572
|
"namespace": "gui",
|
|
1565
1573
|
"fixture": "gui_doc.json",
|
|
1566
|
-
"outFile": "gui.d.ts"
|
|
1574
|
+
"outFile": "gui.d.ts",
|
|
1575
|
+
"skipFunctions": ["animate", "get", "set"]
|
|
1567
1576
|
},
|
|
1568
1577
|
{
|
|
1569
1578
|
"namespace": "html5",
|
|
@@ -1679,6 +1688,7 @@
|
|
|
1679
1688
|
"slerp",
|
|
1680
1689
|
"mul_per_elem",
|
|
1681
1690
|
"normalize",
|
|
1691
|
+
"dot",
|
|
1682
1692
|
"vector"
|
|
1683
1693
|
]
|
|
1684
1694
|
},
|
|
@@ -80,19 +80,19 @@
|
|
|
80
80
|
"bullet3d.constraint.create_generic_6dof_spring": [
|
|
81
81
|
{
|
|
82
82
|
"sourceHash": "208db6534df9ca4a",
|
|
83
|
-
"ts": "// Create a spring that moves along its first linear axis:\nexport default defineScript({\n init() {\n const body_a = bullet3d.get_rigid_body(\"/body_a#collisionobject\");\n const body_b = bullet3d.get_rigid_body(\"/body_b#collisionobject\");\n let spring: bullet3d.constraint.
|
|
83
|
+
"ts": "// Create a spring that moves along its first linear axis:\nexport default defineScript({\n init() {\n const body_a = bullet3d.get_rigid_body(\"/body_a#collisionobject\");\n const body_b = bullet3d.get_rigid_body(\"/body_b#collisionobject\");\n let spring: bullet3d.constraint.BtTypedConstraint | undefined;\n if (body_a !== undefined && body_b !== undefined) {\n spring = bullet3d.constraint.create_generic_6dof_spring(body_a, body_b, {\n frame_a_position: vmath.vector3(),\n frame_a_rotation: vmath.quat(),\n frame_b_position: vmath.vector3(),\n frame_b_rotation: vmath.quat(),\n });\n bullet3d.constraint.set_limit(spring, 1, -1, 1);\n bullet3d.constraint.enable_spring(spring, 1, true);\n bullet3d.constraint.set_spring_stiffness(spring, 1, 20);\n bullet3d.constraint.set_spring_damping(spring, 1, 0.5);\n bullet3d.constraint.set_spring_equilibrium_point(spring, 1, 0);\n }\n return { spring };\n },\n\n final(self) {\n if (self.spring !== undefined && bullet3d.constraint.is_valid(self.spring)) {\n bullet3d.constraint.destroy(self.spring);\n }\n },\n});"
|
|
84
84
|
}
|
|
85
85
|
],
|
|
86
86
|
"bullet3d.constraint.create_hinge": [
|
|
87
87
|
{
|
|
88
88
|
"sourceHash": "76ffd570e08f0b18",
|
|
89
|
-
"ts": "// Create a motorized hinge with a 90-degree range:\nexport default defineScript({\n init() {\n const body_a = bullet3d.get_rigid_body(\"/door#collisionobject\");\n const body_b = bullet3d.get_rigid_body(\"/frame#collisionobject\");\n let hinge: bullet3d.constraint.
|
|
89
|
+
"ts": "// Create a motorized hinge with a 90-degree range:\nexport default defineScript({\n init() {\n const body_a = bullet3d.get_rigid_body(\"/door#collisionobject\");\n const body_b = bullet3d.get_rigid_body(\"/frame#collisionobject\");\n let hinge: bullet3d.constraint.BtTypedConstraint | undefined;\n if (body_a !== undefined) {\n hinge = bullet3d.constraint.create_hinge(body_a, body_b, {\n frame_a_position: vmath.vector3(-0.5, 0, 0),\n frame_a_rotation: vmath.quat(),\n frame_b_position: vmath.vector3(0.5, 0, 0),\n frame_b_rotation: vmath.quat(),\n });\n bullet3d.constraint.set_hinge_limits(hinge, -math.pi / 4, math.pi / 4);\n bullet3d.constraint.set_hinge_motor(hinge, true, 1.5, 2.5);\n }\n return { hinge };\n },\n\n final(self) {\n if (self.hinge !== undefined && bullet3d.constraint.is_valid(self.hinge)) {\n bullet3d.constraint.destroy(self.hinge);\n }\n },\n});"
|
|
90
90
|
}
|
|
91
91
|
],
|
|
92
92
|
"bullet3d.constraint.create_point_to_point": [
|
|
93
93
|
{
|
|
94
94
|
"sourceHash": "91bc34d28899d0c1",
|
|
95
|
-
"ts": "// Join two bodies at matching local pivots and explicitly destroy the\n// constraint when the script is finalized:\nexport default defineScript({\n init() {\n const body_a = bullet3d.get_rigid_body(\"/body_a#collisionobject\");\n const body_b = bullet3d.get_rigid_body(\"/body_b#collisionobject\");\n let constraint: bullet3d.constraint.
|
|
95
|
+
"ts": "// Join two bodies at matching local pivots and explicitly destroy the\n// constraint when the script is finalized:\nexport default defineScript({\n init() {\n const body_a = bullet3d.get_rigid_body(\"/body_a#collisionobject\");\n const body_b = bullet3d.get_rigid_body(\"/body_b#collisionobject\");\n let constraint: bullet3d.constraint.BtTypedConstraint | undefined;\n if (body_a !== undefined) {\n constraint = bullet3d.constraint.create_point_to_point(body_a, body_b, {\n pivot_a: vmath.vector3(0.5, 0, 0),\n pivot_b: vmath.vector3(-0.5, 0, 0),\n });\n }\n return { constraint };\n },\n\n final(self) {\n if (self.constraint !== undefined && bullet3d.constraint.is_valid(self.constraint)) {\n bullet3d.constraint.destroy(self.constraint);\n }\n },\n});"
|
|
96
96
|
}
|
|
97
97
|
],
|
|
98
98
|
"bullet3d.get_gameobject_id": [
|
|
@@ -363,12 +363,6 @@
|
|
|
363
363
|
"ts": "// How to unload resources of a factory prototype loaded with factory.load:\nfactory.unload(\"#factory\");"
|
|
364
364
|
}
|
|
365
365
|
],
|
|
366
|
-
"final": [
|
|
367
|
-
{
|
|
368
|
-
"sourceHash": "ebc3cae218af001a",
|
|
369
|
-
"ts": "export default defineScript({\n init() {\n return { some_value: 0 };\n },\n\n final(self) {\n // report finalization\n msg.post(\"my_friend_instance\", \"im_dead\", { my_stats: self.some_value });\n },\n});"
|
|
370
|
-
}
|
|
371
|
-
],
|
|
372
366
|
"font.add_font": [
|
|
373
367
|
{
|
|
374
368
|
"sourceHash": "eb23e196a4edbd74",
|
|
@@ -708,7 +702,7 @@
|
|
|
708
702
|
},
|
|
709
703
|
{
|
|
710
704
|
"sourceHash": "7234f15bfdc28abb",
|
|
711
|
-
"ts": "// How to start a sequenced animation where the node fades in to white during 0.5\n// seconds, stays visible for 2 seconds and then fades out:\nfunction on_animation_done(self: unknown, node:
|
|
705
|
+
"ts": "// How to start a sequenced animation where the node fades in to white during 0.5\n// seconds, stays visible for 2 seconds and then fades out:\nfunction on_animation_done(self: unknown, node: Opaque<\"node\">) {\n // fade out node, but wait 2 seconds before the animation starts\n gui.animate(node, gui.PROP_COLOR, vmath.vector4(0, 0, 0, 0), gui.EASING_OUTQUAD, 0.5, 2.0);\n}\n\nexport default defineGuiScript({\n init(self) {\n // fetch the node we want to animate\n const my_node = gui.get_node(\"my_node\");\n // node is initially set to fully transparent\n gui.set_color(my_node, vmath.vector4(0, 0, 0, 0));\n // animate the node immediately and call on_animation_done when the animation has completed\n gui.animate(my_node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_INOUTQUAD, 0.5, 0.0, on_animation_done);\n },\n});"
|
|
712
706
|
},
|
|
713
707
|
{
|
|
714
708
|
"sourceHash": "3d5dcef3260b5964",
|
|
@@ -820,7 +814,7 @@
|
|
|
820
814
|
"gui.set": [
|
|
821
815
|
{
|
|
822
816
|
"sourceHash": "0b505e5f92fd4aff",
|
|
823
|
-
"ts": "const node = gui.get_node(\"my_box_node\");\nconst node_position = gui.get(node, \"position\")
|
|
817
|
+
"ts": "const node = gui.get_node(\"my_box_node\");\nconst node_position = gui.get(node, \"position\");\ngui.set(node, \"position.x\", node_position.x + 128);"
|
|
824
818
|
},
|
|
825
819
|
{
|
|
826
820
|
"sourceHash": "8ed6f5c059ba2496",
|
|
@@ -828,7 +822,7 @@
|
|
|
828
822
|
},
|
|
829
823
|
{
|
|
830
824
|
"sourceHash": "2a8317babd507565",
|
|
831
|
-
"ts": "const node = gui.get_node(\"my_box_node\");\ngui.set(node, \"tint\", vmath.vector4(1, 0, 0, 1));\n// matrix4 is also supported\ngui.set(node, \"light_matrix\", vmath.matrix4());\n// update a constant in an array at position 4. the array is specified in the shader as:\n// uniform vec4 tint_array[4]; // lua is 1 based, shader is 0 based\ngui.set(node, \"tint_array\", vmath.vector4(1, 0, 0, 1), { index: 4 });\n// update a matrix constant in an array at position 4. the array is specified in the shader as:\n// uniform mat4 light_matrix_array[4];\ngui.set(node, \"light_matrix_array\", vmath.matrix4(), { index: 4 });\n// update a sub-element in a constant\ngui.set(node, \"tint.x\", 1);\n// update a sub-element in an array constant at position 4\ngui.set(node, \"tint_array.x\", 1, { index: 4 });"
|
|
825
|
+
"ts": "const node = gui.get_node(\"my_box_node\");\ngui.set(node, hash(\"tint\"), vmath.vector4(1, 0, 0, 1));\n// matrix4 is also supported\ngui.set(node, hash(\"light_matrix\"), vmath.matrix4());\n// update a constant in an array at position 4. the array is specified in the shader as:\n// uniform vec4 tint_array[4]; // lua is 1 based, shader is 0 based\ngui.set(node, hash(\"tint_array\"), vmath.vector4(1, 0, 0, 1), { index: 4 });\n// update a matrix constant in an array at position 4. the array is specified in the shader as:\n// uniform mat4 light_matrix_array[4];\ngui.set(node, hash(\"light_matrix_array\"), vmath.matrix4(), { index: 4 });\n// update a sub-element in a constant\ngui.set(node, hash(\"tint.x\"), 1);\n// update a sub-element in an array constant at position 4\ngui.set(node, hash(\"tint_array.x\"), 1, { index: 4 });"
|
|
832
826
|
},
|
|
833
827
|
{
|
|
834
828
|
"sourceHash": "b52d73e25b02e93f",
|
|
@@ -903,12 +897,6 @@
|
|
|
903
897
|
"ts": "// Load an image from an URL as a buffer and create a texture resource from it:\nconst imgurl = \"http://www.site.com/image.png\";\nhttp.request(imgurl, \"GET\", (self, id, response) => {\n const img =\n response.response !== undefined\n ? image.load_buffer(response.response, { flip_vertically: true })\n : undefined;\n // the engine registers a texture format only when the driver supports it\n const format = graphics.TEXTURE_FORMAT_RGBA;\n if (img !== undefined && format !== undefined) {\n const tparams = {\n width: img.width,\n height: img.height,\n type: graphics.TEXTURE_TYPE_2D,\n format,\n };\n\n const my_texture_id = resource.create_texture(\"/my_custom_texture.texturec\", tparams, img.buffer);\n // Apply the texture to a model\n go.set(\"/go1#model\", \"texture0\", my_texture_id);\n }\n});"
|
|
904
898
|
}
|
|
905
899
|
],
|
|
906
|
-
"init": [
|
|
907
|
-
{
|
|
908
|
-
"sourceHash": "70267e467e6e247e",
|
|
909
|
-
"ts": "export default defineScript({\n init() {\n // set up useful data\n return { my_value: 1 };\n },\n});"
|
|
910
|
-
}
|
|
911
|
-
],
|
|
912
900
|
"json.decode": [
|
|
913
901
|
{
|
|
914
902
|
"sourceHash": "8dcdd6f81ef65528",
|
|
@@ -942,7 +930,7 @@
|
|
|
942
930
|
},
|
|
943
931
|
{
|
|
944
932
|
"sourceHash": "877de2c1daa19e58",
|
|
945
|
-
"ts": "export default defineScript({\n init() {\n const text = go.get<label.
|
|
933
|
+
"ts": "export default defineScript({\n init() {\n const text = go.get<label.Properties>()(\"#label\", \"text\");\n print(text);\n },\n});"
|
|
946
934
|
}
|
|
947
935
|
],
|
|
948
936
|
"label.set_text": [
|
|
@@ -952,7 +940,7 @@
|
|
|
952
940
|
},
|
|
953
941
|
{
|
|
954
942
|
"sourceHash": "2ac0aeb70ccdc6bf",
|
|
955
|
-
"ts": "export default defineScript({\n init() {\n go.set<label.
|
|
943
|
+
"ts": "export default defineScript({\n init() {\n go.set<label.Properties>()(\"#label\", \"text\", \"Hello World!\");\n },\n});"
|
|
956
944
|
}
|
|
957
945
|
],
|
|
958
946
|
"liveupdate.add_mount": [
|
|
@@ -1117,36 +1105,6 @@
|
|
|
1117
1105
|
"ts": "const my_url = msg.url(\"#my_component\");\nprint(my_url); // => url: [current_collection:/my_instance#my_component]\n\nconst my_collection_url = msg.url(\"my_collection:/my_sub_collection/my_instance#my_component\");\nprint(my_collection_url); // => url: [my_collection:/my_sub_collection/my_instance#my_component]\n\nconst my_socket_url = msg.url(\"my_socket:\");\nprint(my_socket_url); // => url: [my_collection:]"
|
|
1118
1106
|
}
|
|
1119
1107
|
],
|
|
1120
|
-
"on_input": [
|
|
1121
|
-
{
|
|
1122
|
-
"sourceHash": "86c70cf4ccb7381e",
|
|
1123
|
-
"ts": "// This example demonstrates how a game object instance can be moved as a response to user input.\nexport default defineScript({\n init() {\n // acquire input focus\n msg.post(\".\", \"acquire_input_focus\");\n return {\n // maximum speed the instance can be moved\n max_speed: 2,\n // velocity of the instance, initially zero\n velocity: vmath.vector3(),\n };\n },\n\n update(self, dt) {\n // move the instance\n go.set_position(go.get_position().add(self.velocity.mul(dt)));\n },\n\n on_input(self, action_id, action) {\n // check for movement input\n if (action_id === hash(\"right\")) {\n if (action.released) {\n // reset velocity if input was released\n self.velocity = vmath.vector3();\n } else {\n // update velocity\n self.velocity = vmath.vector3((action.value ?? 0) * self.max_speed, 0, 0);\n }\n }\n },\n});"
|
|
1124
|
-
},
|
|
1125
|
-
{
|
|
1126
|
-
"sourceHash": "cc835ea429adc693",
|
|
1127
|
-
"ts": "export default defineGuiScript({\n init(): { my_value: number | undefined } {\n return { my_value: undefined };\n },\n\n on_input(self, action_id, action) {\n // check for input\n if (action_id === hash(\"my_action\")) {\n // take appropriate action\n self.my_value = action.value;\n }\n // consume input\n return true;\n },\n});"
|
|
1128
|
-
}
|
|
1129
|
-
],
|
|
1130
|
-
"on_message": [
|
|
1131
|
-
{
|
|
1132
|
-
"sourceHash": "d5850f2009394171",
|
|
1133
|
-
"ts": "// This example demonstrates how a game object instance, called \"a\", can communicate with another instance, called \"b\". It\n// is assumed that both script components of the instances has id \"script\".\n\n// a.script — Script of instance \"a\":\nexport default defineScript({\n init() {\n // let b know about some important data\n msg.post(\"b#script\", \"my_data\", { important_value: 1 });\n },\n});"
|
|
1134
|
-
},
|
|
1135
|
-
{
|
|
1136
|
-
"sourceHash": "9f37896589565629",
|
|
1137
|
-
"ts": "// b.script — Script of instance \"b\":\nexport default defineScript({\n init() {\n // store the url of instance \"a\" for later use, by specifying undefined as socket we\n // automatically use our own socket\n return { a_url: msg.url(undefined, go.get_id(\"a\"), \"script\"), important_value: 0 };\n },\n\n on_message(self, message_id, message, sender) {\n // check message and sender\n if (message_id === hash(\"my_data\") && sender === self.a_url && typeof message.important_value === \"number\") {\n // use the data in some way\n self.important_value = message.important_value;\n }\n },\n});"
|
|
1138
|
-
}
|
|
1139
|
-
],
|
|
1140
|
-
"on_reload": [
|
|
1141
|
-
{
|
|
1142
|
-
"sourceHash": "ba39c0b0d5170ccb",
|
|
1143
|
-
"ts": "// This example demonstrates how to tweak the speed of a game object instance that is moved on user input.\nexport default defineScript({\n init() {\n // acquire input focus\n msg.post(\".\", \"acquire_input_focus\");\n return {\n // maximum speed the instance can be moved, this value is tweaked in the on_reload function below\n max_speed: 2,\n // velocity of the instance, initially zero\n velocity: vmath.vector3(),\n };\n },\n\n update(self, dt) {\n // move the instance\n go.set_position(go.get_position().add(self.velocity.mul(dt)));\n },\n\n on_input(self, action_id, action) {\n // check for movement input\n if (action_id === hash(\"right\")) {\n if (action.released) {\n // reset velocity if input was released\n self.velocity = vmath.vector3();\n } else {\n // update velocity\n self.velocity = vmath.vector3((action.value ?? 0) * self.max_speed, 0, 0);\n }\n }\n },\n\n on_reload(self) {\n // edit this value and reload the script component\n self.max_speed = 100;\n },\n});"
|
|
1144
|
-
},
|
|
1145
|
-
{
|
|
1146
|
-
"sourceHash": "e89fe0d0bd51ed98",
|
|
1147
|
-
"ts": "export default defineGuiScript({\n init() {\n return { my_original_color: gui.get_color(gui.get_node(\"my_node\")) };\n },\n\n on_reload(self) {\n // restore some color (or similar)\n gui.set_color(gui.get_node(\"my_node\"), self.my_original_color);\n },\n});"
|
|
1148
|
-
}
|
|
1149
|
-
],
|
|
1150
1108
|
"particlefx.play": [
|
|
1151
1109
|
{
|
|
1152
1110
|
"sourceHash": "01a21997b47ac4fc",
|
|
@@ -1729,7 +1687,7 @@
|
|
|
1729
1687
|
},
|
|
1730
1688
|
{
|
|
1731
1689
|
"sourceHash": "66e3c1c627270938",
|
|
1732
|
-
"ts": "// Create a texture resource asyncronously with a buffer and a callback\nfunction callback(self: unknown, request_id: number, result: resource.
|
|
1690
|
+
"ts": "// Create a texture resource asyncronously with a buffer and a callback\nfunction callback(self: unknown, request_id: number, result: resource.TextureCreationResult) {\n // The resource has been updated with a new texture,\n // so we can update other systems with the new handle,\n // or update components to use the resource if we want\n const tinfo = resource.get_texture_info(result.path);\n msg.post(\"@render:\", \"set_backing_texture\", { handle: tinfo.handle });\n}\n\nexport default defineScript({\n init() {\n // the engine registers a texture format only when the driver supports it\n const format = graphics.TEXTURE_FORMAT_RGBA;\n if (format === undefined) return;\n // Create a texture resource async\n const tparams = {\n width: 128,\n height: 128,\n type: graphics.TEXTURE_TYPE_2D,\n format,\n };\n\n // Create a new buffer with 4 components\n const tbuffer = buffer.create(tparams.width * tparams.height, [{ name: hash(\"rgba\"), type: buffer.VALUE_TYPE_UINT8, count: 4 }]);\n const tstream = buffer.get_stream(tbuffer, hash(\"rgba\"));\n\n // Fill the buffer stream with some float values\n for (let y = 0; y < tparams.width; y++) {\n for (let x = 0; x < tparams.height; x++) {\n const index = y * 128 * 4 + x * 4;\n tstream[index + 0] = 255;\n tstream[index + 1] = 0;\n tstream[index + 2] = 255;\n tstream[index + 3] = 255;\n }\n }\n // create the texture\n const [tpath, request_id] = resource.create_texture_async(\"/my_texture.texturec\", tparams, tbuffer, callback);\n // at this point you can use the resource as-is, but note that the texture will be a blank 1x1 texture\n // that will be removed once the new texture has been updated\n go.set(\"#model\", \"texture0\", tpath);\n },\n});"
|
|
1733
1691
|
}
|
|
1734
1692
|
],
|
|
1735
1693
|
"resource.font": [
|
|
@@ -1745,7 +1703,7 @@
|
|
|
1745
1703
|
"resource.get_buffer": [
|
|
1746
1704
|
{
|
|
1747
1705
|
"sourceHash": "ed7d361c7f5d2e35",
|
|
1748
|
-
"ts": "// How to get the data from a buffer\nexport default defineScript({\n init() {\n const res_path = go.get<mesh.
|
|
1706
|
+
"ts": "// How to get the data from a buffer\nexport default defineScript({\n init() {\n const res_path = go.get<mesh.Properties>()(\"#mesh\", \"vertices\");\n const buf = resource.get_buffer(res_path);\n const stream_positions = buffer.get_stream(buf, \"position\");\n\n for (let i = 0; i < stream_positions.length(); i++) {\n print(i, stream_positions[i]);\n }\n },\n});"
|
|
1749
1707
|
}
|
|
1750
1708
|
],
|
|
1751
1709
|
"resource.get_render_target_info": [
|
|
@@ -1761,7 +1719,7 @@
|
|
|
1761
1719
|
"resource.get_text_metrics": [
|
|
1762
1720
|
{
|
|
1763
1721
|
"sourceHash": "d63156dd59513358",
|
|
1764
|
-
"ts": "export default defineScript({\n init() {\n const font = go.get<label.
|
|
1722
|
+
"ts": "export default defineScript({\n init() {\n const font = go.get<label.Properties>()(\"#label\", \"font\");\n const metrics = resource.get_text_metrics(font, \"The quick brown fox\\n jumps over the lazy dog\");\n pprint(metrics);\n },\n});"
|
|
1765
1723
|
}
|
|
1766
1724
|
],
|
|
1767
1725
|
"resource.get_texture_info": [
|
|
@@ -1803,7 +1761,7 @@
|
|
|
1803
1761
|
"resource.set": [
|
|
1804
1762
|
{
|
|
1805
1763
|
"sourceHash": "fd3445f93ecdd85e",
|
|
1806
|
-
"ts": "// Assuming the folder \"/res\" is added to the project custom resources:\n// load a texture resource and set it on a sprite\nconst buffer = resource.load(\"/res/new.texturec\");\nresource.set(go.get<sprite.
|
|
1764
|
+
"ts": "// Assuming the folder \"/res\" is added to the project custom resources:\n// load a texture resource and set it on a sprite\nconst buffer = resource.load(\"/res/new.texturec\");\nresource.set(go.get<sprite.Properties>()(\"#sprite\", \"texture0\"), buffer);"
|
|
1807
1765
|
}
|
|
1808
1766
|
],
|
|
1809
1767
|
"resource.set_atlas": [
|
|
@@ -1819,21 +1777,21 @@
|
|
|
1819
1777
|
"resource.set_buffer": [
|
|
1820
1778
|
{
|
|
1821
1779
|
"sourceHash": "a52fd8ac7453f601",
|
|
1822
|
-
"ts": "// How to set the data from a buffer\nfunction fill_stream(stream: { [index: number]: number }, verts: number[]) {\n verts.forEach((value, key) => {\n stream[key] = value;\n });\n}\n\nexport default defineScript({\n init() {\n const res_path = go.get<mesh.
|
|
1780
|
+
"ts": "// How to set the data from a buffer\nfunction fill_stream(stream: { [index: number]: number }, verts: number[]) {\n verts.forEach((value, key) => {\n stream[key] = value;\n });\n}\n\nexport default defineScript({\n init() {\n const res_path = go.get<mesh.Properties>()(\"#mesh\", \"vertices\");\n\n const positions = [\n 1, -1, 0,\n 1, 1, 0,\n -1, -1, 0,\n ];\n\n const num_verts = positions.length / 3;\n\n // create a new buffer\n let buf = buffer.create(num_verts, [{ name: hash(\"position\"), type: buffer.VALUE_TYPE_FLOAT32, count: 3 }]);\n\n buf = resource.get_buffer(res_path);\n const stream_positions = buffer.get_stream(buf, \"position\");\n\n fill_stream(stream_positions, positions);\n\n resource.set_buffer(res_path, buf);\n },\n});"
|
|
1823
1781
|
}
|
|
1824
1782
|
],
|
|
1825
1783
|
"resource.set_texture": [
|
|
1826
1784
|
{
|
|
1827
1785
|
"sourceHash": "fe312c35ef2ab0f4",
|
|
1828
|
-
"ts": "// How to set all pixels of an atlas\nexport default defineScript({\n init() {\n const height = 128;\n const width = 128;\n const buf = buffer.create(width * height, [{ name: hash(\"rgb\"), type: buffer.VALUE_TYPE_UINT8, count: 3 }]);\n const stream = buffer.get_stream(buf, hash(\"rgb\"));\n\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n const index = y * width * 3 + x * 3;\n stream[index + 0] = 0xff;\n stream[index + 1] = 0x80;\n stream[index + 2] = 0x10;\n }\n }\n\n // the engine registers a texture format only when the driver supports it\n const format = graphics.TEXTURE_FORMAT_RGB;\n if (format !== undefined) {\n const resource_path = go.get<model.
|
|
1786
|
+
"ts": "// How to set all pixels of an atlas\nexport default defineScript({\n init() {\n const height = 128;\n const width = 128;\n const buf = buffer.create(width * height, [{ name: hash(\"rgb\"), type: buffer.VALUE_TYPE_UINT8, count: 3 }]);\n const stream = buffer.get_stream(buf, hash(\"rgb\"));\n\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n const index = y * width * 3 + x * 3;\n stream[index + 0] = 0xff;\n stream[index + 1] = 0x80;\n stream[index + 2] = 0x10;\n }\n }\n\n // the engine registers a texture format only when the driver supports it\n const format = graphics.TEXTURE_FORMAT_RGB;\n if (format !== undefined) {\n const resource_path = go.get<model.Properties>()(\"#model\", \"texture0\");\n const args = { width, height, type: graphics.TEXTURE_TYPE_2D, format, num_mip_maps: 1 };\n resource.set_texture(resource_path, args, buf);\n }\n return { buffer: buf, stream };\n },\n});"
|
|
1829
1787
|
},
|
|
1830
1788
|
{
|
|
1831
1789
|
"sourceHash": "b4098f0f37b9c1d0",
|
|
1832
|
-
"ts": "// How to update a specific region of an atlas by using the x,y values. Assumes the already set atlas is a 128x128 texture.\nexport default defineScript({\n init() {\n const x = 16;\n const y = 16;\n const height = 128 - x * 2;\n const width = 128 - y * 2;\n const buf = buffer.create(width * height, [{ name: hash(\"rgb\"), type: buffer.VALUE_TYPE_UINT8, count: 3 }]);\n const stream = buffer.get_stream(buf, hash(\"rgb\"));\n\n for (let row = 0; row < height; row++) {\n for (let col = 0; col < width; col++) {\n const index = row * width * 3 + col * 3;\n stream[index + 0] = 0xff;\n stream[index + 1] = 0x80;\n stream[index + 2] = 0x10;\n }\n }\n\n // the engine registers a texture format only when the driver supports it\n const format = graphics.TEXTURE_FORMAT_RGB;\n if (format !== undefined) {\n const resource_path = go.get<model.
|
|
1790
|
+
"ts": "// How to update a specific region of an atlas by using the x,y values. Assumes the already set atlas is a 128x128 texture.\nexport default defineScript({\n init() {\n const x = 16;\n const y = 16;\n const height = 128 - x * 2;\n const width = 128 - y * 2;\n const buf = buffer.create(width * height, [{ name: hash(\"rgb\"), type: buffer.VALUE_TYPE_UINT8, count: 3 }]);\n const stream = buffer.get_stream(buf, hash(\"rgb\"));\n\n for (let row = 0; row < height; row++) {\n for (let col = 0; col < width; col++) {\n const index = row * width * 3 + col * 3;\n stream[index + 0] = 0xff;\n stream[index + 1] = 0x80;\n stream[index + 2] = 0x10;\n }\n }\n\n // the engine registers a texture format only when the driver supports it\n const format = graphics.TEXTURE_FORMAT_RGB;\n if (format !== undefined) {\n const resource_path = go.get<model.Properties>()(\"#model\", \"texture0\");\n const args = { width, height, x, y, type: graphics.TEXTURE_TYPE_2D, format, num_mip_maps: 1 };\n resource.set_texture(resource_path, args, buf);\n }\n return { buffer: buf, stream };\n },\n});"
|
|
1833
1791
|
},
|
|
1834
1792
|
{
|
|
1835
1793
|
"sourceHash": "02d7f2ec29971bf1",
|
|
1836
|
-
"ts": "// Update a texture from a buffer resource\nexport default defineScript({\n // Never call `go.property` yourself: the transpiler emits the chunk-scope\n // registration from this field, and only this field types the property onto `self`.\n properties: { my_buffer: resource.buffer(\"/my_default_buffer.buffer\") },\n\n init(self) {\n // the engine registers a texture format only when the driver supports it\n const format = graphics.TEXTURE_FORMAT_RGB;\n if (format === undefined) return;\n const resource_path = go.get<model.
|
|
1794
|
+
"ts": "// Update a texture from a buffer resource\nexport default defineScript({\n // Never call `go.property` yourself: the transpiler emits the chunk-scope\n // registration from this field, and only this field types the property onto `self`.\n properties: { my_buffer: resource.buffer(\"/my_default_buffer.buffer\") },\n\n init(self) {\n // the engine registers a texture format only when the driver supports it\n const format = graphics.TEXTURE_FORMAT_RGB;\n if (format === undefined) return;\n const resource_path = go.get<model.Properties>()(\"#model\", \"texture0\");\n // the \"my_buffer\" resource is expected to hold 128 * 128 * 3 bytes!\n const args = {\n width: 128,\n height: 128,\n type: graphics.TEXTURE_TYPE_2D,\n format,\n };\n // Note that the extra resource.get_buffer call is a requirement here\n // since the \"self.my_buffer\" is just pointing to a buffer resource path\n // and not an actual buffer object or buffer resource.\n resource.set_texture(resource_path, args, resource.get_buffer(self.my_buffer));\n },\n});"
|
|
1837
1795
|
},
|
|
1838
1796
|
{
|
|
1839
1797
|
"sourceHash": "15829bfe1b186bc3",
|
|
@@ -2151,7 +2109,7 @@
|
|
|
2151
2109
|
"sys.load_buffer_async": [
|
|
2152
2110
|
{
|
|
2153
2111
|
"sourceHash": "91d84e7dc569ae20",
|
|
2154
|
-
"ts": "function my_callback(self: unknown, request_id: unknown, result: unknown) {\n const { status, buf } = result as { status: number; buf:
|
|
2112
|
+
"ts": "function my_callback(self: unknown, request_id: unknown, result: unknown) {\n const { status, buf } = result as { status: number; buf: ReturnType<typeof sys.load_buffer> };\n if (status === sys.REQUEST_STATUS_FINISHED) {\n resource.set_texture(\"/my_texture\", { type: graphics.TEXTURE_TYPE_2D, width: 128, height: 128, format: graphics.TEXTURE_FORMAT_RGBA }, buf);\n }\n}\n\nconst my_request = sys.load_buffer_async(\"/assets/my_level_data.bin\", my_callback);"
|
|
2155
2113
|
},
|
|
2156
2114
|
{
|
|
2157
2115
|
"sourceHash": "5545b8901e6ec4c5",
|
|
@@ -2159,11 +2117,11 @@
|
|
|
2159
2117
|
},
|
|
2160
2118
|
{
|
|
2161
2119
|
"sourceHash": "7f66d3285b20ff78",
|
|
2162
|
-
"ts": "// Load binary data from a custom project resource and update a texture resource:\nfunction my_callback(self: unknown, request_id: number, result: sys.
|
|
2120
|
+
"ts": "// Load binary data from a custom project resource and update a texture resource:\nfunction my_callback(self: unknown, request_id: number, result: sys.LoadBufferResult) {\n const format = graphics.TEXTURE_FORMAT_RGBA;\n if (result.status === sys.REQUEST_STATUS_FINISHED && result.buffer !== undefined && format !== undefined) {\n resource.set_texture(\"/my_texture\", { type: graphics.TEXTURE_TYPE_2D, width: 128, height: 128, format }, result.buffer);\n }\n}\n\nconst my_request = sys.load_buffer_async(\"/assets/my_level_data.bin\", my_callback);"
|
|
2163
2121
|
},
|
|
2164
2122
|
{
|
|
2165
2123
|
"sourceHash": "9be4f92f718990af",
|
|
2166
|
-
"ts": "// Load binary data from non-custom resource files on disk:\nfunction my_callback(self: unknown, request_id: number, result: sys.
|
|
2124
|
+
"ts": "// Load binary data from non-custom resource files on disk:\nfunction my_callback(self: unknown, request_id: number, result: sys.LoadBufferResult) {\n const { first_request, second_request } = self as { first_request: number; second_request: number };\n if (result.status !== sys.REQUEST_STATUS_FINISHED) {\n // uh oh! File could not be found, do something graceful\n } else if (request_id === first_request) {\n // result.buffer contains data from my_level_asset.bin\n } else if (request_id === second_request) {\n // result.buffer contains data from 'my_level.bin'\n }\n}\n\nexport default defineScript({\n init() {\n return {\n first_request: sys.load_buffer_async(\"folder_next_to_binary/my_level_asset.bin\", my_callback),\n second_request: sys.load_buffer_async(\"/some_absolute_path/my_level.bin\", my_callback),\n };\n },\n});"
|
|
2167
2125
|
}
|
|
2168
2126
|
],
|
|
2169
2127
|
"sys.load_resource": [
|
|
@@ -2318,16 +2276,6 @@
|
|
|
2318
2276
|
"ts": "function trigger_ticking(self: { handle: number }) {\n self.handle = timer.delay(1, true, () => print(\"print every second or manually by timer.trigger\"));\n // ...\n const triggered = timer.trigger(self.handle);\n if (!triggered) {\n print(\"the timer is already cancelled or complete\");\n }\n}"
|
|
2319
2277
|
}
|
|
2320
2278
|
],
|
|
2321
|
-
"update": [
|
|
2322
|
-
{
|
|
2323
|
-
"sourceHash": "1019c7620d797753",
|
|
2324
|
-
"ts": "// This example demonstrates how to move a game object instance through the script component:\nexport default defineScript({\n init() {\n // set initial velocity to be 1 along world x-axis\n return { my_velocity: vmath.vector3(1, 0, 0) };\n },\n\n update(self, dt) {\n // move the game object instance\n go.set_position(go.get_position().add(self.my_velocity.mul(dt)));\n },\n});"
|
|
2325
|
-
},
|
|
2326
|
-
{
|
|
2327
|
-
"sourceHash": "f4f87939dbdd5fc3",
|
|
2328
|
-
"ts": "// This example demonstrates how to update a text node that displays game score\n// in a counting fashion. It is assumed that the gui component receives messages\n// from the game when a new score is to be shown.\nexport default defineGuiScript({\n init() {\n return {\n // fetch the score text node for later use (assumes it is called \"score\")\n score_node: gui.get_node(\"score\"),\n // keep track of the current score counted up so far\n current_score: 0,\n // keep track of the target score we should count up to\n target_score: 0,\n // how fast we will update the score, in score/second\n score_update_speed: 1,\n };\n },\n\n update(self, dt) {\n // check if target score is more than current score\n if (self.current_score < self.target_score) {\n // increment current score according to the speed\n self.current_score = self.current_score + dt * self.score_update_speed;\n // check if we went past the target score, clamp current score in that case\n if (self.current_score > self.target_score) {\n self.current_score = self.target_score;\n }\n // update the score text node\n gui.set_text(self.score_node, \"\" + math.floor(self.current_score));\n }\n },\n\n on_message(self, message_id, message) {\n // check the message\n if (message_id === hash(\"set_score\") && typeof message.score === \"number\") {\n self.target_score = message.score;\n }\n },\n});"
|
|
2329
|
-
}
|
|
2330
|
-
],
|
|
2331
2279
|
"vmath.clamp": [
|
|
2332
2280
|
{
|
|
2333
2281
|
"sourceHash": "ce47102e76e3186d",
|
package/generated/b2d.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ declare global {
|
|
|
9
9
|
/**
|
|
10
10
|
* Box2D axis-aligned bounding box
|
|
11
11
|
*/
|
|
12
|
-
interface
|
|
12
|
+
interface Aabb {
|
|
13
13
|
/**
|
|
14
14
|
* Lower bound.
|
|
15
15
|
*/
|
|
@@ -19,12 +19,12 @@ declare global {
|
|
|
19
19
|
*/
|
|
20
20
|
upper: Vector3;
|
|
21
21
|
}
|
|
22
|
-
type
|
|
23
|
-
type
|
|
22
|
+
type B2Body = Opaque<"b2Body">;
|
|
23
|
+
type B2World = Opaque<"b2World">;
|
|
24
24
|
/**
|
|
25
25
|
* Box2D 3.x chain definition
|
|
26
26
|
*/
|
|
27
|
-
interface
|
|
27
|
+
interface ChainDefinition {
|
|
28
28
|
/**
|
|
29
29
|
* Chain vertices.
|
|
30
30
|
*/
|
|
@@ -56,7 +56,7 @@ declare global {
|
|
|
56
56
|
/**
|
|
57
57
|
* Collision filter fields to override.
|
|
58
58
|
*/
|
|
59
|
-
filter?: b2d.
|
|
59
|
+
filter?: b2d.FilterOptions;
|
|
60
60
|
/**
|
|
61
61
|
* Whether to enable sensor events.
|
|
62
62
|
*/
|
|
@@ -65,7 +65,7 @@ declare global {
|
|
|
65
65
|
/**
|
|
66
66
|
* Box2D chain geometry
|
|
67
67
|
*/
|
|
68
|
-
interface
|
|
68
|
+
interface ChainGeometry {
|
|
69
69
|
/**
|
|
70
70
|
* Whether the chain is closed.
|
|
71
71
|
*/
|
|
@@ -90,15 +90,15 @@ declare global {
|
|
|
90
90
|
/**
|
|
91
91
|
* Box2D contact data
|
|
92
92
|
*/
|
|
93
|
-
interface
|
|
93
|
+
interface ContactData {
|
|
94
94
|
/**
|
|
95
95
|
* First contact shape.
|
|
96
96
|
*/
|
|
97
|
-
shape_a: b2d.
|
|
97
|
+
shape_a: b2d.ShapeInfo;
|
|
98
98
|
/**
|
|
99
99
|
* Second contact shape.
|
|
100
100
|
*/
|
|
101
|
-
shape_b: b2d.
|
|
101
|
+
shape_b: b2d.ShapeInfo;
|
|
102
102
|
/**
|
|
103
103
|
* Contact normal.
|
|
104
104
|
*/
|
|
@@ -114,12 +114,12 @@ declare global {
|
|
|
114
114
|
/**
|
|
115
115
|
* Contact manifold points.
|
|
116
116
|
*/
|
|
117
|
-
points: b2d.
|
|
117
|
+
points: b2d.ContactPoint[];
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
120
|
* Box2D contact manifold point
|
|
121
121
|
*/
|
|
122
|
-
interface
|
|
122
|
+
interface ContactPoint {
|
|
123
123
|
/**
|
|
124
124
|
* World contact point.
|
|
125
125
|
*/
|
|
@@ -164,7 +164,7 @@ declare global {
|
|
|
164
164
|
/**
|
|
165
165
|
* Box2D explosion definition
|
|
166
166
|
*/
|
|
167
|
-
interface
|
|
167
|
+
interface ExplosionDefinition {
|
|
168
168
|
/**
|
|
169
169
|
* Explosion center.
|
|
170
170
|
*/
|
|
@@ -189,7 +189,7 @@ declare global {
|
|
|
189
189
|
/**
|
|
190
190
|
* Box2D collision filter
|
|
191
191
|
*/
|
|
192
|
-
interface
|
|
192
|
+
interface Filter {
|
|
193
193
|
/**
|
|
194
194
|
* Collision category bits.
|
|
195
195
|
*/
|
|
@@ -206,7 +206,7 @@ declare global {
|
|
|
206
206
|
/**
|
|
207
207
|
* Partial Box2D collision filter
|
|
208
208
|
*/
|
|
209
|
-
interface
|
|
209
|
+
interface FilterOptions {
|
|
210
210
|
/**
|
|
211
211
|
* Collision category bits.
|
|
212
212
|
*/
|
|
@@ -223,15 +223,15 @@ declare global {
|
|
|
223
223
|
/**
|
|
224
224
|
* Box2D 2.x cast hit
|
|
225
225
|
*/
|
|
226
|
-
interface
|
|
226
|
+
interface FixtureCastHit {
|
|
227
227
|
/**
|
|
228
228
|
* Hit fixture.
|
|
229
229
|
*/
|
|
230
|
-
fixture: b2d.
|
|
230
|
+
fixture: b2d.FixtureInfo;
|
|
231
231
|
/**
|
|
232
232
|
* Hit fixture child shape.
|
|
233
233
|
*/
|
|
234
|
-
shape: b2d.
|
|
234
|
+
shape: b2d.FixtureInfo;
|
|
235
235
|
/**
|
|
236
236
|
* Hit point.
|
|
237
237
|
*/
|
|
@@ -256,11 +256,11 @@ declare global {
|
|
|
256
256
|
/**
|
|
257
257
|
* Box2D 2.x fixture definition
|
|
258
258
|
*/
|
|
259
|
-
interface
|
|
259
|
+
interface FixtureDefinition {
|
|
260
260
|
/**
|
|
261
261
|
* Shape definition.
|
|
262
262
|
*/
|
|
263
|
-
shape: b2d.shape.
|
|
263
|
+
shape: b2d.shape.Definition;
|
|
264
264
|
/**
|
|
265
265
|
* Fixture friction.
|
|
266
266
|
*/
|
|
@@ -284,12 +284,12 @@ declare global {
|
|
|
284
284
|
/**
|
|
285
285
|
* Collision filter.
|
|
286
286
|
*/
|
|
287
|
-
filter?: b2d.
|
|
287
|
+
filter?: b2d.Filter;
|
|
288
288
|
}
|
|
289
289
|
/**
|
|
290
290
|
* Box2D 2.x fixture information
|
|
291
291
|
*/
|
|
292
|
-
interface
|
|
292
|
+
interface FixtureInfo {
|
|
293
293
|
/**
|
|
294
294
|
* Owning body, when returned from a world query.
|
|
295
295
|
*/
|
|
@@ -305,7 +305,7 @@ declare global {
|
|
|
305
305
|
/**
|
|
306
306
|
* Shape type.
|
|
307
307
|
*/
|
|
308
|
-
type: b2d.shape.
|
|
308
|
+
type: b2d.shape.ShapeType;
|
|
309
309
|
/**
|
|
310
310
|
* Whether the fixture is a sensor.
|
|
311
311
|
*/
|
|
@@ -330,7 +330,7 @@ declare global {
|
|
|
330
330
|
/**
|
|
331
331
|
* Mass properties for a Box2D body or shape.
|
|
332
332
|
*/
|
|
333
|
-
interface
|
|
333
|
+
interface MassData {
|
|
334
334
|
/**
|
|
335
335
|
* Body mass, usually in kilograms.
|
|
336
336
|
*/
|
|
@@ -347,7 +347,7 @@ declare global {
|
|
|
347
347
|
/**
|
|
348
348
|
* Box2D mover capsule
|
|
349
349
|
*/
|
|
350
|
-
interface
|
|
350
|
+
interface MoverCapsule {
|
|
351
351
|
/**
|
|
352
352
|
* First capsule center.
|
|
353
353
|
*/
|
|
@@ -364,11 +364,11 @@ declare global {
|
|
|
364
364
|
/**
|
|
365
365
|
* Box2D mover collision plane
|
|
366
366
|
*/
|
|
367
|
-
interface
|
|
367
|
+
interface MoverPlane {
|
|
368
368
|
/**
|
|
369
369
|
* Colliding shape.
|
|
370
370
|
*/
|
|
371
|
-
shape: b2d.
|
|
371
|
+
shape: b2d.ShapeInfo;
|
|
372
372
|
/**
|
|
373
373
|
* Plane normal.
|
|
374
374
|
*/
|
|
@@ -385,7 +385,7 @@ declare global {
|
|
|
385
385
|
/**
|
|
386
386
|
* Box2D world-query filter
|
|
387
387
|
*/
|
|
388
|
-
interface
|
|
388
|
+
interface QueryFilter {
|
|
389
389
|
/**
|
|
390
390
|
* Optional collision category bits.
|
|
391
391
|
*/
|
|
@@ -402,11 +402,11 @@ declare global {
|
|
|
402
402
|
/**
|
|
403
403
|
* Box2D 3.x cast hit
|
|
404
404
|
*/
|
|
405
|
-
interface
|
|
405
|
+
interface ShapeCastHit {
|
|
406
406
|
/**
|
|
407
407
|
* Hit shape.
|
|
408
408
|
*/
|
|
409
|
-
shape: b2d.
|
|
409
|
+
shape: b2d.ShapeInfo;
|
|
410
410
|
/**
|
|
411
411
|
* Hit point.
|
|
412
412
|
*/
|
|
@@ -431,7 +431,7 @@ declare global {
|
|
|
431
431
|
/**
|
|
432
432
|
* Direct Box2D shape cast result
|
|
433
433
|
*/
|
|
434
|
-
interface
|
|
434
|
+
interface ShapeCastOutput {
|
|
435
435
|
/**
|
|
436
436
|
* Hit point.
|
|
437
437
|
*/
|
|
@@ -449,11 +449,11 @@ declare global {
|
|
|
449
449
|
*/
|
|
450
450
|
iterations: number;
|
|
451
451
|
}
|
|
452
|
-
type
|
|
452
|
+
type ShapeCreateDefinition = { shape: b2d.shape.Definition; density?: number; friction?: number; restitution?: number; material?: number; sensor?: boolean; is_sensor?: boolean; filter?: b2d.Filter } | { type: b2d.shape.ShapeType; radius?: number; center?: Vector3; center1?: Vector3; center2?: Vector3; v0?: Vector3; v1?: Vector3; v2?: Vector3; v3?: Vector3; hx?: number; hy?: number; angle?: number; vertices?: Vector3[]; density?: number; friction?: number; restitution?: number; material?: number; sensor?: boolean; is_sensor?: boolean; filter?: b2d.Filter };
|
|
453
453
|
/**
|
|
454
454
|
* Box2D 3.x shape information
|
|
455
455
|
*/
|
|
456
|
-
interface
|
|
456
|
+
interface ShapeInfo {
|
|
457
457
|
/**
|
|
458
458
|
* Shape index on the body.
|
|
459
459
|
*/
|
|
@@ -465,7 +465,7 @@ declare global {
|
|
|
465
465
|
/**
|
|
466
466
|
* Shape type.
|
|
467
467
|
*/
|
|
468
|
-
type: b2d.shape.
|
|
468
|
+
type: b2d.shape.ShapeType;
|
|
469
469
|
/**
|
|
470
470
|
* Whether the shape is a sensor.
|
|
471
471
|
*/
|
|
@@ -498,7 +498,7 @@ declare global {
|
|
|
498
498
|
/**
|
|
499
499
|
* World transform for a Box2D body.
|
|
500
500
|
*/
|
|
501
|
-
interface
|
|
501
|
+
interface Transform {
|
|
502
502
|
/**
|
|
503
503
|
* World position of the body origin.
|
|
504
504
|
*/
|
|
@@ -511,7 +511,7 @@ declare global {
|
|
|
511
511
|
/**
|
|
512
512
|
* Box2D broad-phase query statistics
|
|
513
513
|
*/
|
|
514
|
-
interface
|
|
514
|
+
interface TreeStats {
|
|
515
515
|
/**
|
|
516
516
|
* Number of tree nodes visited.
|
|
517
517
|
*/
|
|
@@ -524,7 +524,7 @@ declare global {
|
|
|
524
524
|
/**
|
|
525
525
|
* Box2D version information
|
|
526
526
|
*/
|
|
527
|
-
interface
|
|
527
|
+
interface VersionInfo {
|
|
528
528
|
/**
|
|
529
529
|
* Full Box2D version string.
|
|
530
530
|
*/
|
|
@@ -545,7 +545,7 @@ declare global {
|
|
|
545
545
|
/**
|
|
546
546
|
* Box2D world counters
|
|
547
547
|
*/
|
|
548
|
-
interface
|
|
548
|
+
interface WorldCounters {
|
|
549
549
|
/**
|
|
550
550
|
* Number of bodies.
|
|
551
551
|
*/
|
|
@@ -594,7 +594,7 @@ declare global {
|
|
|
594
594
|
/**
|
|
595
595
|
* Box2D world profiling data
|
|
596
596
|
*/
|
|
597
|
-
interface
|
|
597
|
+
interface WorldProfile {
|
|
598
598
|
/**
|
|
599
599
|
* Total step time.
|
|
600
600
|
*/
|
|
@@ -711,7 +711,7 @@ declare global {
|
|
|
711
711
|
*
|
|
712
712
|
* @returns version information
|
|
713
713
|
*/
|
|
714
|
-
function get_version(): b2d.
|
|
714
|
+
function get_version(): b2d.VersionInfo;
|
|
715
715
|
/**
|
|
716
716
|
* Get the Box2D world from the current collection
|
|
717
717
|
*
|