sfml.js 1.2.1 → 1.3.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/dist/audio/effect-processor.d.ts +1 -0
- package/dist/audio/input-sound-file.d.ts +1 -0
- package/dist/audio/output-sound-file.d.ts +1 -0
- package/dist/audio/output-sound-file.js +1 -0
- package/dist/audio/sound-buffer-recorder.d.ts +2 -0
- package/dist/audio/sound-buffer-recorder.js +2 -0
- package/dist/audio/sound-buffer.d.ts +5 -1
- package/dist/audio/sound-file-reader.d.ts +4 -1
- package/dist/audio/sound-file-reader.js +0 -9
- package/dist/audio/sound-recorder.d.ts +4 -0
- package/dist/audio/sound-recorder.js +3 -0
- package/dist/audio/sound-source.d.ts +2 -0
- package/dist/audio/sound-source.js +1 -0
- package/dist/graphics/blend-mode.d.ts +1 -0
- package/dist/graphics/boolean-vector.d.ts +6 -0
- package/dist/graphics/boolean-vector.js +2 -0
- package/dist/graphics/color.d.ts +1 -0
- package/dist/graphics/color.js +1 -0
- package/dist/graphics/font.d.ts +6 -1
- package/dist/graphics/font.js +1 -0
- package/dist/graphics/glsl.d.ts +4 -0
- package/dist/graphics/glyph.d.ts +1 -0
- package/dist/graphics/glyph.js +1 -0
- package/dist/graphics/image.d.ts +1 -0
- package/dist/graphics/rect.d.ts +4 -0
- package/dist/graphics/rect.js +3 -0
- package/dist/graphics/render-target.d.ts +2 -0
- package/dist/graphics/render-target.js +2 -0
- package/dist/graphics/render-texture.d.ts +1 -0
- package/dist/graphics/render-window.d.ts +1 -0
- package/dist/graphics/shader.d.ts +11 -5
- package/dist/graphics/shader.js +1 -0
- package/dist/graphics/shape.d.ts +12 -7
- package/dist/graphics/shape.js +0 -6
- package/dist/graphics/sprite.d.ts +5 -3
- package/dist/graphics/text.d.ts +32 -13
- package/dist/graphics/text.js +4 -0
- package/dist/graphics/texture.d.ts +7 -1
- package/dist/graphics/transform.d.ts +3 -0
- package/dist/graphics/transform.js +1 -0
- package/dist/graphics/vertex-buffer.d.ts +2 -0
- package/dist/graphics/vertex.d.ts +1 -0
- package/dist/graphics/vertex.js +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -3
- package/dist/internal/glsl-value.d.ts +3 -0
- package/dist/internal/glsl-value.js +3 -0
- package/dist/internal/scalar.d.ts +12 -6
- package/dist/internal/transformable.d.ts +4 -0
- package/dist/internal/value-storage.d.ts +85 -1
- package/dist/internal/value-storage.js +4 -0
- package/dist/network/common.d.ts +1 -0
- package/dist/network/http.d.ts +1 -0
- package/dist/network/http.js +1 -0
- package/dist/network/sftp.d.ts +3 -2
- package/dist/system/angle.d.ts +1 -0
- package/dist/system/angle.js +1 -0
- package/dist/system/operators.d.ts +8 -0
- package/dist/system/vector2.d.ts +6 -3
- package/dist/system/vector2.js +2 -0
- package/dist/system/vector3.d.ts +5 -3
- package/dist/system/vector3.js +2 -0
- package/dist/window/context.d.ts +1 -0
- package/dist/window/cursor.d.ts +1 -0
- package/dist/window/event.d.ts +1 -0
- package/dist/window/event.js +3 -1
- package/dist/window/window.d.ts +1 -0
- package/native/vertex-buffer-binding.cc +4 -4
- package/native/window-binding.cc +8 -2
- package/package.json +2 -2
- package/src/audio/effect-processor.ts +1 -0
- package/src/audio/input-sound-file.ts +1 -0
- package/src/audio/output-sound-file.ts +1 -0
- package/src/audio/sound-buffer-recorder.ts +2 -0
- package/src/audio/sound-buffer.ts +5 -2
- package/src/audio/sound-file-reader.ts +8 -0
- package/src/audio/sound-recorder.ts +4 -0
- package/src/audio/sound-source.ts +2 -0
- package/src/graphics/blend-mode.ts +1 -0
- package/src/graphics/boolean-vector.ts +6 -0
- package/src/graphics/color.ts +1 -0
- package/src/graphics/font.ts +6 -3
- package/src/graphics/glsl.ts +4 -0
- package/src/graphics/glyph.ts +1 -0
- package/src/graphics/image.ts +1 -0
- package/src/graphics/rect.ts +4 -0
- package/src/graphics/render-target.ts +2 -0
- package/src/graphics/render-texture.ts +1 -0
- package/src/graphics/render-window.ts +1 -0
- package/src/graphics/shader.ts +22 -6
- package/src/graphics/shape.ts +13 -6
- package/src/graphics/sprite.ts +5 -3
- package/src/graphics/text.ts +37 -13
- package/src/graphics/texture.ts +8 -3
- package/src/graphics/transform.ts +3 -0
- package/src/graphics/vertex-buffer.ts +2 -0
- package/src/graphics/vertex.ts +1 -0
- package/src/index.ts +4 -0
- package/src/internal/glsl-value.ts +3 -0
- package/src/internal/scalar.ts +14 -4
- package/src/internal/transformable.ts +4 -0
- package/src/internal/value-storage.ts +93 -3
- package/src/network/common.ts +1 -0
- package/src/network/http.ts +1 -0
- package/src/network/sftp.ts +2 -2
- package/src/system/angle.ts +1 -0
- package/src/system/operators.ts +8 -0
- package/src/system/vector2.ts +8 -1
- package/src/system/vector3.ts +9 -1
- package/src/window/context.ts +1 -0
- package/src/window/cursor.ts +1 -0
- package/src/window/event.ts +4 -1
- package/src/window/window.ts +1 -0
package/src/graphics/shader.ts
CHANGED
|
@@ -47,6 +47,7 @@ export enum ShaderType {
|
|
|
47
47
|
Fragment,
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/** Accepted scalar, vector, matrix and texture uniform values. @inline */
|
|
50
51
|
type Uniform =
|
|
51
52
|
| number
|
|
52
53
|
| boolean
|
|
@@ -63,6 +64,7 @@ type Uniform =
|
|
|
63
64
|
| R<Glsl.Mat4>
|
|
64
65
|
| ReadonlyTexture
|
|
65
66
|
| typeof Shader.CurrentTexture;
|
|
67
|
+
/** Accepted element types for uniform arrays. @inline */
|
|
66
68
|
type ArrayElement =
|
|
67
69
|
| number
|
|
68
70
|
| R<Glsl.Vec2>
|
|
@@ -81,11 +83,13 @@ type Sources<T> = [T, ShaderType] | [T, T] | [T, T, T];
|
|
|
81
83
|
export type ReadonlyShader = Readonly<
|
|
82
84
|
Pick<
|
|
83
85
|
Shader,
|
|
84
|
-
| typeof graphicsNative
|
|
85
|
-
| typeof shaderId
|
|
86
|
-
| typeof shaderTextures
|
|
87
86
|
| 'getNativeHandle'
|
|
88
87
|
>
|
|
88
|
+
> & ShaderIdentity;
|
|
89
|
+
|
|
90
|
+
/** Native identity and texture retention for const references. @inline */
|
|
91
|
+
type ShaderIdentity = Pick<
|
|
92
|
+
Shader, typeof graphicsNative | typeof shaderId | typeof shaderTextures
|
|
89
93
|
>;
|
|
90
94
|
|
|
91
95
|
function nameString(name: string): void {
|
|
@@ -164,7 +168,9 @@ export class Shader {
|
|
|
164
168
|
static readonly CurrentTexture: unique symbol = Symbol(
|
|
165
169
|
'Shader.CurrentTexture',
|
|
166
170
|
);
|
|
171
|
+
/** Native program capability. @internal */
|
|
167
172
|
readonly [graphicsNative]: NativeGraphicsHandle<'shader'>;
|
|
173
|
+
/** Recorded shader identifier. @internal */
|
|
168
174
|
readonly [shaderId]: number;
|
|
169
175
|
/**
|
|
170
176
|
* Read-only Uint32 wrapper for the OpenGL program identifier.
|
|
@@ -194,6 +200,7 @@ export class Shader {
|
|
|
194
200
|
this.program = new Uint32Array(mapping.buffer);
|
|
195
201
|
}
|
|
196
202
|
|
|
203
|
+
/** Texture references retained for recorded draws. @internal */
|
|
197
204
|
get [shaderTextures](): ReadonlyMap<number, ReadonlyTexture> {
|
|
198
205
|
return this.textures;
|
|
199
206
|
}
|
|
@@ -205,7 +212,10 @@ export class Shader {
|
|
|
205
212
|
* @ja ファイルを非同期にコンパイルします。引数はファイルとステージ、頂点/フラグメントファイル、または頂点/ジオメトリ/フラグメントファイルです。
|
|
206
213
|
* @ko 파일을 비동기로 컴파일합니다. 인수는 파일과 단계, 꼭짓점/프래그먼트 파일 또는 꼭짓점/기하/프래그먼트 파일입니다.
|
|
207
214
|
*/
|
|
208
|
-
loadFromFile(
|
|
215
|
+
loadFromFile(
|
|
216
|
+
...sources: [string, ShaderType] | [string, string]
|
|
217
|
+
| [string, string, string]
|
|
218
|
+
): Promise<boolean> {
|
|
209
219
|
return this.load(false, sources);
|
|
210
220
|
}
|
|
211
221
|
|
|
@@ -216,7 +226,10 @@ export class Shader {
|
|
|
216
226
|
* @ja GLSL ソースを非同期にコンパイルします。引数順は loadFromFile と同じです。コンパイルとリンクが成功したかを返します。
|
|
217
227
|
* @ko GLSL 소스를 비동기로 컴파일합니다. 인수 순서는 loadFromFile과 같으며 컴파일 및 링크 성공 여부를 반환합니다.
|
|
218
228
|
*/
|
|
219
|
-
loadFromMemory(
|
|
229
|
+
loadFromMemory(
|
|
230
|
+
...sources: [string, ShaderType] | [string, string]
|
|
231
|
+
| [string, string, string]
|
|
232
|
+
): Promise<boolean> {
|
|
220
233
|
return this.load(true, sources);
|
|
221
234
|
}
|
|
222
235
|
|
|
@@ -227,7 +240,10 @@ export class Shader {
|
|
|
227
240
|
* @ja 入力ストリームから UTF-8 GLSL を読み、非同期にコンパイルします。ステージ順は loadFromFile と同じです。
|
|
228
241
|
* @ko 입력 스트림에서 UTF-8 GLSL을 읽고 비동기로 컴파일합니다. 단계 순서는 loadFromFile과 같습니다.
|
|
229
242
|
*/
|
|
230
|
-
async loadFromStream(
|
|
243
|
+
async loadFromStream(
|
|
244
|
+
...sources: [InputStream, ShaderType] | [InputStream, InputStream]
|
|
245
|
+
| [InputStream, InputStream, InputStream]
|
|
246
|
+
): Promise<boolean> {
|
|
231
247
|
const stages = this.stages(sources);
|
|
232
248
|
const code: (string | null)[] = [ null, null, null ];
|
|
233
249
|
for (let i = 0; i < 3; i++) {
|
package/src/graphics/shape.ts
CHANGED
|
@@ -71,9 +71,12 @@ export function shapeVector(value: R<Vector2f>): [number, number] {
|
|
|
71
71
|
|
|
72
72
|
class ShapeResource extends Drawable {
|
|
73
73
|
readonly [mutableValue] = true;
|
|
74
|
+
/** Native shape capability. @internal */
|
|
74
75
|
readonly [graphicsNative]: NativeGraphicsHandle<'shape'>;
|
|
76
|
+
/** Shared appearance and retained texture state. @internal */
|
|
75
77
|
readonly [shapeState]: ShapeData;
|
|
76
78
|
readonly [transformableState]: TransformableState;
|
|
79
|
+
/** Cached native geometry metadata. @internal */
|
|
77
80
|
protected readonly shapeInfo: Readonly<NativeShapeInfo>;
|
|
78
81
|
/**
|
|
79
82
|
* Lazy IntRect view cache for textureRect.
|
|
@@ -114,7 +117,7 @@ class ShapeResource extends Drawable {
|
|
|
114
117
|
* @ko 텍스처 참조를 설정하고 유지합니다. null은 텍스처를 비활성화하며 resetRect가 true이면 전체 텍스처를 사용합니다.
|
|
115
118
|
*/
|
|
116
119
|
setTexture(
|
|
117
|
-
this:
|
|
120
|
+
this: Shape,
|
|
118
121
|
texture: ReadonlyTexture | null,
|
|
119
122
|
resetRect = false,
|
|
120
123
|
): void {
|
|
@@ -160,7 +163,7 @@ class ShapeResource extends Drawable {
|
|
|
160
163
|
* @ja 使用するテクスチャのピクセル領域をコピーします。負のサイズでテクスチャを反転できます。
|
|
161
164
|
* @ko 사용할 텍스처 픽셀 영역을 복사합니다. 음수 크기로 텍스처를 반전할 수 있습니다.
|
|
162
165
|
*/
|
|
163
|
-
setTextureRect(this:
|
|
166
|
+
setTextureRect(this: Shape, rectangle: R<IntRect>): void {
|
|
164
167
|
if (!(rectangle instanceof IntRect)) {
|
|
165
168
|
throw new TypeError('Expected an IntRect');
|
|
166
169
|
}
|
|
@@ -191,7 +194,7 @@ class ShapeResource extends Drawable {
|
|
|
191
194
|
* @ja 塗りつぶし色を設定します。描画時にテクスチャ色と乗算されます。
|
|
192
195
|
* @ko 채우기 색상을 설정합니다. 그릴 때 텍스처 색상과 곱해집니다.
|
|
193
196
|
*/
|
|
194
|
-
setFillColor(this:
|
|
197
|
+
setFillColor(this: Shape, color: R<Color>): void {
|
|
195
198
|
if (!(color instanceof Color)) {
|
|
196
199
|
throw new TypeError('Expected a Color');
|
|
197
200
|
}
|
|
@@ -214,7 +217,7 @@ class ShapeResource extends Drawable {
|
|
|
214
217
|
* @ja 輪郭色をコピーします。
|
|
215
218
|
* @ko 윤곽선 색상을 복사합니다.
|
|
216
219
|
*/
|
|
217
|
-
setOutlineColor(this:
|
|
220
|
+
setOutlineColor(this: Shape, color: R<Color>): void {
|
|
218
221
|
if (!(color instanceof Color)) {
|
|
219
222
|
throw new TypeError('Expected a Color');
|
|
220
223
|
}
|
|
@@ -238,7 +241,7 @@ class ShapeResource extends Drawable {
|
|
|
238
241
|
* @ja ローカル座標で輪郭の太さを設定します。正の値は外側へ、負の値は内側へ広がります。
|
|
239
242
|
* @ko 로컬 좌표계의 윤곽선 두께를 설정합니다. 양수는 바깥쪽으로, 음수는 안쪽으로 확장합니다.
|
|
240
243
|
*/
|
|
241
|
-
setOutlineThickness(this:
|
|
244
|
+
setOutlineThickness(this: Shape, thickness: number): void {
|
|
242
245
|
this.changeGeometry(0, shapeNumber(thickness));
|
|
243
246
|
}
|
|
244
247
|
|
|
@@ -259,7 +262,7 @@ class ShapeResource extends Drawable {
|
|
|
259
262
|
* @ja 輪郭のマイター延伸と太さの最大比率を設定します。1 以上である必要があります。
|
|
260
263
|
* @ko 윤곽선 마이터 연장 길이와 두께의 최대 비율을 설정합니다. 1 이상이어야 합니다.
|
|
261
264
|
*/
|
|
262
|
-
setMiterLimit(this:
|
|
265
|
+
setMiterLimit(this: Shape, limit: number): void {
|
|
263
266
|
limit = shapeNumber(limit);
|
|
264
267
|
if (limit < 1) {
|
|
265
268
|
throw new RangeError('Miter limit must be at least 1');
|
|
@@ -351,6 +354,10 @@ export abstract class Shape extends withTransformable(ShapeResource) {
|
|
|
351
354
|
* @ja カスタム凸形状を作成します。サブクラスが頂点を提供し、update() を呼び出します。
|
|
352
355
|
* @ko 사용자 정의 볼록 도형을 만듭니다. 하위 클래스가 꼭짓점을 제공하고 update()를 호출합니다.
|
|
353
356
|
*/
|
|
357
|
+
protected constructor();
|
|
358
|
+
|
|
359
|
+
/** Selects a native built-in shape representation. @internal */
|
|
360
|
+
protected constructor(init: ShapeInit);
|
|
354
361
|
protected constructor(init: ShapeInit = { kind: 0 }) {
|
|
355
362
|
super(init);
|
|
356
363
|
}
|
package/src/graphics/sprite.ts
CHANGED
|
@@ -29,7 +29,9 @@ import { Texture, type ReadonlyTexture } from './texture';
|
|
|
29
29
|
|
|
30
30
|
class SpriteResource extends Drawable {
|
|
31
31
|
readonly [mutableValue] = true;
|
|
32
|
+
/** Native sprite capability. @internal */
|
|
32
33
|
readonly [graphicsNative]: NativeGraphicsHandle<'sprite'>;
|
|
34
|
+
/** Shared appearance and retained texture state. @internal */
|
|
33
35
|
readonly [spriteState]: SpriteData;
|
|
34
36
|
readonly [transformableState]: TransformableState;
|
|
35
37
|
private rectangleView?: R<IntRect>;
|
|
@@ -100,7 +102,7 @@ class SpriteResource extends Drawable {
|
|
|
100
102
|
* @ko 텍스처 참조를 교체합니다. resetRect가 true이면 텍스처 영역을 전체 텍스처로 초기화합니다.
|
|
101
103
|
*/
|
|
102
104
|
setTexture(
|
|
103
|
-
this:
|
|
105
|
+
this: Sprite,
|
|
104
106
|
texture: ReadonlyTexture,
|
|
105
107
|
resetRect = false,
|
|
106
108
|
): void {
|
|
@@ -142,7 +144,7 @@ class SpriteResource extends Drawable {
|
|
|
142
144
|
* @ja テクスチャのピクセル領域をコピーします。幅と高さはスプライトのローカルサイズを決め、負の値でテクスチャを反転できます。
|
|
143
145
|
* @ko 텍스처 픽셀 영역을 복사합니다. 너비와 높이는 스프라이트 로컬 크기를 결정하며 음수 값으로 텍스처를 반전할 수 있습니다.
|
|
144
146
|
*/
|
|
145
|
-
setTextureRect(this:
|
|
147
|
+
setTextureRect(this: Sprite, rectangle: R<IntRect>): void {
|
|
146
148
|
if (!(rectangle instanceof IntRect)) {
|
|
147
149
|
throw new TypeError('Expected an IntRect');
|
|
148
150
|
}
|
|
@@ -174,7 +176,7 @@ class SpriteResource extends Drawable {
|
|
|
174
176
|
* @ja テクスチャとチャンネルごとに乗算する色を設定します。Alpha で全体の不透明度を制御できます。
|
|
175
177
|
* @ko 텍스처와 채널별로 곱할 색상을 설정합니다. Alpha로 전체 불투명도를 제어할 수 있습니다.
|
|
176
178
|
*/
|
|
177
|
-
setColor(this:
|
|
179
|
+
setColor(this: Sprite, color: R<Color>): void {
|
|
178
180
|
if (!(color instanceof Color)) {
|
|
179
181
|
throw new TypeError('Expected a Color');
|
|
180
182
|
}
|
package/src/graphics/text.ts
CHANGED
|
@@ -379,8 +379,10 @@ function colorInteger(value: R<Color>): number {
|
|
|
379
379
|
return value.toInteger();
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
+
/** Native text resource used by the public transformable wrapper. @inline */
|
|
382
383
|
class TextResource extends Drawable {
|
|
383
384
|
readonly [mutableValue] = true;
|
|
385
|
+
/** Native text capability. @internal */
|
|
384
386
|
readonly [graphicsNative]: NativeGraphicsHandle<'text'>;
|
|
385
387
|
readonly [transformableState]: TransformableState;
|
|
386
388
|
/**
|
|
@@ -544,7 +546,7 @@ class TextResource extends Drawable {
|
|
|
544
546
|
* @ja 表示文字列を設定し、次回の照会または描画で再シェーピングします。
|
|
545
547
|
* @ko 표시할 문자열을 설정하며 다음 조회 또는 그리기에서 다시 셰이핑합니다.
|
|
546
548
|
*/
|
|
547
|
-
setString(this:
|
|
549
|
+
setString(this: this, value: string): void {
|
|
548
550
|
this.checkIdle();
|
|
549
551
|
if (typeof value !== 'string') {
|
|
550
552
|
throw new TypeError('Expected a string');
|
|
@@ -570,7 +572,7 @@ class TextResource extends Drawable {
|
|
|
570
572
|
* @ja フォントを設定し、その参照を保持します。
|
|
571
573
|
* @ko 글꼴을 설정하고 참조를 유지합니다.
|
|
572
574
|
*/
|
|
573
|
-
setFont(this:
|
|
575
|
+
setFont(this: this, font: ReadonlyFont): void {
|
|
574
576
|
this.checkIdle();
|
|
575
577
|
if (!(font instanceof Font)) {
|
|
576
578
|
throw new TypeError('Expected a Font');
|
|
@@ -595,7 +597,7 @@ class TextResource extends Drawable {
|
|
|
595
597
|
* @ja 文字サイズをピクセル単位で設定します。
|
|
596
598
|
* @ko 글자 크기를 픽셀 단위로 설정합니다.
|
|
597
599
|
*/
|
|
598
|
-
setCharacterSize(this:
|
|
600
|
+
setCharacterSize(this: this, size: number): void {
|
|
599
601
|
this.set(0, fontUnsigned(size));
|
|
600
602
|
}
|
|
601
603
|
/**
|
|
@@ -613,7 +615,7 @@ class TextResource extends Drawable {
|
|
|
613
615
|
* @ja 文字間隔の倍率を設定します。1 は既定の間隔です。
|
|
614
616
|
* @ko 자간 배율을 설정합니다. 1은 기본 간격입니다.
|
|
615
617
|
*/
|
|
616
|
-
setLetterSpacing(this:
|
|
618
|
+
setLetterSpacing(this: this, factor: number): void {
|
|
617
619
|
this.set(1, textFloat(factor));
|
|
618
620
|
}
|
|
619
621
|
/**
|
|
@@ -631,7 +633,7 @@ class TextResource extends Drawable {
|
|
|
631
633
|
* @ja 行間隔の倍率を設定します。1 はフォント既定の行間隔です。
|
|
632
634
|
* @ko 줄 간격 배율을 설정합니다. 1은 글꼴의 기본 줄 간격입니다.
|
|
633
635
|
*/
|
|
634
|
-
setLineSpacing(this:
|
|
636
|
+
setLineSpacing(this: this, factor: number): void {
|
|
635
637
|
this.set(2, textFloat(factor));
|
|
636
638
|
}
|
|
637
639
|
/**
|
|
@@ -649,7 +651,7 @@ class TextResource extends Drawable {
|
|
|
649
651
|
* @ja TextStyle ビットフラグを設定します。太字や斜体などを組み合わせられます。
|
|
650
652
|
* @ko TextStyle 비트 플래그를 설정하며 굵게, 기울임꼴 등의 스타일을 조합할 수 있습니다.
|
|
651
653
|
*/
|
|
652
|
-
setStyle(this:
|
|
654
|
+
setStyle(this: this, style: TextStyle): void {
|
|
653
655
|
this.set(3, fontUnsigned(style, 15));
|
|
654
656
|
}
|
|
655
657
|
/**
|
|
@@ -667,7 +669,7 @@ class TextResource extends Drawable {
|
|
|
667
669
|
* @ja 塗りつぶし色をコピーします。既存ジオメトリは色のみを更新します。
|
|
668
670
|
* @ko 채우기 색상을 복사합니다. 기존 기하 구조는 색상만 갱신합니다.
|
|
669
671
|
*/
|
|
670
|
-
setFillColor(this:
|
|
672
|
+
setFillColor(this: this, color: R<Color>): void {
|
|
671
673
|
this.setColor(4, colorInteger(color));
|
|
672
674
|
}
|
|
673
675
|
/**
|
|
@@ -685,7 +687,7 @@ class TextResource extends Drawable {
|
|
|
685
687
|
* @ja 輪郭色をコピーします。既存ジオメトリは色のみを更新します。
|
|
686
688
|
* @ko 윤곽선 색상을 복사합니다. 기존 기하 구조는 색상만 갱신합니다.
|
|
687
689
|
*/
|
|
688
|
-
setOutlineColor(this:
|
|
690
|
+
setOutlineColor(this: this, color: R<Color>): void {
|
|
689
691
|
this.setColor(5, colorInteger(color));
|
|
690
692
|
}
|
|
691
693
|
/**
|
|
@@ -703,7 +705,7 @@ class TextResource extends Drawable {
|
|
|
703
705
|
* @ja 輪郭の太さをピクセル単位で設定します。
|
|
704
706
|
* @ko 윤곽선 두께를 픽셀 단위로 설정합니다.
|
|
705
707
|
*/
|
|
706
|
-
setOutlineThickness(this:
|
|
708
|
+
setOutlineThickness(this: this, thickness: number): void {
|
|
707
709
|
this.set(6, textFloat(thickness));
|
|
708
710
|
}
|
|
709
711
|
/**
|
|
@@ -721,7 +723,7 @@ class TextResource extends Drawable {
|
|
|
721
723
|
* @ja 複数行テキストの配置を設定します。
|
|
722
724
|
* @ko 여러 줄 텍스트의 정렬을 설정합니다.
|
|
723
725
|
*/
|
|
724
|
-
setLineAlignment(this:
|
|
726
|
+
setLineAlignment(this: this, alignment: LineAlignment): void {
|
|
725
727
|
this.set(7, fontUnsigned(alignment, 3));
|
|
726
728
|
}
|
|
727
729
|
/**
|
|
@@ -740,7 +742,7 @@ class TextResource extends Drawable {
|
|
|
740
742
|
* @ko 가로쓰기 또는 세로쓰기 방향을 설정합니다.
|
|
741
743
|
*/
|
|
742
744
|
setTextOrientation(
|
|
743
|
-
this:
|
|
745
|
+
this: this,
|
|
744
746
|
orientation: TextOrientation,
|
|
745
747
|
): void {
|
|
746
748
|
this.set(8, fontUnsigned(orientation, 2));
|
|
@@ -760,7 +762,7 @@ class TextResource extends Drawable {
|
|
|
760
762
|
* @ja シェーピング時のグリフクラスターのグループ化方針を設定します。
|
|
761
763
|
* @ko 셰이핑 시 글리프 클러스터 그룹화 방식을 설정합니다.
|
|
762
764
|
*/
|
|
763
|
-
setClusterGrouping(this:
|
|
765
|
+
setClusterGrouping(this: this, grouping: ClusterGrouping): void {
|
|
764
766
|
this.set(9, fontUnsigned(grouping, 2));
|
|
765
767
|
}
|
|
766
768
|
/**
|
|
@@ -781,7 +783,7 @@ class TextResource extends Drawable {
|
|
|
781
783
|
* @ko 동기 글리프 외형 콜백을 설정하며 null은 해제합니다. 콜백은 기하 구조를 재구성할 때 실행됩니다.
|
|
782
784
|
*/
|
|
783
785
|
setGlyphPreProcessor(
|
|
784
|
-
this:
|
|
786
|
+
this: this,
|
|
785
787
|
processor: GlyphPreProcessor | null,
|
|
786
788
|
): void {
|
|
787
789
|
this.checkIdle();
|
|
@@ -1051,6 +1053,28 @@ class TextResource extends Drawable {
|
|
|
1051
1053
|
* @ko 네이티브 꼭짓점 저장 공간과 배치 그리기 스냅샷을 사용하는 SFML 셰이핑입니다.
|
|
1052
1054
|
*/
|
|
1053
1055
|
export class Text extends withTransformable(TextResource) {
|
|
1056
|
+
/**
|
|
1057
|
+
* Creates text from a font and options, or copies an existing text object.
|
|
1058
|
+
* The copy retains its font and glyph preprocessor references.
|
|
1059
|
+
* @zh 从字体和参数创建文本,或复制现有文本对象。副本保留字体和字形预处理器引用。
|
|
1060
|
+
* @ja フォントと設定からテキストを作成するか、既存テキストをコピーします。
|
|
1061
|
+
* コピーはフォントとグリフプリプロセッサーの参照を保持します。
|
|
1062
|
+
* @ko 글꼴과 설정으로 텍스트를 만들거나 기존 텍스트 객체를 복사합니다.
|
|
1063
|
+
* 복사본은 글꼴과 글리프 전처리기 참조를 유지합니다.
|
|
1064
|
+
*/
|
|
1065
|
+
public constructor(options: TextOptions);
|
|
1066
|
+
|
|
1067
|
+
/**
|
|
1068
|
+
* Copies text, retaining its font and glyph preprocessor references.
|
|
1069
|
+
* @zh 复制文本,保留字体和字形预处理器引用。
|
|
1070
|
+
* @ja フォントとグリフプリプロセッサーの参照を保持してテキストをコピーします。
|
|
1071
|
+
* @ko 글꼴과 글리프 전처리기 참조를 유지하여 텍스트를 복사합니다.
|
|
1072
|
+
*/
|
|
1073
|
+
public constructor(source: R<Text>);
|
|
1074
|
+
public constructor(options: TextOptions | R<Text>) {
|
|
1075
|
+
super(options);
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1054
1078
|
/**
|
|
1055
1079
|
* Text style bit flags.
|
|
1056
1080
|
* @zh 文本样式位标志。
|
package/src/graphics/texture.ts
CHANGED
|
@@ -31,9 +31,6 @@ import { CoordinateType } from './render-states';
|
|
|
31
31
|
export type ReadonlyTexture = Readonly<
|
|
32
32
|
Pick<
|
|
33
33
|
Texture,
|
|
34
|
-
| typeof graphicsNative
|
|
35
|
-
| typeof textureId
|
|
36
|
-
| typeof textureOwner
|
|
37
34
|
| 'getSize'
|
|
38
35
|
| 'copyToImage'
|
|
39
36
|
| 'isSmooth'
|
|
@@ -41,6 +38,11 @@ Texture,
|
|
|
41
38
|
| 'isSrgb'
|
|
42
39
|
| 'getNativeHandle'
|
|
43
40
|
>
|
|
41
|
+
> & TextureIdentity;
|
|
42
|
+
|
|
43
|
+
/** Native identity and owner retained by const texture references. @inline */
|
|
44
|
+
type TextureIdentity = Pick<
|
|
45
|
+
Texture, typeof graphicsNative | typeof textureId | typeof textureOwner
|
|
44
46
|
>;
|
|
45
47
|
|
|
46
48
|
/**
|
|
@@ -88,8 +90,11 @@ function areaSnapshot(area?: ReadonlyValue<IntRect>): IntRect | undefined {
|
|
|
88
90
|
* @ko 백그라운드 이미지 디코딩과 순서가 보장되는 픽셀 업로드를 지원하는 GPU 텍스처입니다.
|
|
89
91
|
*/
|
|
90
92
|
export class Texture {
|
|
93
|
+
/** Native GPU resource identity. @internal */
|
|
91
94
|
readonly [graphicsNative]: NativeGraphicsHandle<'texture'>;
|
|
95
|
+
/** Command-buffer texture identifier. @internal */
|
|
92
96
|
readonly [textureId]: number;
|
|
97
|
+
/** Retains a borrowed texture's native owner. @internal */
|
|
93
98
|
readonly [textureOwner]?: PendingTarget;
|
|
94
99
|
/**
|
|
95
100
|
* Read-only view of native texture metadata.
|
|
@@ -11,6 +11,7 @@ import { Vector2, Vector2f } from '../system/vector2';
|
|
|
11
11
|
import { Angle } from '../system/angle';
|
|
12
12
|
import { Rect, FloatRect } from './rect';
|
|
13
13
|
|
|
14
|
+
/** Row-major coefficients of a 3×3 transformation matrix. @inline */
|
|
14
15
|
type Components = [
|
|
15
16
|
a00: number,
|
|
16
17
|
a01: number,
|
|
@@ -22,6 +23,7 @@ type Components = [
|
|
|
22
23
|
a21: number,
|
|
23
24
|
a22: number,
|
|
24
25
|
];
|
|
26
|
+
/** Default, copied or nine-component transformation matrix. @inline */
|
|
25
27
|
type Arguments = [] | [source: R<Transform>] | Components;
|
|
26
28
|
type State = LazyValue<'transform', Float32Array> & {
|
|
27
29
|
matrix?: readonly number[];
|
|
@@ -120,6 +122,7 @@ export class Transform {
|
|
|
120
122
|
return this.state.values;
|
|
121
123
|
}
|
|
122
124
|
|
|
125
|
+
/** Native view of the shared transform matrix. @internal */
|
|
123
126
|
get [transformNative](): NativeValueHandle<'transform'> {
|
|
124
127
|
return nativeValue(this, transformNative, this.state);
|
|
125
128
|
}
|
|
@@ -59,6 +59,7 @@ const usages = [
|
|
|
59
59
|
VertexBufferUsage.Dynamic,
|
|
60
60
|
VertexBufferUsage.Static,
|
|
61
61
|
];
|
|
62
|
+
/** Vertex array or immutable sequence copied by the upload. @inline */
|
|
62
63
|
type Vertices = VertexArray | readonly ReadonlyValue<Vertex>[];
|
|
63
64
|
|
|
64
65
|
function usageIndex(usage: VertexBufferUsage): number {
|
|
@@ -94,6 +95,7 @@ export class VertexBuffer extends Drawable {
|
|
|
94
95
|
* @ko 꼭짓점 버퍼 사용 방식 열거형입니다.
|
|
95
96
|
*/
|
|
96
97
|
static readonly Usage = VertexBufferUsage;
|
|
98
|
+
/** Native GPU vertex-buffer capability. @internal */
|
|
97
99
|
readonly [graphicsNative]: NativeGraphicsHandle<'vertexBuffer'>;
|
|
98
100
|
readonly [vertexBufferId]: number;
|
|
99
101
|
/**
|
package/src/graphics/vertex.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -99,6 +99,7 @@ export type { Version } from './system/version';
|
|
|
99
99
|
export * as Unicode from './system/unicode';
|
|
100
100
|
export { Vector2, Vector2i, Vector2u, Vector2f } from './system/vector2';
|
|
101
101
|
export type { ScalarType } from './system/vector2';
|
|
102
|
+
export type { Scalar } from './internal/scalar';
|
|
102
103
|
export { Vector3, Vector3i, Vector3u, Vector3f } from './system/vector3';
|
|
103
104
|
export { Angle, degrees, radians } from './system/angle';
|
|
104
105
|
export { Time, seconds, milliseconds, microseconds } from './system/time';
|
|
@@ -135,6 +136,8 @@ export * from './window/gen/constants';
|
|
|
135
136
|
export { ContextAttribute } from './window/context-settings';
|
|
136
137
|
export type { ContextSettings } from './window/context-settings';
|
|
137
138
|
export type { ReadonlyValue } from './internal/value-storage';
|
|
139
|
+
/** @internal */
|
|
140
|
+
export { mutableValue } from './internal/value-storage';
|
|
138
141
|
export {
|
|
139
142
|
add,
|
|
140
143
|
subtract,
|
|
@@ -178,6 +181,7 @@ export type {
|
|
|
178
181
|
} from './graphics/text';
|
|
179
182
|
export type { ReadonlyPixels } from './graphics/image';
|
|
180
183
|
export { Color } from './graphics/color';
|
|
184
|
+
export type { Rect } from './graphics/rect';
|
|
181
185
|
export { FloatRect, IntRect } from './graphics/rect';
|
|
182
186
|
export { Vertex } from './graphics/vertex';
|
|
183
187
|
export { VertexArray } from './graphics/vertex-array';
|
|
@@ -12,6 +12,7 @@ export abstract class GlslValue<K extends string, A extends ValueArray> {
|
|
|
12
12
|
readonly [mutableValue] = true;
|
|
13
13
|
private readonly state: LazyValue<K, A>;
|
|
14
14
|
|
|
15
|
+
/** Binds component storage to a native value view. @internal */
|
|
15
16
|
protected constructor(
|
|
16
17
|
values: A,
|
|
17
18
|
wrap: (buffer: ArrayBuffer) => NativeValueMapping<K>,
|
|
@@ -23,6 +24,7 @@ export abstract class GlslValue<K extends string, A extends ValueArray> {
|
|
|
23
24
|
return this.state.values;
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
/** Native view bound to the shared GLSL component storage. @internal */
|
|
26
28
|
get [glslNative](): NativeValueHandle<K> {
|
|
27
29
|
return nativeValue(this, glslNative, this.state);
|
|
28
30
|
}
|
|
@@ -40,6 +42,7 @@ Uint8Array
|
|
|
40
42
|
*/
|
|
41
43
|
readonly scalarType = 'bool';
|
|
42
44
|
|
|
45
|
+
/** Converts native boolean component storage. @internal */
|
|
43
46
|
protected constructor(
|
|
44
47
|
components: readonly (number | bigint | boolean)[],
|
|
45
48
|
wrap: (buffer: ArrayBuffer) => NativeValueMapping<K>,
|
package/src/internal/scalar.ts
CHANGED
|
@@ -20,13 +20,23 @@ export const scalarArrays = {
|
|
|
20
20
|
* @ko 벡터 스칼라 유형입니다. i/u는 부호 있는/없는 정수,
|
|
21
21
|
* f는 부동 소수점을 나타내며 접미사는 비트 수입니다.
|
|
22
22
|
*/
|
|
23
|
-
export type ScalarType =
|
|
23
|
+
export type ScalarType =
|
|
24
|
+
| 'i8' | 'u8' | 'i16' | 'u16' | 'i32' | 'u32'
|
|
25
|
+
| 'i64' | 'u64' | 'f32' | 'f64';
|
|
24
26
|
export type BigIntScalar = 'i64' | 'u64';
|
|
25
27
|
export type NumberScalar = Exclude<ScalarType, BigIntScalar>;
|
|
28
|
+
/** Floating-point component storage types. @inline */
|
|
26
29
|
export type FloatScalar = 'f32' | 'f64';
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Component value for a storage type: i64/u64 use bigint, others use number.
|
|
32
|
+
* @zh 存储类型对应的分量值:i64/u64 使用 bigint,其余使用 number。
|
|
33
|
+
* @ja 格納型に対応する成分値。i64/u64 は bigint、それ以外は number。
|
|
34
|
+
* @ko 저장 타입에 해당하는 성분 값. i64/u64는 bigint, 나머지는 number입니다.
|
|
35
|
+
*/
|
|
36
|
+
export type Scalar<T extends ScalarType> = (
|
|
37
|
+
{ [K in Exclude<ScalarType, 'i64' | 'u64'>]: number } &
|
|
38
|
+
{ [K in 'i64' | 'u64']: bigint }
|
|
39
|
+
)[T];
|
|
30
40
|
// Explicit view types remain compatible with TS 5.0
|
|
31
41
|
// and TS 5.9's generic buffers.
|
|
32
42
|
interface ScalarViews {
|
|
@@ -23,11 +23,15 @@ export interface TransformableState {
|
|
|
23
23
|
cache?: TransformCache;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/** Native state required by transform mutation methods. @inline */
|
|
26
27
|
export interface TransformableHost {
|
|
28
|
+
/** Native mutable-value brand. @internal */
|
|
27
29
|
readonly [mutableValue]: true;
|
|
30
|
+
/** Native transform mapping. @internal */
|
|
28
31
|
readonly [transformableState]: TransformableState;
|
|
29
32
|
}
|
|
30
33
|
|
|
34
|
+
/** Public transform methods shared by all transformable objects. @inline */
|
|
31
35
|
export interface TransformableMethods extends TransformableHost {
|
|
32
36
|
/**
|
|
33
37
|
* Set the object's origin in parent coordinates, copying position.
|
|
@@ -15,12 +15,102 @@ export const glyphStorage: unique symbol = Symbol('Glyph.storage');
|
|
|
15
15
|
export const glyphNative: unique symbol = Symbol('Glyph.native');
|
|
16
16
|
export const transformStorage: unique symbol = Symbol('Transform.storage');
|
|
17
17
|
export const transformNative: unique symbol = Symbol('Transform.native');
|
|
18
|
+
/**
|
|
19
|
+
* Internal brand removed from recursive const views.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
18
22
|
export const mutableValue: unique symbol = Symbol('Value.mutable');
|
|
19
23
|
|
|
20
24
|
// Only expose reads and independent copies, never aliases or mutable callbacks.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Numeric reads and independent copies of a shared float view.
|
|
27
|
+
* @zh 共享浮点视图的数值读取和独立副本。
|
|
28
|
+
* @ja 共有浮動小数点ビューの数値読み取りと独立したコピー。
|
|
29
|
+
* @ko 공유 부동 소수점 뷰의 숫자 읽기와 독립적인 복사본입니다.
|
|
30
|
+
* @inline
|
|
31
|
+
*/
|
|
32
|
+
interface ReadonlyFloatArray {
|
|
33
|
+
readonly [index: number]: number;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Number of float32 components.
|
|
37
|
+
* @zh float32 分量数。
|
|
38
|
+
* @ja float32 成分数。
|
|
39
|
+
* @ko float32 성분 수입니다.
|
|
40
|
+
*/
|
|
41
|
+
readonly length: number;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Size of the view in bytes.
|
|
45
|
+
* @zh 视图的字节长度。
|
|
46
|
+
* @ja ビューのバイト長。
|
|
47
|
+
* @ko 뷰의 바이트 길이입니다.
|
|
48
|
+
*/
|
|
49
|
+
readonly byteLength: number;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Byte offset within the backing storage.
|
|
53
|
+
* @zh 视图在底层存储中的字节偏移。
|
|
54
|
+
* @ja 基になるストレージ内でのバイトオフセット。
|
|
55
|
+
* @ko 기반 저장소 내의 바이트 오프셋입니다.
|
|
56
|
+
*/
|
|
57
|
+
readonly byteOffset: number;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Copies the selected components into independent mutable storage.
|
|
61
|
+
* @zh 将选中分量复制到独立的可变存储。
|
|
62
|
+
* @ja 選択した成分を独立した変更可能なストレージにコピーします。
|
|
63
|
+
* @ko 선택한 성분을 독립적인 수정 가능 저장소에 복사합니다.
|
|
64
|
+
*
|
|
65
|
+
* @param start - Inclusive component index; defaults to zero.
|
|
66
|
+
* @zh start - 包含的起始分量索引,默认 0。
|
|
67
|
+
* @ja start - 開始成分インデックス。この位置を含み、既定値は 0。
|
|
68
|
+
* @ko start - 포함되는 시작 성분 인덱스입니다. 기본값은 0입니다.
|
|
69
|
+
*
|
|
70
|
+
* @param end - Exclusive component index; defaults to length.
|
|
71
|
+
* @zh end - 不包含的结束分量索引,默认 length。
|
|
72
|
+
* @ja end - 終了成分インデックス。この位置を含まず、既定値は length。
|
|
73
|
+
* @ko end - 포함되지 않는 끝 성분 인덱스입니다. 기본값은 length입니다.
|
|
74
|
+
*
|
|
75
|
+
* @return An independent float32 array.
|
|
76
|
+
* @zh 独立的 float32 数组。
|
|
77
|
+
* @ja 独立した float32 配列。
|
|
78
|
+
* @ko 독립적인 float32 배열입니다.
|
|
79
|
+
*/
|
|
80
|
+
slice(start?: number, end?: number): Float32Array;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Iterates component indices and values without exposing writable storage.
|
|
84
|
+
* @zh 遍历分量索引和值,不暴露可写存储。
|
|
85
|
+
* @ja 書き込み可能なストレージを公開せず、成分のインデックスと値を走査します。
|
|
86
|
+
* @ko 쓰기 가능한 저장소를 노출하지 않고 성분 인덱스와 값을 순회합니다.
|
|
87
|
+
*/
|
|
88
|
+
entries(): IterableIterator<[number, number]>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Iterates component indices.
|
|
92
|
+
* @zh 遍历分量索引。
|
|
93
|
+
* @ja 成分のインデックスを走査します。
|
|
94
|
+
* @ko 성분 인덱스를 순회합니다.
|
|
95
|
+
*/
|
|
96
|
+
keys(): IterableIterator<number>;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Iterates component values.
|
|
100
|
+
* @zh 遍历分量值。
|
|
101
|
+
* @ja 成分の値を走査します。
|
|
102
|
+
* @ko 성분 값을 순회합니다.
|
|
103
|
+
*/
|
|
104
|
+
values(): IterableIterator<number>;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Iterates component values in storage order.
|
|
108
|
+
* @zh 按存储顺序遍历分量值。
|
|
109
|
+
* @ja ストレージの順序で成分の値を走査します。
|
|
110
|
+
* @ko 저장 순서대로 성분 값을 순회합니다.
|
|
111
|
+
*/
|
|
112
|
+
[Symbol.iterator](): IterableIterator<number>;
|
|
113
|
+
}
|
|
24
114
|
|
|
25
115
|
/**
|
|
26
116
|
* Const data members recurse; methods still return independent mutable values.
|
package/src/network/common.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { EventEmitter } from 'node:events';
|
|
|
2
2
|
import { Time } from '../system/time';
|
|
3
3
|
import type { ReadonlyValue } from '../internal/value-storage';
|
|
4
4
|
|
|
5
|
+
/** Timeout duration, preserving the caller's Time value. @inline */
|
|
5
6
|
export type NetworkTime = ReadonlyValue<Time>;
|
|
6
7
|
export function millisecondsOf(time: NetworkTime): number {
|
|
7
8
|
if (!(time instanceof Time)) {
|
package/src/network/http.ts
CHANGED
|
@@ -330,6 +330,7 @@ export class HttpRequest {
|
|
|
330
330
|
setBody(body: string | Uint8Array): void {
|
|
331
331
|
this.body = Buffer.from(typeof body === 'string' ? body : bytes(body));
|
|
332
332
|
}
|
|
333
|
+
/** Creates the request snapshot consumed by the native client. @internal */
|
|
333
334
|
[prepareRequest](host: string): PreparedRequest {
|
|
334
335
|
const fields = new Map(this.fields);
|
|
335
336
|
if (!fields.has('host')) {
|