@ringozz/godot 4.7.2-583 → 4.7.2-592
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/README.md +19 -1
- package/gen/classes/ArrayOccluder3D.ts +1 -1
- package/gen/classes/CPUParticles2D.ts +3 -3
- package/gen/classes/CPUParticles3D.ts +3 -3
- package/gen/classes/CSGPolygon3D.ts +1 -1
- package/gen/classes/CollisionPolygon2D.ts +1 -1
- package/gen/classes/CollisionPolygon3D.ts +1 -1
- package/gen/classes/ColorPalette.ts +1 -1
- package/gen/classes/ConcavePolygonShape2D.ts +1 -1
- package/gen/classes/ConcavePolygonShape3D.ts +1 -1
- package/gen/classes/ConvexPolygonShape2D.ts +1 -1
- package/gen/classes/ConvexPolygonShape3D.ts +1 -1
- package/gen/classes/FontVariation.ts +1 -1
- package/gen/classes/Gradient.ts +1 -1
- package/gen/classes/Line2D.ts +1 -1
- package/gen/classes/MultiMesh.ts +4 -4
- package/gen/classes/NavigationMesh.ts +1 -1
- package/gen/classes/NavigationObstacle2D.ts +1 -1
- package/gen/classes/NavigationObstacle3D.ts +1 -1
- package/gen/classes/NavigationPathQueryResult2D.ts +1 -1
- package/gen/classes/NavigationPathQueryResult3D.ts +1 -1
- package/gen/classes/NavigationPolygon.ts +1 -1
- package/gen/classes/OccluderPolygon2D.ts +1 -1
- package/gen/classes/Polygon2D.ts +3 -3
- package/gen/classes/PolygonOccluder3D.ts +1 -1
- package/gen/classes/Window.ts +1 -1
- package/gen/index.ts +0 -3
- package/gen/utility-functions.ts +114 -114
- package/gen/value-types/AABB.ts +267 -277
- package/gen/value-types/Basis.ts +313 -264
- package/gen/value-types/Color.ts +398 -268
- package/gen/value-types/Plane.ts +121 -125
- package/gen/value-types/Projection.ts +178 -126
- package/gen/value-types/Quaternion.ts +180 -179
- package/gen/value-types/Rect2.ts +169 -171
- package/gen/value-types/Rect2i.ts +148 -150
- package/gen/value-types/Transform2D.ts +192 -194
- package/gen/value-types/Transform3D.ts +133 -126
- package/gen/value-types/Vector2.ts +370 -354
- package/gen/value-types/Vector2i.ts +192 -191
- package/gen/value-types/Vector3.ts +354 -354
- package/gen/value-types/Vector3i.ts +187 -192
- package/gen/value-types/Vector4.ts +263 -274
- package/gen/value-types/Vector4i.ts +187 -198
- package/gen/value-types/index.ts +16 -16
- package/package.json +20 -4
- package/src/debug.ts +30 -27
- package/src/index.ts +0 -2
- package/src/runtime.ts +16 -7
package/gen/value-types/Rect2.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Auto-generated from extension_api.json - DO NOT EDIT
|
|
2
2
|
// Generated by dev/codegen.ts
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { _V } from '../../src/runtime.ts';
|
|
5
5
|
import type { GodotArray, GodotDictionary, Variant } from '../heap-types/index.ts';
|
|
6
|
-
import type { Rect2i, Transform2D, Vector2 } from '
|
|
6
|
+
import type { Rect2i, Transform2D, Vector2 } from './index.ts';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The {@link Rect2} built-in {@link Variant} type represents an axis-aligned rectangle in a 2D space. It is defined by its {@link position} and {@link size}, which are {@link Vector2}. It is frequently used for fast overlap tests (see {@link intersects}). Although {@link Rect2} itself is axis-aligned, it can be combined with {@link Transform2D} to represent a rotated or skewed rectangle.
|
|
@@ -11,172 +11,170 @@ import type { Rect2i, Transform2D, Vector2 } from '../value-types/index.ts';
|
|
|
11
11
|
* **Note:** Negative values for {@link size} are not supported. With negative size, most {@link Rect2} methods do not work correctly. Use {@link abs} to get an equivalent {@link Rect2} with a non-negative size.
|
|
12
12
|
* **Note:** In a boolean context, a {@link Rect2} evaluates to `false` if both {@link position} and {@link size} are zero (equal to {@link Vector2.ZERO}). Otherwise, it always evaluates to `true`.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
static readonly name = _R(7, Rect2);
|
|
182
|
-
}
|
|
14
|
+
export type Rect2 = [x: number, y: number, w: number, h: number];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Returns the center point of the rectangle. This is the same as `position + (size / 2.0)`.
|
|
18
|
+
*/
|
|
19
|
+
export function getCenter(self: Rect2): Vector2 { return _V(7, 4121, self) as Vector2; }
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Returns the rectangle's area. This is equivalent to `size.x * size.y`. See also {@link hasArea}.
|
|
23
|
+
*/
|
|
24
|
+
export function getArea(self: Rect2): number { return _V(7, 3789, self) as number; }
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Returns `true` if this rectangle has positive width and height. See also {@link getArea}.
|
|
28
|
+
*/
|
|
29
|
+
export function hasArea(self: Rect2): boolean { return _V(7, 7358, self) as boolean; }
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Returns `true` if the rectangle contains the given `point`. By convention, points on the right and bottom edges are **not** included.
|
|
33
|
+
* **Note:** This method is not reliable for {@link Rect2} with a *negative* {@link size}. Use {@link abs} first to get a valid rectangle.
|
|
34
|
+
*/
|
|
35
|
+
export function hasPoint(self: Rect2, point: Vector2): boolean { return _V(7, 7430, self, point) as boolean; }
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Returns `true` if this rectangle and `rect` are approximately equal, by calling {@link Vector2.isEqualApprox} on the {@link position} and the {@link size}.
|
|
39
|
+
*/
|
|
40
|
+
export function isEqualApprox(self: Rect2, rect: Rect2): boolean { return _V(7, 7938, self, rect) as boolean; }
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Returns `true` if this rectangle's values are finite, by calling {@link Vector2.isFinite} on the {@link position} and the {@link size}.
|
|
44
|
+
*/
|
|
45
|
+
export function isFinite(self: Rect2): boolean { return _V(7, 7951, self) as boolean; }
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Returns `true` if this rectangle overlaps with the `b` rectangle. The edges of both rectangles are excluded, unless `includeBorders` is `true`.
|
|
49
|
+
*/
|
|
50
|
+
export function intersects(self: Rect2, b: Rect2, includeBorders?: boolean /* = false */): boolean { return _V(7, 7707, self, b, includeBorders) as boolean; }
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Returns `true` if this rectangle *completely* encloses the `b` rectangle.
|
|
54
|
+
*/
|
|
55
|
+
export function encloses(self: Rect2, b: Rect2): boolean { return _V(7, 3077, self, b) as boolean; }
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Returns the intersection between this rectangle and `b`. If the rectangles do not intersect, returns an empty {@link Rect2}.
|
|
59
|
+
*
|
|
60
|
+
*
|
|
61
|
+
* ```gdscript
|
|
62
|
+
*
|
|
63
|
+
* var rect1 = Rect2(0, 0, 5, 10)
|
|
64
|
+
* var rect2 = Rect2(2, 0, 8, 4)
|
|
65
|
+
*
|
|
66
|
+
* var a = rect1.intersection(rect2) # a is Rect2(2, 0, 3, 4)
|
|
67
|
+
*
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
*
|
|
71
|
+
*
|
|
72
|
+
* **Note:** If you only need to know whether two rectangles are overlapping, use {@link intersects}, instead.
|
|
73
|
+
*/
|
|
74
|
+
export function intersection(self: Rect2, b: Rect2): Rect2 { return _V(7, 7705, self, b) as Rect2; }
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Returns a {@link Rect2} that encloses both this rectangle and `b` around the edges. See also {@link encloses}.
|
|
78
|
+
*/
|
|
79
|
+
export function merge(self: Rect2, b: Rect2): Rect2 { return _V(7, 8850, self, b) as Rect2; }
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Returns a copy of this rectangle expanded to align the edges with the given `to` point, if necessary.
|
|
83
|
+
*
|
|
84
|
+
*
|
|
85
|
+
* ```gdscript
|
|
86
|
+
*
|
|
87
|
+
* var rect = Rect2(0, 0, 5, 2)
|
|
88
|
+
*
|
|
89
|
+
* rect = rect.expand(Vector2(10, 0)) # rect is Rect2(0, 0, 10, 2)
|
|
90
|
+
* rect = rect.expand(Vector2(-5, 5)) # rect is Rect2(-5, 0, 15, 5)
|
|
91
|
+
*
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export function expand(self: Rect2, to: Vector2): Rect2 { return _V(7, 3187, self, to) as Rect2; }
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Returns the vertex's position of this rect that's the farthest in the given direction. This point is commonly known as the support point in collision detection algorithms.
|
|
98
|
+
*/
|
|
99
|
+
export function getSupport(self: Rect2, direction: Vector2): Vector2 { return _V(7, 6612, self, direction) as Vector2; }
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Returns a copy of this rectangle extended on all sides by the given `amount`. A negative `amount` shrinks the rectangle instead. See also {@link growIndividual} and {@link growSide}.
|
|
103
|
+
*
|
|
104
|
+
*
|
|
105
|
+
* ```gdscript
|
|
106
|
+
*
|
|
107
|
+
* var a = Rect2(4, 4, 8, 8).grow(4) # a is Rect2(0, 0, 16, 16)
|
|
108
|
+
* var b = Rect2(0, 0, 8, 4).grow(2) # b is Rect2(-2, -2, 12, 8)
|
|
109
|
+
*
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export function grow(self: Rect2, amount: number): Rect2 { return _V(7, 7304, self, amount) as Rect2; }
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Returns a copy of this rectangle with its `side` extended by the given `amount` (see {@link Side} constants). A negative `amount` shrinks the rectangle, instead. See also {@link grow} and {@link growIndividual}.
|
|
116
|
+
*/
|
|
117
|
+
export function growSide(self: Rect2, side: number, amount: number): Rect2 { return _V(7, 7311, self, side, amount) as Rect2; }
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Returns a copy of this rectangle with its `left`, `top`, `right`, and `bottom` sides extended by the given amounts. Negative values shrink the sides, instead. See also {@link grow} and {@link growSide}.
|
|
121
|
+
*/
|
|
122
|
+
export function growIndividual(self: Rect2, left: number, top: number, right: number, bottom: number): Rect2 { return _V(7, 7309, self, left, top, right, bottom) as Rect2; }
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Returns a {@link Rect2} equivalent to this rectangle, with its width and height modified to be non-negative values, and with its {@link position} being the top-left corner of the rectangle.
|
|
126
|
+
*
|
|
127
|
+
*
|
|
128
|
+
* ```gdscript
|
|
129
|
+
*
|
|
130
|
+
* var rect = Rect2(25, 25, -100, -50)
|
|
131
|
+
* var absolute = rect.abs() # absolute is Rect2(-75, -25, 100, 50)
|
|
132
|
+
*
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
*
|
|
136
|
+
*
|
|
137
|
+
* **Note:** It's recommended to use this method when {@link size} is negative, as most other methods in Godot assume that the {@link position} is the top-left corner, and the {@link end} is the bottom-right corner.
|
|
138
|
+
*/
|
|
139
|
+
export function abs(self: Rect2): Rect2 { return _V(7, 1053, self) as Rect2; }
|
|
140
|
+
|
|
141
|
+
export function equals(a: Rect2, b: Variant | Rect2): boolean { return _V(7, -1, a, b) as boolean; }
|
|
142
|
+
|
|
143
|
+
export function notEquals(a: Rect2, b: Variant | Rect2): boolean { return _V(7, -2, a, b) as boolean; }
|
|
144
|
+
|
|
145
|
+
export function not(self: Rect2): boolean { return _V(7, -24, self, undefined) as boolean; }
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Inversely transforms (multiplies) the {@link Rect2} by the given {@link Transform2D} transformation matrix, under the assumption that the transformation basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not).
|
|
149
|
+
* `rect * transform` is equivalent to `transform.inverse() * rect`. See {@link Transform2D.inverse}.
|
|
150
|
+
* For transforming by inverse of an affine transformation (e.g. with scaling) `transform.affine_inverse() * rect` can be used instead. See {@link Transform2D.affineInverse}.
|
|
151
|
+
*/
|
|
152
|
+
export function mul(a: Rect2, b: Transform2D): Rect2 { return _V(7, -9, a, b) as Rect2; }
|
|
153
|
+
|
|
154
|
+
export function contains(a: Rect2, b: GodotDictionary | GodotArray): boolean { return _V(7, -25, a, b) as boolean; }
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Constructs a {@link Rect2} with its {@link position} and {@link size} set to {@link Vector2.ZERO}.
|
|
158
|
+
*/
|
|
159
|
+
export function create(): Rect2 { return _V(7, -4096, 0) as Rect2; }
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Constructs a {@link Rect2} as a copy of the given {@link Rect2}.
|
|
163
|
+
*/
|
|
164
|
+
export function fromRect2(from: Rect2): Rect2 { return _V(7, -4096, 1, from) as Rect2; }
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Constructs a {@link Rect2} from a {@link Rect2i}.
|
|
168
|
+
*/
|
|
169
|
+
export function fromRect2i(from: Rect2i): Rect2 { return _V(7, -4096, 2, from) as Rect2; }
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Constructs a {@link Rect2} by `position` and `size`.
|
|
173
|
+
*/
|
|
174
|
+
export function fromPositionSize(position: Vector2, size: Vector2): Rect2 { return _V(7, -4096, 3, position, size) as Rect2; }
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Constructs a {@link Rect2} by setting its {@link position} to (`x`, `y`), and its {@link size} to (`width`, `height`).
|
|
178
|
+
*/
|
|
179
|
+
export function fromXYWidthHeight(x: number, y: number, width: number, height: number): Rect2 { return _V(7, -4096, 4, x, y, width, height) as Rect2; }
|
|
180
|
+
|