@ts-defold/types 1.2.77 → 1.2.78

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 +123 -59
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -3,8 +3,35 @@
3
3
  /// <reference types="lua-types/5.1" />
4
4
  /// <reference types="lua-types/special/jit-only" />
5
5
 
6
- // DEFOLD. stable version 1.12.0 (3206f699aaff89f357c9d549050b8453e080c5d2)
6
+ // DEFOLD. stable version 1.12.1 (16c6fd602f32de4814660672c38ce3ccbbc1fb59)
7
7
 
8
+ /**
9
+ * All ids in the engine are represented as hashes, so a string needs to be hashed
10
+ before it can be compared with an id.
11
+ * @param s string to hash
12
+ * @returns a hashed string
13
+ * @example To compare a message_id in an on-message callback function:
14
+ ```lua
15
+ function on_message(self, message_id, message, sender)
16
+ if message_id == hash("my_message") then
17
+ -- Act on the message here
18
+ end
19
+ end
20
+ ```
21
+ */
22
+ declare function hash(s: string): hash;
23
+ /**
24
+ * Returns a hexadecimal representation of a hash value.
25
+ The returned string is always padded with leading zeros.
26
+ * @param h hash value to get hex string for
27
+ * @returns hex representation of the hash
28
+ * @example ```lua
29
+ local h = hash("my_hash")
30
+ local hexstr = hash_to_hex(h)
31
+ print(hexstr) --> a2bc06d97f580aab
32
+ ```
33
+ */
34
+ declare function hash_to_hex(h: hash): string;
8
35
  /**
9
36
  * Pretty printing of Lua values. This function prints Lua values
10
37
  in a manner similar to +print()+, but will also recurse into tables
@@ -34,33 +61,6 @@ Lua tables is undefined):
34
61
  ```
35
62
  */
36
63
  declare function pprint(...v: any[]): void;
37
- /**
38
- * All ids in the engine are represented as hashes, so a string needs to be hashed
39
- before it can be compared with an id.
40
- * @param s string to hash
41
- * @returns a hashed string
42
- * @example To compare a message_id in an on-message callback function:
43
- ```lua
44
- function on_message(self, message_id, message, sender)
45
- if message_id == hash("my_message") then
46
- -- Act on the message here
47
- end
48
- end
49
- ```
50
- */
51
- declare function hash(s: string): hash;
52
- /**
53
- * Returns a hexadecimal representation of a hash value.
54
- The returned string is always padded with leading zeros.
55
- * @param h hash value to get hex string for
56
- * @returns hex representation of the hash
57
- * @example ```lua
58
- local h = hash("my_hash")
59
- local hexstr = hash_to_hex(h)
60
- print(hexstr) --> a2bc06d97f580aab
61
- ```
62
- */
63
- declare function hash_to_hex(h: hash): string;
64
64
  /**
65
65
  * A unique identifier used to reference resources, messages, properties, and other entities within the game.
66
66
  */
@@ -83,33 +83,6 @@ declare type buffer = object;
83
83
  declare type bufferstream = LuaUserdata & number[] & object;
84
84
 
85
85
 
86
- declare namespace missingName {
87
- /**
88
- * Enables engine throttling.
89
- * @param enable true if throttling should be enabled
90
- * @param cooldown the time period to do update + render for (seconds)
91
- * @example Disable throttling
92
- ```lua
93
- sys.set_engine_throttle(false)
94
- ```
95
-
96
- Enable throttling
97
- ```lua
98
- sys.set_engine_throttle(true, 1.5)
99
- ```
100
- */
101
- export function set_engine_throttle(enable: boolean, cooldown: number): void;
102
- /**
103
- * Disables rendering
104
- * @param enable true if throttling should be enabled
105
- * @example Disable rendering
106
- ```lua
107
- sys.set_render_enable(false)
108
- ```
109
- */
110
- export function set_render_enable(enable: boolean): void;
111
- }
112
-
113
86
  declare namespace b2d {
114
87
  /**
115
88
  * Get the Box2D body from a collision object
@@ -1866,6 +1839,13 @@ end
1866
1839
  ```
1867
1840
  */
1868
1841
  export function init(this: LuaUserdata): void;
1842
+ /**
1843
+ * This is a callback-function, which is called by the engine at the end of the frame to update the state of a script
1844
+ component. Use it to make final adjustments to the game object instance.
1845
+ * @param this reference to the script state to be used for storing data
1846
+ * @param dt the time-step of the frame update
1847
+ */
1848
+ export function late_update(this: LuaUserdata, dt: number): void;
1869
1849
  /**
1870
1850
  * This is a callback-function, which is called by the engine when user input is sent to the game object instance of the script.
1871
1851
  It can be used to take action on the input, e.g. move the instance according to the input.
@@ -2411,8 +2391,10 @@ export type input_message = {
2411
2391
  gamepad?: number;
2412
2392
  touch?: touch_input[];
2413
2393
  };
2394
+ export type late_update = (this: any, dt: number) => void;
2414
2395
  export type on_input = (this: any, action_id: hash, action: go.input_message) => void;
2415
2396
  export type on_message = (this: any, message_id: hash, message: object, sender: url) => void;
2397
+ export type on_reload = (this: any) => void;
2416
2398
  export type touch_input = {
2417
2399
  id: number;
2418
2400
  pressed: boolean;
@@ -3026,6 +3008,22 @@ export const RESULT_OUT_OF_RESOURCES: number;
3026
3008
  * The texture id already exists when trying to use gui.new_texture().
3027
3009
  */
3028
3010
  export const RESULT_TEXTURE_ALREADY_EXISTS: number;
3011
+ /**
3012
+ * Safe area mode that applies insets on all edges.
3013
+ */
3014
+ export const SAFE_AREA_BOTH: number;
3015
+ /**
3016
+ * Safe area mode that applies insets only on the long edges.
3017
+ */
3018
+ export const SAFE_AREA_LONG: number;
3019
+ /**
3020
+ * Safe area mode that ignores safe area insets.
3021
+ */
3022
+ export const SAFE_AREA_NONE: number;
3023
+ /**
3024
+ * Safe area mode that applies insets only on the short edges.
3025
+ */
3026
+ export const SAFE_AREA_SHORT: number;
3029
3027
  /**
3030
3028
  * The size of the node is determined by the currently assigned texture.
3031
3029
  */
@@ -4569,6 +4567,17 @@ The rotation is expressed as a quaternion
4569
4567
  * @param rotation new rotation
4570
4568
  */
4571
4569
  export function set_rotation(node: node, rotation: vmath.quaternion | vmath.vector4): void;
4570
+ /**
4571
+ * Sets how the safe area is applied to this gui scene.
4572
+ * @param mode safe area mode
4573
+
4574
+ `gui.SAFE_AREA_NONE`
4575
+ `gui.SAFE_AREA_LONG`
4576
+ `gui.SAFE_AREA_SHORT`
4577
+ `gui.SAFE_AREA_BOTH`
4578
+
4579
+ */
4580
+ export function set_safe_area_mode(mode: number): void;
4572
4581
  /**
4573
4582
  * Sets the scaling of the supplied node.
4574
4583
  * @param node node to set the scale for
@@ -4803,6 +4812,7 @@ export type final = (this: any) => void;
4803
4812
  export type init = (this: any) => void;
4804
4813
  export type on_input = (this: any, action_id: hash, action: go.input_message) => void;
4805
4814
  export type on_message = (this: any, message_id: hash, message: object, sender: url) => void;
4815
+ export type on_reload = (this: any) => void;
4806
4816
  export type update = (this: any, dt: number) => void;
4807
4817
  }
4808
4818
 
@@ -4900,7 +4910,7 @@ function init(self)
4900
4910
  end
4901
4911
  ```
4902
4912
  */
4903
- export function request(url: string, method: string, callback: ((this: any, id: any, response: any) => void), headers?: { [key: string]: string | number }, post_data?: string, options?: { timeout?: number; path?: string; ignore_cache?: boolean; chunked_transfer?: boolean; report_progress?: boolean }): void;
4913
+ export function request(url: string, method: string, callback: ((this: any, id: any, response: any) => void), headers?: { [key: string]: string | number }, post_data?: string, options?: { timeout?: number; path?: string; ignore_cache?: boolean; chunked_transfer?: boolean; report_progress?: boolean; proxy?: string }): void;
4904
4914
  }
4905
4915
 
4906
4916
  declare namespace image {
@@ -6012,7 +6022,7 @@ end
6012
6022
  */
6013
6023
  export function raycast_async(from: vmath.vector3, to: vmath.vector3, groups: hash[] | LuaSet<hash>, request_id?: number): void;
6014
6024
  /**
6015
- * sets a physics world event listener. If a function is set, physics messages will no longer be sent to on_message.
6025
+ * Only one physics world event listener can be set at a time.
6016
6026
  * @param callback A callback that receives an information about all the physics interactions in this physics world.
6017
6027
 
6018
6028
  `self`
@@ -6785,7 +6795,7 @@ function update(self, dt)
6785
6795
  end
6786
6796
  ```
6787
6797
  */
6788
- export function enable_texture(binding: number | string | hash, handle_or_name: number | string | hash, buffer_type?: any | typeof graphics.BUFFER_TYPE_COLOR1_BIT | typeof graphics.BUFFER_TYPE_COLOR2_BIT | typeof graphics.BUFFER_TYPE_COLOR3_BIT | typeof graphics.BUFFER_TYPE_DEPTH_BIT | typeof graphics.BUFFER_TYPE_STENCIL_BIT): void;
6798
+ export function enable_texture(binding: number | string | hash, handle_or_name: number | string | hash, buffer_type?: typeof graphics.BUFFER_TYPE_COLOR0_BIT | typeof graphics.BUFFER_TYPE_COLOR1_BIT | typeof graphics.BUFFER_TYPE_COLOR2_BIT | typeof graphics.BUFFER_TYPE_COLOR3_BIT | typeof graphics.BUFFER_TYPE_DEPTH_BIT | typeof graphics.BUFFER_TYPE_STENCIL_BIT): void;
6789
6799
  /**
6790
6800
  * Returns the logical window height that is set in the "game.project" settings.
6791
6801
  Note that the actual window pixel size can change, either by device constraints
@@ -10513,6 +10523,21 @@ sys.set_connectivity_host("www.google.com")
10513
10523
  ```
10514
10524
  */
10515
10525
  export function set_connectivity_host(host: string): void;
10526
+ /**
10527
+ * Enables engine throttling.
10528
+ * @param enable true if throttling should be enabled
10529
+ * @param cooldown the time period to do update + render for (seconds)
10530
+ * @example Disable throttling
10531
+ ```lua
10532
+ sys.set_engine_throttle(false)
10533
+ ```
10534
+
10535
+ Enable throttling
10536
+ ```lua
10537
+ sys.set_engine_throttle(true, 1.5)
10538
+ ```
10539
+ */
10540
+ export function set_engine_throttle(enable: boolean, cooldown: number): void;
10516
10541
  /**
10517
10542
  * Set the Lua error handler function.
10518
10543
  The error handler is a function which is called whenever a lua runtime error occurs.
@@ -10546,6 +10571,15 @@ end
10546
10571
  ```
10547
10572
  */
10548
10573
  export function set_error_handler(error_handler: (source: string, message: string, traceback: string,) => void): void;
10574
+ /**
10575
+ * Disables rendering
10576
+ * @param enable true if throttling should be enabled
10577
+ * @example Disable rendering
10578
+ ```lua
10579
+ sys.set_render_enable(false)
10580
+ ```
10581
+ */
10582
+ export function set_render_enable(enable: boolean): void;
10549
10583
  /**
10550
10584
  * Set game update-frequency (frame cap). This option is equivalent to `display.update_frequency` in
10551
10585
  the "game.project" settings but set in run-time. If `Vsync` checked in "game.project", the rate will
@@ -11904,6 +11938,36 @@ export function get_display_scale(): number;
11904
11938
  * @returns The lock state
11905
11939
  */
11906
11940
  export function get_mouse_lock(): boolean;
11941
+ /**
11942
+ * This returns the safe area rectangle (x, y, width, height) and the inset
11943
+ values relative to the window edges. On platforms without a safe area,
11944
+ this returns the full window size and zero insets.
11945
+ * @returns safe area data
11946
+
11947
+ `safe_area`
11948
+ table table containing these keys:
11949
+
11950
+
11951
+ number `x`
11952
+ number `y`
11953
+ number `width`
11954
+ number `height`
11955
+ number `inset_left`
11956
+ number `inset_top`
11957
+ number `inset_right`
11958
+ number `inset_bottom`
11959
+
11960
+ */
11961
+ export function get_safe_area(): {
11962
+ x: number,
11963
+ y: number,
11964
+ width: number,
11965
+ height: number,
11966
+ inset_left: number,
11967
+ inset_top: number,
11968
+ inset_right: number,
11969
+ inset_bottom: number,
11970
+ };
11907
11971
  /**
11908
11972
  * This returns the current window size (width and height).
11909
11973
  * @returns The window width & The window height
@@ -11921,7 +11985,7 @@ This function has no effect on platforms that does not support dimming.
11921
11985
  */
11922
11986
  export function set_dim_mode(mode: number): void;
11923
11987
  /**
11924
- * Sets a window event listener.
11988
+ * Sets a window event listener. Only one window event listener can be set at a time.
11925
11989
  * @param callback A callback which receives info about window events. Pass an empty function or `nil` if you no longer wish to receive callbacks.
11926
11990
 
11927
11991
  `self`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-defold/types",
3
- "version": "1.2.77",
3
+ "version": "1.2.78",
4
4
  "description": "TypeScript definitions for Defold",
5
5
  "repository": "github:ts-defold/types",
6
6
  "keywords": [