@defold-typescript/library-types 0.18.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/NOTICE +52 -0
- package/README.md +78 -0
- package/api-doc/boom.boom.json +26 -0
- package/api-doc/bridge.bridge.json +1653 -0
- package/api-doc/bzAnim.bzLibrary.json +156 -0
- package/api-doc/defcon.console.json +109 -0
- package/api-doc/defmath.defmath.json +1381 -0
- package/api-doc/defsave.defsave.json +175 -0
- package/api-doc/deftest.deftest.json +71 -0
- package/api-doc/dicebag.dicebag.json +323 -0
- package/api-doc/event.event.json +238 -0
- package/api-doc/gooey.gooey.json +963 -0
- package/api-doc/immutable.immutable.json +63 -0
- package/api-doc/in.accelerometer.json +281 -0
- package/api-doc/in.button.json +148 -0
- package/api-doc/in.cursor.json +203 -0
- package/api-doc/in.gesture.json +206 -0
- package/api-doc/in.keyboard.json +45 -0
- package/api-doc/in.mapper.json +141 -0
- package/api-doc/in.onscreen.json +265 -0
- package/api-doc/in.state.json +195 -0
- package/api-doc/in.textbox.json +213 -0
- package/api-doc/in.triggers.json +1260 -0
- package/api-doc/lang.lang.json +411 -0
- package/api-doc/log.log.json +50 -0
- package/api-doc/metrics.fps.json +88 -0
- package/api-doc/metrics.mem.json +80 -0
- package/api-doc/monarch.monarch.json +1065 -0
- package/api-doc/monarch.transitions.easings.json +206 -0
- package/api-doc/monarch.transitions.gui.json +445 -0
- package/api-doc/nakama.engine.defold.json +165 -0
- package/api-doc/nakama.nakama.json +6574 -0
- package/api-doc/nakama.util.log.json +25 -0
- package/api-doc/narrator.narrator.json +150 -0
- package/api-doc/orthographic.camera.json +1019 -0
- package/api-doc/persist.persist.json +142 -0
- package/api-doc/platypus.platypus.json +631 -0
- package/api-doc/proto.proto.json +355 -0
- package/api-doc/rendy.rendy.json +408 -0
- package/api-doc/richtext.color.json +219 -0
- package/api-doc/richtext.richtext.json +382 -0
- package/api-doc/richtext.tags.json +67 -0
- package/api-doc/saver.saver.json +553 -0
- package/api-doc/saver.storage.json +174 -0
- package/api-doc/squid.squid.json +660 -0
- package/api-doc/starly.starly.json +488 -0
- package/api-doc/tweener.tweener.json +419 -0
- package/api-doc/yagames.yagames.json +1465 -0
- package/api-doc/zzfx.api.json +85 -0
- package/generated/boom.boom.d.ts +1585 -0
- package/generated/bridge.bridge.d.ts +533 -0
- package/generated/bzAnim.bzLibrary.d.ts +93 -0
- package/generated/defcon.console.d.ts +24 -0
- package/generated/defmath.defmath.d.ts +194 -0
- package/generated/defsave.defsave.d.ts +31 -0
- package/generated/deftest.deftest.d.ts +47 -0
- package/generated/dicebag.dicebag.d.ts +90 -0
- package/generated/event.event.d.ts +54 -0
- package/generated/gooey.gooey.d.ts +261 -0
- package/generated/immutable.immutable.d.ts +13 -0
- package/generated/in.accelerometer.d.ts +37 -0
- package/generated/in.button.d.ts +20 -0
- package/generated/in.cursor.d.ts +33 -0
- package/generated/in.gesture.d.ts +64 -0
- package/generated/in.keyboard.d.ts +18 -0
- package/generated/in.mapper.d.ts +23 -0
- package/generated/in.onscreen.d.ts +58 -0
- package/generated/in.state.d.ts +34 -0
- package/generated/in.textbox.d.ts +26 -0
- package/generated/in.triggers.d.ts +180 -0
- package/generated/lang.lang.d.ts +33 -0
- package/generated/log.log.d.ts +40 -0
- package/generated/metrics.fps.d.ts +16 -0
- package/generated/metrics.mem.d.ts +16 -0
- package/generated/monarch.monarch.d.ts +412 -0
- package/generated/monarch.transitions.easings.d.ts +65 -0
- package/generated/monarch.transitions.gui.d.ts +197 -0
- package/generated/nakama.engine.defold.d.ts +24 -0
- package/generated/nakama.nakama.d.ts +594 -0
- package/generated/nakama.util.log.d.ts +10 -0
- package/generated/narrator.narrator.d.ts +66 -0
- package/generated/orthographic.camera.d.ts +308 -0
- package/generated/persist.persist.d.ts +34 -0
- package/generated/platypus.platypus.d.ts +76 -0
- package/generated/proto.proto.d.ts +36 -0
- package/generated/rendy.rendy.d.ts +184 -0
- package/generated/richtext.color.d.ts +33 -0
- package/generated/richtext.richtext.d.ts +126 -0
- package/generated/richtext.tags.d.ts +12 -0
- package/generated/saver.saver.d.ts +44 -0
- package/generated/saver.storage.d.ts +16 -0
- package/generated/squid.squid.d.ts +106 -0
- package/generated/starly.starly.d.ts +148 -0
- package/generated/tweener.tweener.d.ts +151 -0
- package/generated/yagames.yagames.d.ts +279 -0
- package/generated/zzfx.api.d.ts +20 -0
- package/library-classification.json +726 -0
- package/library-targets.json +291 -0
- package/package.json +180 -0
- package/scripts/extract-api-doc.ts +418 -0
- package/scripts/sync-library-types.ts +542 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/** @noSelfInFile **/
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @see {@link https://github.com/subsoap/defmath|Github Source}
|
|
5
|
+
* @noResolution
|
|
6
|
+
*/
|
|
7
|
+
declare module "defmath.defmath" {
|
|
8
|
+
/**
|
|
9
|
+
* Angle-Diff (gets the smallest angle between two angles, using radians)
|
|
10
|
+
*/
|
|
11
|
+
export function anglediff_rad(rad1: number, rad2: number): number;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Angle-Diff (gets the smallest angle between two angles, using degrees)
|
|
15
|
+
*/
|
|
16
|
+
export function anglediff_deg(deg1: number, deg2: number): number;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Round
|
|
20
|
+
*/
|
|
21
|
+
export function round(x: number): number;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Round to decimal point
|
|
25
|
+
*/
|
|
26
|
+
export function round_decimal(number: number, decimal: number): number;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Clamp
|
|
30
|
+
*/
|
|
31
|
+
export function clamp(x: number, min: number, max: number): number;
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Sign
|
|
36
|
+
*/
|
|
37
|
+
export function sign(x: number): number;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Checks if two numbers have the same sign
|
|
41
|
+
*/
|
|
42
|
+
export function same_sign(a: number, b: number): boolean;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Vect to Quat
|
|
46
|
+
*/
|
|
47
|
+
export function vect_to_quat(vect: Vector3 | Vector4): Quaternion;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Vect to Quat + 90 degrees (perpendicular)
|
|
52
|
+
*/
|
|
53
|
+
export function vect_to_quat90(vect: Vector3 | Vector4): Quaternion;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Random float from -1 to 1
|
|
57
|
+
*/
|
|
58
|
+
export function rand11(): number;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Random float in range
|
|
62
|
+
*/
|
|
63
|
+
export function rand_range(min: number, max: number): number;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Linear interpolation
|
|
67
|
+
*/
|
|
68
|
+
export function lerp(start: number, stop: number, amount: number): number;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Distance between two 2d points
|
|
72
|
+
*/
|
|
73
|
+
export function dist2d(x1: number, y1: number, x2: number, y2: number): number;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Distance between two 3d points
|
|
77
|
+
*/
|
|
78
|
+
export function dist3d(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): number;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Angle in radians of vector between two points
|
|
82
|
+
*/
|
|
83
|
+
export function angle_of_vector_between_two_points(x1: number, y1: number, x2: number, y2: number): number;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Clears bad RNG and sets seed to be based on OS time
|
|
87
|
+
*/
|
|
88
|
+
export function setup_rng(): void;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Check if number is within range
|
|
92
|
+
*/
|
|
93
|
+
export function is_within_range(number: number, min: number, max: number): boolean;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Convert radians to degrees
|
|
97
|
+
*/
|
|
98
|
+
export function radians_to_degrees(radian: number): number;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Convert degrees to radians
|
|
102
|
+
*/
|
|
103
|
+
export function degrees_to_radians(degrees: number): number;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Wrap a number to betwen 0 and a range bound
|
|
107
|
+
*/
|
|
108
|
+
export function wrap(number: number, bound: number): number;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Bound a number so that it is no larger than max and no smaller than min
|
|
112
|
+
*/
|
|
113
|
+
export function bound(number: number, min: number, max: number): number;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Adds an amount to a value within the value going over max or below min
|
|
117
|
+
*/
|
|
118
|
+
export function bound_add(number: number, amount: number, min: number, max: number): number;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Sums a set of values
|
|
122
|
+
*/
|
|
123
|
+
export function sum(...vararg: number[]): number;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Average of set of values
|
|
127
|
+
*/
|
|
128
|
+
export function average(...vararg: number[]): number;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Get difference between two values
|
|
132
|
+
*/
|
|
133
|
+
export function difference(a: number, b: number): number;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* if a number is even
|
|
137
|
+
*/
|
|
138
|
+
export function is_even(number: number): boolean;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* if a number is odd
|
|
142
|
+
*/
|
|
143
|
+
export function is_odd(number: number): boolean;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Wrap an angle between -180 and +180
|
|
147
|
+
*/
|
|
148
|
+
export function wrap_angle(angle: number): number;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Angle between vmath vectors in radians
|
|
152
|
+
*/
|
|
153
|
+
export function angle_between_vectors(vector1: Vector3 | Vector4, vector2: Vector3 | Vector4): number;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Average midpoint of a set of vmath vectors
|
|
157
|
+
*/
|
|
158
|
+
export function average_midpoint_of_vectors(...vararg: Array<Vector3 | Vector4>): LuaMultiReturn<[number, number]>;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Fraction of
|
|
162
|
+
*/
|
|
163
|
+
export function fraction_of(a: number, b: number): number;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Percent of
|
|
167
|
+
*/
|
|
168
|
+
export function percent_of(a: number, b: number): number;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Used for MinMax Range
|
|
172
|
+
*/
|
|
173
|
+
export function min_max(min: number, max: number, value: number): number;
|
|
174
|
+
|
|
175
|
+
export function min_value(smallest: number, value: number): number;
|
|
176
|
+
|
|
177
|
+
export function max_value(largest: number, value: number): number;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Used to find a point in a triangle
|
|
181
|
+
* x0, y0 are the points that are being checked against the rest to see if it's inside
|
|
182
|
+
*/
|
|
183
|
+
export function in_triangle(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): boolean;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* arr must be 6 in length: top x/y, bottom right x/y, bottom left x/y
|
|
187
|
+
*/
|
|
188
|
+
export function box_intersect(ax: number, ay: number, awidth: number, aheight: number, bx: number, by: number, bwidth: number, bheight: number): boolean;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* see if a single point is within a rotated rectangle
|
|
192
|
+
*/
|
|
193
|
+
export function check_point_in_rect(rx: number, ry: number, rw: number, rh: number, rot: number, px: number, py: number): boolean;
|
|
194
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** @noSelfInFile **/
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Save and load config and user data persistently between a Defold project's sessions
|
|
5
|
+
* @see {@link https://github.com/subsoap/defsave|Github Source}
|
|
6
|
+
* @noResolution
|
|
7
|
+
*/
|
|
8
|
+
declare module "defsave.defsave" {
|
|
9
|
+
export let appname: string;
|
|
10
|
+
|
|
11
|
+
export function set_appname(name: string): void;
|
|
12
|
+
|
|
13
|
+
export function load(config: string): unknown;
|
|
14
|
+
|
|
15
|
+
export function get(config: string, name: string): unknown;
|
|
16
|
+
|
|
17
|
+
export function set(config: string, name: string, value: any): void;
|
|
18
|
+
|
|
19
|
+
export function save(config: string): void;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* You can save all files at once. By default, it will only actually save files with changes, but you can force saving all files by setting the force flag to true.
|
|
23
|
+
* @param all_files false only saves changed files and true saves all files
|
|
24
|
+
*/
|
|
25
|
+
export function save_all(all_files?: boolean): void;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* In your update, if you want autosave to be enabled, you will need to include
|
|
29
|
+
*/
|
|
30
|
+
export function update(dt: number): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** @noSelfInFile **/
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Unit testing in Defold
|
|
5
|
+
* @see {@link https://github.com/britzl/deftest|Github Source}
|
|
6
|
+
* @noResolution
|
|
7
|
+
*/
|
|
8
|
+
declare module 'deftest.deftest' {
|
|
9
|
+
export function add(...args: ((...args: any[]) => unknown)[]): void;
|
|
10
|
+
export function run(options?: {
|
|
11
|
+
coverage?: {
|
|
12
|
+
enabled?: boolean,
|
|
13
|
+
}
|
|
14
|
+
pattern?: string,
|
|
15
|
+
}): void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare function describe(title: string, tests: () => void): void
|
|
19
|
+
declare function before(before: () => void): void
|
|
20
|
+
declare function after(after: () => void): void
|
|
21
|
+
declare function test(title: string, test: () => void): void
|
|
22
|
+
declare function assert_equal<T>(a: T, b: T): void
|
|
23
|
+
declare function assert_blank(value: any): void
|
|
24
|
+
declare function assert_empty(obj: Record<any, any>): void
|
|
25
|
+
declare function assert_error(func: any): void
|
|
26
|
+
declare function assert_not_error(func: any): void
|
|
27
|
+
declare function assert_false(value: boolean): void
|
|
28
|
+
declare function assert_not_false(value: boolean): void
|
|
29
|
+
declare function assert_not_true(value: boolean): void
|
|
30
|
+
declare function assert_true(value: boolean): void
|
|
31
|
+
declare function assert_greater_than(a: number, b: number): void
|
|
32
|
+
declare function assert_gte(a: number, b: number): void
|
|
33
|
+
declare function assert_less_than(a: number, b: number): void
|
|
34
|
+
declare function assert_lte(a: number, b: number): void
|
|
35
|
+
declare function assert_match(a: number, b: number): void
|
|
36
|
+
declare function assert_nil(value: any): void
|
|
37
|
+
declare function assert_type<T>(a: T, b: T): void
|
|
38
|
+
declare function assert_not_blank(value: any): void
|
|
39
|
+
declare function assert_not_empty(value: any): void
|
|
40
|
+
declare function assert_not_equal<T>(a: T, b: T): void
|
|
41
|
+
declare function assert_not_greater_than(a: number, b: number): void
|
|
42
|
+
declare function assert_not_gte(a: number, b: number): void
|
|
43
|
+
declare function assert_not_less_than(a: number, b: number): void
|
|
44
|
+
declare function assert_not_lte(a: number, b: number): void
|
|
45
|
+
declare function assert_not_match(a: number, b: number): void
|
|
46
|
+
declare function assert_not_nil(value: any): void
|
|
47
|
+
declare function assert_not_type<T>(a: T, b: T): void
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/** @noSelfInFile **/
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Dicebag is a Defold extension containing probability functions designed specifically for games.
|
|
5
|
+
* @see {@link https://github.com/8bitskull/dicebag|Github Source}
|
|
6
|
+
* @noResolution
|
|
7
|
+
*/
|
|
8
|
+
declare module "dicebag.dicebag" {
|
|
9
|
+
/**
|
|
10
|
+
* Sets up the randomseed and clears the first number of random rolls.
|
|
11
|
+
* @param seed optional seed, if not specified a seed will be generated using socket.gettime().
|
|
12
|
+
* @returns the number used to seed the random function.
|
|
13
|
+
*/
|
|
14
|
+
export function set_up_rng(seed?: number): number;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Flip a coin.
|
|
18
|
+
* @returns true or false (50% chance).
|
|
19
|
+
*/
|
|
20
|
+
export function flip_coin(): boolean;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Roll a number of dice, D&D-style. An example would be rolling 3d6+2. Returns the sum of the resulting roll.
|
|
24
|
+
* @param num_dice Number of dice to roll.
|
|
25
|
+
* @param num_sides Number of sides on the dice.
|
|
26
|
+
* @param modifier Number to add to the result.
|
|
27
|
+
* @returns Sum of rolled dice plus modifier.
|
|
28
|
+
*/
|
|
29
|
+
export function roll_dice(num_dice: number, num_sides: number, modifier: number): number;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Roll a number of dice and choose one (or more) of the highest (advantage) or lowest (disadvantage) results. Returns the sum of the relevant dice rolls.
|
|
33
|
+
* @param num_sides Number of sides on the dice.
|
|
34
|
+
* @param advantage If true, the highest rolls will be selected, otherwise the lowest values will be selected.
|
|
35
|
+
* @param num_dice Number of dice to roll.
|
|
36
|
+
* @param num_results How many of the highest (advantage) or lowest (disadvantage) dice to sum up.
|
|
37
|
+
* @returns Sum of the highest (advantage) or lowest (disadvantage) dice rolls
|
|
38
|
+
*/
|
|
39
|
+
export function roll_special_dice(num_sides: number, advantage: number, num_dice: number, num_results: number): number;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Roll custom dice. The dice can have sides with different weights and different values.
|
|
43
|
+
* @param num_dice How many dice to roll.
|
|
44
|
+
* @param sides A table describing the sides of the die in the format `[[weight1, value1], [weight2, value2], ...]`.
|
|
45
|
+
* @returns The sum of the values as specified in the table `sides`.
|
|
46
|
+
*/
|
|
47
|
+
export function roll_custom_dice(num_dice: number, sides: Array<[number, number]>): number;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Create a marble bag of green (success) and red (fails) 'marbles'. This allows you to, for example, make an unlikely event more and more likely the more fails are accumulated.
|
|
51
|
+
* @param id A unique identifier for the marble bag.
|
|
52
|
+
* @param num_success The number of success marbles in the bag.
|
|
53
|
+
* @param num_fails The number of fails marbles in the bag.
|
|
54
|
+
* @param reset_on_success Whether or not the bag should reset when a successful result is drawn. If false or nil the bag will reset when all marbles have been drawn.
|
|
55
|
+
*/
|
|
56
|
+
export function bag_create(id: string | number | Hash, num_success: number, num_fails: number, reset_on_success: boolean): void;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Draw a marble from a previously created bag.
|
|
60
|
+
* @param id A unique identifier for the marble bag.
|
|
61
|
+
* @returns True or false
|
|
62
|
+
*/
|
|
63
|
+
export function bag_draw(id: string | number | Hash): boolean;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Manually reset a marble bag. Will also be called when a marble bag is empty, or a success is drawn in a bag where `reset_on_success` is true.
|
|
67
|
+
* @param id A unique identifier for the marble bag.
|
|
68
|
+
*/
|
|
69
|
+
export function bag_reset(id: string | number | Hash): void;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Create a rollable table. This is similar to a marble bag, except each entry can have a different weight, and can return any value (not just a boolean).
|
|
73
|
+
* @param id A unique identifier for the rollable table.
|
|
74
|
+
* @param rollable_table A table of weights, values and reset flags.
|
|
75
|
+
*/
|
|
76
|
+
export function table_create(id: string | number | Hash, rollable_table: Array<[number, any, boolean?]>): void;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Draw a random value from the rollable table created in `table_create`. The value will be removed from the table. If `reset_on_roll` is true, the table will reset. Otherwise, the table will reset when all values are drawn.
|
|
80
|
+
* @param id A unique identifier for the rollable table.
|
|
81
|
+
* @returns The value specified in `table_create`.
|
|
82
|
+
*/
|
|
83
|
+
export function table_roll(id: string | number | Hash): any;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Manually reset a rollable table. Will also be called when the rollable table is empty, or a drawn value where `reset_on_roll` is true.
|
|
87
|
+
* @param id A unique identifier for the rollable table.
|
|
88
|
+
*/
|
|
89
|
+
export function table_reset(id: string | number | Hash): void;
|
|
90
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cross-Context Defold Event System
|
|
5
|
+
* @see {@link https://github.com/Insality/defold-event|Github Source}
|
|
6
|
+
* @noResolution
|
|
7
|
+
*/
|
|
8
|
+
declare module 'event.event' {
|
|
9
|
+
interface LoggerInstance {
|
|
10
|
+
trace(this: any, message: string, data?: {}): void;
|
|
11
|
+
debug(this: any, message: string, data?: {}): void;
|
|
12
|
+
info(this: any, message: string, data?: {}): void;
|
|
13
|
+
warn(this: any, message: string, data?: {}): void;
|
|
14
|
+
error(this: any, message: string, data?: {}): void;
|
|
15
|
+
}
|
|
16
|
+
export function set_logger(logger: LoggerInstance): void;
|
|
17
|
+
/**
|
|
18
|
+
* Generate a new event instance. This instance can then be used to subscribe to and trigger events.
|
|
19
|
+
*/
|
|
20
|
+
export function create(
|
|
21
|
+
this: void,
|
|
22
|
+
callback: (this: any) => void,
|
|
23
|
+
callback_context?: any,
|
|
24
|
+
): EventInstance;
|
|
25
|
+
class EventInstance {
|
|
26
|
+
/**
|
|
27
|
+
* Subscribe a callback to the event. The callback will be invoked whenever the event is triggered.
|
|
28
|
+
*/
|
|
29
|
+
subscribe(callback: (this: any) => void, callback_context?: any): void;
|
|
30
|
+
/**
|
|
31
|
+
* Remove a previously subscribed callback from the event.
|
|
32
|
+
*/
|
|
33
|
+
unsubscribe(callback: (this: any) => void, callback_context?: any): void;
|
|
34
|
+
/**
|
|
35
|
+
* Determine if a specific callback is currently subscribed to the event.
|
|
36
|
+
*/
|
|
37
|
+
is_subscribed(
|
|
38
|
+
callback: (this: any) => void,
|
|
39
|
+
callback_context?: any,
|
|
40
|
+
): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Trigger the event, causing all subscribed callbacks to be executed.
|
|
43
|
+
*/
|
|
44
|
+
trigger(...args: any[]): void;
|
|
45
|
+
/**
|
|
46
|
+
* Check if the event has no subscribed callbacks.
|
|
47
|
+
*/
|
|
48
|
+
is_empty(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Remove all callbacks subscribed to the event, effectively resetting it.
|
|
51
|
+
*/
|
|
52
|
+
clear(): void;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This is a definition stub with incomplete or untested signatures.
|
|
5
|
+
* Contributions to improve the accuracy of these types are welcome.
|
|
6
|
+
* @see {@link https://github.com/britzl/gooey|Github Source}
|
|
7
|
+
* @noResolution
|
|
8
|
+
*/
|
|
9
|
+
declare module 'gooey.gooey' {
|
|
10
|
+
type table = {};
|
|
11
|
+
|
|
12
|
+
type ButtonState = {
|
|
13
|
+
node: Opaque<"node">;
|
|
14
|
+
node_id: Hash;
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
consumed: boolean;
|
|
17
|
+
clicked: boolean;
|
|
18
|
+
over: boolean;
|
|
19
|
+
over_now: boolean;
|
|
20
|
+
out_now: boolean;
|
|
21
|
+
pressed: boolean;
|
|
22
|
+
pressed_now: boolean;
|
|
23
|
+
long_pressed: boolean;
|
|
24
|
+
released_now: boolean;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
type CheckboxState = {
|
|
28
|
+
node: Opaque<"node">;
|
|
29
|
+
node_id: Hash;
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
consumed: boolean;
|
|
32
|
+
clicked: boolean;
|
|
33
|
+
over: boolean;
|
|
34
|
+
over_now: boolean;
|
|
35
|
+
out_now: boolean;
|
|
36
|
+
checked: boolean;
|
|
37
|
+
pressed: boolean;
|
|
38
|
+
pressed_now: boolean;
|
|
39
|
+
long_pressed: boolean;
|
|
40
|
+
released_now: boolean;
|
|
41
|
+
checked_now: boolean;
|
|
42
|
+
unchecked_now: boolean;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
type RadioState = {
|
|
46
|
+
node: Opaque<"node">;
|
|
47
|
+
node_id: Hash;
|
|
48
|
+
enabled: boolean;
|
|
49
|
+
consumed: boolean;
|
|
50
|
+
clicked: boolean;
|
|
51
|
+
over: boolean;
|
|
52
|
+
over_now: boolean;
|
|
53
|
+
out_now: boolean;
|
|
54
|
+
selected: boolean;
|
|
55
|
+
pressed: boolean;
|
|
56
|
+
pressed_now: boolean;
|
|
57
|
+
long_pressed: boolean;
|
|
58
|
+
released_now: boolean;
|
|
59
|
+
selected_now: boolean;
|
|
60
|
+
deselected_now: boolean;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
type ListState = {
|
|
64
|
+
id: string;
|
|
65
|
+
enabled: boolean;
|
|
66
|
+
consumed: boolean;
|
|
67
|
+
items: {
|
|
68
|
+
root: Opaque<"node">;
|
|
69
|
+
nodes: LuaMap<Hash, Opaque<"node">>;
|
|
70
|
+
data: unknown;
|
|
71
|
+
index: number;
|
|
72
|
+
}[];
|
|
73
|
+
over: boolean;
|
|
74
|
+
over_item: {
|
|
75
|
+
root: Opaque<"node">;
|
|
76
|
+
nodes: LuaMap<Hash, Opaque<"node">>;
|
|
77
|
+
data: unknown;
|
|
78
|
+
index: number;
|
|
79
|
+
};
|
|
80
|
+
over_item_now: {
|
|
81
|
+
root: Opaque<"node">;
|
|
82
|
+
nodes: LuaMap<Hash, Opaque<"node">>;
|
|
83
|
+
data: unknown;
|
|
84
|
+
index: number;
|
|
85
|
+
};
|
|
86
|
+
out_item_now: {
|
|
87
|
+
root: Opaque<"node">;
|
|
88
|
+
nodes: LuaMap<Hash, Opaque<"node">>;
|
|
89
|
+
data: unknown;
|
|
90
|
+
index: number;
|
|
91
|
+
};
|
|
92
|
+
selected_item: number | undefined;
|
|
93
|
+
pressed_item: number | undefined;
|
|
94
|
+
pressed_item_now: number | undefined;
|
|
95
|
+
long_pressed: boolean;
|
|
96
|
+
released_item_now: number | undefined;
|
|
97
|
+
scroll: Vector3;
|
|
98
|
+
is_horizontal: boolean;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
type ScrollbarState = {
|
|
102
|
+
enabled: boolean;
|
|
103
|
+
pressed: boolean;
|
|
104
|
+
pressed_now: boolean;
|
|
105
|
+
released_now: boolean;
|
|
106
|
+
over: boolean;
|
|
107
|
+
over_now: boolean;
|
|
108
|
+
out_now: boolean;
|
|
109
|
+
clicked: boolean;
|
|
110
|
+
scroll: Vector3;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
type InputState = {
|
|
114
|
+
node: Opaque<"node">;
|
|
115
|
+
node_id: Hash | string;
|
|
116
|
+
enabled: boolean;
|
|
117
|
+
consumed: boolean;
|
|
118
|
+
over: boolean;
|
|
119
|
+
over_now: boolean;
|
|
120
|
+
out_now: boolean;
|
|
121
|
+
selected: boolean;
|
|
122
|
+
pressed: boolean;
|
|
123
|
+
pressed_now: boolean;
|
|
124
|
+
long_pressed: boolean;
|
|
125
|
+
released_now: boolean;
|
|
126
|
+
selected_now: boolean;
|
|
127
|
+
deselected_now: boolean;
|
|
128
|
+
text: string;
|
|
129
|
+
marked_text: string;
|
|
130
|
+
keyboard_type: number;
|
|
131
|
+
masked_text: string;
|
|
132
|
+
masked_marked_text: string;
|
|
133
|
+
text_width: number;
|
|
134
|
+
marked_text_width: number;
|
|
135
|
+
total_width: number;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export function button(
|
|
139
|
+
node_id: Hash | string,
|
|
140
|
+
action_id: Hash,
|
|
141
|
+
action: table,
|
|
142
|
+
fn: (button: ButtonState) => void,
|
|
143
|
+
refresh_fn?: (button: ButtonState) => void,
|
|
144
|
+
): ButtonState;
|
|
145
|
+
|
|
146
|
+
export function checkbox(
|
|
147
|
+
node_id: Hash | string,
|
|
148
|
+
action_id: Hash,
|
|
149
|
+
action: table,
|
|
150
|
+
fn: (checkbox: CheckboxState) => void,
|
|
151
|
+
refresh_fn?: (checkbox: CheckboxState) => void,
|
|
152
|
+
): CheckboxState;
|
|
153
|
+
|
|
154
|
+
export function radio(
|
|
155
|
+
node_id: Hash | string,
|
|
156
|
+
group: string,
|
|
157
|
+
action_id: Hash,
|
|
158
|
+
action: table,
|
|
159
|
+
fn: (radio: RadioState) => void,
|
|
160
|
+
refresh_fn?: (radio: RadioState) => void,
|
|
161
|
+
): RadioState;
|
|
162
|
+
|
|
163
|
+
export function static_list(
|
|
164
|
+
list_id: string,
|
|
165
|
+
stencil_id: Hash | string,
|
|
166
|
+
item_ids: (Hash | string)[],
|
|
167
|
+
action_id: Hash,
|
|
168
|
+
action: table,
|
|
169
|
+
config: { horizontal?: boolean } | undefined,
|
|
170
|
+
fn: (list: ListState) => void,
|
|
171
|
+
refresh_fn?: (list: ListState) => void,
|
|
172
|
+
is_horizontal?: boolean,
|
|
173
|
+
): ListState;
|
|
174
|
+
|
|
175
|
+
export function dynamic_list(
|
|
176
|
+
list_id: string,
|
|
177
|
+
root_id: string,
|
|
178
|
+
stencil_id: Hash | string,
|
|
179
|
+
item_id: Hash | string,
|
|
180
|
+
data: table,
|
|
181
|
+
action_id: Hash,
|
|
182
|
+
action: table,
|
|
183
|
+
config: { horizontal?: boolean; carousel?: boolean } | undefined,
|
|
184
|
+
fn: (list: ListState) => void,
|
|
185
|
+
refresh_fn?: (list: ListState) => void,
|
|
186
|
+
is_horizontal?: boolean,
|
|
187
|
+
): ListState;
|
|
188
|
+
|
|
189
|
+
export function horizontal_dynamic_list(
|
|
190
|
+
list_id: string,
|
|
191
|
+
root_id: string,
|
|
192
|
+
stencil_id: Hash | string,
|
|
193
|
+
item_id: Hash | string,
|
|
194
|
+
data: table,
|
|
195
|
+
action_id: Hash,
|
|
196
|
+
action: table,
|
|
197
|
+
config: { carousel?: boolean } | undefined,
|
|
198
|
+
fn: (list: ListState) => void,
|
|
199
|
+
refresh_fn?: (list: ListState) => void,
|
|
200
|
+
): ListState;
|
|
201
|
+
|
|
202
|
+
export function vertical_dynamic_list(
|
|
203
|
+
list_id: string,
|
|
204
|
+
root_id: string,
|
|
205
|
+
stencil_id: Hash | string,
|
|
206
|
+
item_id: Hash | string,
|
|
207
|
+
data: table,
|
|
208
|
+
action_id: Hash,
|
|
209
|
+
action: table,
|
|
210
|
+
config: { carousel?: boolean } | undefined,
|
|
211
|
+
fn: (list: ListState) => void,
|
|
212
|
+
refresh_fn?: (list: ListState) => void,
|
|
213
|
+
): ListState;
|
|
214
|
+
|
|
215
|
+
export function horizontal_static_list(
|
|
216
|
+
list_id: string,
|
|
217
|
+
stencil_id: Hash | string,
|
|
218
|
+
item_ids: (Hash | string)[],
|
|
219
|
+
action_id: Hash,
|
|
220
|
+
action: table,
|
|
221
|
+
config: undefined,
|
|
222
|
+
fn: (list: ListState) => void,
|
|
223
|
+
refresh_fn?: (list: ListState) => void,
|
|
224
|
+
): ListState;
|
|
225
|
+
|
|
226
|
+
export function vertical_static_list(
|
|
227
|
+
list_id: string,
|
|
228
|
+
stencil_id: Hash | string,
|
|
229
|
+
item_ids: (Hash | string)[],
|
|
230
|
+
action_id: Hash,
|
|
231
|
+
action: table,
|
|
232
|
+
config: undefined,
|
|
233
|
+
fn: (list: ListState) => void,
|
|
234
|
+
refresh_fn?: (list: ListState) => void,
|
|
235
|
+
): ListState;
|
|
236
|
+
|
|
237
|
+
export function vertical_scrollbar(
|
|
238
|
+
handle_id: Hash | string,
|
|
239
|
+
bounds_id: Hash | string,
|
|
240
|
+
action_id: Hash,
|
|
241
|
+
action: table,
|
|
242
|
+
fn: (scrollbar: ScrollbarState) => void,
|
|
243
|
+
refresh_fn?: (scrollbar: ScrollbarState) => void,
|
|
244
|
+
): ScrollbarState;
|
|
245
|
+
|
|
246
|
+
export function input(
|
|
247
|
+
node_id: Hash | string,
|
|
248
|
+
keyboard_type: number,
|
|
249
|
+
action_id: Hash,
|
|
250
|
+
action: table,
|
|
251
|
+
config?: {
|
|
252
|
+
max_length?: number;
|
|
253
|
+
empty_text?: string;
|
|
254
|
+
allowed_characters?: string;
|
|
255
|
+
use_marked_text?: boolean;
|
|
256
|
+
},
|
|
257
|
+
refresh_fn?: (input: InputState) => void,
|
|
258
|
+
): InputState;
|
|
259
|
+
|
|
260
|
+
export function group(group_id: string, fn: () => void): table;
|
|
261
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** @noSelfInFile **/
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Runtime immutable Lua table implementation
|
|
5
|
+
* @see {@link https://github.com/paweljarosz/lua-immutable|Github Source}
|
|
6
|
+
* @noResolution
|
|
7
|
+
* @example `import * as IMMUTABLE from 'immutable.immutable'`
|
|
8
|
+
*/
|
|
9
|
+
declare module 'immutable.immutable' {
|
|
10
|
+
type table = object | any[] | LuaTable | LuaSet | LuaMap;
|
|
11
|
+
export function make<T extends table>(original_table: T): Readonly<T>;
|
|
12
|
+
export function is_immutable(table_to_check: table): boolean;
|
|
13
|
+
}
|