@defold-typescript/types 0.51.0 → 0.52.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 +878 -1356
- package/api-targets.json +15 -5
- package/examples/translations.json +4 -56
- package/generated/b2d_world.d.ts +10 -10
- package/generated/buffer.d.ts +9 -9
- package/generated/bullet3d_collision_object.d.ts +1 -1
- package/generated/bullet3d_constraint.d.ts +109 -7
- package/generated/bullet3d_shape.d.ts +2 -2
- package/generated/go.d.ts +114 -220
- package/generated/graphics.d.ts +1 -0
- package/generated/gui.d.ts +148 -371
- package/generated/http.d.ts +2 -2
- package/generated/image.d.ts +55 -3
- package/generated/kinds/gui-script.d.ts +2 -0
- package/generated/kinds/render-script.d.ts +14 -15
- package/generated/liveupdate.d.ts +5 -1
- package/generated/material.d.ts +3 -3
- package/generated/particlefx.d.ts +20 -1
- package/generated/physics.d.ts +45 -1
- 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 +25 -0
- package/generated/render-script-modules/collectionproxy.d.ts +39 -0
- package/generated/render-script-modules/factory.d.ts +25 -0
- package/generated/render-script-modules/go.d.ts +436 -0
- package/generated/render-script-modules/label.d.ts +105 -0
- package/generated/render-script-modules/model.d.ts +89 -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 +1233 -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 +134 -8
- package/generated/resource.d.ts +31 -10
- package/generated/sprite.d.ts +49 -1
- package/generated/sys.d.ts +70 -6
- package/generated/versions/defold-1.12.4/buffer.d.ts +8 -8
- package/generated/versions/defold-1.12.4/go.d.ts +115 -343
- package/generated/versions/defold-1.12.4/graphics.d.ts +1 -0
- package/generated/versions/defold-1.12.4/gui.d.ts +151 -513
- 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/liveupdate.d.ts +4 -0
- package/generated/versions/defold-1.12.4/particlefx.d.ts +22 -1
- package/generated/versions/defold-1.12.4/physics.d.ts +45 -1
- package/generated/versions/defold-1.12.4/render.d.ts +78 -2
- package/generated/versions/defold-1.12.4/resource.d.ts +43 -10
- package/generated/versions/defold-1.12.4/sprite.d.ts +58 -1
- package/generated/versions/defold-1.12.4/sys.d.ts +101 -6
- package/generated/versions/defold-1.12.4/vmath.d.ts +0 -24
- package/generated/versions/defold-1.13.0/buffer.d.ts +8 -8
- package/generated/versions/defold-1.13.0/go.d.ts +115 -370
- package/generated/versions/defold-1.13.0/graphics.d.ts +1 -0
- package/generated/versions/defold-1.13.0/gui.d.ts +151 -513
- 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/liveupdate.d.ts +4 -0
- package/generated/versions/defold-1.13.0/material.d.ts +3 -1
- package/generated/versions/defold-1.13.0/particlefx.d.ts +22 -1
- package/generated/versions/defold-1.13.0/physics.d.ts +45 -1
- package/generated/versions/defold-1.13.0/render.d.ts +142 -4
- package/generated/versions/defold-1.13.0/resource.d.ts +43 -10
- package/generated/versions/defold-1.13.0/sprite.d.ts +58 -1
- package/generated/versions/defold-1.13.0/sys.d.ts +101 -6
- package/generated/versions/defold-1.13.0/vmath.d.ts +0 -24
- package/generated/versions/defold-1.13.1/buffer.d.ts +8 -8
- package/generated/versions/defold-1.13.1/go.d.ts +115 -370
- package/generated/versions/defold-1.13.1/graphics.d.ts +1 -0
- package/generated/versions/defold-1.13.1/gui.d.ts +151 -529
- 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/liveupdate.d.ts +4 -0
- package/generated/versions/defold-1.13.1/material.d.ts +3 -1
- package/generated/versions/defold-1.13.1/particlefx.d.ts +22 -1
- package/generated/versions/defold-1.13.1/physics.d.ts +45 -1
- package/generated/versions/defold-1.13.1/render.d.ts +142 -4
- package/generated/versions/defold-1.13.1/resource.d.ts +43 -10
- package/generated/versions/defold-1.13.1/sprite.d.ts +58 -1
- package/generated/versions/defold-1.13.1/sys.d.ts +101 -6
- package/generated/versions/defold-1.13.1/vmath.d.ts +0 -24
- package/generated/versions/defold-1.13.2/b2d_world.d.ts +10 -10
- package/generated/versions/defold-1.13.2/buffer.d.ts +9 -9
- package/generated/versions/defold-1.13.2/bullet3d_collision_object.d.ts +1 -1
- package/generated/versions/defold-1.13.2/bullet3d_constraint.d.ts +109 -7
- package/generated/versions/defold-1.13.2/bullet3d_shape.d.ts +2 -2
- package/generated/versions/defold-1.13.2/go.d.ts +114 -220
- package/generated/versions/defold-1.13.2/graphics.d.ts +1 -0
- package/generated/versions/defold-1.13.2/gui.d.ts +148 -371
- package/generated/versions/defold-1.13.2/http.d.ts +2 -2
- package/generated/versions/defold-1.13.2/image.d.ts +55 -3
- package/generated/versions/defold-1.13.2/index.d.ts +2 -0
- package/generated/versions/defold-1.13.2/liveupdate.d.ts +5 -1
- package/generated/versions/defold-1.13.2/material.d.ts +3 -3
- package/generated/versions/defold-1.13.2/particlefx.d.ts +20 -1
- package/generated/versions/defold-1.13.2/physics.d.ts +45 -1
- package/generated/versions/defold-1.13.2/render.d.ts +123 -7
- package/generated/versions/defold-1.13.2/resource.d.ts +31 -10
- package/generated/versions/defold-1.13.2/sprite.d.ts +49 -1
- package/generated/versions/defold-1.13.2/sys.d.ts +70 -6
- package/generated/versions/defold-1.13.2/vmath.d.ts +0 -24
- package/generated/vmath.d.ts +0 -24
- package/identity-vocabulary.json +52 -7
- package/index.d.ts +2 -0
- package/package.json +2 -1
- package/scripts/generate-api-availability.ts +1 -21
- package/scripts/generate-api-signatures.ts +75 -14
- package/scripts/materialize-version.ts +48 -7
- package/scripts/regen.ts +214 -19
- package/scripts/signature-store-fs.ts +1 -0
- package/scripts/target-version.ts +26 -0
- package/src/api-doc.ts +26 -0
- package/src/component-properties.d.ts +89 -0
- package/src/core-types.ts +42 -15
- package/src/doc-corrections.ts +53 -5
- package/src/emit-dts.ts +758 -198
- package/src/engine-globals.d.ts +5 -1
- package/src/go-overloads.d.ts +68 -13
- package/src/gui-overloads.d.ts +489 -0
- package/src/gui-texture-removal.d.ts +41 -0
- package/src/index.ts +2 -0
- package/src/lifecycle.ts +30 -21
- package/src/msg-overloads.d.ts +25 -13
- package/src/signature-store.ts +50 -0
- package/src/timers.d.ts +2 -1
- package/src/vmath-overloads.d.ts +26 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
-
import type { Hash } from "../../../src/core-types";
|
|
2
|
+
import type { Hash, Url } from "../../../src/core-types";
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
5
|
/**
|
|
@@ -72,7 +72,7 @@ declare global {
|
|
|
72
72
|
* });
|
|
73
73
|
* ```
|
|
74
74
|
*/
|
|
75
|
-
function request(url: string, method: string, callback: (self: unknown, id: Hash, response: { status: number; url: string; response?: string; headers?: LuaMap<string, string>; path?: string; error?: string; bytes_sent?: number; bytes_received?: number; bytes_total?: number; range_start?: number; range_end?: number; document_size?: number }) => void, headers?: LuaMap<string, string> | Record<string, string>, post_data?: string, options?: { timeout?: number; path?: string; ignore_cache?: boolean; chunked_transfer?: boolean; report_progress?: boolean }): void;
|
|
75
|
+
function request(url: string, method: string, callback: (self: unknown, id: Hash, response: { status: number; url: string; response?: string; headers?: LuaMap<string, string>; path?: string; error?: string; bytes_sent?: number; bytes_received?: number; bytes_total?: number; range_start?: number; range_end?: number; document_size?: number }, sender: Url) => void, headers?: LuaMap<string, string> | Record<string, string>, post_data?: string, options?: { timeout?: number; path?: string; ignore_cache?: boolean; chunked_transfer?: boolean; report_progress?: boolean }): void;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -77,7 +77,87 @@ declare global {
|
|
|
77
77
|
* });
|
|
78
78
|
* ```
|
|
79
79
|
*/
|
|
80
|
-
function load(buffer: string
|
|
80
|
+
function load(buffer: string): { width: number; height: number; type: Opaque<"constant">; buffer: string } | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Load image (PNG or JPEG) from buffer.
|
|
83
|
+
*
|
|
84
|
+
* @param buffer - image data buffer
|
|
85
|
+
* @param options - An optional table containing parameters for loading the image. Supported entries:
|
|
86
|
+
*
|
|
87
|
+
* `premultiply_alpha`
|
|
88
|
+
* boolean True if alpha should be premultiplied into the color components. Defaults to `false`.
|
|
89
|
+
* `flip_vertically`
|
|
90
|
+
* boolean True if the image contents should be flipped vertically. Defaults to `false`.
|
|
91
|
+
* @returns object or `nil` if loading fails. The object is a table with the following fields:
|
|
92
|
+
*
|
|
93
|
+
* - number `width`: image width
|
|
94
|
+
* - number `height`: image height
|
|
95
|
+
* - constant `type`: image type
|
|
96
|
+
* - `image.TYPE_RGB`
|
|
97
|
+
* - `image.TYPE_RGBA`
|
|
98
|
+
* - `image.TYPE_LUMINANCE`
|
|
99
|
+
* - `image.TYPE_LUMINANCE_ALPHA`
|
|
100
|
+
* - string `buffer`: the raw image data
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* // How to load an image from an URL and create a GUI texture from it:
|
|
104
|
+
* const imgurl = "http://www.site.com/image.png";
|
|
105
|
+
* http.request(imgurl, "GET", (self, id, response) => {
|
|
106
|
+
* const img = response.response !== undefined ? image.load(response.response) : undefined;
|
|
107
|
+
* if (img !== undefined) {
|
|
108
|
+
* const tx = gui.new_texture("image_node", img.width, img.height, img.type, img.buffer);
|
|
109
|
+
* }
|
|
110
|
+
* });
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
function load(buffer: string, options: { premultiply_alpha?: boolean; flip_vertically?: boolean }): { width: number; height: number; type: Opaque<"constant">; buffer: string } | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Load image (PNG or JPEG) from a string buffer.
|
|
116
|
+
*
|
|
117
|
+
* @param buffer - image data buffer
|
|
118
|
+
* @param options - An optional table containing parameters for loading the image. Supported entries:
|
|
119
|
+
*
|
|
120
|
+
* `premultiply_alpha`
|
|
121
|
+
* boolean True if alpha should be premultiplied into the color components. Defaults to `false`.
|
|
122
|
+
* `flip_vertically`
|
|
123
|
+
* boolean True if the image contents should be flipped vertically. Defaults to `false`.
|
|
124
|
+
* @returns object or `nil` if loading fails. The object is a table with the following fields:
|
|
125
|
+
*
|
|
126
|
+
* - number `width`: image width
|
|
127
|
+
* - number `height`: image height
|
|
128
|
+
* - constant `type`: image type
|
|
129
|
+
* - `image.TYPE_RGB`
|
|
130
|
+
* - `image.TYPE_RGBA`
|
|
131
|
+
* - `image.TYPE_LUMINANCE`
|
|
132
|
+
* - `image.TYPE_LUMINANCE_ALPHA`
|
|
133
|
+
* - buffer `buffer`: the script buffer that holds the decompressed image data. See buffer.create how to use the buffer.
|
|
134
|
+
* @example
|
|
135
|
+
* ```ts
|
|
136
|
+
* // Load an image from an URL as a buffer and create a texture resource from it:
|
|
137
|
+
* const imgurl = "http://www.site.com/image.png";
|
|
138
|
+
* http.request(imgurl, "GET", (self, id, response) => {
|
|
139
|
+
* const img =
|
|
140
|
+
* response.response !== undefined
|
|
141
|
+
* ? image.load_buffer(response.response, { flip_vertically: true })
|
|
142
|
+
* : undefined;
|
|
143
|
+
* // the engine registers a texture format only when the driver supports it
|
|
144
|
+
* const format = graphics.TEXTURE_FORMAT_RGBA;
|
|
145
|
+
* if (img !== undefined && format !== undefined) {
|
|
146
|
+
* const tparams = {
|
|
147
|
+
* width: img.width,
|
|
148
|
+
* height: img.height,
|
|
149
|
+
* type: graphics.TEXTURE_TYPE_2D,
|
|
150
|
+
* format,
|
|
151
|
+
* };
|
|
152
|
+
*
|
|
153
|
+
* const my_texture_id = resource.create_texture("/my_custom_texture.texturec", tparams, img.buffer);
|
|
154
|
+
* // Apply the texture to a model
|
|
155
|
+
* go.set("/go1#model", "texture0", my_texture_id);
|
|
156
|
+
* }
|
|
157
|
+
* });
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
function load_buffer(buffer: string): { width: number; height: number; type: Opaque<"constant">; buffer: Opaque<"buffer"> & { length: LuaLengthMethod<number> } } | undefined;
|
|
81
161
|
/**
|
|
82
162
|
* Load image (PNG or JPEG) from a string buffer.
|
|
83
163
|
*
|
|
@@ -124,7 +204,7 @@ declare global {
|
|
|
124
204
|
* });
|
|
125
205
|
* ```
|
|
126
206
|
*/
|
|
127
|
-
function load_buffer(buffer: string, options
|
|
207
|
+
function load_buffer(buffer: string, options: { premultiply_alpha?: boolean; flip_vertically?: boolean }): { width: number; height: number; type: Opaque<"constant">; buffer: Opaque<"buffer"> & { length: LuaLengthMethod<number> } } | undefined;
|
|
128
208
|
}
|
|
129
209
|
}
|
|
130
210
|
|
|
@@ -45,6 +45,7 @@ import "../../../src/scene-addresses";
|
|
|
45
45
|
import "../../../src/go-overloads";
|
|
46
46
|
import "../../../src/component-properties";
|
|
47
47
|
import "../../../src/render-overloads";
|
|
48
|
+
import "../../../src/gui-overloads";
|
|
48
49
|
import "../../../src/vmath-overloads";
|
|
49
50
|
import "../../../src/sys-overloads";
|
|
50
51
|
|
|
@@ -36,6 +36,10 @@ declare global {
|
|
|
36
36
|
* Memory wasn't allocated
|
|
37
37
|
*/
|
|
38
38
|
const LIVEUPDATE_MEM_ERROR: number & { readonly __brand: "liveupdate.LIVEUPDATE_MEM_ERROR" };
|
|
39
|
+
/**
|
|
40
|
+
* Live update is not initialized. `liveupdate.add_mount` and `liveupdate.remove_mount` return it while live update is disabled.
|
|
41
|
+
*/
|
|
42
|
+
const LIVEUPDATE_NOT_INITIALIZED: number & { readonly __brand: "liveupdate.LIVEUPDATE_NOT_INITIALIZED" };
|
|
39
43
|
/**
|
|
40
44
|
* LIVEUPDATE_OK
|
|
41
45
|
*/
|
|
@@ -134,7 +134,28 @@ declare global {
|
|
|
134
134
|
* });
|
|
135
135
|
* ```
|
|
136
136
|
*/
|
|
137
|
-
function stop(url: string | Hash | Url
|
|
137
|
+
function stop(url: string | Hash | Url): void;
|
|
138
|
+
/**
|
|
139
|
+
* Stops a particle FX component from playing.
|
|
140
|
+
* Stopping a particle FX does not remove already spawned particles.
|
|
141
|
+
* Which particle FX to stop is identified by the URL.
|
|
142
|
+
*
|
|
143
|
+
* @param url - the particle fx that should stop playing
|
|
144
|
+
* @param options - Options when stopping the particle fx. Supported options:
|
|
145
|
+
*
|
|
146
|
+
* - boolean `clear`: instantly clear spawned particles
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* // How to stop a particle fx when a game object is deleted and immediately also
|
|
150
|
+
* // clear any spawned particles:
|
|
151
|
+
* export default defineScript({
|
|
152
|
+
* final(self) {
|
|
153
|
+
* particlefx.stop("#particlefx", { clear: true });
|
|
154
|
+
* },
|
|
155
|
+
* });
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
function stop(url: string | Hash | Url, options: { clear?: boolean }): void;
|
|
138
159
|
interface properties {
|
|
139
160
|
/**
|
|
140
161
|
* The animation used during rendering by an emitter in a particle FX component.
|
|
@@ -271,7 +271,51 @@ declare global {
|
|
|
271
271
|
* });
|
|
272
272
|
* ```
|
|
273
273
|
*/
|
|
274
|
-
function raycast_async(from: Vector3, to: Vector3, groups: Hash[]
|
|
274
|
+
function raycast_async(from: Vector3, to: Vector3, groups: Hash[]): void;
|
|
275
|
+
/**
|
|
276
|
+
* Ray casts are used to test for intersections against collision objects in the physics world.
|
|
277
|
+
* Collision objects of types kinematic, dynamic and static are tested against. Trigger objects
|
|
278
|
+
* do not intersect with ray casts.
|
|
279
|
+
* Which collision objects to hit is filtered by their collision groups and can be configured
|
|
280
|
+
* through `groups`.
|
|
281
|
+
* The actual ray cast will be performed during the physics-update.
|
|
282
|
+
*
|
|
283
|
+
* - If an object is hit, the result will be reported via a ray_cast_response message.
|
|
284
|
+
* - If there is no object hit, the result will be reported via a ray_cast_missed message.
|
|
285
|
+
*
|
|
286
|
+
* NOTE: Ray casts will ignore collision objects that contain the starting point of the ray. This is a limitation in Box2D.
|
|
287
|
+
*
|
|
288
|
+
* @param from - the world position of the start of the ray
|
|
289
|
+
* @param to - the world position of the end of the ray
|
|
290
|
+
* @param groups - a lua table containing the hashed groups for which to test collisions against
|
|
291
|
+
* @param request_id - a number in range [0,255]. It will be sent back in the response for identification, 0 by default
|
|
292
|
+
* @example
|
|
293
|
+
* ```ts
|
|
294
|
+
* // How to perform a ray cast asynchronously:
|
|
295
|
+
* export default defineScript({
|
|
296
|
+
* init() {
|
|
297
|
+
* return { my_groups: [hash("my_group1"), hash("my_group2")] };
|
|
298
|
+
* },
|
|
299
|
+
*
|
|
300
|
+
* update(self, dt) {
|
|
301
|
+
* // request ray cast
|
|
302
|
+
* const my_start = go.get_world_position();
|
|
303
|
+
* const my_end = vmath.vector3(my_start.x, my_start.y - 100, my_start.z);
|
|
304
|
+
* physics.raycast_async(my_start, my_end, self.my_groups);
|
|
305
|
+
* },
|
|
306
|
+
*
|
|
307
|
+
* on_message(self, message_id, message, sender) {
|
|
308
|
+
* // check for the response
|
|
309
|
+
* if (message_id === hash("ray_cast_response")) {
|
|
310
|
+
* // act on the hit
|
|
311
|
+
* } else if (message_id === hash("ray_cast_missed")) {
|
|
312
|
+
* // act on the miss
|
|
313
|
+
* }
|
|
314
|
+
* },
|
|
315
|
+
* });
|
|
316
|
+
* ```
|
|
317
|
+
*/
|
|
318
|
+
function raycast_async(from: Vector3, to: Vector3, groups: Hash[], request_id: number): void;
|
|
275
319
|
/**
|
|
276
320
|
* Only one physics world event listener can be set at a time.
|
|
277
321
|
*
|
|
@@ -18,6 +18,7 @@ declare global {
|
|
|
18
18
|
type render_target = Opaque<"render_target">;
|
|
19
19
|
type texture = Opaque<"texture">;
|
|
20
20
|
type ClearBufferKey = typeof graphics.BUFFER_TYPE_COLOR0_BIT | typeof graphics.BUFFER_TYPE_DEPTH_BIT | typeof graphics.BUFFER_TYPE_STENCIL_BIT;
|
|
21
|
+
type RenderTargetTextureType = typeof graphics.TEXTURE_TYPE_2D | typeof graphics.TEXTURE_TYPE_CUBE_MAP;
|
|
21
22
|
type RenderTargetParams = Record<string | number, unknown>;
|
|
22
23
|
/**
|
|
23
24
|
* The rendering context was lost. Rendering is paused and all graphics resources become invalid. Passed to the `render.set_listener` callback.
|
|
@@ -220,7 +221,7 @@ declare global {
|
|
|
220
221
|
* });
|
|
221
222
|
* ```
|
|
222
223
|
*/
|
|
223
|
-
function disable_texture(binding:
|
|
224
|
+
function disable_texture(binding: string | Hash | number): void;
|
|
224
225
|
/**
|
|
225
226
|
* Dispatches the currently enabled compute program. The dispatch call takes three arguments x,y,z which constitutes
|
|
226
227
|
* the 'global working group' of the compute dispatch. Together with the 'local working group' specified in the compute shader
|
|
@@ -1027,7 +1028,82 @@ declare global {
|
|
|
1027
1028
|
* });
|
|
1028
1029
|
* ```
|
|
1029
1030
|
*/
|
|
1030
|
-
function set_render_target(render_target?: Opaque<"render_target"> | string | Hash | typeof render.RENDER_TARGET_DEFAULT
|
|
1031
|
+
function set_render_target(render_target?: Opaque<"render_target"> | string | Hash | typeof render.RENDER_TARGET_DEFAULT): void;
|
|
1032
|
+
/**
|
|
1033
|
+
* Sets a render target. Subsequent draw operations will be to the
|
|
1034
|
+
* render target until it is replaced by a subsequent call to set_render_target.
|
|
1035
|
+
* This function supports render targets created by a render script, or a render target resource.
|
|
1036
|
+
*
|
|
1037
|
+
* @param render_target - render target to set. render.RENDER_TARGET_DEFAULT to set the default render target
|
|
1038
|
+
* @param options - optional table with behaviour parameters
|
|
1039
|
+
*
|
|
1040
|
+
* `transient`
|
|
1041
|
+
* table Transient frame buffer types are only valid while the render target is active, i.e becomes undefined when a new target is set by a subsequent call to set_render_target.
|
|
1042
|
+
* Default is all non-transient. Be aware that some hardware uses a combined depth stencil buffer and when this is the case both are considered non-transient if exclusively selected!
|
|
1043
|
+
* A buffer type defined that doesn't exist in the render target is silently ignored.
|
|
1044
|
+
*
|
|
1045
|
+
* - `graphics.BUFFER_TYPE_COLOR0_BIT`
|
|
1046
|
+
* - `graphics.BUFFER_TYPE_DEPTH_BIT`
|
|
1047
|
+
* - `graphics.BUFFER_TYPE_STENCIL_BIT`
|
|
1048
|
+
* @example
|
|
1049
|
+
* How to set a render target and draw to it and then switch back to the default render target
|
|
1050
|
+
* The render target defines the depth/stencil buffers as transient, when set_render_target is called the next time the buffers may be invalidated and allow for optimisations depending on driver support
|
|
1051
|
+
* ```ts
|
|
1052
|
+
* // How to set a render target and draw to it and then switch back to the default render target
|
|
1053
|
+
* // The render target defines the depth/stencil buffers as transient, when set_render_target is called the next time the buffers may be invalidated and allow for optimisations depending on driver support
|
|
1054
|
+
* export default defineRenderScript({
|
|
1055
|
+
* init() {
|
|
1056
|
+
* // the engine registers a texture format only when the driver supports it
|
|
1057
|
+
* const format = graphics.TEXTURE_FORMAT_RGBA;
|
|
1058
|
+
* if (format === undefined) return undefined;
|
|
1059
|
+
* const color_params = {
|
|
1060
|
+
* format,
|
|
1061
|
+
* width: render.get_window_width(),
|
|
1062
|
+
* height: render.get_window_height(),
|
|
1063
|
+
* };
|
|
1064
|
+
* return {
|
|
1065
|
+
* my_render_target: render.render_target({ [graphics.BUFFER_TYPE_COLOR0_BIT]: color_params }),
|
|
1066
|
+
* my_pred: render.predicate([hash("my_tag")]),
|
|
1067
|
+
* };
|
|
1068
|
+
* },
|
|
1069
|
+
*
|
|
1070
|
+
* update(self, dt) {
|
|
1071
|
+
* if (self === undefined) return;
|
|
1072
|
+
* // set render target so all drawing is done to it
|
|
1073
|
+
* render.set_render_target(self.my_render_target, {
|
|
1074
|
+
* transient: [graphics.BUFFER_TYPE_DEPTH_BIT, graphics.BUFFER_TYPE_STENCIL_BIT],
|
|
1075
|
+
* });
|
|
1076
|
+
*
|
|
1077
|
+
* // draw a predicate to the render target
|
|
1078
|
+
* render.draw(self.my_pred);
|
|
1079
|
+
*
|
|
1080
|
+
* // set default render target. This also invalidates the depth and stencil buffers of the current target (self.my_render_target)
|
|
1081
|
+
* // which can be an optimisation on some hardware
|
|
1082
|
+
* render.set_render_target(render.RENDER_TARGET_DEFAULT);
|
|
1083
|
+
* },
|
|
1084
|
+
* });
|
|
1085
|
+
* ```
|
|
1086
|
+
* @example
|
|
1087
|
+
* ```ts
|
|
1088
|
+
* export default defineRenderScript({
|
|
1089
|
+
* init() {
|
|
1090
|
+
* return { my_pred: render.predicate([hash("my_tag")]) };
|
|
1091
|
+
* },
|
|
1092
|
+
*
|
|
1093
|
+
* update(self, dt) {
|
|
1094
|
+
* // set render target by a render target resource identifier
|
|
1095
|
+
* render.set_render_target("my_rt_resource");
|
|
1096
|
+
*
|
|
1097
|
+
* // draw a predicate to the render target
|
|
1098
|
+
* render.draw(self.my_pred);
|
|
1099
|
+
*
|
|
1100
|
+
* // reset the render target to the default backbuffer
|
|
1101
|
+
* render.set_render_target(render.RENDER_TARGET_DEFAULT);
|
|
1102
|
+
* },
|
|
1103
|
+
* });
|
|
1104
|
+
* ```
|
|
1105
|
+
*/
|
|
1106
|
+
function set_render_target(render_target: Opaque<"render_target"> | string | Hash | typeof render.RENDER_TARGET_DEFAULT | undefined, options: { transient?: graphics.BufferType[] }): void;
|
|
1031
1107
|
/**
|
|
1032
1108
|
* Sets the render target size for a render target created from
|
|
1033
1109
|
* either a render script, or from a render target resource.
|
|
@@ -277,7 +277,7 @@ declare global {
|
|
|
277
277
|
* });
|
|
278
278
|
* ```
|
|
279
279
|
*/
|
|
280
|
-
function create_buffer(path: string, table: { buffer: Opaque<"buffer"
|
|
280
|
+
function create_buffer(path: string, table: { buffer: Opaque<"buffer"> & { length: LuaLengthMethod<number> }; transfer_ownership?: boolean }): Hash;
|
|
281
281
|
/**
|
|
282
282
|
* Creates a sound data resource
|
|
283
283
|
* Supported formats are .oggc, .opusc and .wavc
|
|
@@ -310,7 +310,7 @@ declare global {
|
|
|
310
310
|
* });
|
|
311
311
|
* ```
|
|
312
312
|
*/
|
|
313
|
-
function create_sound_data(path: string, options: { data: string | Opaque<"buffer">; filesize?: number; partial?: boolean }): Hash;
|
|
313
|
+
function create_sound_data(path: string, options: { data: string | Opaque<"buffer">; filesize?: number; partial?: boolean } & ({ partial?: false } | ({ partial: true } & Required<Pick<{ data: string | Opaque<"buffer">; filesize?: number; partial?: boolean }, "filesize">>))): Hash;
|
|
314
314
|
/**
|
|
315
315
|
* Creates a new texture resource that can be used in the same way as any texture created during build time.
|
|
316
316
|
* The path used for creating the texture must be unique, trying to create a resource at a path that is already
|
|
@@ -496,7 +496,7 @@ declare global {
|
|
|
496
496
|
* }
|
|
497
497
|
* ```
|
|
498
498
|
*/
|
|
499
|
-
function create_texture(path: string, table: { type: number; width: number; height: number; depth?: number; format: number; flags?: number; max_mipmaps?: number; compression_type?: number; page_count?: number }, buffer?: Opaque<"buffer">): Hash;
|
|
499
|
+
function create_texture(path: string, table: { type: number; width: number; height: number; depth?: number; format: number; flags?: number; max_mipmaps?: number; compression_type?: number; page_count?: number }, buffer?: Opaque<"buffer"> & { length: LuaLengthMethod<number> }): Hash;
|
|
500
500
|
/**
|
|
501
501
|
* Creates a new texture resource that can be used in the same way as any texture created during build time.
|
|
502
502
|
* The path used for creating the texture must be unique, trying to create a resource at a path that is already
|
|
@@ -666,7 +666,7 @@ declare global {
|
|
|
666
666
|
* });
|
|
667
667
|
* ```
|
|
668
668
|
*/
|
|
669
|
-
function create_texture_async(path: string, table: { type: number; width: number; height: number; depth?: number; format: number; flags?: number; max_mipmaps?: number; compression_type?: number }, buffer: Opaque<"buffer"> | undefined, callback: (...args: unknown[]) => unknown): LuaMultiReturn<[Hash, number]>;
|
|
669
|
+
function create_texture_async(path: string, table: { type: number; width: number; height: number; depth?: number; format: number; flags?: number; max_mipmaps?: number; compression_type?: number }, buffer: Opaque<"buffer"> & { length: LuaLengthMethod<number> } | undefined, callback: (...args: unknown[]) => unknown): LuaMultiReturn<[Hash, number]>;
|
|
670
670
|
/**
|
|
671
671
|
* Constructor-like function with two purposes:
|
|
672
672
|
*
|
|
@@ -745,7 +745,7 @@ declare global {
|
|
|
745
745
|
* });
|
|
746
746
|
* ```
|
|
747
747
|
*/
|
|
748
|
-
function get_buffer(path: Hash | string): Opaque<"buffer"
|
|
748
|
+
function get_buffer(path: Hash | string): Opaque<"buffer"> & { length: LuaLengthMethod<number> };
|
|
749
749
|
/**
|
|
750
750
|
* Gets render target info from a render target resource path or a render target handle
|
|
751
751
|
*
|
|
@@ -844,7 +844,40 @@ declare global {
|
|
|
844
844
|
* });
|
|
845
845
|
* ```
|
|
846
846
|
*/
|
|
847
|
-
function get_text_metrics(url: Hash | string, text: string
|
|
847
|
+
function get_text_metrics(url: Hash | string, text: string): { width: number; height: number; max_ascent: number; max_descent: number };
|
|
848
|
+
/**
|
|
849
|
+
* Gets the text metrics from a font
|
|
850
|
+
*
|
|
851
|
+
* @param url - the font to get the (unscaled) metrics from
|
|
852
|
+
* @param text - text to measure
|
|
853
|
+
* @param options - A table containing parameters for the text. Supported entries:
|
|
854
|
+
*
|
|
855
|
+
* `width`
|
|
856
|
+
* number The width of the text field. Not used if `line_break` is false.
|
|
857
|
+
* `leading`
|
|
858
|
+
* number The leading (default 1.0)
|
|
859
|
+
* `tracking`
|
|
860
|
+
* number The tracking (default 0.0)
|
|
861
|
+
* `line_break`
|
|
862
|
+
* boolean If the calculation should consider line breaks (default false)
|
|
863
|
+
* @returns a table with the following fields:
|
|
864
|
+
*
|
|
865
|
+
* - width
|
|
866
|
+
* - height
|
|
867
|
+
* - max_ascent
|
|
868
|
+
* - max_descent
|
|
869
|
+
* @example
|
|
870
|
+
* ```ts
|
|
871
|
+
* export default defineScript({
|
|
872
|
+
* init() {
|
|
873
|
+
* const font = go.get<label.properties>()("#label", "font");
|
|
874
|
+
* const metrics = resource.get_text_metrics(font, "The quick brown fox\n jumps over the lazy dog");
|
|
875
|
+
* pprint(metrics);
|
|
876
|
+
* },
|
|
877
|
+
* });
|
|
878
|
+
* ```
|
|
879
|
+
*/
|
|
880
|
+
function get_text_metrics(url: Hash | string, text: string, options: { width?: number; leading?: number; tracking?: number; line_break?: boolean }): { width: number; height: number; max_ascent: number; max_descent: number };
|
|
848
881
|
/**
|
|
849
882
|
* Gets texture info from a texture resource path or a texture handle
|
|
850
883
|
*
|
|
@@ -943,7 +976,7 @@ declare global {
|
|
|
943
976
|
* // custom_resources = resources/,assets/level_data.json
|
|
944
977
|
* ```
|
|
945
978
|
*/
|
|
946
|
-
function load(path: string): Opaque<"buffer"
|
|
979
|
+
function load(path: string): Opaque<"buffer"> & { length: LuaLengthMethod<number> };
|
|
947
980
|
/**
|
|
948
981
|
* Constructor-like function with two purposes:
|
|
949
982
|
*
|
|
@@ -1030,7 +1063,7 @@ declare global {
|
|
|
1030
1063
|
* resource.set(go.get<sprite.properties>()("#sprite", "texture0"), buffer);
|
|
1031
1064
|
* ```
|
|
1032
1065
|
*/
|
|
1033
|
-
function set(path: string | Hash, buffer: Opaque<"buffer">): void;
|
|
1066
|
+
function set(path: string | Hash, buffer: Opaque<"buffer"> & { length: LuaLengthMethod<number> }): void;
|
|
1034
1067
|
/**
|
|
1035
1068
|
* Sets the data for a specific atlas resource. Setting new atlas data is specified by passing in
|
|
1036
1069
|
* a texture path for the backing texture of the atlas, a list of geometries and a list of animations
|
|
@@ -1209,7 +1242,7 @@ declare global {
|
|
|
1209
1242
|
* });
|
|
1210
1243
|
* ```
|
|
1211
1244
|
*/
|
|
1212
|
-
function set_buffer(path: Hash | string, buffer: Opaque<"buffer"
|
|
1245
|
+
function set_buffer(path: Hash | string, buffer: Opaque<"buffer"> & { length: LuaLengthMethod<number> }, table?: { transfer_ownership?: boolean }): void;
|
|
1213
1246
|
/**
|
|
1214
1247
|
* Update internal sound resource (wavc/oggc/opusc) with new data
|
|
1215
1248
|
*
|
|
@@ -1462,7 +1495,7 @@ declare global {
|
|
|
1462
1495
|
* }
|
|
1463
1496
|
* ```
|
|
1464
1497
|
*/
|
|
1465
|
-
function set_texture(path: Hash | string, table: { type: number; width: number; height: number; format: number; x?: number; y?: number; z?: number; page?: number; mipmap?: number; compression_type?: number }, buffer: Opaque<"buffer">): void;
|
|
1498
|
+
function set_texture(path: Hash | string, table: { type: number; width: number; height: number; format: number; x?: number; y?: number; z?: number; page?: number; mipmap?: number; compression_type?: number }, buffer: Opaque<"buffer"> & { length: LuaLengthMethod<number> }): void;
|
|
1466
1499
|
/**
|
|
1467
1500
|
* Constructor-like function with two purposes:
|
|
1468
1501
|
*
|
|
@@ -62,7 +62,64 @@ declare global {
|
|
|
62
62
|
* });
|
|
63
63
|
* ```
|
|
64
64
|
*/
|
|
65
|
-
function play_flipbook(url: string | Hash | Url, id: string | Hash, complete_function?: (self: unknown, message_id: Hash, message: { current_tile: number; id: Hash }, sender: Url) => void
|
|
65
|
+
function play_flipbook(url: string | Hash | Url, id: string | Hash, complete_function?: (self: unknown, message_id: Hash, message: { current_tile: number; id: Hash }, sender: Url) => void): void;
|
|
66
|
+
/**
|
|
67
|
+
* Play an animation on a sprite component from its tile set
|
|
68
|
+
* An optional completion callback function can be provided that will be called when
|
|
69
|
+
* the animation has completed playing. If no function is provided,
|
|
70
|
+
* a animation_done message is sent to the script that started the animation.
|
|
71
|
+
*
|
|
72
|
+
* @param url - the sprite that should play the animation
|
|
73
|
+
* @param id - hashed id of the animation to play
|
|
74
|
+
* @param complete_function - function to call when the animation has completed.
|
|
75
|
+
*
|
|
76
|
+
* `self`
|
|
77
|
+
* object The current object.
|
|
78
|
+
* `message_id`
|
|
79
|
+
* hash The name of the completion message, `"animation_done"`.
|
|
80
|
+
* `message`
|
|
81
|
+
* table Information about the completion:
|
|
82
|
+
*
|
|
83
|
+
* - number `current_tile` - the current tile of the sprite.
|
|
84
|
+
* - hash `id` - id of the animation that was completed.
|
|
85
|
+
*
|
|
86
|
+
* `sender`
|
|
87
|
+
* url The invoker of the callback: the sprite component.
|
|
88
|
+
* @param play_properties - optional table with properties:
|
|
89
|
+
*
|
|
90
|
+
* `offset`
|
|
91
|
+
* number the normalized initial value of the animation cursor when the animation starts playing.
|
|
92
|
+
* `playback_rate`
|
|
93
|
+
* number the rate with which the animation will be played. Must be positive.
|
|
94
|
+
* @example
|
|
95
|
+
* The following examples assumes that the model has id "sprite".
|
|
96
|
+
* How to play the "jump" animation followed by the "run" animation:
|
|
97
|
+
* ```ts
|
|
98
|
+
* const url = msg.url("#sprite");
|
|
99
|
+
*
|
|
100
|
+
* function anim_done(self: unknown, message_id: Hash, message: { id: Hash }) {
|
|
101
|
+
* if (message_id === hash("animation_done") && message.id === hash("jump")) {
|
|
102
|
+
* // jump animation done, chain with "run"
|
|
103
|
+
* sprite.play_flipbook(url, "run");
|
|
104
|
+
* }
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts
|
|
109
|
+
* export default defineScript({
|
|
110
|
+
* init() {
|
|
111
|
+
* const url = msg.url("#sprite");
|
|
112
|
+
* sprite.play_flipbook(url, "jump", (self, message_id, message) => {
|
|
113
|
+
* if (message_id === hash("animation_done") && message.id === hash("jump")) {
|
|
114
|
+
* // jump animation done, chain with "run"
|
|
115
|
+
* sprite.play_flipbook(url, "run");
|
|
116
|
+
* }
|
|
117
|
+
* });
|
|
118
|
+
* },
|
|
119
|
+
* });
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
function play_flipbook(url: string | Hash | Url, id: string | Hash, complete_function: ((self: unknown, message_id: Hash, message: { current_tile: number; id: Hash }, sender: Url) => void) | undefined, play_properties: { offset?: number; playback_rate?: number }): void;
|
|
66
123
|
/**
|
|
67
124
|
* Sets horizontal flipping of the provided sprite's animations.
|
|
68
125
|
* The sprite is identified by its URL.
|
|
@@ -183,7 +183,40 @@ declare global {
|
|
|
183
183
|
* }
|
|
184
184
|
* ```
|
|
185
185
|
*/
|
|
186
|
-
function get_config_int(key: string
|
|
186
|
+
function get_config_int(key: string): number;
|
|
187
|
+
/**
|
|
188
|
+
* Get integer config value from the game.project configuration file with optional default value
|
|
189
|
+
*
|
|
190
|
+
* @param key - key to get value for. The syntax is SECTION.KEY
|
|
191
|
+
* @param default_value - (optional) default value to return if the value does not exist
|
|
192
|
+
* @returns config value as an integer. default_value if the config key does not exist. 0 if no default value was supplied.
|
|
193
|
+
* @example
|
|
194
|
+
* Get user config value
|
|
195
|
+
* ```ts
|
|
196
|
+
* const speed = sys.get_config_int("my_game.speed", 20); // with default value
|
|
197
|
+
* ```
|
|
198
|
+
* @example
|
|
199
|
+
* ```ts
|
|
200
|
+
* const testmode = sys.get_config_int("my_game.testmode"); // without default value
|
|
201
|
+
* if (testmode !== undefined) {
|
|
202
|
+
* // do stuff
|
|
203
|
+
* }
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
function get_config_int(key: string, default_value: number): number;
|
|
207
|
+
/**
|
|
208
|
+
* Get number config value from the game.project configuration file with optional default value
|
|
209
|
+
*
|
|
210
|
+
* @param key - key to get value for. The syntax is SECTION.KEY
|
|
211
|
+
* @param default_value - (optional) default value to return if the value does not exist
|
|
212
|
+
* @returns config value as an number. default_value if the config key does not exist. 0 if no default value was supplied.
|
|
213
|
+
* @example
|
|
214
|
+
* ```ts
|
|
215
|
+
* // Get user config value
|
|
216
|
+
* const speed = sys.get_config_number("my_game.speed", 20.0);
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
function get_config_number(key: string): number;
|
|
187
220
|
/**
|
|
188
221
|
* Get number config value from the game.project configuration file with optional default value
|
|
189
222
|
*
|
|
@@ -196,7 +229,7 @@ declare global {
|
|
|
196
229
|
* const speed = sys.get_config_number("my_game.speed", 20.0);
|
|
197
230
|
* ```
|
|
198
231
|
*/
|
|
199
|
-
function get_config_number(key: string, default_value
|
|
232
|
+
function get_config_number(key: string, default_value: number): number;
|
|
200
233
|
/**
|
|
201
234
|
* Returns the current network connectivity status
|
|
202
235
|
* on mobile platforms.
|
|
@@ -355,7 +388,46 @@ declare global {
|
|
|
355
388
|
* }
|
|
356
389
|
* ```
|
|
357
390
|
*/
|
|
358
|
-
function get_sys_info(
|
|
391
|
+
function get_sys_info(): { device_model: string; manufacturer: string; system_name: string; system_version: string; api_version: string; language: string; device_language: string; territory: string; gmt_offset: number; device_ident: string; user_agent: string };
|
|
392
|
+
/**
|
|
393
|
+
* Returns a table with system information.
|
|
394
|
+
*
|
|
395
|
+
* @param options - optional options table
|
|
396
|
+
* - ignore_secure boolean this flag ignores values might be secured by OS e.g. `device_ident`
|
|
397
|
+
* @returns table with system information in the following fields:
|
|
398
|
+
*
|
|
399
|
+
* `device_model`
|
|
400
|
+
* string Only available on iOS and Android.
|
|
401
|
+
* `manufacturer`
|
|
402
|
+
* string Only available on iOS and Android.
|
|
403
|
+
* `system_name`
|
|
404
|
+
* string The system name: "Darwin", "Linux", "Windows", "HTML5", "Android" or "iPhone OS"
|
|
405
|
+
* `system_version`
|
|
406
|
+
* string The system OS version.
|
|
407
|
+
* `api_version`
|
|
408
|
+
* string The API version on the system.
|
|
409
|
+
* `language`
|
|
410
|
+
* string Two character ISO-639 format, i.e. "en".
|
|
411
|
+
* `device_language`
|
|
412
|
+
* string Two character ISO-639 format (i.e. "sr") and, if applicable, followed by a dash (-) and an ISO 15924 script code (i.e. "sr-Cyrl" or "sr-Latn"). Reflects the device preferred language.
|
|
413
|
+
* `territory`
|
|
414
|
+
* string Two character ISO-3166 format, i.e. "US".
|
|
415
|
+
* `gmt_offset`
|
|
416
|
+
* number The current offset from GMT (Greenwich Mean Time), in minutes.
|
|
417
|
+
* `device_ident`
|
|
418
|
+
* string This value secured by OS. "identifierForVendor" on iOS. "android_id" on Android. On Android, you need to add `READ_PHONE_STATE` permission to be able to get this data. We don't use this permission in Defold.
|
|
419
|
+
* `user_agent`
|
|
420
|
+
* string The HTTP user agent, i.e. "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
|
|
421
|
+
* @example
|
|
422
|
+
* ```ts
|
|
423
|
+
* // How to get system information:
|
|
424
|
+
* const info = sys.get_sys_info();
|
|
425
|
+
* if (info.system_name === "HTML5") {
|
|
426
|
+
* // We are running in a browser.
|
|
427
|
+
* }
|
|
428
|
+
* ```
|
|
429
|
+
*/
|
|
430
|
+
function get_sys_info(options: { ignore_secure?: boolean }): { device_model: string; manufacturer: string; system_name: string; system_version: string; api_version: string; language: string; device_language: string; territory: string; gmt_offset: number; device_ident: string; user_agent: string };
|
|
359
431
|
/**
|
|
360
432
|
* If the file exists, it must have been created by `sys.save` to be loaded.
|
|
361
433
|
* This function will raise a Lua error if an error occurs while loading the file.
|
|
@@ -401,7 +473,7 @@ declare global {
|
|
|
401
473
|
* const asset_2 = sys.load_buffer("/my/absolute/path");
|
|
402
474
|
* ```
|
|
403
475
|
*/
|
|
404
|
-
function load_buffer(path: string): Opaque<"buffer"
|
|
476
|
+
function load_buffer(path: string): Opaque<"buffer"> & { length: LuaLengthMethod<number> };
|
|
405
477
|
/**
|
|
406
478
|
* The sys.load_buffer function will first try to load the resource
|
|
407
479
|
* from any of the mounted resource locations and return the data if
|
|
@@ -434,7 +506,7 @@ declare global {
|
|
|
434
506
|
* Load binary data from a custom project resource and update a texture resource:
|
|
435
507
|
* ```ts
|
|
436
508
|
* function my_callback(self: unknown, request_id: unknown, result: unknown) {
|
|
437
|
-
* const { status, buf } = result as { status: number; buf:
|
|
509
|
+
* const { status, buf } = result as { status: number; buf: ReturnType<typeof sys.load_buffer> };
|
|
438
510
|
* if (status === sys.REQUEST_STATUS_FINISHED) {
|
|
439
511
|
* resource.set_texture("/my_texture", { type: graphics.TEXTURE_TYPE_2D, width: 128, height: 128, format: graphics.TEXTURE_FORMAT_RGBA }, buf);
|
|
440
512
|
* }
|
|
@@ -519,7 +591,30 @@ declare global {
|
|
|
519
591
|
* }
|
|
520
592
|
* ```
|
|
521
593
|
*/
|
|
522
|
-
function open_url(url: string
|
|
594
|
+
function open_url(url: string): boolean;
|
|
595
|
+
/**
|
|
596
|
+
* Open URL in default application, typically a browser
|
|
597
|
+
*
|
|
598
|
+
* @param url - url to open
|
|
599
|
+
* @param attributes - table with attributes
|
|
600
|
+
* `target`
|
|
601
|
+
* - string : Optional. Specifies the target attribute or the name of the window. The following values are supported:
|
|
602
|
+
* - `_self` - (default value) URL replaces the current page.
|
|
603
|
+
* - `_blank` - URL is loaded into a new window, or tab.
|
|
604
|
+
* - `_parent` - URL is loaded into the parent frame.
|
|
605
|
+
* - `_top` - URL replaces any framesets that may be loaded.
|
|
606
|
+
* - `name` - The name of the window (Note: the name does not specify the title of the new window).
|
|
607
|
+
* @returns a boolean indicating if the url could be opened or not
|
|
608
|
+
* @example
|
|
609
|
+
* ```ts
|
|
610
|
+
* // Open an URL:
|
|
611
|
+
* const success = sys.open_url("http://www.defold.com", { target: "_blank" });
|
|
612
|
+
* if (!success) {
|
|
613
|
+
* // could not open the url...
|
|
614
|
+
* }
|
|
615
|
+
* ```
|
|
616
|
+
*/
|
|
617
|
+
function open_url(url: string, attributes: { target?: string }): boolean;
|
|
523
618
|
/**
|
|
524
619
|
* Reboots the game engine with a specified set of arguments.
|
|
525
620
|
* Arguments will be translated into command line arguments. Calling reboot
|