sfml.js 1.0.0-rc.2 → 1.1.0
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 +16 -11
- package/README.ko.md +16 -11
- package/README.md +16 -11
- package/README.zh-CN.md +16 -11
- package/assets/breakout.png +0 -0
- 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 +43 -50
- 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 -148
- package/docs/development.ko.md +0 -148
- package/docs/development.md +0 -150
- package/docs/development.zh-CN.md +0 -150
- 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 -69
- 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/dist/graphics/text.js
CHANGED
|
@@ -202,8 +202,9 @@ var TextOrientation;
|
|
|
202
202
|
TextOrientation[TextOrientation["BottomToTop"] = 2] = "BottomToTop";
|
|
203
203
|
})(TextOrientation = exports.TextOrientation || (exports.TextOrientation = {}));
|
|
204
204
|
function colorInteger(value) {
|
|
205
|
-
if (!(value instanceof color_1.Color))
|
|
205
|
+
if (!(value instanceof color_1.Color)) {
|
|
206
206
|
throw new TypeError('Expected a Color');
|
|
207
|
+
}
|
|
207
208
|
return value.toInteger();
|
|
208
209
|
}
|
|
209
210
|
class TextResource extends drawable_1.Drawable {
|
|
@@ -254,8 +255,9 @@ class TextResource extends drawable_1.Drawable {
|
|
|
254
255
|
}
|
|
255
256
|
else {
|
|
256
257
|
const init = options;
|
|
257
|
-
if (!init || !(init.font instanceof font_1.Font))
|
|
258
|
+
if (!init || !(init.font instanceof font_1.Font)) {
|
|
258
259
|
throw new TypeError('Expected Text options with a Font');
|
|
260
|
+
}
|
|
259
261
|
this.font = init.font;
|
|
260
262
|
}
|
|
261
263
|
const mapping = native_1.native.createText(this.font[graphics_state_1.graphicsNative], options instanceof TextResource ? options[graphics_state_1.graphicsNative] : undefined);
|
|
@@ -266,10 +268,12 @@ class TextResource extends drawable_1.Drawable {
|
|
|
266
268
|
this.geometry = new Uint8Array(mapping.geometry);
|
|
267
269
|
this.bounds = new Float32Array(mapping.bounds);
|
|
268
270
|
this[transformable_1.transformableState] = {
|
|
269
|
-
handle: mapping.transformable,
|
|
271
|
+
handle: mapping.transformable,
|
|
272
|
+
values: new Float32Array(mapping.transform),
|
|
270
273
|
};
|
|
271
274
|
if (options instanceof TextResource) {
|
|
272
|
-
if (!this.geometry[0] &&
|
|
275
|
+
if (!this.geometry[0] &&
|
|
276
|
+
options.revision === this.font[font_1.fontRevision]) {
|
|
273
277
|
this.vertices = new vertex_array_1.VertexArray(options.vertices);
|
|
274
278
|
this.outline = new vertex_array_1.VertexArray(options.outline);
|
|
275
279
|
this.revision = options.revision;
|
|
@@ -277,10 +281,12 @@ class TextResource extends drawable_1.Drawable {
|
|
|
277
281
|
}
|
|
278
282
|
else {
|
|
279
283
|
const init = options;
|
|
280
|
-
if (init.string !== undefined)
|
|
284
|
+
if (init.string !== undefined) {
|
|
281
285
|
this.setString(init.string);
|
|
282
|
-
|
|
286
|
+
}
|
|
287
|
+
if (init.characterSize !== undefined) {
|
|
283
288
|
this.setCharacterSize(init.characterSize);
|
|
289
|
+
}
|
|
284
290
|
}
|
|
285
291
|
}
|
|
286
292
|
/**
|
|
@@ -291,8 +297,9 @@ class TextResource extends drawable_1.Drawable {
|
|
|
291
297
|
*/
|
|
292
298
|
setString(value) {
|
|
293
299
|
this.checkIdle();
|
|
294
|
-
if (typeof value !== 'string')
|
|
300
|
+
if (typeof value !== 'string') {
|
|
295
301
|
throw new TypeError('Expected a string');
|
|
302
|
+
}
|
|
296
303
|
if (value !== this.string) {
|
|
297
304
|
this.string = value;
|
|
298
305
|
this.indices = undefined;
|
|
@@ -305,7 +312,9 @@ class TextResource extends drawable_1.Drawable {
|
|
|
305
312
|
* @ja 現在の JS 文字列を返します。
|
|
306
313
|
* @ko 현재 JS 문자열을 반환합니다.
|
|
307
314
|
*/
|
|
308
|
-
getString() {
|
|
315
|
+
getString() {
|
|
316
|
+
return this.string;
|
|
317
|
+
}
|
|
309
318
|
/**
|
|
310
319
|
* Sets the font and retains its reference.
|
|
311
320
|
* @zh 设置字体并保留其引用。
|
|
@@ -314,8 +323,9 @@ class TextResource extends drawable_1.Drawable {
|
|
|
314
323
|
*/
|
|
315
324
|
setFont(font) {
|
|
316
325
|
this.checkIdle();
|
|
317
|
-
if (!(font instanceof font_1.Font))
|
|
326
|
+
if (!(font instanceof font_1.Font)) {
|
|
318
327
|
throw new TypeError('Expected a Font');
|
|
328
|
+
}
|
|
319
329
|
if (font !== this.font) {
|
|
320
330
|
this.font = font;
|
|
321
331
|
this.geometry[0] = 1;
|
|
@@ -327,147 +337,189 @@ class TextResource extends drawable_1.Drawable {
|
|
|
327
337
|
* @ja 現在のフォントへの読み取り専用参照を返します。
|
|
328
338
|
* @ko 현재 글꼴의 읽기 전용 참조를 반환합니다.
|
|
329
339
|
*/
|
|
330
|
-
getFont() {
|
|
340
|
+
getFont() {
|
|
341
|
+
return this.font;
|
|
342
|
+
}
|
|
331
343
|
/**
|
|
332
344
|
* Sets the character size in pixels.
|
|
333
345
|
* @zh 设置像素字号。
|
|
334
346
|
* @ja 文字サイズをピクセル単位で設定します。
|
|
335
347
|
* @ko 글자 크기를 픽셀 단위로 설정합니다.
|
|
336
348
|
*/
|
|
337
|
-
setCharacterSize(size) {
|
|
349
|
+
setCharacterSize(size) {
|
|
350
|
+
this.set(0, (0, font_1.fontUnsigned)(size));
|
|
351
|
+
}
|
|
338
352
|
/**
|
|
339
353
|
* Returns the character size in pixels.
|
|
340
354
|
* @zh 返回像素字号。
|
|
341
355
|
* @ja 文字サイズをピクセル単位で返します。
|
|
342
356
|
* @ko 글자 크기를 픽셀 단위로 반환합니다.
|
|
343
357
|
*/
|
|
344
|
-
getCharacterSize() {
|
|
358
|
+
getCharacterSize() {
|
|
359
|
+
return this.words[0];
|
|
360
|
+
}
|
|
345
361
|
/**
|
|
346
362
|
* Sets the letter spacing factor; 1 is the default spacing.
|
|
347
363
|
* @zh 设置字间距倍率,1 为默认间距。
|
|
348
364
|
* @ja 文字間隔の倍率を設定します。1 は既定の間隔です。
|
|
349
365
|
* @ko 자간 배율을 설정합니다. 1은 기본 간격입니다.
|
|
350
366
|
*/
|
|
351
|
-
setLetterSpacing(factor) {
|
|
367
|
+
setLetterSpacing(factor) {
|
|
368
|
+
this.set(1, (0, font_1.textFloat)(factor));
|
|
369
|
+
}
|
|
352
370
|
/**
|
|
353
371
|
* Returns the letter spacing factor.
|
|
354
372
|
* @zh 返回字间距倍率。
|
|
355
373
|
* @ja 文字間隔の倍率を返します。
|
|
356
374
|
* @ko 자간 배율을 반환합니다.
|
|
357
375
|
*/
|
|
358
|
-
getLetterSpacing() {
|
|
376
|
+
getLetterSpacing() {
|
|
377
|
+
return this.floats[1];
|
|
378
|
+
}
|
|
359
379
|
/**
|
|
360
380
|
* Sets the line spacing factor; 1 is the font's default line spacing.
|
|
361
381
|
* @zh 设置行间距倍率,1 为字体默认行距。
|
|
362
382
|
* @ja 行間隔の倍率を設定します。1 はフォント既定の行間隔です。
|
|
363
383
|
* @ko 줄 간격 배율을 설정합니다. 1은 글꼴의 기본 줄 간격입니다.
|
|
364
384
|
*/
|
|
365
|
-
setLineSpacing(factor) {
|
|
385
|
+
setLineSpacing(factor) {
|
|
386
|
+
this.set(2, (0, font_1.textFloat)(factor));
|
|
387
|
+
}
|
|
366
388
|
/**
|
|
367
389
|
* Returns the line spacing factor.
|
|
368
390
|
* @zh 返回行间距倍率。
|
|
369
391
|
* @ja 行間隔の倍率を返します。
|
|
370
392
|
* @ko 줄 간격 배율을 반환합니다.
|
|
371
393
|
*/
|
|
372
|
-
getLineSpacing() {
|
|
394
|
+
getLineSpacing() {
|
|
395
|
+
return this.floats[2];
|
|
396
|
+
}
|
|
373
397
|
/**
|
|
374
398
|
* Sets TextStyle bit flags, combining styles such as bold and italic.
|
|
375
399
|
* @zh 设置 TextStyle 位标志,可组合粗体、斜体等样式。
|
|
376
400
|
* @ja TextStyle ビットフラグを設定します。太字や斜体などを組み合わせられます。
|
|
377
401
|
* @ko TextStyle 비트 플래그를 설정하며 굵게, 기울임꼴 등의 스타일을 조합할 수 있습니다.
|
|
378
402
|
*/
|
|
379
|
-
setStyle(style) {
|
|
403
|
+
setStyle(style) {
|
|
404
|
+
this.set(3, (0, font_1.fontUnsigned)(style, 15));
|
|
405
|
+
}
|
|
380
406
|
/**
|
|
381
407
|
* Returns the text style bit flags.
|
|
382
408
|
* @zh 返回文本样式位标志。
|
|
383
409
|
* @ja テキストスタイルのビットフラグを返します。
|
|
384
410
|
* @ko 텍스트 스타일 비트 플래그를 반환합니다.
|
|
385
411
|
*/
|
|
386
|
-
getStyle() {
|
|
412
|
+
getStyle() {
|
|
413
|
+
return this.words[3];
|
|
414
|
+
}
|
|
387
415
|
/**
|
|
388
416
|
* Copies the fill color; existing geometry is only recolored.
|
|
389
417
|
* @zh 复制填充颜色;已有几何仅重新着色。
|
|
390
418
|
* @ja 塗りつぶし色をコピーします。既存ジオメトリは色のみを更新します。
|
|
391
419
|
* @ko 채우기 색상을 복사합니다. 기존 기하 구조는 색상만 갱신합니다.
|
|
392
420
|
*/
|
|
393
|
-
setFillColor(color) {
|
|
421
|
+
setFillColor(color) {
|
|
422
|
+
this.setColor(4, colorInteger(color));
|
|
423
|
+
}
|
|
394
424
|
/**
|
|
395
425
|
* Returns a copy of the fill color.
|
|
396
426
|
* @zh 返回填充颜色副本。
|
|
397
427
|
* @ja 塗りつぶし色のコピーを返します。
|
|
398
428
|
* @ko 채우기 색상 복사본을 반환합니다.
|
|
399
429
|
*/
|
|
400
|
-
getFillColor() {
|
|
430
|
+
getFillColor() {
|
|
431
|
+
return new color_1.Color(this.colors.getUint32(16));
|
|
432
|
+
}
|
|
401
433
|
/**
|
|
402
434
|
* Copies the outline color; existing geometry is only recolored.
|
|
403
435
|
* @zh 复制轮廓颜色;已有几何仅重新着色。
|
|
404
436
|
* @ja 輪郭色をコピーします。既存ジオメトリは色のみを更新します。
|
|
405
437
|
* @ko 윤곽선 색상을 복사합니다. 기존 기하 구조는 색상만 갱신합니다.
|
|
406
438
|
*/
|
|
407
|
-
setOutlineColor(color) {
|
|
439
|
+
setOutlineColor(color) {
|
|
440
|
+
this.setColor(5, colorInteger(color));
|
|
441
|
+
}
|
|
408
442
|
/**
|
|
409
443
|
* Returns a copy of the outline color.
|
|
410
444
|
* @zh 返回轮廓颜色副本。
|
|
411
445
|
* @ja 輪郭色のコピーを返します。
|
|
412
446
|
* @ko 윤곽선 색상 복사본을 반환합니다.
|
|
413
447
|
*/
|
|
414
|
-
getOutlineColor() {
|
|
448
|
+
getOutlineColor() {
|
|
449
|
+
return new color_1.Color(this.colors.getUint32(20));
|
|
450
|
+
}
|
|
415
451
|
/**
|
|
416
452
|
* Sets the outline thickness in pixels.
|
|
417
453
|
* @zh 设置轮廓像素厚度。
|
|
418
454
|
* @ja 輪郭の太さをピクセル単位で設定します。
|
|
419
455
|
* @ko 윤곽선 두께를 픽셀 단위로 설정합니다.
|
|
420
456
|
*/
|
|
421
|
-
setOutlineThickness(thickness) {
|
|
457
|
+
setOutlineThickness(thickness) {
|
|
458
|
+
this.set(6, (0, font_1.textFloat)(thickness));
|
|
459
|
+
}
|
|
422
460
|
/**
|
|
423
461
|
* Returns the outline thickness in pixels.
|
|
424
462
|
* @zh 返回轮廓像素厚度。
|
|
425
463
|
* @ja 輪郭の太さをピクセル単位で返します。
|
|
426
464
|
* @ko 윤곽선 두께를 픽셀 단위로 반환합니다.
|
|
427
465
|
*/
|
|
428
|
-
getOutlineThickness() {
|
|
466
|
+
getOutlineThickness() {
|
|
467
|
+
return this.floats[6];
|
|
468
|
+
}
|
|
429
469
|
/**
|
|
430
470
|
* Sets the alignment of multiline text.
|
|
431
471
|
* @zh 设置多行文本的对齐方式。
|
|
432
472
|
* @ja 複数行テキストの配置を設定します。
|
|
433
473
|
* @ko 여러 줄 텍스트의 정렬을 설정합니다.
|
|
434
474
|
*/
|
|
435
|
-
setLineAlignment(alignment) {
|
|
475
|
+
setLineAlignment(alignment) {
|
|
476
|
+
this.set(7, (0, font_1.fontUnsigned)(alignment, 3));
|
|
477
|
+
}
|
|
436
478
|
/**
|
|
437
479
|
* Returns line alignment.
|
|
438
480
|
* @zh 返回行对齐方式。
|
|
439
481
|
* @ja 行の配置を返します。
|
|
440
482
|
* @ko 행 정렬을 반환합니다.
|
|
441
483
|
*/
|
|
442
|
-
getLineAlignment() {
|
|
484
|
+
getLineAlignment() {
|
|
485
|
+
return this.words[7];
|
|
486
|
+
}
|
|
443
487
|
/**
|
|
444
488
|
* Sets horizontal or vertical writing direction.
|
|
445
489
|
* @zh 设置横排或竖排方向。
|
|
446
490
|
* @ja 横書きまたは縦書きの方向を設定します。
|
|
447
491
|
* @ko 가로쓰기 또는 세로쓰기 방향을 설정합니다.
|
|
448
492
|
*/
|
|
449
|
-
setTextOrientation(orientation) {
|
|
493
|
+
setTextOrientation(orientation) {
|
|
494
|
+
this.set(8, (0, font_1.fontUnsigned)(orientation, 2));
|
|
495
|
+
}
|
|
450
496
|
/**
|
|
451
497
|
* Returns text writing direction.
|
|
452
498
|
* @zh 返回文本排版方向。
|
|
453
499
|
* @ja テキストの組版方向を返します。
|
|
454
500
|
* @ko 텍스트 쓰기 방향을 반환합니다.
|
|
455
501
|
*/
|
|
456
|
-
getTextOrientation() {
|
|
502
|
+
getTextOrientation() {
|
|
503
|
+
return this.words[8];
|
|
504
|
+
}
|
|
457
505
|
/**
|
|
458
506
|
* Sets the glyph cluster grouping strategy for shaping.
|
|
459
507
|
* @zh 设置整形时的字形簇分组策略。
|
|
460
508
|
* @ja シェーピング時のグリフクラスターのグループ化方針を設定します。
|
|
461
509
|
* @ko 셰이핑 시 글리프 클러스터 그룹화 방식을 설정합니다.
|
|
462
510
|
*/
|
|
463
|
-
setClusterGrouping(grouping) {
|
|
511
|
+
setClusterGrouping(grouping) {
|
|
512
|
+
this.set(9, (0, font_1.fontUnsigned)(grouping, 2));
|
|
513
|
+
}
|
|
464
514
|
/**
|
|
465
515
|
* Returns the glyph cluster grouping strategy.
|
|
466
516
|
* @zh 返回字形簇分组策略。
|
|
467
517
|
* @ja グリフクラスターのグループ化方針を返します。
|
|
468
518
|
* @ko 글리프 클러스터 그룹화 방식을 반환합니다.
|
|
469
519
|
*/
|
|
470
|
-
getClusterGrouping() {
|
|
520
|
+
getClusterGrouping() {
|
|
521
|
+
return this.words[9];
|
|
522
|
+
}
|
|
471
523
|
/**
|
|
472
524
|
* Sets a synchronous glyph appearance callback, or null to remove it; the
|
|
473
525
|
* callback runs when geometry is rebuilt.
|
|
@@ -506,7 +558,10 @@ class TextResource extends drawable_1.Drawable {
|
|
|
506
558
|
* @ja 変更可能な塗りつぶし頂点データを返します。次のジオメトリ再構築後は再取得が必要です。
|
|
507
559
|
* @ko 수정 가능한 채우기 꼭짓점 데이터를 반환합니다. 다음 기하 구조 재구성 후 다시 가져와야 합니다.
|
|
508
560
|
*/
|
|
509
|
-
getVertexData() {
|
|
561
|
+
getVertexData() {
|
|
562
|
+
this.prepare();
|
|
563
|
+
return this.vertices;
|
|
564
|
+
}
|
|
510
565
|
/**
|
|
511
566
|
* Returns mutable outline vertex data; retrieve it again after the next
|
|
512
567
|
* geometry rebuild.
|
|
@@ -514,7 +569,10 @@ class TextResource extends drawable_1.Drawable {
|
|
|
514
569
|
* @ja 変更可能な輪郭頂点データを返します。次のジオメトリ再構築後は再取得が必要です。
|
|
515
570
|
* @ko 수정 가능한 윤곽선 꼭짓점 데이터를 반환합니다. 다음 기하 구조 재구성 후 다시 가져와야 합니다.
|
|
516
571
|
*/
|
|
517
|
-
getOutlineVertexData() {
|
|
572
|
+
getOutlineVertexData() {
|
|
573
|
+
this.prepare();
|
|
574
|
+
return this.outline;
|
|
575
|
+
}
|
|
518
576
|
/**
|
|
519
577
|
* Returns the local axis-aligned bounds of the shaped text.
|
|
520
578
|
* @zh 返回整形后文本的局部轴对齐包围框。
|
|
@@ -539,8 +597,9 @@ class TextResource extends drawable_1.Drawable {
|
|
|
539
597
|
* @ko 전체 배치를 얻으려면 getShapedGlyphs()를 사용하세요.
|
|
540
598
|
*/
|
|
541
599
|
findCharacterPos(index) {
|
|
542
|
-
if (!Number.isSafeInteger(index) || index < 0)
|
|
600
|
+
if (!Number.isSafeInteger(index) || index < 0) {
|
|
543
601
|
throw new RangeError('Invalid character index');
|
|
602
|
+
}
|
|
544
603
|
this.prepare();
|
|
545
604
|
(0, graphics_state_1.flushGraphics)();
|
|
546
605
|
return this.getTransform().transformPoint(new vector2_1.Vector2f(...native_1.native.findTextCharacter(this[graphics_state_1.graphicsNative], index)));
|
|
@@ -559,10 +618,12 @@ class TextResource extends drawable_1.Drawable {
|
|
|
559
618
|
}
|
|
560
619
|
}
|
|
561
620
|
[(_a = value_storage_1.mutableValue, graphics_state_1.dispatchDrawable)](target, states) {
|
|
562
|
-
if (this.draw === TextResource.prototype.draw)
|
|
621
|
+
if (this.draw === TextResource.prototype.draw) {
|
|
563
622
|
this.draw(target, states);
|
|
564
|
-
|
|
623
|
+
}
|
|
624
|
+
else {
|
|
565
625
|
super[graphics_state_1.dispatchDrawable](target, states);
|
|
626
|
+
}
|
|
566
627
|
}
|
|
567
628
|
/**
|
|
568
629
|
* Writes Native parameter fields and marks geometry dirty only when the value
|
|
@@ -573,10 +634,10 @@ class TextResource extends drawable_1.Drawable {
|
|
|
573
634
|
*/
|
|
574
635
|
set(index, value) {
|
|
575
636
|
this.checkIdle();
|
|
576
|
-
const data = index === 1 || index === 2 || index === 6
|
|
577
|
-
|
|
578
|
-
if (data[index] === value)
|
|
637
|
+
const data = index === 1 || index === 2 || index === 6 ? this.floats : this.words;
|
|
638
|
+
if (data[index] === value) {
|
|
579
639
|
return;
|
|
640
|
+
}
|
|
580
641
|
data[index] = value;
|
|
581
642
|
this.geometry[0] = 1;
|
|
582
643
|
}
|
|
@@ -589,12 +650,14 @@ class TextResource extends drawable_1.Drawable {
|
|
|
589
650
|
*/
|
|
590
651
|
setColor(index, value) {
|
|
591
652
|
this.checkIdle();
|
|
592
|
-
if (this.colors.getUint32(index * 4) === value)
|
|
653
|
+
if (this.colors.getUint32(index * 4) === value) {
|
|
593
654
|
return;
|
|
655
|
+
}
|
|
594
656
|
this.colors.setUint32(index * 4, value);
|
|
595
657
|
// SFML recolors existing geometry without reshaping or running callbacks.
|
|
596
|
-
if (this.geometry[0] || !this.vertices)
|
|
658
|
+
if (this.geometry[0] || !this.vertices) {
|
|
597
659
|
return;
|
|
660
|
+
}
|
|
598
661
|
const vertices = index === 4 ? this.vertices : this.outline;
|
|
599
662
|
const bytes = vertices[graphics_state_1.vertexArrayBytes];
|
|
600
663
|
for (let offset = 8; offset < bytes.length; offset += 20) {
|
|
@@ -610,8 +673,9 @@ class TextResource extends drawable_1.Drawable {
|
|
|
610
673
|
* @ko 전처리기 콜백 안에서 실행되면 예외를 던집니다.
|
|
611
674
|
*/
|
|
612
675
|
checkIdle() {
|
|
613
|
-
if (this.preparing)
|
|
676
|
+
if (this.preparing) {
|
|
614
677
|
throw new error_1.SFMLError('Cannot update or query text geometry in its glyph pre-processor');
|
|
678
|
+
}
|
|
615
679
|
}
|
|
616
680
|
/**
|
|
617
681
|
* Lazily creates an index from UTF-16 to Unicode glyph ranges.
|
|
@@ -631,8 +695,9 @@ class TextResource extends drawable_1.Drawable {
|
|
|
631
695
|
*/
|
|
632
696
|
prepare() {
|
|
633
697
|
this.checkIdle();
|
|
634
|
-
if (!this.geometry[0] && this.revision === this.font[font_1.fontRevision])
|
|
698
|
+
if (!this.geometry[0] && this.revision === this.font[font_1.fontRevision]) {
|
|
635
699
|
return;
|
|
700
|
+
}
|
|
636
701
|
this.preparing = true;
|
|
637
702
|
try {
|
|
638
703
|
let callback = null;
|
|
@@ -644,16 +709,26 @@ class TextResource extends drawable_1.Drawable {
|
|
|
644
709
|
let outlineColor = new color_1.Color(outline);
|
|
645
710
|
const appearance = {
|
|
646
711
|
style,
|
|
647
|
-
get fillColor() {
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
set
|
|
712
|
+
get fillColor() {
|
|
713
|
+
return fillColor;
|
|
714
|
+
},
|
|
715
|
+
set fillColor(value) {
|
|
716
|
+
fillColor = new color_1.Color(value);
|
|
717
|
+
},
|
|
718
|
+
get outlineColor() {
|
|
719
|
+
return outlineColor;
|
|
720
|
+
},
|
|
721
|
+
set outlineColor(value) {
|
|
722
|
+
outlineColor = new color_1.Color(value);
|
|
723
|
+
},
|
|
651
724
|
outlineThickness: thickness,
|
|
652
725
|
};
|
|
653
726
|
processor(new shaped_glyph_1.ShapedGlyphView(new shaped_glyph_1.ShapedGlyphBuffer(glyph), 0, indices), appearance);
|
|
654
727
|
return new Float64Array([
|
|
655
|
-
(0, font_1.fontUnsigned)(appearance.style, 15),
|
|
656
|
-
colorInteger(appearance.
|
|
728
|
+
(0, font_1.fontUnsigned)(appearance.style, 15),
|
|
729
|
+
colorInteger(appearance.fillColor),
|
|
730
|
+
colorInteger(appearance.outlineColor),
|
|
731
|
+
(0, font_1.textFloat)(appearance.outlineThickness),
|
|
657
732
|
]);
|
|
658
733
|
};
|
|
659
734
|
}
|
package/dist/graphics/texture.js
CHANGED
|
@@ -16,14 +16,17 @@ function coordinates(value) {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
function flag(value) {
|
|
19
|
-
if (typeof value !== 'boolean')
|
|
19
|
+
if (typeof value !== 'boolean') {
|
|
20
20
|
throw new TypeError('Expected a boolean');
|
|
21
|
+
}
|
|
21
22
|
}
|
|
22
23
|
function areaSnapshot(area) {
|
|
23
|
-
if (area === undefined)
|
|
24
|
+
if (area === undefined) {
|
|
24
25
|
return undefined;
|
|
25
|
-
|
|
26
|
+
}
|
|
27
|
+
if (!(area instanceof rect_1.IntRect)) {
|
|
26
28
|
throw new TypeError('Expected an IntRect');
|
|
29
|
+
}
|
|
27
30
|
return new rect_1.IntRect(area);
|
|
28
31
|
}
|
|
29
32
|
/**
|
|
@@ -35,9 +38,11 @@ function areaSnapshot(area) {
|
|
|
35
38
|
class Texture {
|
|
36
39
|
constructor(source, sRgb = false, area) {
|
|
37
40
|
flag(sRgb);
|
|
38
|
-
if (source !== undefined &&
|
|
39
|
-
!(source instanceof
|
|
41
|
+
if (source !== undefined &&
|
|
42
|
+
!(source instanceof Texture) &&
|
|
43
|
+
!(source instanceof image_1.Image)) {
|
|
40
44
|
coordinates(source);
|
|
45
|
+
}
|
|
41
46
|
if (area !== undefined && !(area instanceof rect_1.IntRect)) {
|
|
42
47
|
throw new TypeError('Expected an IntRect');
|
|
43
48
|
}
|
|
@@ -56,7 +61,8 @@ class Texture {
|
|
|
56
61
|
this[graphics_state_1.graphicsNative] = mapping.handle;
|
|
57
62
|
this[graphics_state_1.textureId] = mapping.id;
|
|
58
63
|
this.state = (0, struct_view_1.nativeStruct)(mapping.info);
|
|
59
|
-
if (source instanceof image_1.Image &&
|
|
64
|
+
if (source instanceof image_1.Image &&
|
|
65
|
+
!this.loadFromImage(source, sRgb, area)) {
|
|
60
66
|
throw new error_1.SFMLError('SFML could not create the texture from the image');
|
|
61
67
|
}
|
|
62
68
|
}
|
|
@@ -145,11 +151,13 @@ class Texture {
|
|
|
145
151
|
*/
|
|
146
152
|
swap(other) {
|
|
147
153
|
this.checkWritable();
|
|
148
|
-
if (!(other instanceof Texture))
|
|
154
|
+
if (!(other instanceof Texture)) {
|
|
149
155
|
throw new TypeError('Expected a Texture');
|
|
156
|
+
}
|
|
150
157
|
other.checkWritable();
|
|
151
|
-
if (other === this)
|
|
158
|
+
if (other === this) {
|
|
152
159
|
return;
|
|
160
|
+
}
|
|
153
161
|
(0, graphics_state_1.flushGraphics)();
|
|
154
162
|
native_1.native.swapTextures(this[graphics_state_1.graphicsNative], other[graphics_state_1.graphicsNative]);
|
|
155
163
|
}
|
|
@@ -162,10 +170,12 @@ class Texture {
|
|
|
162
170
|
*/
|
|
163
171
|
assign(source) {
|
|
164
172
|
this.checkWritable();
|
|
165
|
-
if (!(source instanceof Texture))
|
|
173
|
+
if (!(source instanceof Texture)) {
|
|
166
174
|
throw new TypeError('Expected a Texture');
|
|
167
|
-
|
|
175
|
+
}
|
|
176
|
+
if (source === this) {
|
|
168
177
|
return this;
|
|
178
|
+
}
|
|
169
179
|
(0, graphics_state_1.flushGraphics)();
|
|
170
180
|
native_1.native.assignTexture(this[graphics_state_1.graphicsNative], source[graphics_state_1.graphicsNative]);
|
|
171
181
|
return this;
|
|
@@ -182,8 +192,9 @@ class Texture {
|
|
|
182
192
|
flag(sRgb);
|
|
183
193
|
const snapshot = areaSnapshot(area);
|
|
184
194
|
const image = new image_1.Image();
|
|
185
|
-
if (!await image.loadFromFile(filename))
|
|
195
|
+
if (!(await image.loadFromFile(filename))) {
|
|
186
196
|
return false;
|
|
197
|
+
}
|
|
187
198
|
return this.loadFromImage(image, sRgb, snapshot);
|
|
188
199
|
}
|
|
189
200
|
/**
|
|
@@ -198,8 +209,9 @@ class Texture {
|
|
|
198
209
|
flag(sRgb);
|
|
199
210
|
const snapshot = areaSnapshot(area);
|
|
200
211
|
const image = new image_1.Image();
|
|
201
|
-
if (!await image.loadFromMemory(data))
|
|
212
|
+
if (!(await image.loadFromMemory(data))) {
|
|
202
213
|
return false;
|
|
214
|
+
}
|
|
203
215
|
return this.loadFromImage(image, sRgb, snapshot);
|
|
204
216
|
}
|
|
205
217
|
/**
|
|
@@ -215,8 +227,9 @@ class Texture {
|
|
|
215
227
|
flag(sRgb);
|
|
216
228
|
const snapshot = areaSnapshot(area);
|
|
217
229
|
const image = new image_1.Image();
|
|
218
|
-
if (!await image.loadFromStream(stream))
|
|
230
|
+
if (!(await image.loadFromStream(stream))) {
|
|
219
231
|
return false;
|
|
232
|
+
}
|
|
220
233
|
return this.loadFromImage(image, sRgb, snapshot);
|
|
221
234
|
}
|
|
222
235
|
/**
|
|
@@ -228,8 +241,9 @@ class Texture {
|
|
|
228
241
|
*/
|
|
229
242
|
loadFromImage(image, sRgb = false, area) {
|
|
230
243
|
this.checkWritable();
|
|
231
|
-
if (!(image instanceof image_1.Image))
|
|
244
|
+
if (!(image instanceof image_1.Image)) {
|
|
232
245
|
throw new TypeError('Expected an Image');
|
|
246
|
+
}
|
|
233
247
|
flag(sRgb);
|
|
234
248
|
if (area !== undefined && !(area instanceof rect_1.IntRect)) {
|
|
235
249
|
throw new TypeError('Expected an IntRect');
|
|
@@ -240,10 +254,12 @@ class Texture {
|
|
|
240
254
|
}
|
|
241
255
|
update(source, sizeOrDest, dest) {
|
|
242
256
|
this.checkWritable();
|
|
243
|
-
if (sizeOrDest !== undefined)
|
|
257
|
+
if (sizeOrDest !== undefined) {
|
|
244
258
|
coordinates(sizeOrDest);
|
|
245
|
-
|
|
259
|
+
}
|
|
260
|
+
if (dest !== undefined) {
|
|
246
261
|
coordinates(dest);
|
|
262
|
+
}
|
|
247
263
|
if (source instanceof Uint8Array) {
|
|
248
264
|
if ((sizeOrDest === undefined) !== (dest === undefined)) {
|
|
249
265
|
throw new TypeError('Pixel region requires both size and destination');
|
|
@@ -260,15 +276,17 @@ class Texture {
|
|
|
260
276
|
native_1.native.updateTexture(this[graphics_state_1.graphicsNative], source, width, height, x, y);
|
|
261
277
|
return;
|
|
262
278
|
}
|
|
263
|
-
if (!(source instanceof image_1.Image) &&
|
|
279
|
+
if (!(source instanceof image_1.Image) &&
|
|
280
|
+
!(source instanceof Texture) &&
|
|
264
281
|
!(source instanceof window_1.Window)) {
|
|
265
282
|
throw new TypeError('Expected RGBA Uint8Array, Image, Texture or Window');
|
|
266
283
|
}
|
|
267
284
|
if (dest !== undefined) {
|
|
268
285
|
throw new TypeError('Image, Texture or Window update only accepts a destination');
|
|
269
286
|
}
|
|
270
|
-
if (source instanceof window_1.Window && !source.isOpen())
|
|
287
|
+
if (source instanceof window_1.Window && !source.isOpen()) {
|
|
271
288
|
return;
|
|
289
|
+
}
|
|
272
290
|
const size = source.getSize();
|
|
273
291
|
const x = sizeOrDest?.x ?? 0;
|
|
274
292
|
const y = sizeOrDest?.y ?? 0;
|
|
@@ -293,8 +311,9 @@ class Texture {
|
|
|
293
311
|
setSmooth(smooth) {
|
|
294
312
|
this.checkWritable();
|
|
295
313
|
flag(smooth);
|
|
296
|
-
if (smooth === this.state.smooth)
|
|
314
|
+
if (smooth === this.state.smooth) {
|
|
297
315
|
return;
|
|
316
|
+
}
|
|
298
317
|
(0, graphics_state_1.flushGraphics)();
|
|
299
318
|
native_1.native.setTextureSmooth(this[graphics_state_1.graphicsNative], smooth);
|
|
300
319
|
}
|
|
@@ -317,8 +336,9 @@ class Texture {
|
|
|
317
336
|
setRepeated(repeated) {
|
|
318
337
|
this.checkWritable();
|
|
319
338
|
flag(repeated);
|
|
320
|
-
if (repeated === this.state.repeated)
|
|
339
|
+
if (repeated === this.state.repeated) {
|
|
321
340
|
return;
|
|
341
|
+
}
|
|
322
342
|
(0, graphics_state_1.flushGraphics)();
|
|
323
343
|
native_1.native.setTextureRepeated(this[graphics_state_1.graphicsNative], repeated);
|
|
324
344
|
}
|
|
@@ -347,10 +367,12 @@ class Texture {
|
|
|
347
367
|
* @ko 텍스처가 읽기 전용으로 빌린 뷰이면 쓰기를 거부합니다.
|
|
348
368
|
*/
|
|
349
369
|
checkWritable() {
|
|
350
|
-
if (this[graphics_state_1.textureOwner])
|
|
370
|
+
if (this[graphics_state_1.textureOwner]) {
|
|
351
371
|
throw new TypeError('Cannot modify a RenderTexture texture view');
|
|
352
|
-
|
|
372
|
+
}
|
|
373
|
+
if (this.resourceOwner) {
|
|
353
374
|
throw new TypeError('Cannot modify a Font texture view');
|
|
375
|
+
}
|
|
354
376
|
}
|
|
355
377
|
/**
|
|
356
378
|
* Validates that the update region lies within the texture.
|
|
@@ -359,8 +381,10 @@ class Texture {
|
|
|
359
381
|
* @ko 갱신 영역이 텍스처 범위 안에 있는지 검증합니다.
|
|
360
382
|
*/
|
|
361
383
|
checkRegion(width, height, x, y) {
|
|
362
|
-
if (x > this.state.width ||
|
|
363
|
-
|
|
384
|
+
if (x > this.state.width ||
|
|
385
|
+
y > this.state.height ||
|
|
386
|
+
width > this.state.width - x ||
|
|
387
|
+
height > this.state.height - y) {
|
|
364
388
|
throw new RangeError('Update region is outside the texture');
|
|
365
389
|
}
|
|
366
390
|
}
|