@ts-defold/types 1.2.45 → 1.2.47

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.
Files changed (2) hide show
  1. package/index.d.ts +223 -54
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  /// <reference types="lua-types/5.1" />
3
3
  /// <reference types="@typescript-to-lua/language-extensions" />
4
4
 
5
- // DEFOLD. stable version 1.8.0 (9141d9d3605e3f5d51c71293116d769da2613d39)
5
+ // DEFOLD. stable version 1.9.0 (d6882f432beca85d460ec42497888157c356d058)
6
6
  // =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
7
7
 
8
8
 
@@ -315,13 +315,6 @@ declare namespace b2d.body {
315
315
  */
316
316
  export function get_angular_damping(body: any): number
317
317
 
318
- /**
319
- * Set the angular velocity.
320
- * @param body body
321
- * @param omega the new angular velocity in radians/second.
322
- */
323
- export function get_angular_velocity(body: any, omega: number): void
324
-
325
318
  /**
326
319
  * Get the angular velocity.
327
320
  * @param body body
@@ -358,17 +351,17 @@ declare namespace b2d.body {
358
351
  export function get_linear_velocity(body: any): vmath.vector3
359
352
 
360
353
  /**
361
- * Get the world linear velocity of a world point attached to this body.
354
+ * Get the world velocity of a local point.
362
355
  * @param body body
363
- * @param world_point a point in world coordinates.
356
+ * @param local_point a point in local coordinates.
364
357
  * @return velocity the world velocity of a point.
365
358
  */
366
- export function get_linear_velocity_from_world_point(body: any, world_point: vmath.vector3): vmath.vector3
359
+ export function get_linear_velocity_from_local_point(body: any, local_point: vmath.vector3): vmath.vector3
367
360
 
368
361
  /**
369
- * Get the world velocity of a local point.
362
+ * Get the world linear velocity of a world point attached to this body.
370
363
  * @param body body
371
- * @param world_point a point in local coordinates.
364
+ * @param world_point a point in world coordinates.
372
365
  * @return velocity the world velocity of a point.
373
366
  */
374
367
  export function get_linear_velocity_from_world_point(body: any, world_point: vmath.vector3): vmath.vector3
@@ -529,6 +522,13 @@ declare namespace b2d.body {
529
522
  */
530
523
  export function set_angular_damping(body: any, damping: number): void
531
524
 
525
+ /**
526
+ * Set the angular velocity.
527
+ * @param body body
528
+ * @param omega the new angular velocity in radians/second.
529
+ */
530
+ export function set_angular_velocity(body: any, omega: number): void
531
+
532
532
  /**
533
533
  * Set the sleep state of the body. A sleeping body has very low CPU cost.
534
534
  * @param body body
@@ -2398,7 +2398,7 @@ with a custom curve. See the animation guide for more information.
2398
2398
  * @param recursive check hierarchy recursively
2399
2399
  * @return enabled whether the node is enabled or not
2400
2400
  */
2401
- export function is_enabled(node: node, recursive: boolean): boolean
2401
+ export function is_enabled(node: node, recursive?: boolean): boolean
2402
2402
 
2403
2403
  /**
2404
2404
  * Alters the ordering of the two supplied nodes by moving the first node
@@ -2805,10 +2805,10 @@ the new state of the emitter:
2805
2805
  /**
2806
2806
  * Sets the parent node of the specified node.
2807
2807
  * @param node node for which to set its parent
2808
- * @param parent parent node to set
2808
+ * @param parent parent node to set, pass `nil` to remove parent
2809
2809
  * @param keep_scene_transform optional flag to make the scene position being perserved
2810
2810
  */
2811
- export function set_parent(node: node, parent: node, keep_scene_transform?: boolean): void
2811
+ export function set_parent(node: node, parent?: node, keep_scene_transform?: boolean): void
2812
2812
 
2813
2813
  /**
2814
2814
  * Set the paricle fx for a gui node
@@ -2925,7 +2925,7 @@ the new state of the emitter:
2925
2925
  * @param node node to set text for
2926
2926
  * @param text text to set
2927
2927
  */
2928
- export function set_text(node: node, text: string): void
2928
+ export function set_text(node: node, text: string | number): void
2929
2929
 
2930
2930
  /**
2931
2931
  * Set the texture on a box or pie node. The texture must be mapped to
@@ -3019,7 +3019,7 @@ the new state of the emitter:
3019
3019
  `clear`: instantly clear spawned particles
3020
3020
 
3021
3021
  */
3022
- export function stop_particlefx(node: node, options: any): void
3022
+ export function stop_particlefx(node: node, options?: any): void
3023
3023
 
3024
3024
 
3025
3025
  /**
@@ -3162,6 +3162,26 @@ declare namespace physics {
3162
3162
  */
3163
3163
  export let JOINT_TYPE_WHEEL: any
3164
3164
 
3165
+ /**
3166
+ *
3167
+ */
3168
+ export let SHAPE_TYPE_BOX: any
3169
+
3170
+ /**
3171
+ *
3172
+ */
3173
+ export let SHAPE_TYPE_CAPSULE: any
3174
+
3175
+ /**
3176
+ *
3177
+ */
3178
+ export let SHAPE_TYPE_HULL: any
3179
+
3180
+ /**
3181
+ *
3182
+ */
3183
+ export let SHAPE_TYPE_SPHERE: any
3184
+
3165
3185
  /**
3166
3186
  * Create a physics joint between two collision object components.
3167
3187
  * Note: Currently only supported in 2D physics.
@@ -3312,7 +3332,7 @@ Set to `true` to return all ray cast hits. If `false`, it will only return the c
3312
3332
 
3313
3333
  * @return result It returns a list. If missed it returns `nil`. See ray_cast_response for details on the returned values.
3314
3334
  */
3315
- export function raycast(from: vmath.vector3, to: vmath.vector3, groups: any, options: any): LuaMultiReturn<[any, any]>
3335
+ export function raycast(from: vmath.vector3, to: vmath.vector3, groups: any, options?: any): LuaMultiReturn<[any, any]>
3316
3336
 
3317
3337
  /**
3318
3338
  * Ray casts are used to test for intersections against collision objects in the physics world.
@@ -3418,17 +3438,20 @@ See physics.get_shape for a detailed description of each field in the data table
3418
3438
  `local function set_shape_data()
3419
3439
  -- set capsule shape data
3420
3440
  local data = {}
3441
+ data.type = physics.SHAPE_TYPE_CAPSULE
3421
3442
  data.diameter = 10
3422
3443
  data.height = 20
3423
3444
  physics.set_shape(&quot;#collisionobject&quot;, &quot;my_capsule_shape&quot;, data)
3424
3445
 
3425
3446
  -- set sphere shape data
3426
3447
  data = {}
3448
+ data.type = physics.SHAPE_TYPE_SPHERE
3427
3449
  data.diameter = 10
3428
3450
  physics.set_shape(&quot;#collisionobject&quot;, &quot;my_sphere_shape&quot;, data)
3429
3451
 
3430
3452
  -- set box shape data
3431
3453
  data = {}
3454
+ data.type = physics.SHAPE_TYPE_BOX
3432
3455
  data.dimensions = vmath.vector3(10, 10, 5)
3433
3456
  physics.set_shape(&quot;#collisionobject&quot;, &quot;my_box_shape&quot;, data)
3434
3457
  end
@@ -4073,6 +4096,23 @@ declare namespace render {
4073
4096
  */
4074
4097
  export function disable_texture(binding: number | string | hash): void
4075
4098
 
4099
+ /**
4100
+ * Dispatches the currently enabled compute program. The dispatch call takes three arguments x,y,z which constitutes
4101
+ * the 'global working group' of the compute dispatch. Together with the 'local working group' specified in the compute shader
4102
+ * as a layout qualifier, these two sets of parameters forms the number of invocations the compute shader will execute.
4103
+ * An optional constant buffer can be provided to override the default constants. If no constants buffer is provided, a default
4104
+ * system constants buffer is used containing constants as defined in the compute program.
4105
+ * @param x global work group size X
4106
+ * @param y global work group size Y
4107
+ * @param z global work group size Z
4108
+ * @param options optional table with properties:
4109
+
4110
+ `constants`
4111
+ optional constants to use while rendering
4112
+
4113
+ */
4114
+ export function dispatch_compute(x: number, y: number, z: number, options?: any): void
4115
+
4076
4116
  /**
4077
4117
  * Draws all objects that match a specified predicate. An optional constant buffer can be
4078
4118
  * provided to override the default constants. If no constants buffer is provided, a default
@@ -4405,6 +4445,23 @@ to enable those textures as well. Currently 4 color attachments are supported:
4405
4445
  */
4406
4446
  export function set_blend_func(source_factor: any, destination_factor: any): void
4407
4447
 
4448
+ /**
4449
+ * Sets the current render camera to be used for rendering. If a render camera
4450
+ * has been set by the render script, the renderer will be using its projection and view matrix
4451
+ * during rendering. If a projection and/or view matrix has been set by the render script,
4452
+ * they will not be used until the current render camera has been reset by calling `render.set_camera()`.
4453
+ * If the 'use_frustum' flag in the options table has been set to true, the renderer will automatically use the
4454
+ * camera frustum for frustum culling regardless of what frustum is being passed into the render.draw() function.
4455
+ * Note that the frustum plane option in render.draw can still be used together with the camera.
4456
+ * @param camera camera id to use, or nil to reset
4457
+ * @param options optional table with properties:
4458
+
4459
+ `use_frustum`
4460
+ If true, the renderer will use the cameras view-projection matrix for frustum culling (default: false)
4461
+
4462
+ */
4463
+ export function set_camera(camera: any, options?: any): void
4464
+
4408
4465
  /**
4409
4466
  * Specifies whether the individual color components in the frame buffer is enabled for writing (`true`) or disabled (`false`). For example, if `blue` is `false`, nothing is written to the blue component of any pixel in any of the color buffers, regardless of the drawing operation attempted. Note that writing are either enabled or disabled for entire color components, not the individual bits of a component.
4410
4467
  * The component masks are all initially `true`.
@@ -4415,6 +4472,14 @@ to enable those textures as well. Currently 4 color attachments are supported:
4415
4472
  */
4416
4473
  export function set_color_mask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void
4417
4474
 
4475
+ /**
4476
+ * The name of the compute program must be specified in the ".render" resource set
4477
+ * in the "game.project" setting. If nil (or no arguments) are passed to this function,
4478
+ * the current compute program will instead be disabled.
4479
+ * @param compute compute id to use, or nil to disable
4480
+ */
4481
+ export function set_compute(compute: any): void
4482
+
4418
4483
  /**
4419
4484
  * Specifies whether front- or back-facing polygons can be culled
4420
4485
  * when polygon culling is enabled. Polygon culling is initially disabled.
@@ -4760,6 +4825,21 @@ declare namespace resource {
4760
4825
  */
4761
4826
  export let TEXTURE_TYPE_CUBE_MAP: any
4762
4827
 
4828
+ /**
4829
+ * Usage hint for creating textures that uses temporary memory
4830
+ */
4831
+ export let TEXTURE_USAGE_FLAG_MEMORYLESS: any
4832
+
4833
+ /**
4834
+ * Usage hint for creating textures that can be sampled in a shader
4835
+ */
4836
+ export let TEXTURE_USAGE_FLAG_SAMPLE: any
4837
+
4838
+ /**
4839
+ * Usage hint for creating textures that can be used for writing in a shader
4840
+ */
4841
+ export let TEXTURE_USAGE_FLAG_STORAGE: any
4842
+
4763
4843
  /**
4764
4844
  * Constructor-like function with two purposes:
4765
4845
  *
@@ -4926,7 +5006,7 @@ optional flag to determine wether or not the resource should take over ownership
4926
5006
 
4927
5007
  * @return path Returns the buffer resource path
4928
5008
  */
4929
- export function create_buffer(path: string, table: any): hash
5009
+ export function create_buffer(path: string, table?: any): hash
4930
5010
 
4931
5011
  /**
4932
5012
  * Creates a new texture resource that can be used in the same way as any texture created during build time.
@@ -4944,6 +5024,7 @@ The texture type. Supported values:
4944
5024
 
4945
5025
  - `resource.TEXTURE_TYPE_2D`
4946
5026
  - `resource.TEXTURE_TYPE_CUBE_MAP`
5027
+ - `resource.TEXTURE_TYPE_IMAGE_2D`
4947
5028
 
4948
5029
 
4949
5030
  `width`
@@ -4988,6 +5069,16 @@ end
4988
5069
  `
4989
5070
 
4990
5071
 
5072
+ `flags`
5073
+ Texture creation flags that can be used to dictate how the texture is created. The default value is resource.TEXTURE_USAGE_FLAG_SAMPLE, which means that the texture can be sampled from a shader.
5074
+ These flags may or may not be supported on the running device and/or the underlying graphics API and is simply used internally as a 'hint' when creating the texture. There is no guarantee that any of these will have any effect. Supported values:
5075
+
5076
+
5077
+ - `resource.TEXTURE_USAGE_FLAG_SAMPLE` - The texture can be sampled from a shader (default)
5078
+ - `resource.TEXTURE_USAGE_FLAG_MEMORYLESS` - The texture can be used as a memoryless texture, i.e only transient memory for the texture is used during rendering
5079
+ - `resource.TEXTURE_USAGE_FLAG_STORAGE` - The texture can be used as a storage texture, which is required for a shader to write to the texture
5080
+
5081
+
4991
5082
  `max_mipmaps`
4992
5083
  optional max number of mipmaps. Defaults to zero, i.e no mipmap support
4993
5084
  `compression_type`
@@ -5060,6 +5151,15 @@ These constants might not be available on the device:
5060
5151
  - `resource.TEXTURE_FORMAT_R32F`
5061
5152
  - `resource.TEXTURE_FORMAT_RG32F`
5062
5153
 
5154
+
5155
+ `flags`
5156
+ Texture creation flags that can be used to dictate how the texture is created. Supported values:
5157
+
5158
+
5159
+ - `resource.TEXTURE_USAGE_FLAG_SAMPLE` - The texture can be sampled from a shader (default)
5160
+ - `resource.TEXTURE_USAGE_FLAG_MEMORYLESS` - The texture can be used as a memoryless texture, i.e only transient memory for the texture is used during rendering
5161
+ - `resource.TEXTURE_USAGE_FLAG_STORAGE` - The texture can be used as a storage texture, which is required for a shader to write to the texture
5162
+
5063
5163
  You can test if the device supports these values by checking if a specific enum is nil or not:
5064
5164
  `if resource.TEXTURE_FORMAT_RGBA16F ~= nil then
5065
5165
  -- it is safe to use this format
@@ -5197,11 +5297,14 @@ height of the texture
5197
5297
  depth of the texture (i.e 1 for a 2D texture and 6 for a cube map)
5198
5298
  `mipmaps`
5199
5299
  number of mipmaps of the texture
5300
+ `flags`
5301
+ usage hints of the texture.
5200
5302
  `type`
5201
5303
  The texture type. Supported values:
5202
5304
 
5203
5305
 
5204
5306
  - `resource.TEXTURE_TYPE_2D`
5307
+ - `resource.TEXTURE_TYPE_IMAGE_2D`
5205
5308
  - `resource.TEXTURE_TYPE_CUBE_MAP`
5206
5309
  - `resource.TEXTURE_TYPE_2D_ARRAY`
5207
5310
 
@@ -5370,7 +5473,7 @@ optional flag to determine wether or not the resource should take over ownership
5370
5473
 
5371
5474
 
5372
5475
  */
5373
- export function set_buffer(path: hash | string, buffer: buffer, table: any): void
5476
+ export function set_buffer(path: hash | string, buffer: buffer, table?: any): void
5374
5477
 
5375
5478
  /**
5376
5479
  * Update internal sound resource (wavc/oggc) with new data
@@ -5830,7 +5933,7 @@ If the request was successfull, this will contain the request payload in a buffe
5830
5933
  * @param arg5 argument 5
5831
5934
  * @param arg6 argument 6
5832
5935
  */
5833
- export function reboot(arg1: string, arg2: string, arg3: string, arg4: string, arg5: string, arg6: string): void
5936
+ export function reboot(arg1?: string, arg2?: string, arg3?: string, arg4?: string, arg5?: string, arg6?: string): void
5834
5937
 
5835
5938
  /**
5836
5939
  * The table can later be loaded by `sys.load`.
@@ -6229,7 +6332,7 @@ The response data. Contains the fields:
6229
6332
  * @param options optional table with request parameters. Supported entries:
6230
6333
 
6231
6334
  `timeout`: timeout in seconds
6232
- Not available in HTML5 build
6335
+ Path should be absolute
6233
6336
  Not available in HTML5 build
6234
6337
  Not available in HTML5 build
6235
6338
 
@@ -6330,7 +6433,7 @@ declare namespace json {
6330
6433
 
6331
6434
  * @return data decoded json
6332
6435
  */
6333
- export function decode(json: string, options: any): any
6436
+ export function decode(json: string, options?: any): any
6334
6437
 
6335
6438
  /**
6336
6439
  * Encode a lua table to a JSON string.
@@ -6342,7 +6445,7 @@ declare namespace json {
6342
6445
 
6343
6446
  * @return json encoded json
6344
6447
  */
6345
- export function encode(tbl: any, options: any): string
6448
+ export function encode(tbl: any, options?: any): string
6346
6449
 
6347
6450
  /**
6348
6451
  * null
@@ -6967,14 +7070,6 @@ declare namespace zlib {
6967
7070
 
6968
7071
  declare namespace camera {
6969
7072
 
6970
- /**
6971
- * Post this message to a camera-component to activate it.
6972
- * Several cameras can be active at the same time, but only the camera that was last activated will be used for rendering.
6973
- * When the camera is deactivated (see `release_camera_focus`), the previously activated camera will again be used for rendering automatically.
6974
- * The reason it is called "camera focus" is the similarity to how acquiring input focus works (see `acquire_input_focus`).
6975
- */
6976
- export type acquire_camera_focus = "acquire_camera_focus"
6977
-
6978
7073
  /**
6979
7074
  * The ratio between the frustum width and height. Used when calculating the
6980
7075
  * projection of a perspective camera.
@@ -6983,16 +7078,96 @@ declare namespace camera {
6983
7078
  export let aspect_ratio: any
6984
7079
 
6985
7080
  /**
6986
- * makes camera active
6987
- * @param url url of camera component
7081
+ * get aspect ratio
7082
+ * @param camera camera id
7083
+ * @return aspect_ratio the aspect ratio.
7084
+ */
7085
+ export function get_aspect_ratio(camera: any): number
7086
+
7087
+ /**
7088
+ * This function returns a table with all the camera URLs that have been
7089
+ * registered in the render context.
7090
+ * @param camera camera id
7091
+ * @return cameras a table with all camera URLs
7092
+ */
7093
+ export function get_cameras(camera: any): any
7094
+
7095
+ /**
7096
+ * get far z
7097
+ * @param camera camera id
7098
+ * @return far_z the far z.
6988
7099
  */
6989
- export function acquire_focus(url: string | hash | url): void
7100
+ export function get_far_z(camera: any): number
6990
7101
 
6991
7102
  /**
6992
- * deactivate camera
6993
- * @param url url of camera component
7103
+ * get field of view
7104
+ * @param camera camera id
7105
+ * @return fov the field of view.
6994
7106
  */
6995
- export function release_focus(url: string | hash | url): void
7107
+ export function get_fov(camera: any): number
7108
+
7109
+ /**
7110
+ * get near z
7111
+ * @param camera camera id
7112
+ * @return near_z the near z.
7113
+ */
7114
+ export function get_near_z(camera: any): number
7115
+
7116
+ /**
7117
+ * get orthographic zoom
7118
+ * @param camera camera id
7119
+ * @return orthographic_zoom true if the camera is using an orthographic projection.
7120
+ */
7121
+ export function get_orthographic_zoom(camera: any): boolean
7122
+
7123
+ /**
7124
+ * get projection matrix
7125
+ * @param camera camera id
7126
+ * @return projection the projection matrix.
7127
+ */
7128
+ export function get_projection(camera: any): vmath.matrix4
7129
+
7130
+ /**
7131
+ * get view matrix
7132
+ * @param camera camera id
7133
+ * @return view the view matrix.
7134
+ */
7135
+ export function get_view(camera: any): vmath.matrix4
7136
+
7137
+ /**
7138
+ * set aspect ratio
7139
+ * @param camera camera id
7140
+ * @param aspect_ratio the aspect ratio.
7141
+ */
7142
+ export function set_aspect_ratio(camera: any, aspect_ratio: number): void
7143
+
7144
+ /**
7145
+ * set far z
7146
+ * @param camera camera id
7147
+ * @param far_z the far z.
7148
+ */
7149
+ export function set_far_z(camera: any, far_z: number): void
7150
+
7151
+ /**
7152
+ * set field of view
7153
+ * @param camera camera id
7154
+ * @param fov the field of view.
7155
+ */
7156
+ export function set_fov(camera: any, fov: number): void
7157
+
7158
+ /**
7159
+ * set near z
7160
+ * @param camera camera id
7161
+ * @param near_z the near z.
7162
+ */
7163
+ export function set_near_z(camera: any, near_z: number): void
7164
+
7165
+ /**
7166
+ * set orthographic zoom
7167
+ * @param camera camera id
7168
+ * @param orthographic_zoom true if the camera is using an orthographic projection.
7169
+ */
7170
+ export function set_orthographic_zoom(camera: any, orthographic_zoom: boolean): void
6996
7171
 
6997
7172
  /**
6998
7173
  * Camera frustum far plane.
@@ -7024,14 +7199,6 @@ declare namespace camera {
7024
7199
  */
7025
7200
  export let projection: any
7026
7201
 
7027
- /**
7028
- *
7029
- * Post this message to a camera-component to deactivate it. The camera is then removed from the active cameras.
7030
- * See `acquire_camera_focus` for more information how the active cameras are used in rendering.
7031
- *
7032
- */
7033
- export type release_camera_focus = "release_camera_focus"
7034
-
7035
7202
  /**
7036
7203
  *
7037
7204
  * Post this message to a camera-component to set its properties at run-time.
@@ -7148,13 +7315,15 @@ declare namespace collectionproxy {
7148
7315
  export type async_load = "async_load"
7149
7316
 
7150
7317
  /**
7151
- * return an indexed table of resources for a collection proxy. Each
7152
- * entry is a hexadecimal string that represents the data of the specific
7153
- * resource. This representation corresponds with the filename for each
7154
- * individual resource that is exported when you bundle an application with
7155
- * LiveUpdate functionality.
7318
+ * return an indexed table of resources for a collection proxy where the
7319
+ * referenced collection has been excluded using LiveUpdate. Each entry is a
7320
+ * hexadecimal string that represents the data of the specific resource.
7321
+ * This representation corresponds with the filename for each individual
7322
+ * resource that is exported when you bundle an application with LiveUpdate
7323
+ * functionality.
7156
7324
  * @param collectionproxy the collectionproxy to check for resources.
7157
- * @return resources the resources
7325
+ * @return resources the resources, or an empty list if the
7326
+ collection was not excluded.
7158
7327
  */
7159
7328
  export function get_resources(collectionproxy: url): any
7160
7329
 
@@ -7613,7 +7782,7 @@ the new state of the emitter:
7613
7782
  `clear`: instantly clear spawned particles
7614
7783
 
7615
7784
  */
7616
- export function stop(url: string | hash | url, options: any): void
7785
+ export function stop(url: string | hash | url, options?: any): void
7617
7786
 
7618
7787
  }
7619
7788
  // =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-defold/types",
3
- "version": "1.2.45",
3
+ "version": "1.2.47",
4
4
  "description": "TypeScript definitions for Defold",
5
5
  "repository": "github:ts-defold/types",
6
6
  "keywords": [