sfml.js 1.0.0 → 1.2.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/README.ja.md +10 -9
- package/README.ko.md +10 -9
- package/README.md +10 -9
- package/README.zh-CN.md +10 -9
- package/binding.gyp +23 -16
- package/dist/audio/effect-processor.js +9 -3
- package/dist/audio/input-sound-file.js +41 -15
- package/dist/audio/listener.js +33 -11
- package/dist/audio/music.js +41 -18
- package/dist/audio/output-sound-file.js +4 -2
- package/dist/audio/playback-device.js +11 -3
- package/dist/audio/sound-buffer-recorder.js +8 -5
- package/dist/audio/sound-buffer.js +40 -17
- package/dist/audio/sound-file-factory.js +21 -9
- package/dist/audio/sound-file-reader.js +21 -7
- package/dist/audio/sound-recorder.js +36 -15
- package/dist/audio/sound-source.js +117 -40
- package/dist/audio/sound-stream.js +14 -5
- package/dist/audio/sound.js +9 -4
- package/dist/audio/value.js +42 -16
- package/dist/graphics/blend-mode.js +2 -1
- package/dist/graphics/boolean-vector.d.ts +1 -2
- package/dist/graphics/boolean-vector.js +19 -9
- package/dist/graphics/color.js +2 -1
- package/dist/graphics/convex-shape.js +7 -3
- package/dist/graphics/font.js +52 -23
- package/dist/graphics/glsl-matrix.js +8 -3
- package/dist/graphics/glsl.js +47 -16
- package/dist/graphics/glyph.js +27 -10
- package/dist/graphics/image.js +30 -14
- package/dist/graphics/rect.js +15 -8
- package/dist/graphics/render-states.js +18 -9
- package/dist/graphics/render-target.js +49 -23
- package/dist/graphics/render-texture.js +24 -12
- package/dist/graphics/render-window.js +6 -3
- package/dist/graphics/shader.js +67 -32
- package/dist/graphics/shape.js +25 -13
- package/dist/graphics/sprite.js +19 -9
- package/dist/graphics/stencil-mode.js +10 -6
- package/dist/graphics/swap.js +2 -1
- package/dist/graphics/text.js +123 -48
- package/dist/graphics/texture.js +48 -24
- package/dist/graphics/transform.js +29 -13
- package/dist/graphics/transformable.js +2 -1
- package/dist/graphics/vertex-array.js +40 -18
- package/dist/graphics/vertex-buffer.js +39 -19
- package/dist/graphics/vertex.js +6 -3
- package/dist/graphics/view.js +30 -14
- package/dist/index.d.ts +4 -4
- package/dist/internal/audio-codec-registry.js +12 -6
- package/dist/internal/audio-input-stream.js +2 -1
- package/dist/internal/audio-music-pump.js +58 -24
- package/dist/internal/audio-recorder-session.js +17 -7
- package/dist/internal/audio-worker-session.js +28 -10
- package/dist/internal/audio-worker.js +40 -21
- package/dist/internal/glsl-value.d.ts +3 -1
- package/dist/internal/glsl-value.js +18 -8
- package/dist/internal/graphics-state.js +29 -15
- package/dist/internal/input-stream.d.ts +3 -1
- package/dist/internal/input-stream.js +16 -7
- package/dist/internal/numeric-properties.js +2 -1
- package/dist/internal/render-states.js +2 -1
- package/dist/internal/scalar.js +22 -13
- package/dist/internal/shaped-glyph.d.ts +3 -1
- package/dist/internal/shaped-glyph.js +12 -4
- package/dist/internal/struct-view.d.ts +3 -1
- package/dist/internal/struct-view.js +3 -1
- package/dist/internal/transformable.js +2 -1
- package/dist/network/common.js +23 -11
- package/dist/network/dns.js +25 -17
- package/dist/network/ftp.js +43 -18
- package/dist/network/http.js +126 -56
- package/dist/network/ip-address.js +50 -25
- package/dist/network/packet.js +63 -25
- package/dist/network/sftp.js +175 -74
- package/dist/network/socket-selector.js +28 -14
- package/dist/network/socket.js +71 -30
- package/dist/network/tcp-listener.js +42 -19
- package/dist/network/tcp-socket.js +111 -53
- package/dist/network/tls-material.js +2 -1
- package/dist/network/udp-socket.js +68 -33
- package/dist/system/angle.js +2 -1
- package/dist/system/clock.js +4 -2
- package/dist/system/err.js +5 -2
- package/dist/system/file-input-stream.js +8 -4
- package/dist/system/input-stream.js +6 -3
- package/dist/system/operators.d.ts +1 -1
- package/dist/system/operators.js +90 -50
- package/dist/system/sleep.js +4 -2
- package/dist/system/time.js +12 -6
- package/dist/system/vector2.js +6 -7
- package/dist/system/vector3.js +11 -6
- package/dist/window/clipboard.js +2 -1
- package/dist/window/context.js +10 -5
- package/dist/window/cursor.js +2 -1
- package/dist/window/event.js +9 -5
- package/dist/window/mouse.js +4 -2
- package/dist/window/video-mode.js +2 -1
- package/dist/window/window.js +19 -12
- package/native/addon.cc +25 -12
- package/native/audio-binding.cc +266 -126
- package/native/audio-codec-binding.cc +147 -77
- package/native/audio-device-binding.cc +76 -49
- package/native/audio-file-binding.cc +116 -67
- package/native/audio-recorder-binding.cc +147 -98
- package/native/audio-recorder.h +1 -1
- package/native/audio-state.h +53 -30
- package/native/audio-stream-binding.cc +148 -94
- package/native/audio-stream.h +5 -4
- package/native/audio-worker-binding.cc +163 -81
- package/native/audio-worker.h +35 -19
- package/native/batch-drawable.cc +29 -16
- package/native/batch-drawable.h +11 -8
- package/native/context-binding.cc +40 -27
- package/native/context-settings.h +15 -8
- package/native/deferred-delete.cc +9 -6
- package/native/deferred-delete.h +7 -8
- package/native/error-stream-binding.cc +42 -28
- package/native/font-binding.cc +89 -48
- package/native/graphics-binding.cc +122 -72
- package/native/graphics-state.h +50 -36
- package/native/image-binding.cc +38 -24
- package/native/image-state.h +26 -18
- package/native/input-binding.cc +42 -27
- package/native/render-window-binding.cc +38 -23
- package/native/shader-binding.cc +115 -50
- package/native/shape-binding.cc +94 -49
- package/native/shape-state.h +18 -9
- package/native/shaped-glyph-storage.h +9 -5
- package/native/stream-binding.cc +143 -117
- package/native/system-binding.cc +17 -12
- package/native/text-binding.cc +68 -35
- package/native/text-state.h +25 -18
- package/native/texture-binding.cc +42 -33
- package/native/texture-resource.h +20 -12
- package/native/time-value.h +3 -1
- package/native/transformable-binding.cc +12 -6
- package/native/transformable-state.h +6 -6
- package/native/value-binding.h +46 -28
- package/native/value-layout.h +10 -10
- package/native/values-binding.cc +29 -23
- package/native/vertex-binding.cc +18 -12
- package/native/vertex-buffer-binding.cc +38 -24
- package/native/vertex-storage.h +2 -2
- package/native/view-data.h +4 -3
- package/native/window-binding.cc +75 -45
- package/native/window-event.h +20 -11
- package/native/window-owner.h +15 -12
- package/package.json +44 -51
- package/src/audio/effect-processor.ts +9 -3
- package/src/audio/input-sound-file.ts +108 -36
- package/src/audio/listener.ts +39 -13
- package/src/audio/music.ts +112 -47
- package/src/audio/output-sound-file.ts +40 -11
- package/src/audio/playback-device.ts +23 -8
- package/src/audio/sound-buffer-recorder.ts +35 -13
- package/src/audio/sound-buffer.ts +166 -58
- package/src/audio/sound-file-factory.ts +127 -49
- package/src/audio/sound-file-reader.ts +49 -15
- package/src/audio/sound-recorder.ts +100 -34
- package/src/audio/sound-source.ts +142 -45
- package/src/audio/sound-stream.ts +15 -5
- package/src/audio/sound.ts +12 -4
- package/src/audio/value.ts +89 -26
- package/src/graphics/blend-mode.ts +3 -1
- package/src/graphics/boolean-vector.ts +56 -26
- package/src/graphics/color.ts +3 -1
- package/src/graphics/convex-shape.ts +10 -3
- package/src/graphics/font.ts +171 -50
- package/src/graphics/glsl-matrix.ts +9 -3
- package/src/graphics/glsl.ts +81 -35
- package/src/graphics/glyph.ts +67 -26
- package/src/graphics/image.ts +119 -45
- package/src/graphics/rect.ts +56 -24
- package/src/graphics/render-states.ts +31 -14
- package/src/graphics/render-target.ts +197 -81
- package/src/graphics/render-texture.ts +36 -12
- package/src/graphics/render-window.ts +9 -3
- package/src/graphics/shader.ts +186 -61
- package/src/graphics/shape.ts +93 -35
- package/src/graphics/sprite.ts +64 -25
- package/src/graphics/stencil-mode.ts +12 -6
- package/src/graphics/swap.ts +3 -2
- package/src/graphics/text.ts +229 -74
- package/src/graphics/texture.ts +180 -61
- package/src/graphics/transform.ts +132 -47
- package/src/graphics/transformable.ts +3 -1
- package/src/graphics/vertex-array.ts +87 -35
- package/src/graphics/vertex-buffer.ts +97 -33
- package/src/graphics/vertex.ts +9 -3
- package/src/graphics/view.ts +59 -21
- package/src/index.ts +101 -23
- package/src/internal/audio-codec-registry.ts +18 -6
- package/src/internal/audio-input-stream.ts +6 -2
- package/src/internal/audio-music-pump.ts +116 -41
- package/src/internal/audio-native.ts +249 -96
- package/src/internal/audio-recorder-session.ts +68 -24
- package/src/internal/audio-worker-session.ts +65 -21
- package/src/internal/audio-worker.ts +85 -41
- package/src/internal/glsl-value.ts +26 -11
- package/src/internal/graphics-state.ts +57 -20
- package/src/internal/input-stream.ts +23 -10
- package/src/internal/native.ts +252 -99
- package/src/internal/numeric-properties.ts +2 -1
- package/src/internal/render-states.ts +3 -1
- package/src/internal/scalar.ts +33 -14
- package/src/internal/shaped-glyph.ts +25 -12
- package/src/internal/struct-view.ts +40 -13
- package/src/internal/transformable.ts +3 -1
- package/src/network/common.ts +35 -11
- package/src/network/dns.ts +95 -38
- package/src/network/ftp.ts +129 -47
- package/src/network/http.ts +232 -77
- package/src/network/ip-address.ts +118 -48
- package/src/network/packet.ts +161 -54
- package/src/network/sftp.ts +498 -168
- package/src/network/socket-selector.ts +66 -26
- package/src/network/socket.ts +133 -46
- package/src/network/tcp-listener.ts +78 -29
- package/src/network/tcp-socket.ts +240 -95
- package/src/network/tls-material.ts +6 -2
- package/src/network/udp-socket.ts +147 -53
- package/src/system/angle.ts +3 -1
- package/src/system/clock.ts +12 -4
- package/src/system/err.ts +5 -2
- package/src/system/file-input-stream.ts +12 -4
- package/src/system/input-stream.ts +9 -3
- package/src/system/operators.ts +290 -115
- package/src/system/sleep.ts +6 -2
- package/src/system/time.ts +18 -6
- package/src/system/timeout-with-predicate.ts +19 -8
- package/src/system/vector2.ts +101 -49
- package/src/system/vector3.ts +85 -36
- package/src/window/clipboard.ts +3 -1
- package/src/window/context.ts +15 -5
- package/src/window/cursor.ts +3 -1
- package/src/window/event.ts +26 -12
- package/src/window/mouse.ts +6 -2
- package/src/window/video-mode.ts +3 -1
- package/src/window/window.ts +119 -37
- package/test/native/audio-probes.cc +74 -36
- package/test/native/deferred-delete-probes.cc +17 -11
- package/test/native/drawable-probes.cc +70 -36
- package/test/native/exception-probes.cc +14 -9
- package/test/native/image-probes.cc +20 -10
- package/test/native/matrix-probes.cc +8 -4
- package/test/native/network-oracle.cc +17 -11
- package/test/native/render-texture-probes.cc +33 -24
- package/test/native/shader-probes.cc +9 -9
- package/test/native/shape-probes.cc +37 -23
- package/test/native/sprite-probes.cc +41 -25
- package/test/native/system-probes.cc +58 -35
- package/test/native/text-probes.cc +77 -44
- package/test/native/texture-probes.cc +43 -26
- package/test/native/time-probes.cc +18 -12
- package/test/native/transform-probes.cc +15 -10
- package/test/native/transformable-probes.cc +23 -17
- package/test/native/value-oracle.h +9 -4
- package/test/native/value-probes.cc +31 -23
- package/test/native/vertex-array-probes.cc +22 -14
- package/test/native/vertex-buffer-probes.cc +28 -17
- package/test/native/view-probes.cc +29 -17
- package/test/native/window-probes.cc +66 -33
- package/tools/ensure-sfml.cjs +9 -0
- package/tools/generate-network-constants.cjs +11 -6
- package/tools/generate-window-constants.cjs +31 -12
- package/docs/README.ja.md +0 -30
- package/docs/README.ko.md +0 -30
- package/docs/README.md +0 -30
- package/docs/README.zh-CN.md +0 -30
- package/docs/api.ja.md +0 -84
- package/docs/api.ko.md +0 -84
- package/docs/api.md +0 -81
- package/docs/api.zh-CN.md +0 -81
- package/docs/audio.ja.md +0 -249
- package/docs/audio.ko.md +0 -251
- package/docs/audio.md +0 -252
- package/docs/audio.zh-CN.md +0 -252
- package/docs/concepts.ja.md +0 -130
- package/docs/concepts.ko.md +0 -130
- package/docs/concepts.md +0 -131
- package/docs/concepts.zh-CN.md +0 -131
- package/docs/development.ja.md +0 -144
- package/docs/development.ko.md +0 -144
- package/docs/development.md +0 -146
- package/docs/development.zh-CN.md +0 -146
- package/docs/getting-started.ja.md +0 -154
- package/docs/getting-started.ko.md +0 -154
- package/docs/getting-started.md +0 -156
- package/docs/getting-started.zh-CN.md +0 -156
- package/docs/graphics.ja.md +0 -256
- package/docs/graphics.ko.md +0 -254
- package/docs/graphics.md +0 -255
- package/docs/graphics.zh-CN.md +0 -257
- package/docs/network.ja.md +0 -214
- package/docs/network.ko.md +0 -216
- package/docs/network.md +0 -218
- package/docs/network.zh-CN.md +0 -218
- package/docs/system.ja.md +0 -169
- package/docs/system.ko.md +0 -171
- package/docs/system.md +0 -173
- package/docs/system.zh-CN.md +0 -173
- package/docs/window.ja.md +0 -138
- package/docs/window.ko.md +0 -140
- package/docs/window.md +0 -141
- package/docs/window.zh-CN.md +0 -141
- package/native/exception-boundary.h +0 -97
- package/native/numeric-fields.h +0 -96
- package/native/shared-handle.h +0 -107
- package/test/tsconfig.json +0 -8
- package/tools/configure-lsp.cjs +0 -23
- package/tools/lib_downloader.cjs +0 -92
- package/tools/lib_downloader_urls.cjs +0 -23
package/src/internal/native.ts
CHANGED
|
@@ -101,14 +101,19 @@ export interface NativeContextMapping {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
export type NativeGlyphProcessor = (
|
|
104
|
-
glyph: NativeShapedGlyphs,
|
|
105
|
-
|
|
104
|
+
glyph: NativeShapedGlyphs,
|
|
105
|
+
style: number,
|
|
106
|
+
fill: number,
|
|
107
|
+
outline: number,
|
|
108
|
+
thickness: number,
|
|
106
109
|
) => Float64Array;
|
|
107
110
|
|
|
108
111
|
type ImageCallback<T> = (error: Error | null, result: T) => void;
|
|
109
112
|
|
|
110
113
|
export type NativeStreamDispatch = (
|
|
111
|
-
operation: number,
|
|
114
|
+
operation: number,
|
|
115
|
+
data: Uint8Array | undefined,
|
|
116
|
+
position: bigint,
|
|
112
117
|
complete: (error: string | null, result?: bigint) => void,
|
|
113
118
|
) => void;
|
|
114
119
|
|
|
@@ -122,13 +127,17 @@ interface NativeBinding {
|
|
|
122
127
|
setClipboardString(text: string): void;
|
|
123
128
|
isTouchDown(finger: number): boolean;
|
|
124
129
|
getTouchPosition(
|
|
125
|
-
finger: number,
|
|
130
|
+
finger: number,
|
|
131
|
+
window?: NativeGraphicsHandle<'window'>,
|
|
126
132
|
): [number, number];
|
|
127
133
|
createContext(
|
|
128
|
-
settings?: Readonly<ContextSettings>,
|
|
134
|
+
settings?: Readonly<ContextSettings>,
|
|
135
|
+
width?: number,
|
|
136
|
+
height?: number,
|
|
129
137
|
): NativeContextMapping;
|
|
130
138
|
setContextActive(
|
|
131
|
-
handle: NativeGraphicsHandle<'contextResource'>,
|
|
139
|
+
handle: NativeGraphicsHandle<'contextResource'>,
|
|
140
|
+
active: boolean,
|
|
132
141
|
): boolean;
|
|
133
142
|
getActiveContextKey(): bigint | undefined;
|
|
134
143
|
referenceActiveContext(): NativeContextMapping | undefined;
|
|
@@ -142,7 +151,11 @@ interface NativeBinding {
|
|
|
142
151
|
/** 复制 Vulkan 图形实例所需的扩展名称。 */
|
|
143
152
|
getVulkanGraphicsRequiredInstanceExtensions(): string[];
|
|
144
153
|
/** 以 UTF-16 索引查询字素、单词或句子边界。 */
|
|
145
|
-
isUnicodeBoundary(
|
|
154
|
+
isUnicodeBoundary(
|
|
155
|
+
text: string,
|
|
156
|
+
position: number,
|
|
157
|
+
kind: 0 | 1 | 2,
|
|
158
|
+
): boolean;
|
|
146
159
|
suspendAwareClockNow(): bigint;
|
|
147
160
|
createFont(
|
|
148
161
|
context: NativeGraphicsHandle<'context'>,
|
|
@@ -157,42 +170,68 @@ interface NativeBinding {
|
|
|
157
170
|
data: NativeGraphicsHandle<'fontData'>,
|
|
158
171
|
): NativeFontMapping;
|
|
159
172
|
getFontGlyph(
|
|
160
|
-
handle: NativeGraphicsHandle<'font'>,
|
|
161
|
-
|
|
173
|
+
handle: NativeGraphicsHandle<'font'>,
|
|
174
|
+
id: number,
|
|
175
|
+
size: number,
|
|
176
|
+
bold: boolean,
|
|
177
|
+
outline: number,
|
|
178
|
+
byId: boolean,
|
|
162
179
|
): NativeValueMapping<'glyph'>;
|
|
163
180
|
fontMetric(
|
|
164
|
-
handle: NativeGraphicsHandle<'font'>,
|
|
165
|
-
|
|
181
|
+
handle: NativeGraphicsHandle<'font'>,
|
|
182
|
+
metric: number,
|
|
183
|
+
value: number,
|
|
184
|
+
second?: number,
|
|
185
|
+
size?: number,
|
|
186
|
+
bold?: boolean,
|
|
166
187
|
): number | boolean;
|
|
167
|
-
setFontSmooth(
|
|
188
|
+
setFontSmooth(
|
|
189
|
+
handle: NativeGraphicsHandle<'font'>,
|
|
190
|
+
smooth: boolean,
|
|
191
|
+
): void;
|
|
168
192
|
getFontTexture(
|
|
169
|
-
handle: NativeGraphicsHandle<'font'>,
|
|
193
|
+
handle: NativeGraphicsHandle<'font'>,
|
|
194
|
+
size: number,
|
|
170
195
|
): NativeTextureMapping;
|
|
171
|
-
getTextureInfo(
|
|
196
|
+
getTextureInfo(
|
|
197
|
+
handle: NativeGraphicsHandle<'texture'>,
|
|
198
|
+
): NativeTextureInfo;
|
|
172
199
|
wrapGlyph(buffer: ArrayBuffer): NativeValueMapping<'glyph'>;
|
|
173
200
|
glyphMember(
|
|
174
|
-
handle: NativeValueHandle<'glyph'>,
|
|
201
|
+
handle: NativeValueHandle<'glyph'>,
|
|
202
|
+
index: 0 | 1,
|
|
175
203
|
): NativeValueMapping<'rect'>;
|
|
176
204
|
createText(
|
|
177
|
-
font: NativeGraphicsHandle<'font'>,
|
|
205
|
+
font: NativeGraphicsHandle<'font'>,
|
|
206
|
+
source?: NativeGraphicsHandle<'text'>,
|
|
178
207
|
): NativeTextMapping;
|
|
179
208
|
prepareText(
|
|
180
|
-
handle: NativeGraphicsHandle<'text'>,
|
|
181
|
-
|
|
209
|
+
handle: NativeGraphicsHandle<'text'>,
|
|
210
|
+
font: NativeGraphicsHandle<'font'>,
|
|
211
|
+
string: string,
|
|
212
|
+
callback: NativeGlyphProcessor | null,
|
|
182
213
|
): NativeTextLayout;
|
|
183
214
|
getTextGlyphs(handle: NativeGraphicsHandle<'text'>): NativeShapedGlyphs;
|
|
184
215
|
shapedGlyphMember(
|
|
185
|
-
handle: NativeGraphicsHandle<'shapedGlyphs'>,
|
|
216
|
+
handle: NativeGraphicsHandle<'shapedGlyphs'>,
|
|
217
|
+
index: number,
|
|
218
|
+
member: 0,
|
|
186
219
|
): NativeValueMapping<'glyph'>;
|
|
187
220
|
shapedGlyphMember(
|
|
188
|
-
handle: NativeGraphicsHandle<'shapedGlyphs'>,
|
|
221
|
+
handle: NativeGraphicsHandle<'shapedGlyphs'>,
|
|
222
|
+
index: number,
|
|
223
|
+
member: 1,
|
|
189
224
|
): NativeValueMapping<'vector2'>;
|
|
190
225
|
findTextCharacter(
|
|
191
|
-
handle: NativeGraphicsHandle<'text'>,
|
|
226
|
+
handle: NativeGraphicsHandle<'text'>,
|
|
227
|
+
index: number,
|
|
192
228
|
): [number, number];
|
|
193
229
|
createShape(
|
|
194
|
-
context: NativeGraphicsHandle<'context'>,
|
|
195
|
-
|
|
230
|
+
context: NativeGraphicsHandle<'context'>,
|
|
231
|
+
kind: 0 | 1 | 2 | 3,
|
|
232
|
+
x: number,
|
|
233
|
+
y: number,
|
|
234
|
+
source?: NativeGraphicsHandle<'shape'>,
|
|
196
235
|
): {
|
|
197
236
|
handle: NativeGraphicsHandle<'shape'>;
|
|
198
237
|
transformable: NativeGraphicsHandle<'transformable'>;
|
|
@@ -202,19 +241,25 @@ interface NativeBinding {
|
|
|
202
241
|
info: NativeStruct;
|
|
203
242
|
};
|
|
204
243
|
changeShapeGeometry(
|
|
205
|
-
handle: NativeGraphicsHandle<'shape'>,
|
|
206
|
-
|
|
244
|
+
handle: NativeGraphicsHandle<'shape'>,
|
|
245
|
+
operation: number,
|
|
246
|
+
x: number,
|
|
247
|
+
y?: number,
|
|
248
|
+
z?: number,
|
|
207
249
|
): void;
|
|
208
250
|
updateShapePoints(
|
|
209
|
-
handle: NativeGraphicsHandle<'shape'>,
|
|
251
|
+
handle: NativeGraphicsHandle<'shape'>,
|
|
252
|
+
points: Float32Array,
|
|
210
253
|
): void;
|
|
211
254
|
getShapePoint(
|
|
212
|
-
handle: NativeGraphicsHandle<'shape'>,
|
|
255
|
+
handle: NativeGraphicsHandle<'shape'>,
|
|
256
|
+
index: number,
|
|
213
257
|
): [number, number];
|
|
214
258
|
getShapeCenter(handle: NativeGraphicsHandle<'shape'>): [number, number];
|
|
215
259
|
setShapeTexture(
|
|
216
260
|
handle: NativeGraphicsHandle<'shape'>,
|
|
217
|
-
texture: NativeGraphicsHandle<'texture'> | null,
|
|
261
|
+
texture: NativeGraphicsHandle<'texture'> | null,
|
|
262
|
+
id: number,
|
|
218
263
|
): void;
|
|
219
264
|
shapeTextureRect(
|
|
220
265
|
handle: NativeGraphicsHandle<'shape'>,
|
|
@@ -226,17 +271,21 @@ interface NativeBinding {
|
|
|
226
271
|
};
|
|
227
272
|
submitRenderWindow(
|
|
228
273
|
handle: NativeGraphicsHandle<'renderWindow'>,
|
|
229
|
-
count: number,
|
|
274
|
+
count: number,
|
|
275
|
+
display: boolean,
|
|
230
276
|
): void;
|
|
231
277
|
allocateRenderWindowVertices(
|
|
232
|
-
handle: NativeGraphicsHandle<'renderWindow'>,
|
|
278
|
+
handle: NativeGraphicsHandle<'renderWindow'>,
|
|
279
|
+
capacity: number,
|
|
233
280
|
): ArrayBuffer;
|
|
234
281
|
setRenderWindowActive(
|
|
235
|
-
handle: NativeGraphicsHandle<'renderWindow'>,
|
|
282
|
+
handle: NativeGraphicsHandle<'renderWindow'>,
|
|
283
|
+
active: boolean,
|
|
236
284
|
): boolean;
|
|
237
285
|
isRenderWindowSrgb(handle: NativeGraphicsHandle<'renderWindow'>): boolean;
|
|
238
286
|
changeRenderWindowGLStates(
|
|
239
|
-
handle: NativeGraphicsHandle<'renderWindow'>,
|
|
287
|
+
handle: NativeGraphicsHandle<'renderWindow'>,
|
|
288
|
+
operation: 0 | 1 | 2,
|
|
240
289
|
): void;
|
|
241
290
|
isKeyPressed(code: number, scancode: boolean): boolean;
|
|
242
291
|
localizeKey(code: number): number;
|
|
@@ -248,7 +297,9 @@ interface NativeBinding {
|
|
|
248
297
|
window?: NativeGraphicsHandle<'window'>,
|
|
249
298
|
): [number, number];
|
|
250
299
|
setMousePosition(
|
|
251
|
-
x: number,
|
|
300
|
+
x: number,
|
|
301
|
+
y: number,
|
|
302
|
+
window?: NativeGraphicsHandle<'window'>,
|
|
252
303
|
): void;
|
|
253
304
|
isJoystickConnected(joystick: number): boolean;
|
|
254
305
|
getJoystickButtonCount(joystick: number): number;
|
|
@@ -266,26 +317,35 @@ interface NativeBinding {
|
|
|
266
317
|
buffer: ArrayBuffer;
|
|
267
318
|
};
|
|
268
319
|
compileShader(
|
|
269
|
-
memory: boolean,
|
|
270
|
-
|
|
320
|
+
memory: boolean,
|
|
321
|
+
sources: (string | null)[],
|
|
322
|
+
callback: ImageCallback<
|
|
323
|
+
NativeGraphicsHandle<'shaderProgram'> | undefined
|
|
324
|
+
>,
|
|
271
325
|
): void;
|
|
272
326
|
commitShader(
|
|
273
327
|
handle: NativeGraphicsHandle<'shader'>,
|
|
274
328
|
program: NativeGraphicsHandle<'shaderProgram'>,
|
|
275
329
|
): void;
|
|
276
330
|
setShaderUniform(
|
|
277
|
-
handle: NativeGraphicsHandle<'shader'>,
|
|
278
|
-
|
|
331
|
+
handle: NativeGraphicsHandle<'shader'>,
|
|
332
|
+
name: string,
|
|
333
|
+
type: number,
|
|
334
|
+
data: Float32Array | Int32Array,
|
|
335
|
+
array: boolean,
|
|
279
336
|
): void;
|
|
280
337
|
setShaderTexture(
|
|
281
|
-
handle: NativeGraphicsHandle<'shader'>,
|
|
338
|
+
handle: NativeGraphicsHandle<'shader'>,
|
|
339
|
+
name: string,
|
|
282
340
|
texture: NativeGraphicsHandle<'texture'> | null,
|
|
283
341
|
): number | undefined;
|
|
284
342
|
getShaderNativeHandle(handle: NativeGraphicsHandle<'shader'>): number;
|
|
285
343
|
bindShader(handle: NativeGraphicsHandle<'shader'> | null): void;
|
|
286
344
|
isShaderAvailable(geometry: boolean): boolean;
|
|
287
345
|
createVertexBuffer(
|
|
288
|
-
context: NativeGraphicsHandle<'context'>,
|
|
346
|
+
context: NativeGraphicsHandle<'context'>,
|
|
347
|
+
type: number,
|
|
348
|
+
usage: number,
|
|
289
349
|
source?: NativeGraphicsHandle<'vertexBuffer'>,
|
|
290
350
|
): {
|
|
291
351
|
handle: NativeGraphicsHandle<'vertexBuffer'>;
|
|
@@ -293,11 +353,14 @@ interface NativeBinding {
|
|
|
293
353
|
info: NativeStruct;
|
|
294
354
|
};
|
|
295
355
|
allocateVertexBuffer(
|
|
296
|
-
handle: NativeGraphicsHandle<'vertexBuffer'>,
|
|
356
|
+
handle: NativeGraphicsHandle<'vertexBuffer'>,
|
|
357
|
+
count: number,
|
|
297
358
|
): true | undefined;
|
|
298
359
|
updateVertexBuffer(
|
|
299
|
-
handle: NativeGraphicsHandle<'vertexBuffer'>,
|
|
300
|
-
|
|
360
|
+
handle: NativeGraphicsHandle<'vertexBuffer'>,
|
|
361
|
+
bytes: Uint8Array,
|
|
362
|
+
count: number,
|
|
363
|
+
offset: number,
|
|
301
364
|
): true | undefined;
|
|
302
365
|
copyVertexBuffer(
|
|
303
366
|
destination: NativeGraphicsHandle<'vertexBuffer'>,
|
|
@@ -312,22 +375,31 @@ interface NativeBinding {
|
|
|
312
375
|
source: NativeGraphicsHandle<'vertexBuffer'>,
|
|
313
376
|
): void;
|
|
314
377
|
setVertexBufferPrimitiveType(
|
|
315
|
-
handle: NativeGraphicsHandle<'vertexBuffer'>,
|
|
378
|
+
handle: NativeGraphicsHandle<'vertexBuffer'>,
|
|
379
|
+
type: number,
|
|
316
380
|
): void;
|
|
317
381
|
setVertexBufferUsage(
|
|
318
|
-
handle: NativeGraphicsHandle<'vertexBuffer'>,
|
|
382
|
+
handle: NativeGraphicsHandle<'vertexBuffer'>,
|
|
383
|
+
usage: number,
|
|
384
|
+
): void;
|
|
385
|
+
bindVertexBuffer(
|
|
386
|
+
handle: NativeGraphicsHandle<'vertexBuffer'> | null,
|
|
319
387
|
): void;
|
|
320
|
-
bindVertexBuffer(handle: NativeGraphicsHandle<'vertexBuffer'> | null): void;
|
|
321
388
|
isVertexBufferAvailable(): boolean;
|
|
322
389
|
createWindow(): NativeGraphicsHandle<'window'>;
|
|
323
390
|
openWindow(
|
|
324
391
|
handle: NativeGraphicsHandle<'window'>,
|
|
325
|
-
width: number,
|
|
326
|
-
|
|
392
|
+
width: number,
|
|
393
|
+
height: number,
|
|
394
|
+
title: string,
|
|
395
|
+
bitsPerPixel: number,
|
|
396
|
+
style: number,
|
|
397
|
+
state: number,
|
|
327
398
|
settings: Readonly<ContextSettings>,
|
|
328
399
|
): void;
|
|
329
400
|
openWindowHandle(
|
|
330
|
-
handle: NativeGraphicsHandle<'window'>,
|
|
401
|
+
handle: NativeGraphicsHandle<'window'>,
|
|
402
|
+
window: bigint,
|
|
331
403
|
settings: Readonly<ContextSettings>,
|
|
332
404
|
): void;
|
|
333
405
|
/** 按原生触发顺序取出并消费一个窗口生命周期通知。 */
|
|
@@ -335,10 +407,14 @@ interface NativeBinding {
|
|
|
335
407
|
handle: NativeGraphicsHandle<'window'>,
|
|
336
408
|
): 'create' | 'resize' | undefined;
|
|
337
409
|
windowCommand(
|
|
338
|
-
handle: NativeGraphicsHandle<'window'>,
|
|
339
|
-
|
|
410
|
+
handle: NativeGraphicsHandle<'window'>,
|
|
411
|
+
command: string,
|
|
412
|
+
value?: number | string | boolean,
|
|
413
|
+
second?: number,
|
|
340
414
|
): void;
|
|
341
|
-
getWindowPosition(
|
|
415
|
+
getWindowPosition(
|
|
416
|
+
handle: NativeGraphicsHandle<'window'>,
|
|
417
|
+
): [number, number];
|
|
342
418
|
getWindowNativeHandle(handle: NativeGraphicsHandle<'window'>): bigint;
|
|
343
419
|
getWindowSettings(handle: NativeGraphicsHandle<'window'>): ArrayBuffer;
|
|
344
420
|
hasWindowFocus(handle: NativeGraphicsHandle<'window'>): boolean;
|
|
@@ -346,31 +422,47 @@ interface NativeBinding {
|
|
|
346
422
|
handle: NativeGraphicsHandle<'window'>,
|
|
347
423
|
): NativeWindowEvent | undefined;
|
|
348
424
|
waitWindowEvent(
|
|
349
|
-
handle: NativeGraphicsHandle<'window'>,
|
|
425
|
+
handle: NativeGraphicsHandle<'window'>,
|
|
426
|
+
timeout: bigint,
|
|
350
427
|
): NativeWindowEvent | undefined;
|
|
351
428
|
setWindowIcon(
|
|
352
429
|
handle: NativeGraphicsHandle<'window'>,
|
|
353
|
-
width: number,
|
|
430
|
+
width: number,
|
|
431
|
+
height: number,
|
|
432
|
+
pixels: Uint8Array,
|
|
354
433
|
): void;
|
|
355
434
|
setWindowCursor(
|
|
356
435
|
handle: NativeGraphicsHandle<'window'>,
|
|
357
436
|
cursor: NativeGraphicsHandle<'cursor'>,
|
|
358
437
|
): void;
|
|
359
|
-
createSystemCursor(
|
|
438
|
+
createSystemCursor(
|
|
439
|
+
type: number,
|
|
440
|
+
): NativeGraphicsHandle<'cursor'> | undefined;
|
|
360
441
|
createPixelCursor(
|
|
361
|
-
pixels: Uint8Array,
|
|
442
|
+
pixels: Uint8Array,
|
|
443
|
+
width: number,
|
|
444
|
+
height: number,
|
|
445
|
+
x: number,
|
|
446
|
+
y: number,
|
|
362
447
|
): NativeGraphicsHandle<'cursor'> | undefined;
|
|
363
448
|
getDesktopVideoMode(): [number, number, number];
|
|
364
449
|
getFullscreenVideoModes(): [number, number, number][];
|
|
365
|
-
isVideoModeValid(
|
|
450
|
+
isVideoModeValid(
|
|
451
|
+
width: number,
|
|
452
|
+
height: number,
|
|
453
|
+
bitsPerPixel: number,
|
|
454
|
+
): boolean;
|
|
366
455
|
createWindowVulkanSurface(
|
|
367
|
-
handle: NativeGraphicsHandle<'window'>,
|
|
456
|
+
handle: NativeGraphicsHandle<'window'>,
|
|
457
|
+
instance: bigint,
|
|
458
|
+
allocator: bigint,
|
|
368
459
|
): bigint | undefined;
|
|
369
460
|
closeWindow(handle: NativeGraphicsHandle<'window'>): void;
|
|
370
461
|
isWindowOpen(handle: NativeGraphicsHandle<'window'>): boolean;
|
|
371
462
|
getWindowSize(handle: NativeGraphicsHandle<'window'>): [number, number];
|
|
372
463
|
setWindowActive(
|
|
373
|
-
handle: NativeGraphicsHandle<'window'>,
|
|
464
|
+
handle: NativeGraphicsHandle<'window'>,
|
|
465
|
+
active: boolean,
|
|
374
466
|
): boolean;
|
|
375
467
|
displayWindow(handle: NativeGraphicsHandle<'window'>): void;
|
|
376
468
|
createVertexStorage(capacity: number): {
|
|
@@ -378,44 +470,64 @@ interface NativeBinding {
|
|
|
378
470
|
buffer: ArrayBuffer;
|
|
379
471
|
};
|
|
380
472
|
vertexStorageMember(
|
|
381
|
-
handle: NativeGraphicsHandle<'vertices'>,
|
|
473
|
+
handle: NativeGraphicsHandle<'vertices'>,
|
|
474
|
+
index: number,
|
|
382
475
|
): NativeValueMapping<'vertex'>;
|
|
383
476
|
createImage(handle: NativeGraphicsHandle<'image'>): NativeImageResource;
|
|
384
477
|
createImage(
|
|
385
|
-
width: number,
|
|
478
|
+
width: number,
|
|
479
|
+
height: number,
|
|
480
|
+
pixels: number | Uint8Array,
|
|
386
481
|
): NativeImageResource;
|
|
387
482
|
resizeImage(
|
|
388
483
|
handle: NativeGraphicsHandle<'image'>,
|
|
389
|
-
width: number,
|
|
484
|
+
width: number,
|
|
485
|
+
height: number,
|
|
486
|
+
pixels: number | Uint8Array,
|
|
390
487
|
): NativeImageMapping;
|
|
391
488
|
maskImage(
|
|
392
|
-
handle: NativeGraphicsHandle<'image'>,
|
|
489
|
+
handle: NativeGraphicsHandle<'image'>,
|
|
490
|
+
color: number,
|
|
491
|
+
alpha: number,
|
|
492
|
+
): void;
|
|
493
|
+
flipImage(
|
|
494
|
+
handle: NativeGraphicsHandle<'image'>,
|
|
495
|
+
horizontal: boolean,
|
|
393
496
|
): void;
|
|
394
|
-
flipImage(handle: NativeGraphicsHandle<'image'>, horizontal: boolean): void;
|
|
395
497
|
copyImage(
|
|
396
498
|
destination: NativeGraphicsHandle<'image'>,
|
|
397
499
|
source: NativeGraphicsHandle<'image'>,
|
|
398
|
-
x: number,
|
|
399
|
-
|
|
500
|
+
x: number,
|
|
501
|
+
y: number,
|
|
502
|
+
left: number,
|
|
503
|
+
top: number,
|
|
504
|
+
width: number,
|
|
505
|
+
height: number,
|
|
506
|
+
alpha: boolean,
|
|
400
507
|
): boolean;
|
|
401
508
|
loadImageFile(
|
|
402
|
-
handle: NativeGraphicsHandle<'image'>,
|
|
509
|
+
handle: NativeGraphicsHandle<'image'>,
|
|
510
|
+
path: string,
|
|
403
511
|
callback: ImageCallback<NativeImageMapping | undefined>,
|
|
404
512
|
): void;
|
|
405
513
|
loadImageMemory(
|
|
406
|
-
handle: NativeGraphicsHandle<'image'>,
|
|
514
|
+
handle: NativeGraphicsHandle<'image'>,
|
|
515
|
+
bytes: Uint8Array,
|
|
407
516
|
callback: ImageCallback<NativeImageMapping | undefined>,
|
|
408
517
|
): void;
|
|
409
518
|
loadImageStream(
|
|
410
|
-
handle: NativeGraphicsHandle<'image'>,
|
|
519
|
+
handle: NativeGraphicsHandle<'image'>,
|
|
520
|
+
dispatch: NativeStreamDispatch,
|
|
411
521
|
callback: ImageCallback<NativeImageMapping | undefined>,
|
|
412
522
|
): void;
|
|
413
523
|
saveImageFile(
|
|
414
|
-
handle: NativeGraphicsHandle<'image'>,
|
|
524
|
+
handle: NativeGraphicsHandle<'image'>,
|
|
525
|
+
path: string,
|
|
415
526
|
callback: ImageCallback<boolean>,
|
|
416
527
|
): void;
|
|
417
528
|
saveImageMemory(
|
|
418
|
-
handle: NativeGraphicsHandle<'image'>,
|
|
529
|
+
handle: NativeGraphicsHandle<'image'>,
|
|
530
|
+
format: string,
|
|
419
531
|
callback: ImageCallback<Uint8Array | undefined>,
|
|
420
532
|
): void;
|
|
421
533
|
wrapMat3(buffer: ArrayBuffer): NativeValueMapping<'mat3'>;
|
|
@@ -425,49 +537,62 @@ interface NativeBinding {
|
|
|
425
537
|
wrapColor(buffer: ArrayBuffer): NativeValueMapping<'color'>;
|
|
426
538
|
wrapVertex(buffer: ArrayBuffer): NativeValueMapping<'vertex'>;
|
|
427
539
|
wrapRect(
|
|
428
|
-
type: 'i32' | 'f32',
|
|
540
|
+
type: 'i32' | 'f32',
|
|
541
|
+
buffer: ArrayBuffer,
|
|
429
542
|
): NativeValueMapping<'rect'>;
|
|
430
543
|
wrapVector3(
|
|
431
|
-
type: ScalarType | 'bool',
|
|
544
|
+
type: ScalarType | 'bool',
|
|
545
|
+
buffer: ArrayBuffer,
|
|
432
546
|
): NativeValueMapping<'vector3'>;
|
|
433
547
|
wrapVector4(
|
|
434
|
-
type: 'i32' | 'f32' | 'bool',
|
|
548
|
+
type: 'i32' | 'f32' | 'bool',
|
|
549
|
+
buffer: ArrayBuffer,
|
|
435
550
|
): NativeValueMapping<'vector4'>;
|
|
436
551
|
createVertex(): NativeValueMapping<'vertex'>;
|
|
437
552
|
vertexMember(
|
|
438
|
-
handle: NativeValueHandle<'vertex'>,
|
|
553
|
+
handle: NativeValueHandle<'vertex'>,
|
|
554
|
+
index: 0 | 2,
|
|
439
555
|
): NativeValueMapping<'vector2'>;
|
|
440
556
|
vertexMember(
|
|
441
|
-
handle: NativeValueHandle<'vertex'>,
|
|
557
|
+
handle: NativeValueHandle<'vertex'>,
|
|
558
|
+
index: 1,
|
|
442
559
|
): NativeValueMapping<'color'>;
|
|
443
560
|
createRect(type: 'i32' | 'f32'): NativeValueMapping<'rect'>;
|
|
444
561
|
rectMember(
|
|
445
|
-
handle: NativeValueHandle<'rect'>,
|
|
562
|
+
handle: NativeValueHandle<'rect'>,
|
|
563
|
+
index: 0 | 1,
|
|
446
564
|
): NativeValueMapping<'vector2'>;
|
|
447
565
|
createColor(): NativeValueMapping<'color'>;
|
|
448
566
|
createAngle(): NativeValueMapping<'angle'>;
|
|
449
567
|
createVector3(type: ScalarType): NativeValueMapping<'vector3'>;
|
|
450
568
|
createVector2(type: ScalarType): NativeValueMapping<'vector2'>;
|
|
451
569
|
wrapVector2(
|
|
452
|
-
type: ScalarType | 'bool',
|
|
570
|
+
type: ScalarType | 'bool',
|
|
571
|
+
buffer: ArrayBuffer,
|
|
453
572
|
): NativeValueMapping<'vector2'>;
|
|
454
573
|
createGraphicsContext(): NativeGraphicsHandle<'context'>;
|
|
455
574
|
createTransformable(): {
|
|
456
575
|
handle: NativeGraphicsHandle<'transformable'>;
|
|
457
576
|
buffer: ArrayBuffer;
|
|
458
577
|
};
|
|
459
|
-
createTexture(
|
|
578
|
+
createTexture(
|
|
579
|
+
context: NativeGraphicsHandle<'context'>,
|
|
580
|
+
): NativeTextureMapping;
|
|
460
581
|
createTexture(
|
|
461
582
|
context: NativeGraphicsHandle<'context'>,
|
|
462
583
|
source: NativeGraphicsHandle<'texture'>,
|
|
463
584
|
): NativeTextureMapping;
|
|
464
585
|
createTexture(
|
|
465
586
|
context: NativeGraphicsHandle<'context'>,
|
|
466
|
-
width: number,
|
|
587
|
+
width: number,
|
|
588
|
+
height: number,
|
|
589
|
+
sRgb: boolean,
|
|
467
590
|
): NativeTextureMapping;
|
|
468
591
|
resizeTexture(
|
|
469
592
|
handle: NativeGraphicsHandle<'texture'>,
|
|
470
|
-
width: number,
|
|
593
|
+
width: number,
|
|
594
|
+
height: number,
|
|
595
|
+
sRgb: boolean,
|
|
471
596
|
): true | undefined;
|
|
472
597
|
copyTextureToImage(
|
|
473
598
|
handle: NativeGraphicsHandle<'texture'>,
|
|
@@ -475,7 +600,8 @@ interface NativeBinding {
|
|
|
475
600
|
getMaximumTextureSize(): number;
|
|
476
601
|
getTextureNativeHandle(handle: NativeGraphicsHandle<'texture'>): number;
|
|
477
602
|
bindTexture(
|
|
478
|
-
handle: NativeGraphicsHandle<'texture'> | null,
|
|
603
|
+
handle: NativeGraphicsHandle<'texture'> | null,
|
|
604
|
+
coordinateType: number,
|
|
479
605
|
): void;
|
|
480
606
|
generateTextureMipmap(handle: NativeGraphicsHandle<'texture'>): boolean;
|
|
481
607
|
swapTextures(
|
|
@@ -488,30 +614,46 @@ interface NativeBinding {
|
|
|
488
614
|
): void;
|
|
489
615
|
loadTextureImage(
|
|
490
616
|
handle: NativeGraphicsHandle<'texture'>,
|
|
491
|
-
image: NativeGraphicsHandle<'image'>,
|
|
492
|
-
|
|
617
|
+
image: NativeGraphicsHandle<'image'>,
|
|
618
|
+
sRgb: boolean,
|
|
619
|
+
left: number,
|
|
620
|
+
top: number,
|
|
621
|
+
width: number,
|
|
622
|
+
height: number,
|
|
493
623
|
): true | undefined;
|
|
494
624
|
updateTexture(
|
|
495
|
-
handle: NativeGraphicsHandle<'texture'>,
|
|
496
|
-
|
|
625
|
+
handle: NativeGraphicsHandle<'texture'>,
|
|
626
|
+
pixels: Uint8Array,
|
|
627
|
+
width: number,
|
|
628
|
+
height: number,
|
|
629
|
+
x: number,
|
|
630
|
+
y: number,
|
|
497
631
|
): void;
|
|
498
632
|
updateTextureImage(
|
|
499
633
|
handle: NativeGraphicsHandle<'texture'>,
|
|
500
|
-
source: NativeGraphicsHandle<'image'>,
|
|
634
|
+
source: NativeGraphicsHandle<'image'>,
|
|
635
|
+
x: number,
|
|
636
|
+
y: number,
|
|
501
637
|
): void;
|
|
502
638
|
updateTextureTexture(
|
|
503
639
|
handle: NativeGraphicsHandle<'texture'>,
|
|
504
|
-
source: NativeGraphicsHandle<'texture'>,
|
|
640
|
+
source: NativeGraphicsHandle<'texture'>,
|
|
641
|
+
x: number,
|
|
642
|
+
y: number,
|
|
505
643
|
): void;
|
|
506
644
|
updateTextureWindow(
|
|
507
645
|
handle: NativeGraphicsHandle<'texture'>,
|
|
508
|
-
source: NativeGraphicsHandle<'window'>,
|
|
646
|
+
source: NativeGraphicsHandle<'window'>,
|
|
647
|
+
x: number,
|
|
648
|
+
y: number,
|
|
509
649
|
): void;
|
|
510
650
|
setTextureSmooth(
|
|
511
|
-
handle: NativeGraphicsHandle<'texture'>,
|
|
651
|
+
handle: NativeGraphicsHandle<'texture'>,
|
|
652
|
+
smooth: boolean,
|
|
512
653
|
): void;
|
|
513
654
|
setTextureRepeated(
|
|
514
|
-
handle: NativeGraphicsHandle<'texture'>,
|
|
655
|
+
handle: NativeGraphicsHandle<'texture'>,
|
|
656
|
+
repeated: boolean,
|
|
515
657
|
): void;
|
|
516
658
|
createSprite(
|
|
517
659
|
context: NativeGraphicsHandle<'context'>,
|
|
@@ -526,13 +668,16 @@ interface NativeBinding {
|
|
|
526
668
|
};
|
|
527
669
|
setSpriteTexture(
|
|
528
670
|
sprite: NativeGraphicsHandle<'sprite'>,
|
|
529
|
-
texture: NativeGraphicsHandle<'texture'>,
|
|
671
|
+
texture: NativeGraphicsHandle<'texture'>,
|
|
672
|
+
textureId: number,
|
|
530
673
|
): void;
|
|
531
674
|
spriteTextureRect(
|
|
532
675
|
sprite: NativeGraphicsHandle<'sprite'>,
|
|
533
676
|
): NativeValueMapping<'rect'>;
|
|
534
677
|
createRenderTexture(
|
|
535
|
-
context: NativeGraphicsHandle<'context'>,
|
|
678
|
+
context: NativeGraphicsHandle<'context'>,
|
|
679
|
+
width?: number,
|
|
680
|
+
height?: number,
|
|
536
681
|
settings?: Readonly<ContextSettings>,
|
|
537
682
|
): {
|
|
538
683
|
handle: NativeGraphicsHandle<'renderTexture'>;
|
|
@@ -541,34 +686,42 @@ interface NativeBinding {
|
|
|
541
686
|
targetInfo: NativeStruct;
|
|
542
687
|
};
|
|
543
688
|
resizeRenderTexture(
|
|
544
|
-
handle: NativeGraphicsHandle<'renderTexture'>,
|
|
689
|
+
handle: NativeGraphicsHandle<'renderTexture'>,
|
|
690
|
+
width: number,
|
|
691
|
+
height: number,
|
|
545
692
|
settings: Readonly<ContextSettings>,
|
|
546
693
|
): true | undefined;
|
|
547
694
|
getMaximumRenderTextureAntiAliasingLevel(): number;
|
|
548
695
|
setRenderTextureSmooth(
|
|
549
|
-
handle: NativeGraphicsHandle<'renderTexture'>,
|
|
696
|
+
handle: NativeGraphicsHandle<'renderTexture'>,
|
|
697
|
+
smooth: boolean,
|
|
550
698
|
): void;
|
|
551
699
|
setRenderTextureRepeated(
|
|
552
|
-
handle: NativeGraphicsHandle<'renderTexture'>,
|
|
700
|
+
handle: NativeGraphicsHandle<'renderTexture'>,
|
|
701
|
+
repeated: boolean,
|
|
553
702
|
): void;
|
|
554
703
|
generateRenderTextureMipmap(
|
|
555
704
|
handle: NativeGraphicsHandle<'renderTexture'>,
|
|
556
705
|
): boolean;
|
|
557
706
|
setRenderTextureActive(
|
|
558
|
-
handle: NativeGraphicsHandle<'renderTexture'>,
|
|
707
|
+
handle: NativeGraphicsHandle<'renderTexture'>,
|
|
708
|
+
active: boolean,
|
|
559
709
|
): boolean;
|
|
560
710
|
changeRenderTextureGLStates(
|
|
561
|
-
handle: NativeGraphicsHandle<'renderTexture'>,
|
|
711
|
+
handle: NativeGraphicsHandle<'renderTexture'>,
|
|
712
|
+
operation: 0 | 1 | 2,
|
|
562
713
|
): void;
|
|
563
714
|
submitRenderTexture(
|
|
564
715
|
handle: NativeGraphicsHandle<'renderTexture'>,
|
|
565
|
-
count: number,
|
|
716
|
+
count: number,
|
|
717
|
+
display: boolean,
|
|
566
718
|
): void;
|
|
567
719
|
getRenderTextureTexture(
|
|
568
720
|
handle: NativeGraphicsHandle<'renderTexture'>,
|
|
569
721
|
): NativeTextureMapping;
|
|
570
722
|
allocateRenderTextureVertices(
|
|
571
|
-
handle: NativeGraphicsHandle<'renderTexture'>,
|
|
723
|
+
handle: NativeGraphicsHandle<'renderTexture'>,
|
|
724
|
+
capacity: number,
|
|
572
725
|
): ArrayBuffer;
|
|
573
726
|
}
|
|
574
727
|
|
|
@@ -5,7 +5,8 @@ export function numericProperties(
|
|
|
5
5
|
target: object, defaults: Record<string, number | boolean>,
|
|
6
6
|
): void {
|
|
7
7
|
// Float64 preserves invalid numbers until the existing API validation point.
|
|
8
|
-
// In particular, Uint32 coercion must not turn NaN/fractions
|
|
8
|
+
// In particular, Uint32 coercion must not turn NaN/fractions
|
|
9
|
+
// into valid enums.
|
|
9
10
|
const entries = Object.entries(defaults);
|
|
10
11
|
const data = new Float64Array(entries.length);
|
|
11
12
|
// A writable data property keeps seal() distinct from freeze().
|
|
@@ -13,7 +13,9 @@ function enumeration(value: number, maximum: number): boolean {
|
|
|
13
13
|
/** Validate before a user callback or a leaf command reserves queue space. */
|
|
14
14
|
export function validateRenderStates(states: RenderStates): void {
|
|
15
15
|
// Default and its value members are frozen and known to be valid.
|
|
16
|
-
if (states === defaultRenderStates)
|
|
16
|
+
if (states === defaultRenderStates) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
17
19
|
const b = states.blendMode;
|
|
18
20
|
const s = states.stencilMode;
|
|
19
21
|
if (!(b instanceof BlendMode) || !(s instanceof StencilMode)) {
|