@defold-typescript/types 0.4.3 → 0.5.1
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/generated/b2d.d.ts +11 -0
- package/generated/buffer.d.ts +142 -0
- package/generated/collectionfactory.d.ts +118 -0
- package/generated/collectionproxy.d.ts +52 -0
- package/generated/crash.d.ts +109 -0
- package/generated/factory.d.ts +94 -0
- package/generated/go.d.ts +880 -0
- package/generated/graphics.d.ts +108 -0
- package/generated/gui.d.ts +1892 -0
- package/generated/http.d.ts +50 -0
- package/generated/iac.d.ts +7 -0
- package/generated/iap.d.ts +41 -0
- package/generated/image.d.ts +95 -0
- package/generated/json.d.ts +59 -0
- package/generated/label.d.ts +64 -0
- package/generated/liveupdate.d.ts +96 -0
- package/generated/model.d.ts +156 -0
- package/generated/msg.d.ts +56 -0
- package/generated/particlefx.d.ts +122 -0
- package/generated/physics.d.ts +451 -0
- package/generated/profiler.d.ts +188 -0
- package/generated/push.d.ts +48 -0
- package/generated/render.d.ts +944 -0
- package/generated/resource.d.ts +1227 -0
- package/generated/socket.d.ts +125 -0
- package/generated/sound.d.ts +246 -0
- package/generated/sprite.d.ts +111 -0
- package/generated/sys.d.ts +513 -0
- package/generated/tilemap.d.ts +151 -0
- package/generated/timer.d.ts +93 -0
- package/generated/vmath.d.ts +914 -0
- package/generated/webview.d.ts +50 -0
- package/generated/window.d.ts +141 -0
- package/generated/zlib.d.ts +28 -0
- package/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/api-doc.ts +10 -1
- package/src/doc-comment.ts +119 -0
- package/src/emit-dts.ts +63 -2
- package/src/engine-globals.d.ts +12 -0
- package/src/index.ts +1 -0
- package/src/lifecycle.ts +45 -16
package/generated/profiler.d.ts
CHANGED
|
@@ -3,24 +3,212 @@ import type { Opaque } from "../src/core-types";
|
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
5
|
namespace profiler {
|
|
6
|
+
/**
|
|
7
|
+
* pause on current frame
|
|
8
|
+
*/
|
|
6
9
|
const MODE_PAUSE: number & { readonly __brand: "profiler.MODE_PAUSE" };
|
|
10
|
+
/**
|
|
11
|
+
* start recording
|
|
12
|
+
*/
|
|
7
13
|
const MODE_RECORD: number & { readonly __brand: "profiler.MODE_RECORD" };
|
|
14
|
+
/**
|
|
15
|
+
* continously show latest frame
|
|
16
|
+
*/
|
|
8
17
|
const MODE_RUN: number & { readonly __brand: "profiler.MODE_RUN" };
|
|
18
|
+
/**
|
|
19
|
+
* pause at peak frame
|
|
20
|
+
*/
|
|
9
21
|
const MODE_SHOW_PEAK_FRAME: number & { readonly __brand: "profiler.MODE_SHOW_PEAK_FRAME" };
|
|
22
|
+
/**
|
|
23
|
+
* show full profiler ui
|
|
24
|
+
*/
|
|
10
25
|
const VIEW_MODE_FULL: number & { readonly __brand: "profiler.VIEW_MODE_FULL" };
|
|
26
|
+
/**
|
|
27
|
+
* show mimimal profiler ui
|
|
28
|
+
*/
|
|
11
29
|
const VIEW_MODE_MINIMIZED: number & { readonly __brand: "profiler.VIEW_MODE_MINIMIZED" };
|
|
30
|
+
/**
|
|
31
|
+
* logs the current frame to the console
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```lua
|
|
35
|
+
* profiler.dump_frame()
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
12
38
|
function dump_frame(): void;
|
|
39
|
+
/**
|
|
40
|
+
* The profiler is a real-time tool that shows the numbers of milliseconds spent
|
|
41
|
+
* in each scope per frame as well as counters. The profiler is very useful for
|
|
42
|
+
* tracking down performance and resource problems.
|
|
43
|
+
*
|
|
44
|
+
* @param enabled - true to enable, false to disable
|
|
45
|
+
* @example
|
|
46
|
+
* ```lua
|
|
47
|
+
* -- Show the profiler UI
|
|
48
|
+
* profiler.enable(true)
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
13
51
|
function enable(enabled: boolean): void;
|
|
52
|
+
/**
|
|
53
|
+
* Creates and shows or hides and destroys the on-sceen profiler ui
|
|
54
|
+
* The profiler is a real-time tool that shows the numbers of milliseconds spent
|
|
55
|
+
* in each scope per frame as well as counters. The profiler is very useful for
|
|
56
|
+
* tracking down performance and resource problems.
|
|
57
|
+
*
|
|
58
|
+
* @param enabled - true to enable, false to disable
|
|
59
|
+
* @example
|
|
60
|
+
* ```lua
|
|
61
|
+
* -- Show the profiler UI
|
|
62
|
+
* profiler.enable_ui(true)
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
14
65
|
function enable_ui(enabled: boolean): void;
|
|
66
|
+
/**
|
|
67
|
+
* Get the percent of CPU usage by the application, as reported by the OS.
|
|
68
|
+
* This function is not available on HTML5.
|
|
69
|
+
* For some platforms ( Android, Linux and Windows), this information is only available
|
|
70
|
+
* by default in the debug version of the engine. It can be enabled in release version as well
|
|
71
|
+
* by checking `track_cpu` under `profiler` in the `game.project` file.
|
|
72
|
+
* (This means that the engine will sample the CPU usage in intervalls during execution even in release mode.)
|
|
73
|
+
*
|
|
74
|
+
* @returns of CPU used by the application
|
|
75
|
+
*/
|
|
15
76
|
function get_cpu_usage(): number;
|
|
77
|
+
/**
|
|
78
|
+
* Get the amount of memory used (resident/working set) by the application in bytes, as reported by the OS.
|
|
79
|
+
* This function is not available on HTML5.
|
|
80
|
+
* The values are gathered from internal OS functions which correspond to the following;
|
|
81
|
+
* OS
|
|
82
|
+
* Value
|
|
83
|
+
* iOS
|
|
84
|
+
* MacOS
|
|
85
|
+
* Android
|
|
86
|
+
* Linux
|
|
87
|
+
* Resident memory
|
|
88
|
+
* Windows
|
|
89
|
+
* Working set
|
|
90
|
+
* HTML5
|
|
91
|
+
* Not available
|
|
92
|
+
*
|
|
93
|
+
* @returns used by the application
|
|
94
|
+
* @example
|
|
95
|
+
* ```lua
|
|
96
|
+
* Get memory usage before and after loading a collection:
|
|
97
|
+
* print(profiler.get_memory_usage())
|
|
98
|
+
* msg.post("#collectionproxy", "load")
|
|
99
|
+
* ...
|
|
100
|
+
* print(profiler.get_memory_usage()) -- will report a higher number than the initial call
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
16
103
|
function get_memory_usage(): number;
|
|
104
|
+
/**
|
|
105
|
+
* Send a text to the connected profiler
|
|
106
|
+
*
|
|
107
|
+
* @param text - the string to send to the connected profiler
|
|
108
|
+
* @example
|
|
109
|
+
* ```lua
|
|
110
|
+
* profiler.log_text("Event: " .. name)
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
17
113
|
function log_text(text: string): void;
|
|
114
|
+
/**
|
|
115
|
+
* Get the number of recorded frames in the on-screen profiler ui recording buffer
|
|
116
|
+
*
|
|
117
|
+
* @returns the number of recorded frames, zero if on-screen profiler is disabled
|
|
118
|
+
* @example
|
|
119
|
+
* ```lua
|
|
120
|
+
* -- Show the last recorded frame
|
|
121
|
+
* local recorded_frame_count = profiler.recorded_frame_count()
|
|
122
|
+
* profiler.view_recorded_frame(recorded_frame_count)
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
18
125
|
function recorded_frame_count(): number;
|
|
126
|
+
/**
|
|
127
|
+
* Starts a profile scope.
|
|
128
|
+
*
|
|
129
|
+
* @param name - The name of the scope
|
|
130
|
+
* @example
|
|
131
|
+
* ```lua
|
|
132
|
+
* -- Go back one frame
|
|
133
|
+
* profiler.scope_begin("test_function")
|
|
134
|
+
* test_function()
|
|
135
|
+
* profiler.scope_end()
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
19
138
|
function scope_begin(name: string): void;
|
|
139
|
+
/**
|
|
140
|
+
* End the current profile scope.
|
|
141
|
+
*/
|
|
20
142
|
function scope_end(): void;
|
|
143
|
+
/**
|
|
144
|
+
* Set the on-screen profile mode - run, pause, record or show peak frame
|
|
145
|
+
*
|
|
146
|
+
* @param mode - the mode to set the ui profiler in
|
|
147
|
+
- `profiler.MODE_RUN` This is default mode that continously shows the last frame
|
|
148
|
+
- `profiler.MODE_PAUSE` Pauses on the currently displayed frame
|
|
149
|
+
- `profiler.MODE_SHOW_PEAK_FRAME` Pauses on the currently displayed frame but shows a new frame if that frame is slower
|
|
150
|
+
- `profiler.MODE_RECORD` Records all incoming frames to the recording buffer
|
|
151
|
+
To stop recording, switch to a different mode such as `MODE_PAUSE` or `MODE_RUN`.
|
|
152
|
+
You can also use the `view_recorded_frame` function to display a recorded frame. Doing so stops the recording as well.
|
|
153
|
+
Every time you switch to recording mode the recording buffer is cleared.
|
|
154
|
+
* @example
|
|
155
|
+
* ```lua
|
|
156
|
+
* function start_recording()
|
|
157
|
+
* profiler.set_ui_mode(profiler.MODE_RECORD)
|
|
158
|
+
* end
|
|
159
|
+
*
|
|
160
|
+
* function stop_recording()
|
|
161
|
+
* profiler.set_ui_mode(profiler.MODE_PAUSE)
|
|
162
|
+
* end
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
21
165
|
function set_ui_mode(mode: Opaque<"constant">): void;
|
|
166
|
+
/**
|
|
167
|
+
* Set the on-screen profile view mode - minimized or expanded
|
|
168
|
+
*
|
|
169
|
+
* @param mode - the view mode to set the ui profiler in
|
|
170
|
+
- `profiler.VIEW_MODE_FULL` The default mode which displays all the ui profiler details
|
|
171
|
+
- `profiler.VIEW_MODE_MINIMIZED` Minimized mode which only shows the top header (fps counters and ui profiler mode)
|
|
172
|
+
* @example
|
|
173
|
+
* ```lua
|
|
174
|
+
* -- Minimize the profiler view
|
|
175
|
+
* profiler.set_ui_view_mode(profiler.VIEW_MODE_MINIMIZED)
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
22
178
|
function set_ui_view_mode(mode: Opaque<"constant">): void;
|
|
179
|
+
/**
|
|
180
|
+
* Shows or hides the time the engine waits for vsync in the on-screen profiler
|
|
181
|
+
* Each frame the engine waits for vsync and depending on your vsync settings and how much time
|
|
182
|
+
* your game logic takes this time can dwarf the time in the game logic making it hard to
|
|
183
|
+
* see details in the on-screen profiler graph and lists.
|
|
184
|
+
* Also, by hiding this the FPS times in the header show the time spent each time excuding the
|
|
185
|
+
* time spent waiting for vsync. This shows you how long time your game is spending actively
|
|
186
|
+
* working each frame.
|
|
187
|
+
* This setting also effects the display of recorded frames but does not affect the actual
|
|
188
|
+
* recorded frames so it is possible to toggle this on and off when viewing recorded frames.
|
|
189
|
+
* By default the vsync wait times is displayed in the profiler.
|
|
190
|
+
*
|
|
191
|
+
* @param visible - true to include it in the display, false to hide it.
|
|
192
|
+
* @example
|
|
193
|
+
* ```lua
|
|
194
|
+
* -- Exclude frame wait time form the profiler ui
|
|
195
|
+
* profiler.set_ui_vsync_wait_visible(false)
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
23
198
|
function set_ui_vsync_wait_visible(visible: boolean): void;
|
|
199
|
+
/**
|
|
200
|
+
* Pauses and displays a frame from the recording buffer in the on-screen profiler ui
|
|
201
|
+
* The frame to show can either be an absolute frame or a relative frame to the current frame.
|
|
202
|
+
*
|
|
203
|
+
* @param frame_index - a table where you specify one of the following parameters:
|
|
204
|
+
- `distance` The offset from the currently displayed frame (this is truncated between zero and the number of recorded frames)
|
|
205
|
+
- `frame` The frame index in the recording buffer (1 is first recorded frame)
|
|
206
|
+
* @example
|
|
207
|
+
* ```lua
|
|
208
|
+
* -- Go back one frame
|
|
209
|
+
* profiler.view_recorded_frame({distance = -1})
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
24
212
|
function view_recorded_frame(frame_index: Record<string | number, unknown>): void;
|
|
25
213
|
}
|
|
26
214
|
}
|
package/generated/push.d.ts
CHANGED
|
@@ -1,13 +1,61 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
declare global {
|
|
3
3
|
namespace push {
|
|
4
|
+
/**
|
|
5
|
+
* Use this function to cancel a previously scheduled local push notification.
|
|
6
|
+
* The notification is identified by a numeric id as returned by `push.schedule()`.
|
|
7
|
+
*
|
|
8
|
+
* @param id - The numeric id of the local push notification
|
|
9
|
+
*/
|
|
4
10
|
function cancel(id: number): void;
|
|
11
|
+
/**
|
|
12
|
+
* Use this function to cancel a previously issued local push notifications.
|
|
13
|
+
*/
|
|
5
14
|
function cancel_all_issued(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Returns a table with all data associated with all scheduled local push notifications.
|
|
17
|
+
* The table contains key, value pairs where the key is the push notification id and the value is a table with the notification data, corresponding to the data given by `push.get_scheduled(id)`.
|
|
18
|
+
*
|
|
19
|
+
* @returns Table with all data associated with all scheduled notifications.
|
|
20
|
+
*/
|
|
6
21
|
function get_all_scheduled(): Record<string | number, unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* Returns a table with all data associated with a specified local push notification.
|
|
24
|
+
* The notification is identified by a numeric id as returned by `push.schedule()`.
|
|
25
|
+
*
|
|
26
|
+
* @param id - The numeric id of the local push notification.
|
|
27
|
+
* @returns Table with all data associated with the notification.
|
|
28
|
+
*/
|
|
7
29
|
function get_scheduled(id: number): Record<string | number, unknown>;
|
|
30
|
+
/**
|
|
31
|
+
* Send a request for push notifications. Note that the notifications table parameter is iOS only and will be ignored on Android.
|
|
32
|
+
*
|
|
33
|
+
* @param notifications - The types of notifications to listen to. [icon:ios]
|
|
34
|
+
* @param callback - Register callback function.
|
|
35
|
+
*/
|
|
8
36
|
function register(notifications: Record<string | number, unknown>, callback: (...args: unknown[]) => unknown): void;
|
|
37
|
+
/**
|
|
38
|
+
* Local push notifications are scheduled with this function.
|
|
39
|
+
* The returned `id` value is uniquely identifying the scheduled notification and can be stored for later reference.
|
|
40
|
+
*
|
|
41
|
+
* @param time - Number of seconds into the future until the notification should be triggered.
|
|
42
|
+
* @param title - Localized title to be displayed to the user if the application is not running.
|
|
43
|
+
* @param alert - Localized body message of the notification to be displayed to the user if the application is not running.
|
|
44
|
+
* @param payload - JSON string to be passed to the registered listener function.
|
|
45
|
+
* @param notification_settings - Table with notification and platform specific fields
|
|
46
|
+
*/
|
|
9
47
|
function schedule(time: number, title: string, alert: string, payload: string, notification_settings: Record<string | number, unknown>): LuaMultiReturn<[number, string]>;
|
|
48
|
+
/**
|
|
49
|
+
* Set the badge count for application icon. This function is only available on iOS. [icon:ios]
|
|
50
|
+
*
|
|
51
|
+
* @param count - Badge count
|
|
52
|
+
*/
|
|
10
53
|
function set_badge_count(count: number): void;
|
|
54
|
+
/**
|
|
55
|
+
* Sets a listener function to listen to push notifications.
|
|
56
|
+
*
|
|
57
|
+
* @param listener - Listener callback function.
|
|
58
|
+
*/
|
|
11
59
|
function set_listener(listener: (...args: unknown[]) => unknown): void;
|
|
12
60
|
}
|
|
13
61
|
}
|