@ts-defold/types 1.2.76 → 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.
- package/index.d.ts +241 -34
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/// <reference types="lua-types/5.1" />
|
|
4
4
|
/// <reference types="lua-types/special/jit-only" />
|
|
5
5
|
|
|
6
|
-
// DEFOLD. stable version 1.
|
|
6
|
+
// DEFOLD. stable version 1.12.1 (16c6fd602f32de4814660672c38ce3ccbbc1fb59)
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* All ids in the engine are represented as hashes, so a string needs to be hashed
|
|
@@ -637,6 +637,48 @@ export function get_projection(camera: url | number | undefined): vmath.matrix4;
|
|
|
637
637
|
* @returns the view matrix.
|
|
638
638
|
*/
|
|
639
639
|
export function get_view(camera: url | number | undefined): vmath.matrix4;
|
|
640
|
+
/**
|
|
641
|
+
* Converts a screen-space 2D point with view depth to a 3D world point.
|
|
642
|
+
z is the view depth in world units measured from the camera plane along the camera forward axis.
|
|
643
|
+
If a camera isn't specified, the last enabled camera is used.
|
|
644
|
+
* @param pos Screen-space position (x, y) with z as view depth in world units
|
|
645
|
+
* @param camera optional camera id
|
|
646
|
+
* @returns the world coordinate
|
|
647
|
+
* @example Place objects at the touch point with a random Z position, keeping them within the visible view zone.
|
|
648
|
+
```lua
|
|
649
|
+
function on_input(self, action_id, action)
|
|
650
|
+
if action_id == hash("touch") then
|
|
651
|
+
if action.pressed then
|
|
652
|
+
local percpective_camera = msg.url("#perspective_camera")
|
|
653
|
+
local random_z = math.random(camera.get_near_z(percpective_camera) + 0.01, camera.get_far_z(percpective_camera) - 0.01)
|
|
654
|
+
local world_position = camera.screen_to_world(vmath.vector3(action.screen_x, action.screen_y, random_z), percpective_camera)
|
|
655
|
+
go.set_position(world_position, "/go1")
|
|
656
|
+
end
|
|
657
|
+
end
|
|
658
|
+
end
|
|
659
|
+
```
|
|
660
|
+
*/
|
|
661
|
+
export function screen_to_world(pos: vmath.vector3, camera?: url | number | undefined): vmath.vector3;
|
|
662
|
+
/**
|
|
663
|
+
* Converts 2D screen coordinates (x,y) to the 3D world-space point on the camera's near plane for that pixel.
|
|
664
|
+
If a camera isn't specified, the last enabled camera is used.
|
|
665
|
+
* @param x X coordinate on screen.
|
|
666
|
+
* @param y Y coordinate on screen.
|
|
667
|
+
* @param camera optional camera id
|
|
668
|
+
* @returns the world coordinate on the camera near plane
|
|
669
|
+
* @example Place objects at the touch point.
|
|
670
|
+
```lua
|
|
671
|
+
function on_input(self, action_id, action)
|
|
672
|
+
if action_id == hash("touch") then
|
|
673
|
+
if action.pressed then
|
|
674
|
+
local world_position = camera.screen_xy_to_world(action.screen_x, action.screen_y)
|
|
675
|
+
go.set_position(world_position, "/go1")
|
|
676
|
+
end
|
|
677
|
+
end
|
|
678
|
+
end
|
|
679
|
+
```
|
|
680
|
+
*/
|
|
681
|
+
export function screen_xy_to_world(x: number, y: number, camera?: url | number | undefined): vmath.vector3;
|
|
640
682
|
/**
|
|
641
683
|
* Sets the manual aspect ratio for the camera. This value is only used when
|
|
642
684
|
auto aspect ratio is disabled. To disable auto aspect ratio and use this
|
|
@@ -683,6 +725,23 @@ export function set_orthographic_mode(camera: url | number | undefined, mode: nu
|
|
|
683
725
|
* @param orthographic_zoom the zoom level when the camera uses orthographic projection.
|
|
684
726
|
*/
|
|
685
727
|
export function set_orthographic_zoom(camera: url | number | undefined, orthographic_zoom: number): void;
|
|
728
|
+
/**
|
|
729
|
+
* Converts a 3D world position to screen-space coordinates with view depth.
|
|
730
|
+
Returns a vector3 where x and y are in screen pixels and z is the view depth in world units
|
|
731
|
+
measured from the camera plane along the camera forward axis. The returned z can be used with
|
|
732
|
+
camera.screen_to_world to reconstruct the world position on the same pixel ray.
|
|
733
|
+
If a camera isn't specified, the last enabled camera is used.
|
|
734
|
+
* @param world_pos World-space position
|
|
735
|
+
* @param camera optional camera id
|
|
736
|
+
* @returns Screen position (x,y in pixels, z is view depth)
|
|
737
|
+
* @example Convert go position into screen pisition
|
|
738
|
+
```lua
|
|
739
|
+
go.update_world_transform("/go1")
|
|
740
|
+
local world_pos = go.get_world_position("/go1")
|
|
741
|
+
local screen_pos = camera.world_to_screen(world_pos)
|
|
742
|
+
```
|
|
743
|
+
*/
|
|
744
|
+
export function world_to_screen(world_pos: vmath.vector3, camera?: url | number | undefined): vmath.vector3;
|
|
686
745
|
}
|
|
687
746
|
|
|
688
747
|
declare namespace collectionfactory {
|
|
@@ -1133,9 +1192,25 @@ export function unload(url?: string | hash | url): void;
|
|
|
1133
1192
|
|
|
1134
1193
|
declare namespace font {
|
|
1135
1194
|
/**
|
|
1136
|
-
*
|
|
1137
|
-
* @param
|
|
1138
|
-
* @param
|
|
1195
|
+
* associates a ttf resource to a .fontc file.
|
|
1196
|
+
* @param fontc The path to the .fontc resource
|
|
1197
|
+
* @param ttf The path to the .ttf resource
|
|
1198
|
+
* @example ```lua
|
|
1199
|
+
local font_hash = hash("/assets/fonts/roboto.fontc")
|
|
1200
|
+
local ttf_hash = hash("/assets/fonts/Roboto/Roboto-Bold.ttf")
|
|
1201
|
+
font.add_font(font_hash, ttf_hash)
|
|
1202
|
+
```
|
|
1203
|
+
*/
|
|
1204
|
+
export function add_font(fontc: string | hash, ttf: string | hash): void;
|
|
1205
|
+
/**
|
|
1206
|
+
* Gets information about a font, such as the associated font files
|
|
1207
|
+
* @param fontc The path to the .fontc resource
|
|
1208
|
+
*/
|
|
1209
|
+
export function get_info(fontc: string | hash): { path: hash, fonts: { path: string, path_hash: hash }[] };
|
|
1210
|
+
/**
|
|
1211
|
+
* prepopulates the font glyph cache with rasterised glyphs
|
|
1212
|
+
* @param fontc The path to the .fontc resource
|
|
1213
|
+
* @param text The text to layout
|
|
1139
1214
|
* @param callback (optional) A callback function that is called after the request is finished
|
|
1140
1215
|
|
|
1141
1216
|
`self`
|
|
@@ -1149,26 +1224,24 @@ string `nil` if the request was successful
|
|
|
1149
1224
|
|
|
1150
1225
|
* @returns Returns the asynchronous request id
|
|
1151
1226
|
* @example ```lua
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
--
|
|
1155
|
-
-- and we're ready to present the text
|
|
1156
|
-
self.dialog_text_ready = true
|
|
1227
|
+
local font_hash = hash("/assets/fonts/roboto.fontc")
|
|
1228
|
+
font.prewarm_text(font_hash, "Some text", function (self, request_id, result, errstring)
|
|
1229
|
+
-- cache is warm, show the text!
|
|
1157
1230
|
end)
|
|
1158
|
-
```
|
|
1159
|
-
|
|
1160
|
-
```lua
|
|
1161
|
-
-- Remove glyphs
|
|
1162
|
-
local requestid = font.remove_glyphs("/path/to/my.fontc", "abcABC123")
|
|
1163
1231
|
```
|
|
1164
1232
|
*/
|
|
1165
|
-
export function
|
|
1233
|
+
export function prewarm_text(fontc: string | hash, text: string, callback?: ((this: any, request_id: any, result: any, errstring: any) => void)): number;
|
|
1166
1234
|
/**
|
|
1167
|
-
*
|
|
1168
|
-
* @param
|
|
1169
|
-
* @param
|
|
1235
|
+
* associates a ttf resource to a .fontc file
|
|
1236
|
+
* @param fontc The path to the .fontc resource
|
|
1237
|
+
* @param ttf The path to the .ttf resource
|
|
1238
|
+
* @example ```lua
|
|
1239
|
+
local font_hash = hash("/assets/fonts/roboto.fontc")
|
|
1240
|
+
local ttf_hash = hash("/assets/fonts/Roboto/Roboto-Bold.ttf")
|
|
1241
|
+
font.remove_font(font_hash, ttf_hash)
|
|
1242
|
+
```
|
|
1170
1243
|
*/
|
|
1171
|
-
export function
|
|
1244
|
+
export function remove_font(fontc: string | hash, ttf: string | hash): void;
|
|
1172
1245
|
}
|
|
1173
1246
|
|
|
1174
1247
|
declare namespace go {
|
|
@@ -1766,6 +1839,13 @@ end
|
|
|
1766
1839
|
```
|
|
1767
1840
|
*/
|
|
1768
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;
|
|
1769
1849
|
/**
|
|
1770
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.
|
|
1771
1851
|
It can be used to take action on the input, e.g. move the instance according to the input.
|
|
@@ -2311,8 +2391,10 @@ export type input_message = {
|
|
|
2311
2391
|
gamepad?: number;
|
|
2312
2392
|
touch?: touch_input[];
|
|
2313
2393
|
};
|
|
2394
|
+
export type late_update = (this: any, dt: number) => void;
|
|
2314
2395
|
export type on_input = (this: any, action_id: hash, action: go.input_message) => void;
|
|
2315
2396
|
export type on_message = (this: any, message_id: hash, message: object, sender: url) => void;
|
|
2397
|
+
export type on_reload = (this: any) => void;
|
|
2316
2398
|
export type touch_input = {
|
|
2317
2399
|
id: number;
|
|
2318
2400
|
pressed: boolean;
|
|
@@ -2926,6 +3008,22 @@ export const RESULT_OUT_OF_RESOURCES: number;
|
|
|
2926
3008
|
* The texture id already exists when trying to use gui.new_texture().
|
|
2927
3009
|
*/
|
|
2928
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;
|
|
2929
3027
|
/**
|
|
2930
3028
|
* The size of the node is determined by the currently assigned texture.
|
|
2931
3029
|
*/
|
|
@@ -3718,6 +3816,7 @@ export function new_text_node(pos: vmath.vector3 | vmath.vector4, text: string):
|
|
|
3718
3816
|
`"rgb"` - RGB
|
|
3719
3817
|
`"rgba"` - RGBA
|
|
3720
3818
|
`"l"` - LUMINANCE
|
|
3819
|
+
`"astc"` - ASTC compressed format
|
|
3721
3820
|
|
|
3722
3821
|
* @param buffer texture data
|
|
3723
3822
|
* @param flip flip texture vertically
|
|
@@ -3746,6 +3845,16 @@ function init(self)
|
|
|
3746
3845
|
end
|
|
3747
3846
|
end
|
|
3748
3847
|
end
|
|
3848
|
+
```How to create a texture using .astc format
|
|
3849
|
+
|
|
3850
|
+
```lua
|
|
3851
|
+
local path = "/assets/images/logo_4x4.astc"
|
|
3852
|
+
local buffer = sys.load_resource(path)
|
|
3853
|
+
local n = gui.new_box_node(pos, vmath.vector3(size, size, 0))
|
|
3854
|
+
-- size is read from the .astc buffer
|
|
3855
|
+
-- flip is not supported
|
|
3856
|
+
gui.new_texture(path, 0, 0, "astc", buffer, false)
|
|
3857
|
+
gui.set_texture(n, path)
|
|
3749
3858
|
```
|
|
3750
3859
|
*/
|
|
3751
3860
|
export function new_texture(texture_id: string | hash, width: number, height: number, type: string | number, buffer: string, flip: boolean): LuaMultiReturn<[boolean, number]>;
|
|
@@ -4458,6 +4567,17 @@ The rotation is expressed as a quaternion
|
|
|
4458
4567
|
* @param rotation new rotation
|
|
4459
4568
|
*/
|
|
4460
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;
|
|
4461
4581
|
/**
|
|
4462
4582
|
* Sets the scaling of the supplied node.
|
|
4463
4583
|
* @param node node to set the scale for
|
|
@@ -4554,6 +4674,7 @@ export function set_texture(node: node, texture: string | hash): void;
|
|
|
4554
4674
|
`"rgb"` - RGB
|
|
4555
4675
|
`"rgba"` - RGBA
|
|
4556
4676
|
`"l"` - LUMINANCE
|
|
4677
|
+
`"astc"` - ASTC compressed format
|
|
4557
4678
|
|
|
4558
4679
|
* @param buffer texture data
|
|
4559
4680
|
* @param flip flip texture vertically
|
|
@@ -4691,6 +4812,7 @@ export type final = (this: any) => void;
|
|
|
4691
4812
|
export type init = (this: any) => void;
|
|
4692
4813
|
export type on_input = (this: any, action_id: hash, action: go.input_message) => void;
|
|
4693
4814
|
export type on_message = (this: any, message_id: hash, message: object, sender: url) => void;
|
|
4815
|
+
export type on_reload = (this: any) => void;
|
|
4694
4816
|
export type update = (this: any, dt: number) => void;
|
|
4695
4817
|
}
|
|
4696
4818
|
|
|
@@ -4788,7 +4910,7 @@ function init(self)
|
|
|
4788
4910
|
end
|
|
4789
4911
|
```
|
|
4790
4912
|
*/
|
|
4791
|
-
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;
|
|
4792
4914
|
}
|
|
4793
4915
|
|
|
4794
4916
|
declare namespace image {
|
|
@@ -4808,6 +4930,24 @@ export const TYPE_RGB: number;
|
|
|
4808
4930
|
* RGBA image type
|
|
4809
4931
|
*/
|
|
4810
4932
|
export const TYPE_RGBA: number;
|
|
4933
|
+
/**
|
|
4934
|
+
* get the header of an .astc buffer
|
|
4935
|
+
* @param buffer .astc file data buffer
|
|
4936
|
+
* @example How to get the block size and dimensions from a .astc file
|
|
4937
|
+
```lua
|
|
4938
|
+
local s = sys.load_resource("/assets/cat.astc")
|
|
4939
|
+
local header = image.get_astc_header(s)
|
|
4940
|
+
pprint(s)
|
|
4941
|
+
```
|
|
4942
|
+
*/
|
|
4943
|
+
export function get_astc_header(buffer: string): {
|
|
4944
|
+
width: number;
|
|
4945
|
+
height: number;
|
|
4946
|
+
depth: number;
|
|
4947
|
+
block_size_x: number;
|
|
4948
|
+
block_size_y: number;
|
|
4949
|
+
block_size_z: number;
|
|
4950
|
+
} | undefined;
|
|
4811
4951
|
/**
|
|
4812
4952
|
* Load image (PNG or JPEG) from buffer.
|
|
4813
4953
|
* @param buffer image data buffer
|
|
@@ -5882,7 +6022,7 @@ end
|
|
|
5882
6022
|
*/
|
|
5883
6023
|
export function raycast_async(from: vmath.vector3, to: vmath.vector3, groups: hash[] | LuaSet<hash>, request_id?: number): void;
|
|
5884
6024
|
/**
|
|
5885
|
-
*
|
|
6025
|
+
* Only one physics world event listener can be set at a time.
|
|
5886
6026
|
* @param callback A callback that receives an information about all the physics interactions in this physics world.
|
|
5887
6027
|
|
|
5888
6028
|
`self`
|
|
@@ -6655,7 +6795,7 @@ function update(self, dt)
|
|
|
6655
6795
|
end
|
|
6656
6796
|
```
|
|
6657
6797
|
*/
|
|
6658
|
-
export function enable_texture(binding: number | string | hash, handle_or_name: number | string | hash, buffer_type?:
|
|
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;
|
|
6659
6799
|
/**
|
|
6660
6800
|
* Returns the logical window height that is set in the "game.project" settings.
|
|
6661
6801
|
Note that the actual window pixel size can change, either by device constraints
|
|
@@ -9909,7 +10049,7 @@ export const REQUEST_STATUS_ERROR_NOT_FOUND: number;
|
|
|
9909
10049
|
*/
|
|
9910
10050
|
export const REQUEST_STATUS_FINISHED: number;
|
|
9911
10051
|
/**
|
|
9912
|
-
*
|
|
10052
|
+
* This function will raise a Lua error if an error occurs while deserializing the buffer.
|
|
9913
10053
|
* @param buffer buffer to deserialize from
|
|
9914
10054
|
* @example Deserialize a lua table that was previously serialized:
|
|
9915
10055
|
```lua
|
|
@@ -9981,6 +10121,7 @@ end
|
|
|
9981
10121
|
export function get_application_info(app_string: string): {installed: boolean};
|
|
9982
10122
|
/**
|
|
9983
10123
|
* The path from which the application is run.
|
|
10124
|
+
This function will raise a Lua error if unable to get the application support path.
|
|
9984
10125
|
* @returns path to application executable
|
|
9985
10126
|
* @example Find a path where we can store data (the example path is on the macOS platform):
|
|
9986
10127
|
```lua
|
|
@@ -10005,6 +10146,17 @@ print(application_path) --> http://www.foobar.com/my_game
|
|
|
10005
10146
|
```
|
|
10006
10147
|
*/
|
|
10007
10148
|
export function get_application_path(): string;
|
|
10149
|
+
/**
|
|
10150
|
+
* Get boolean config value from the game.project configuration file with optional default value
|
|
10151
|
+
* @param key key to get value for. The syntax is SECTION.KEY
|
|
10152
|
+
* @param default_value (optional) default value to return if the value does not exist
|
|
10153
|
+
* @returns config value as a boolean. default_value if the config key does not exist. false if no default value was supplied.
|
|
10154
|
+
* @example Get user config value
|
|
10155
|
+
```lua
|
|
10156
|
+
local vsync = sys.get_config_boolean("display.vsync", false)
|
|
10157
|
+
```
|
|
10158
|
+
*/
|
|
10159
|
+
export function get_config_boolean(key: string, default_value?: boolean): boolean;
|
|
10008
10160
|
/**
|
|
10009
10161
|
* Get integer config value from the game.project configuration file with optional default value
|
|
10010
10162
|
* @param key key to get value for. The syntax is SECTION.KEY
|
|
@@ -10118,6 +10270,7 @@ end
|
|
|
10118
10270
|
export function get_ifaddrs(): { name: string, address: string | undefined, mac: string | undefined, up: boolean, running: boolean }[];
|
|
10119
10271
|
/**
|
|
10120
10272
|
* The save-file path is operating system specific and is typically located under the user's home directory.
|
|
10273
|
+
This function will raise a Lua error if unable to get the save file path.
|
|
10121
10274
|
* @param application_id user defined id of the application, which helps define the location of the save-file
|
|
10122
10275
|
* @param file_name file-name to get path for
|
|
10123
10276
|
* @returns path to save-file
|
|
@@ -10161,6 +10314,7 @@ end
|
|
|
10161
10314
|
export 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};
|
|
10162
10315
|
/**
|
|
10163
10316
|
* If the file exists, it must have been created by `sys.save` to be loaded.
|
|
10317
|
+
This function will raise a Lua error if an error occurs while loading the file.
|
|
10164
10318
|
* @param filename file to read from
|
|
10165
10319
|
* @example Load data that was previously saved, e.g. an earlier game session:
|
|
10166
10320
|
```lua
|
|
@@ -10335,23 +10489,22 @@ Additionally, the total number of rows that any one table may contain is limited
|
|
|
10335
10489
|
(i.e. a 16 bit range). When tables are used to represent arrays, the values of
|
|
10336
10490
|
keys are permitted to fall within a 32 bit range, supporting sparse arrays, however
|
|
10337
10491
|
the limit on the total number of rows remains in effect.
|
|
10492
|
+
This function will raise a Lua error if an error occurs while saving the table.
|
|
10338
10493
|
* @param filename file to write to
|
|
10339
10494
|
* @param table lua table to save
|
|
10340
|
-
* @returns a boolean indicating if the table could be saved or not
|
|
10341
10495
|
* @example Save data:
|
|
10342
10496
|
```lua
|
|
10343
10497
|
local my_table = {}
|
|
10344
10498
|
table.insert(my_table, "my_value")
|
|
10345
10499
|
local my_file_path = sys.get_save_file("my_game", "my_file")
|
|
10346
|
-
|
|
10347
|
-
-- Alert user that the data could not be saved
|
|
10348
|
-
end
|
|
10500
|
+
sys.save(my_file_path, my_table)
|
|
10349
10501
|
```
|
|
10350
10502
|
*/
|
|
10351
|
-
export function save(filename: string, table: object):
|
|
10503
|
+
export function save(filename: string, table: object): void;
|
|
10352
10504
|
/**
|
|
10353
10505
|
* The buffer can later deserialized by `sys.deserialize`.
|
|
10354
|
-
This
|
|
10506
|
+
This function has all the same limitations as `sys.save`.
|
|
10507
|
+
This function will raise a Lua error if an error occurs while serializing the table.
|
|
10355
10508
|
* @param table lua table to serialize
|
|
10356
10509
|
* @returns serialized data buffer
|
|
10357
10510
|
* @example Serialize table:
|
|
@@ -10370,6 +10523,21 @@ sys.set_connectivity_host("www.google.com")
|
|
|
10370
10523
|
```
|
|
10371
10524
|
*/
|
|
10372
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;
|
|
10373
10541
|
/**
|
|
10374
10542
|
* Set the Lua error handler function.
|
|
10375
10543
|
The error handler is a function which is called whenever a lua runtime error occurs.
|
|
@@ -10403,6 +10571,15 @@ end
|
|
|
10403
10571
|
```
|
|
10404
10572
|
*/
|
|
10405
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;
|
|
10406
10583
|
/**
|
|
10407
10584
|
* Set game update-frequency (frame cap). This option is equivalent to `display.update_frequency` in
|
|
10408
10585
|
the "game.project" settings but set in run-time. If `Vsync` checked in "game.project", the rate will
|
|
@@ -11600,22 +11777,22 @@ export type matrix4 = number & {
|
|
|
11600
11777
|
c1: vmath.vector4;
|
|
11601
11778
|
c2: vmath.vector4;
|
|
11602
11779
|
c3: vmath.vector4;
|
|
11780
|
+
m00: number;
|
|
11603
11781
|
m01: number;
|
|
11604
11782
|
m02: number;
|
|
11605
11783
|
m03: number;
|
|
11606
|
-
|
|
11784
|
+
m10: number;
|
|
11607
11785
|
m11: number;
|
|
11608
11786
|
m12: number;
|
|
11609
11787
|
m13: number;
|
|
11610
|
-
|
|
11788
|
+
m20: number;
|
|
11611
11789
|
m21: number;
|
|
11612
11790
|
m22: number;
|
|
11613
11791
|
m23: number;
|
|
11614
|
-
|
|
11792
|
+
m30: number;
|
|
11615
11793
|
m31: number;
|
|
11616
11794
|
m32: number;
|
|
11617
11795
|
m33: number;
|
|
11618
|
-
m34: number;
|
|
11619
11796
|
};
|
|
11620
11797
|
export function mul_per_elem(v1: vmath.vector3, v2: vmath.vector3): vmath.vector3;
|
|
11621
11798
|
export function mul_per_elem(v1: vmath.vector4, v2: vmath.vector4): vmath.vector4;
|
|
@@ -11761,6 +11938,36 @@ export function get_display_scale(): number;
|
|
|
11761
11938
|
* @returns The lock state
|
|
11762
11939
|
*/
|
|
11763
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
|
+
};
|
|
11764
11971
|
/**
|
|
11765
11972
|
* This returns the current window size (width and height).
|
|
11766
11973
|
* @returns The window width & The window height
|
|
@@ -11778,7 +11985,7 @@ This function has no effect on platforms that does not support dimming.
|
|
|
11778
11985
|
*/
|
|
11779
11986
|
export function set_dim_mode(mode: number): void;
|
|
11780
11987
|
/**
|
|
11781
|
-
* Sets a window event listener.
|
|
11988
|
+
* Sets a window event listener. Only one window event listener can be set at a time.
|
|
11782
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.
|
|
11783
11990
|
|
|
11784
11991
|
`self`
|