sfml.js 1.1.0 → 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.
Files changed (113) hide show
  1. package/dist/audio/effect-processor.d.ts +1 -0
  2. package/dist/audio/input-sound-file.d.ts +1 -0
  3. package/dist/audio/output-sound-file.d.ts +1 -0
  4. package/dist/audio/output-sound-file.js +1 -0
  5. package/dist/audio/sound-buffer-recorder.d.ts +2 -0
  6. package/dist/audio/sound-buffer-recorder.js +2 -0
  7. package/dist/audio/sound-buffer.d.ts +5 -1
  8. package/dist/audio/sound-file-reader.d.ts +4 -1
  9. package/dist/audio/sound-file-reader.js +0 -9
  10. package/dist/audio/sound-recorder.d.ts +4 -0
  11. package/dist/audio/sound-recorder.js +3 -0
  12. package/dist/audio/sound-source.d.ts +2 -0
  13. package/dist/audio/sound-source.js +1 -0
  14. package/dist/graphics/blend-mode.d.ts +1 -0
  15. package/dist/graphics/boolean-vector.d.ts +6 -0
  16. package/dist/graphics/boolean-vector.js +2 -0
  17. package/dist/graphics/color.d.ts +1 -0
  18. package/dist/graphics/color.js +1 -0
  19. package/dist/graphics/font.d.ts +6 -1
  20. package/dist/graphics/font.js +1 -0
  21. package/dist/graphics/glsl.d.ts +4 -0
  22. package/dist/graphics/glyph.d.ts +1 -0
  23. package/dist/graphics/glyph.js +1 -0
  24. package/dist/graphics/image.d.ts +1 -0
  25. package/dist/graphics/rect.d.ts +4 -0
  26. package/dist/graphics/rect.js +3 -0
  27. package/dist/graphics/render-target.d.ts +2 -0
  28. package/dist/graphics/render-target.js +2 -0
  29. package/dist/graphics/render-texture.d.ts +1 -0
  30. package/dist/graphics/render-window.d.ts +1 -0
  31. package/dist/graphics/shader.d.ts +11 -5
  32. package/dist/graphics/shader.js +1 -0
  33. package/dist/graphics/shape.d.ts +12 -7
  34. package/dist/graphics/shape.js +0 -6
  35. package/dist/graphics/sprite.d.ts +5 -3
  36. package/dist/graphics/text.d.ts +32 -13
  37. package/dist/graphics/text.js +4 -0
  38. package/dist/graphics/texture.d.ts +7 -1
  39. package/dist/graphics/transform.d.ts +3 -0
  40. package/dist/graphics/transform.js +1 -0
  41. package/dist/graphics/vertex-buffer.d.ts +2 -0
  42. package/dist/graphics/vertex.d.ts +1 -0
  43. package/dist/graphics/vertex.js +1 -0
  44. package/dist/index.d.ts +4 -0
  45. package/dist/index.js +6 -3
  46. package/dist/internal/glsl-value.d.ts +3 -0
  47. package/dist/internal/glsl-value.js +3 -0
  48. package/dist/internal/scalar.d.ts +12 -6
  49. package/dist/internal/transformable.d.ts +4 -0
  50. package/dist/internal/value-storage.d.ts +85 -1
  51. package/dist/internal/value-storage.js +4 -0
  52. package/dist/network/common.d.ts +1 -0
  53. package/dist/network/http.d.ts +1 -0
  54. package/dist/network/http.js +1 -0
  55. package/dist/network/sftp.d.ts +3 -2
  56. package/dist/system/angle.d.ts +1 -0
  57. package/dist/system/angle.js +1 -0
  58. package/dist/system/operators.d.ts +8 -0
  59. package/dist/system/vector2.d.ts +6 -3
  60. package/dist/system/vector2.js +2 -0
  61. package/dist/system/vector3.d.ts +5 -3
  62. package/dist/system/vector3.js +2 -0
  63. package/dist/window/context.d.ts +1 -0
  64. package/dist/window/cursor.d.ts +1 -0
  65. package/dist/window/event.d.ts +1 -0
  66. package/dist/window/event.js +3 -1
  67. package/dist/window/window.d.ts +1 -0
  68. package/native/vertex-buffer-binding.cc +4 -4
  69. package/native/window-binding.cc +8 -2
  70. package/package.json +6 -5
  71. package/src/audio/effect-processor.ts +1 -0
  72. package/src/audio/input-sound-file.ts +1 -0
  73. package/src/audio/output-sound-file.ts +1 -0
  74. package/src/audio/sound-buffer-recorder.ts +2 -0
  75. package/src/audio/sound-buffer.ts +5 -2
  76. package/src/audio/sound-file-reader.ts +8 -0
  77. package/src/audio/sound-recorder.ts +4 -0
  78. package/src/audio/sound-source.ts +2 -0
  79. package/src/graphics/blend-mode.ts +1 -0
  80. package/src/graphics/boolean-vector.ts +6 -0
  81. package/src/graphics/color.ts +1 -0
  82. package/src/graphics/font.ts +6 -3
  83. package/src/graphics/glsl.ts +4 -0
  84. package/src/graphics/glyph.ts +1 -0
  85. package/src/graphics/image.ts +1 -0
  86. package/src/graphics/rect.ts +4 -0
  87. package/src/graphics/render-target.ts +2 -0
  88. package/src/graphics/render-texture.ts +1 -0
  89. package/src/graphics/render-window.ts +1 -0
  90. package/src/graphics/shader.ts +22 -6
  91. package/src/graphics/shape.ts +13 -6
  92. package/src/graphics/sprite.ts +5 -3
  93. package/src/graphics/text.ts +37 -13
  94. package/src/graphics/texture.ts +8 -3
  95. package/src/graphics/transform.ts +3 -0
  96. package/src/graphics/vertex-buffer.ts +2 -0
  97. package/src/graphics/vertex.ts +1 -0
  98. package/src/index.ts +4 -0
  99. package/src/internal/glsl-value.ts +3 -0
  100. package/src/internal/scalar.ts +14 -4
  101. package/src/internal/transformable.ts +4 -0
  102. package/src/internal/value-storage.ts +93 -3
  103. package/src/network/common.ts +1 -0
  104. package/src/network/http.ts +1 -0
  105. package/src/network/sftp.ts +2 -2
  106. package/src/system/angle.ts +1 -0
  107. package/src/system/operators.ts +8 -0
  108. package/src/system/vector2.ts +8 -1
  109. package/src/system/vector3.ts +9 -1
  110. package/src/window/context.ts +1 -0
  111. package/src/window/cursor.ts +1 -0
  112. package/src/window/event.ts +4 -1
  113. package/src/window/window.ts +1 -0
@@ -10,7 +10,9 @@ import type { RenderTarget } from './render-target';
10
10
  import { type ReadonlyTexture } from './texture';
11
11
  declare class SpriteResource extends Drawable {
12
12
  readonly [mutableValue] = true;
13
+ /** Native sprite capability. @internal */
13
14
  readonly [graphicsNative]: NativeGraphicsHandle<'sprite'>;
15
+ /** Shared appearance and retained texture state. @internal */
14
16
  readonly [spriteState]: SpriteData;
15
17
  readonly [transformableState]: TransformableState;
16
18
  private rectangleView?;
@@ -37,7 +39,7 @@ declare class SpriteResource extends Drawable {
37
39
  * @ja テクスチャ参照を置き換えます。resetRect が true なら領域をテクスチャ全体にリセットします。
38
40
  * @ko 텍스처 참조를 교체합니다. resetRect가 true이면 텍스처 영역을 전체 텍스처로 초기화합니다.
39
41
  */
40
- setTexture(this: SpriteResource, texture: ReadonlyTexture, resetRect?: boolean): void;
42
+ setTexture(this: Sprite, texture: ReadonlyTexture, resetRect?: boolean): void;
41
43
  /**
42
44
  * Returns the texture reference retained by the sprite.
43
45
  * @zh 返回精灵持有的纹理引用。
@@ -52,7 +54,7 @@ declare class SpriteResource extends Drawable {
52
54
  * @ja テクスチャのピクセル領域をコピーします。幅と高さはスプライトのローカルサイズを決め、負の値でテクスチャを反転できます。
53
55
  * @ko 텍스처 픽셀 영역을 복사합니다. 너비와 높이는 스프라이트 로컬 크기를 결정하며 음수 값으로 텍스처를 반전할 수 있습니다.
54
56
  */
55
- setTextureRect(this: SpriteResource, rectangle: R<IntRect>): void;
57
+ setTextureRect(this: Sprite, rectangle: R<IntRect>): void;
56
58
  /**
57
59
  * Returns a shared view typed as read-only of the texture pixel region.
58
60
  * @zh 返回纹理像素区域的只读类型共享视图。
@@ -67,7 +69,7 @@ declare class SpriteResource extends Drawable {
67
69
  * @ja テクスチャとチャンネルごとに乗算する色を設定します。Alpha で全体の不透明度を制御できます。
68
70
  * @ko 텍스처와 채널별로 곱할 색상을 설정합니다. Alpha로 전체 불투명도를 제어할 수 있습니다.
69
71
  */
70
- setColor(this: SpriteResource, color: R<Color>): void;
72
+ setColor(this: Sprite, color: R<Color>): void;
71
73
  /**
72
74
  * Returns an independent copy of the sprite color.
73
75
  * @zh 返回精灵颜色的独立副本。
@@ -335,8 +335,10 @@ export interface TextOptions {
335
335
  */
336
336
  characterSize?: number;
337
337
  }
338
+ /** Native text resource used by the public transformable wrapper. @inline */
338
339
  declare class TextResource extends Drawable {
339
340
  readonly [mutableValue] = true;
341
+ /** Native text capability. @internal */
340
342
  readonly [graphicsNative]: NativeGraphicsHandle<'text'>;
341
343
  readonly [transformableState]: TransformableState;
342
344
  /**
@@ -451,7 +453,7 @@ declare class TextResource extends Drawable {
451
453
  * @ja 表示文字列を設定し、次回の照会または描画で再シェーピングします。
452
454
  * @ko 표시할 문자열을 설정하며 다음 조회 또는 그리기에서 다시 셰이핑합니다.
453
455
  */
454
- setString(this: TextResource, value: string): void;
456
+ setString(this: this, value: string): void;
455
457
  /**
456
458
  * Returns the current JS string.
457
459
  * @zh 返回当前 JS 字符串。
@@ -465,7 +467,7 @@ declare class TextResource extends Drawable {
465
467
  * @ja フォントを設定し、その参照を保持します。
466
468
  * @ko 글꼴을 설정하고 참조를 유지합니다.
467
469
  */
468
- setFont(this: TextResource, font: ReadonlyFont): void;
470
+ setFont(this: this, font: ReadonlyFont): void;
469
471
  /**
470
472
  * Returns a read-only reference to the current font.
471
473
  * @zh 返回当前字体的只读引用。
@@ -479,7 +481,7 @@ declare class TextResource extends Drawable {
479
481
  * @ja 文字サイズをピクセル単位で設定します。
480
482
  * @ko 글자 크기를 픽셀 단위로 설정합니다.
481
483
  */
482
- setCharacterSize(this: TextResource, size: number): void;
484
+ setCharacterSize(this: this, size: number): void;
483
485
  /**
484
486
  * Returns the character size in pixels.
485
487
  * @zh 返回像素字号。
@@ -493,7 +495,7 @@ declare class TextResource extends Drawable {
493
495
  * @ja 文字間隔の倍率を設定します。1 は既定の間隔です。
494
496
  * @ko 자간 배율을 설정합니다. 1은 기본 간격입니다.
495
497
  */
496
- setLetterSpacing(this: TextResource, factor: number): void;
498
+ setLetterSpacing(this: this, factor: number): void;
497
499
  /**
498
500
  * Returns the letter spacing factor.
499
501
  * @zh 返回字间距倍率。
@@ -507,7 +509,7 @@ declare class TextResource extends Drawable {
507
509
  * @ja 行間隔の倍率を設定します。1 はフォント既定の行間隔です。
508
510
  * @ko 줄 간격 배율을 설정합니다. 1은 글꼴의 기본 줄 간격입니다.
509
511
  */
510
- setLineSpacing(this: TextResource, factor: number): void;
512
+ setLineSpacing(this: this, factor: number): void;
511
513
  /**
512
514
  * Returns the line spacing factor.
513
515
  * @zh 返回行间距倍率。
@@ -521,7 +523,7 @@ declare class TextResource extends Drawable {
521
523
  * @ja TextStyle ビットフラグを設定します。太字や斜体などを組み合わせられます。
522
524
  * @ko TextStyle 비트 플래그를 설정하며 굵게, 기울임꼴 등의 스타일을 조합할 수 있습니다.
523
525
  */
524
- setStyle(this: TextResource, style: TextStyle): void;
526
+ setStyle(this: this, style: TextStyle): void;
525
527
  /**
526
528
  * Returns the text style bit flags.
527
529
  * @zh 返回文本样式位标志。
@@ -535,7 +537,7 @@ declare class TextResource extends Drawable {
535
537
  * @ja 塗りつぶし色をコピーします。既存ジオメトリは色のみを更新します。
536
538
  * @ko 채우기 색상을 복사합니다. 기존 기하 구조는 색상만 갱신합니다.
537
539
  */
538
- setFillColor(this: TextResource, color: R<Color>): void;
540
+ setFillColor(this: this, color: R<Color>): void;
539
541
  /**
540
542
  * Returns a copy of the fill color.
541
543
  * @zh 返回填充颜色副本。
@@ -549,7 +551,7 @@ declare class TextResource extends Drawable {
549
551
  * @ja 輪郭色をコピーします。既存ジオメトリは色のみを更新します。
550
552
  * @ko 윤곽선 색상을 복사합니다. 기존 기하 구조는 색상만 갱신합니다.
551
553
  */
552
- setOutlineColor(this: TextResource, color: R<Color>): void;
554
+ setOutlineColor(this: this, color: R<Color>): void;
553
555
  /**
554
556
  * Returns a copy of the outline color.
555
557
  * @zh 返回轮廓颜色副本。
@@ -563,7 +565,7 @@ declare class TextResource extends Drawable {
563
565
  * @ja 輪郭の太さをピクセル単位で設定します。
564
566
  * @ko 윤곽선 두께를 픽셀 단위로 설정합니다.
565
567
  */
566
- setOutlineThickness(this: TextResource, thickness: number): void;
568
+ setOutlineThickness(this: this, thickness: number): void;
567
569
  /**
568
570
  * Returns the outline thickness in pixels.
569
571
  * @zh 返回轮廓像素厚度。
@@ -577,7 +579,7 @@ declare class TextResource extends Drawable {
577
579
  * @ja 複数行テキストの配置を設定します。
578
580
  * @ko 여러 줄 텍스트의 정렬을 설정합니다.
579
581
  */
580
- setLineAlignment(this: TextResource, alignment: LineAlignment): void;
582
+ setLineAlignment(this: this, alignment: LineAlignment): void;
581
583
  /**
582
584
  * Returns line alignment.
583
585
  * @zh 返回行对齐方式。
@@ -591,7 +593,7 @@ declare class TextResource extends Drawable {
591
593
  * @ja 横書きまたは縦書きの方向を設定します。
592
594
  * @ko 가로쓰기 또는 세로쓰기 방향을 설정합니다.
593
595
  */
594
- setTextOrientation(this: TextResource, orientation: TextOrientation): void;
596
+ setTextOrientation(this: this, orientation: TextOrientation): void;
595
597
  /**
596
598
  * Returns text writing direction.
597
599
  * @zh 返回文本排版方向。
@@ -605,7 +607,7 @@ declare class TextResource extends Drawable {
605
607
  * @ja シェーピング時のグリフクラスターのグループ化方針を設定します。
606
608
  * @ko 셰이핑 시 글리프 클러스터 그룹화 방식을 설정합니다.
607
609
  */
608
- setClusterGrouping(this: TextResource, grouping: ClusterGrouping): void;
610
+ setClusterGrouping(this: this, grouping: ClusterGrouping): void;
609
611
  /**
610
612
  * Returns the glyph cluster grouping strategy.
611
613
  * @zh 返回字形簇分组策略。
@@ -620,7 +622,7 @@ declare class TextResource extends Drawable {
620
622
  * @ja 同期グリフ外観コールバックを設定し、null で解除します。コールバックはジオメトリ再構築時に実行されます。
621
623
  * @ko 동기 글리프 외형 콜백을 설정하며 null은 해제합니다. 콜백은 기하 구조를 재구성할 때 실행됩니다.
622
624
  */
623
- setGlyphPreProcessor(this: TextResource, processor: GlyphPreProcessor | null): void;
625
+ setGlyphPreProcessor(this: this, processor: GlyphPreProcessor | null): void;
624
626
  /**
625
627
  * Shapes on demand and returns glyph layout views; cluster is a JS UTF-16
626
628
  * index.
@@ -713,6 +715,23 @@ declare const Text_base: typeof TextResource & (new (...args: any[]) => import("
713
715
  * @ko 네이티브 꼭짓점 저장 공간과 배치 그리기 스냅샷을 사용하는 SFML 셰이핑입니다.
714
716
  */
715
717
  export declare class Text extends Text_base {
718
+ /**
719
+ * Creates text from a font and options, or copies an existing text object.
720
+ * The copy retains its font and glyph preprocessor references.
721
+ * @zh 从字体和参数创建文本,或复制现有文本对象。副本保留字体和字形预处理器引用。
722
+ * @ja フォントと設定からテキストを作成するか、既存テキストをコピーします。
723
+ * コピーはフォントとグリフプリプロセッサーの参照を保持します。
724
+ * @ko 글꼴과 설정으로 텍스트를 만들거나 기존 텍스트 객체를 복사합니다.
725
+ * 복사본은 글꼴과 글리프 전처리기 참조를 유지합니다.
726
+ */
727
+ constructor(options: TextOptions);
728
+ /**
729
+ * Copies text, retaining its font and glyph preprocessor references.
730
+ * @zh 复制文本,保留字体和字形预处理器引用。
731
+ * @ja フォントとグリフプリプロセッサーの参照を保持してテキストをコピーします。
732
+ * @ko 글꼴과 글리프 전처리기 참조를 유지하여 텍스트를 복사합니다.
733
+ */
734
+ constructor(source: R<Text>);
716
735
  /**
717
736
  * Text style bit flags.
718
737
  * @zh 文本样式位标志。
@@ -207,6 +207,7 @@ function colorInteger(value) {
207
207
  }
208
208
  return value.toInteger();
209
209
  }
210
+ /** Native text resource used by the public transformable wrapper. @inline */
210
211
  class TextResource extends drawable_1.Drawable {
211
212
  /**
212
213
  * Creates text from a font and text parameters, or copies text retaining font
@@ -751,6 +752,9 @@ class TextResource extends drawable_1.Drawable {
751
752
  * @ko 네이티브 꼭짓점 저장 공간과 배치 그리기 스냅샷을 사용하는 SFML 셰이핑입니다.
752
753
  */
753
754
  class Text extends (0, transformable_1.withTransformable)(TextResource) {
755
+ constructor(options) {
756
+ super(options);
757
+ }
754
758
  /**
755
759
  * Returns text axis-aligned bounds after applying the object's transform.
756
760
  * @zh 返回应用对象变换后的文本轴对齐包围框。
@@ -13,7 +13,9 @@ import { CoordinateType } from './render-states';
13
13
  * @ja 同一テクスチャリソースへのコンパイル時 const 参照。
14
14
  * @ko 동일한 텍스처 리소스에 대한 컴파일 시점의 const 참조입니다.
15
15
  */
16
- export type ReadonlyTexture = Readonly<Pick<Texture, typeof graphicsNative | typeof textureId | typeof textureOwner | 'getSize' | 'copyToImage' | 'isSmooth' | 'isRepeated' | 'isSrgb' | 'getNativeHandle'>>;
16
+ export type ReadonlyTexture = Readonly<Pick<Texture, 'getSize' | 'copyToImage' | 'isSmooth' | 'isRepeated' | 'isSrgb' | 'getNativeHandle'>> & TextureIdentity;
17
+ /** Native identity and owner retained by const texture references. @inline */
18
+ type TextureIdentity = Pick<Texture, typeof graphicsNative | typeof textureId | typeof textureOwner>;
17
19
  /**
18
20
  * Internal factory for a render target's borrowed GPU texture.
19
21
  * @zh 渲染目标借用 GPU 纹理的内部工厂。
@@ -29,8 +31,11 @@ export declare let fontTextureFromMapping: (mapping: NativeTextureMapping, owner
29
31
  * @ko 백그라운드 이미지 디코딩과 순서가 보장되는 픽셀 업로드를 지원하는 GPU 텍스처입니다.
30
32
  */
31
33
  export declare class Texture {
34
+ /** Native GPU resource identity. @internal */
32
35
  readonly [graphicsNative]: NativeGraphicsHandle<'texture'>;
36
+ /** Command-buffer texture identifier. @internal */
33
37
  readonly [textureId]: number;
38
+ /** Retains a borrowed texture's native owner. @internal */
34
39
  readonly [textureOwner]?: PendingTarget;
35
40
  /**
36
41
  * Read-only view of native texture metadata.
@@ -253,3 +258,4 @@ export declare class Texture {
253
258
  */
254
259
  private checkRegion;
255
260
  }
261
+ export {};
@@ -3,6 +3,7 @@ import { transformStorage, transformNative, mutableValue, type ReadonlyValue as
3
3
  import { Vector2f } from '../system/vector2';
4
4
  import { Angle } from '../system/angle';
5
5
  import { FloatRect } from './rect';
6
+ /** Row-major coefficients of a 3×3 transformation matrix. @inline */
6
7
  type Components = [
7
8
  a00: number,
8
9
  a01: number,
@@ -14,6 +15,7 @@ type Components = [
14
15
  a21: number,
15
16
  a22: number
16
17
  ];
18
+ /** Default, copied or nine-component transformation matrix. @inline */
17
19
  type Arguments = [] | [source: R<Transform>] | Components;
18
20
  /**
19
21
  * sf::Transform, using its 64-byte column-major storage from construction.
@@ -40,6 +42,7 @@ export declare class Transform {
40
42
  */
41
43
  constructor(...args: Arguments);
42
44
  get [transformStorage](): Float32Array;
45
+ /** Native view of the shared transform matrix. @internal */
43
46
  get [transformNative](): NativeValueHandle<'transform'>;
44
47
  /**
45
48
  * Returns a read-only 4x4 column-major view for OpenGL; its contents update
@@ -76,6 +76,7 @@ class Transform {
76
76
  get [(_a = value_storage_1.mutableValue, value_storage_1.transformStorage)]() {
77
77
  return this.state.values;
78
78
  }
79
+ /** Native view of the shared transform matrix. @internal */
79
80
  get [value_storage_1.transformNative]() {
80
81
  return (0, lazy_value_1.nativeValue)(this, value_storage_1.transformNative, this.state);
81
82
  }
@@ -36,6 +36,7 @@ export declare enum VertexBufferUsage {
36
36
  */
37
37
  Static = "static"
38
38
  }
39
+ /** Vertex array or immutable sequence copied by the upload. @inline */
39
40
  type Vertices = VertexArray | readonly ReadonlyValue<Vertex>[];
40
41
  /**
41
42
  * GPU storage owned by Native; draw records a handle without uploading
@@ -52,6 +53,7 @@ export declare class VertexBuffer extends Drawable {
52
53
  * @ko 꼭짓점 버퍼 사용 방식 열거형입니다.
53
54
  */
54
55
  static readonly Usage: typeof VertexBufferUsage;
56
+ /** Native GPU vertex-buffer capability. @internal */
55
57
  readonly [graphicsNative]: NativeGraphicsHandle<'vertexBuffer'>;
56
58
  readonly [vertexBufferId]: number;
57
59
  /**
@@ -63,6 +63,7 @@ export declare class Vertex {
63
63
  */
64
64
  constructor(position: R<Vector2f>, color?: R<Color>, texCoords?: R<Vector2f>);
65
65
  get [vertexStorage](): Uint8Array;
66
+ /** Native view of the shared vertex bytes. @internal */
66
67
  get [vertexNative](): NativeValueHandle<'vertex'>;
67
68
  /**
68
69
  * Shared view of local position; changing components directly changes the
@@ -42,6 +42,7 @@ class Vertex {
42
42
  get [(_a = value_storage_1.mutableValue, value_storage_1.vertexStorage)]() {
43
43
  return this.state.values;
44
44
  }
45
+ /** Native view of the shared vertex bytes. @internal */
45
46
  get [value_storage_1.vertexNative]() {
46
47
  return (0, lazy_value_1.nativeValue)(this, value_storage_1.vertexNative, this.state);
47
48
  }
package/dist/index.d.ts CHANGED
@@ -45,6 +45,7 @@ export type { Version } from './system/version';
45
45
  export * as Unicode from './system/unicode';
46
46
  export { Vector2, Vector2i, Vector2u, Vector2f } from './system/vector2';
47
47
  export type { ScalarType } from './system/vector2';
48
+ export type { Scalar } from './internal/scalar';
48
49
  export { Vector3, Vector3i, Vector3u, Vector3f } from './system/vector3';
49
50
  export { Angle, degrees, radians } from './system/angle';
50
51
  export { Time, seconds, milliseconds, microseconds } from './system/time';
@@ -75,6 +76,8 @@ export * from './window/gen/constants';
75
76
  export { ContextAttribute } from './window/context-settings';
76
77
  export type { ContextSettings } from './window/context-settings';
77
78
  export type { ReadonlyValue } from './internal/value-storage';
79
+ /** @internal */
80
+ export { mutableValue } from './internal/value-storage';
78
81
  export { add, subtract, negate, addAssign, subtractAssign, multiply, multiplyAssign, divide, divideAssign, modulo, moduloAssign, equal, notEqual, less, lessEqual, greater, greaterEqual, } from './system/operators';
79
82
  export { Texture } from './graphics/texture';
80
83
  export type { ReadonlyTexture } from './graphics/texture';
@@ -88,6 +91,7 @@ export { Text, TextStyle, LineAlignment, ClusterGrouping, TextDirection, TextOri
88
91
  export type { TextOptions, ShapedGlyph, GlyphAppearance, GlyphPreProcessor, } from './graphics/text';
89
92
  export type { ReadonlyPixels } from './graphics/image';
90
93
  export { Color } from './graphics/color';
94
+ export type { Rect } from './graphics/rect';
91
95
  export { FloatRect, IntRect } from './graphics/rect';
92
96
  export { Vertex } from './graphics/vertex';
93
97
  export { VertexArray } from './graphics/vertex-array';
package/dist/index.js CHANGED
@@ -15,9 +15,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.SoundChannel = exports.TimeSpan = exports.Cone = exports.SoundFileFactory = exports.SoundFileWriter = exports.SoundFileReaderInfo = exports.SoundFileReader = exports.OutputSoundFile = exports.InputSoundFile = exports.Music = exports.Sound = exports.EffectProcessor = exports.SoundBufferRecorder = exports.SoundRecorder = exports.SoundStream = exports.SoundSource = exports.SoundBuffer = exports.FileType = exports.SftpHostKeyType = exports.SftpResultValue = exports.SftpListingResult = exports.SftpAttributesResult = exports.SftpPathResult = exports.SftpResult = exports.Sftp = exports.TransferMode = exports.FtpStatus = exports.FtpListingResponse = exports.FtpDirectoryResponse = exports.FtpResponse = exports.Ftp = exports.HttpStatus = exports.HttpMethod = exports.HttpResponse = exports.HttpRequest = exports.Http = exports.ReadinessType = exports.SocketSelector = exports.UdpSocket = exports.TcpListener = exports.TlsStatus = exports.TcpSocket = exports.SocketType = exports.SocketStatus = exports.Socket = exports.Packet = exports.Dns = exports.IpAddressType = exports.IpAddress = exports.SFMLError = void 0;
18
- exports.divide = exports.multiplyAssign = exports.multiply = exports.subtractAssign = exports.addAssign = exports.negate = exports.subtract = exports.add = exports.ContextAttribute = exports.Touch = exports.Clipboard = exports.Sensor = exports.Joystick = exports.Mouse = exports.Keyboard = exports.Event = exports.Cursor = exports.VideoMode = exports.Vulkan = exports.Context = exports.Window = exports.FileInputStream = exports.MemoryInputStream = exports.InputStream = exports.TimeoutWithPredicate = exports.SuspendAwareClock = exports.Clock = exports.sleep = exports.microseconds = exports.milliseconds = exports.seconds = exports.Time = exports.radians = exports.degrees = exports.Angle = exports.Vector3f = exports.Vector3u = exports.Vector3i = exports.Vector3 = exports.Vector2f = exports.Vector2u = exports.Vector2i = exports.Vector2 = exports.Unicode = exports.version = exports.setErrorOutput = exports.err = exports.PlaybackDevice = exports.Listener = exports.SoundStatus = void 0;
19
- exports.BlendMin = exports.BlendMultiply = exports.BlendAdd = exports.BlendAlpha = exports.BlendEquation = exports.BlendFactor = exports.BlendMode = exports.CoordinateType = exports.RenderStates = exports.RenderTarget = exports.Drawable = exports.ConvexShape = exports.RectangleShape = exports.CircleShape = exports.Shape = exports.Sprite = exports.Glsl = exports.View = exports.Transformable = exports.Transform = exports.PrimitiveType = exports.swap = exports.VertexBufferUsage = exports.VertexBuffer = exports.VertexArray = exports.Vertex = exports.IntRect = exports.FloatRect = exports.Color = exports.TextOrientation = exports.TextDirection = exports.ClusterGrouping = exports.LineAlignment = exports.TextStyle = exports.Text = exports.Glyph = exports.Font = exports.Image = exports.ShaderType = exports.Shader = exports.Texture = exports.greaterEqual = exports.greater = exports.lessEqual = exports.less = exports.notEqual = exports.equal = exports.moduloAssign = exports.modulo = exports.divideAssign = void 0;
20
- exports.RenderWindow = exports.RenderTexture = exports.StencilUpdateOperation = exports.StencilComparison = exports.StencilValue = exports.StencilMode = exports.BlendNone = exports.BlendMax = void 0;
18
+ exports.multiplyAssign = exports.multiply = exports.subtractAssign = exports.addAssign = exports.negate = exports.subtract = exports.add = exports.mutableValue = exports.ContextAttribute = exports.Touch = exports.Clipboard = exports.Sensor = exports.Joystick = exports.Mouse = exports.Keyboard = exports.Event = exports.Cursor = exports.VideoMode = exports.Vulkan = exports.Context = exports.Window = exports.FileInputStream = exports.MemoryInputStream = exports.InputStream = exports.TimeoutWithPredicate = exports.SuspendAwareClock = exports.Clock = exports.sleep = exports.microseconds = exports.milliseconds = exports.seconds = exports.Time = exports.radians = exports.degrees = exports.Angle = exports.Vector3f = exports.Vector3u = exports.Vector3i = exports.Vector3 = exports.Vector2f = exports.Vector2u = exports.Vector2i = exports.Vector2 = exports.Unicode = exports.version = exports.setErrorOutput = exports.err = exports.PlaybackDevice = exports.Listener = exports.SoundStatus = void 0;
19
+ exports.BlendMultiply = exports.BlendAdd = exports.BlendAlpha = exports.BlendEquation = exports.BlendFactor = exports.BlendMode = exports.CoordinateType = exports.RenderStates = exports.RenderTarget = exports.Drawable = exports.ConvexShape = exports.RectangleShape = exports.CircleShape = exports.Shape = exports.Sprite = exports.Glsl = exports.View = exports.Transformable = exports.Transform = exports.PrimitiveType = exports.swap = exports.VertexBufferUsage = exports.VertexBuffer = exports.VertexArray = exports.Vertex = exports.IntRect = exports.FloatRect = exports.Color = exports.TextOrientation = exports.TextDirection = exports.ClusterGrouping = exports.LineAlignment = exports.TextStyle = exports.Text = exports.Glyph = exports.Font = exports.Image = exports.ShaderType = exports.Shader = exports.Texture = exports.greaterEqual = exports.greater = exports.lessEqual = exports.less = exports.notEqual = exports.equal = exports.moduloAssign = exports.modulo = exports.divideAssign = exports.divide = void 0;
20
+ exports.RenderWindow = exports.RenderTexture = exports.StencilUpdateOperation = exports.StencilComparison = exports.StencilValue = exports.StencilMode = exports.BlendNone = exports.BlendMax = exports.BlendMin = void 0;
21
21
  var error_1 = require("./system/error");
22
22
  Object.defineProperty(exports, "SFMLError", { enumerable: true, get: function () { return error_1.SFMLError; } });
23
23
  var ip_address_1 = require("./network/ip-address");
@@ -154,6 +154,9 @@ exports.Touch = require("./window/touch");
154
154
  __exportStar(require("./window/gen/constants"), exports);
155
155
  var context_settings_1 = require("./window/context-settings");
156
156
  Object.defineProperty(exports, "ContextAttribute", { enumerable: true, get: function () { return context_settings_1.ContextAttribute; } });
157
+ /** @internal */
158
+ var value_storage_1 = require("./internal/value-storage");
159
+ Object.defineProperty(exports, "mutableValue", { enumerable: true, get: function () { return value_storage_1.mutableValue; } });
157
160
  var operators_1 = require("./system/operators");
158
161
  Object.defineProperty(exports, "add", { enumerable: true, get: function () { return operators_1.add; } });
159
162
  Object.defineProperty(exports, "subtract", { enumerable: true, get: function () { return operators_1.subtract; } });
@@ -9,8 +9,10 @@ export declare const glslNative: unique symbol;
9
9
  export declare abstract class GlslValue<K extends string, A extends ValueArray> {
10
10
  readonly [mutableValue] = true;
11
11
  private readonly state;
12
+ /** Binds component storage to a native value view. @internal */
12
13
  protected constructor(values: A, wrap: (buffer: ArrayBuffer) => NativeValueMapping<K>);
13
14
  get [glslStorage](): A;
15
+ /** Native view bound to the shared GLSL component storage. @internal */
14
16
  get [glslNative](): NativeValueHandle<K>;
15
17
  }
16
18
  export declare abstract class BooleanComponents<K extends string> extends GlslValue<K, Uint8Array> {
@@ -21,6 +23,7 @@ export declare abstract class BooleanComponents<K extends string> extends GlslVa
21
23
  * @ko 불리언 스칼라 유형이며 성분을 0/1 바이트로 저장합니다.
22
24
  */
23
25
  readonly scalarType = "bool";
26
+ /** Converts native boolean component storage. @internal */
24
27
  protected constructor(components: readonly (number | bigint | boolean)[], wrap: (buffer: ArrayBuffer) => NativeValueMapping<K>);
25
28
  /**
26
29
  * X boolean component.
@@ -10,6 +10,7 @@ exports.glslNative = Symbol('Glsl.native');
10
10
  * Internal storage only; concrete GLSL types define their own component API.
11
11
  */
12
12
  class GlslValue {
13
+ /** Binds component storage to a native value view. @internal */
13
14
  constructor(values, wrap) {
14
15
  this[_a] = true;
15
16
  this.state = new lazy_value_1.LazyValue(values, wrap);
@@ -17,12 +18,14 @@ class GlslValue {
17
18
  get [(_a = value_storage_1.mutableValue, exports.glslStorage)]() {
18
19
  return this.state.values;
19
20
  }
21
+ /** Native view bound to the shared GLSL component storage. @internal */
20
22
  get [exports.glslNative]() {
21
23
  return (0, lazy_value_1.nativeValue)(this, exports.glslNative, this.state);
22
24
  }
23
25
  }
24
26
  exports.GlslValue = GlslValue;
25
27
  class BooleanComponents extends GlslValue {
28
+ /** Converts native boolean component storage. @internal */
26
29
  constructor(components, wrap) {
27
30
  super(new Uint8Array(components.length), wrap);
28
31
  /**
@@ -19,16 +19,22 @@ export declare const scalarArrays: {
19
19
  * @ko 벡터 스칼라 유형입니다. i/u는 부호 있는/없는 정수,
20
20
  * f는 부동 소수점을 나타내며 접미사는 비트 수입니다.
21
21
  */
22
- export type ScalarType = keyof typeof scalarArrays;
22
+ export type ScalarType = 'i8' | 'u8' | 'i16' | 'u16' | 'i32' | 'u32' | 'i64' | 'u64' | 'f32' | 'f64';
23
23
  export type BigIntScalar = 'i64' | 'u64';
24
24
  export type NumberScalar = Exclude<ScalarType, BigIntScalar>;
25
+ /** Floating-point component storage types. @inline */
25
26
  export type FloatScalar = 'f32' | 'f64';
26
- type ScalarValues = {
27
- [T in NumberScalar]: number;
27
+ /**
28
+ * Component value for a storage type: i64/u64 use bigint, others use number.
29
+ * @zh 存储类型对应的分量值:i64/u64 使用 bigint,其余使用 number。
30
+ * @ja 格納型に対応する成分値。i64/u64 は bigint、それ以外は number。
31
+ * @ko 저장 타입에 해당하는 성분 값. i64/u64는 bigint, 나머지는 number입니다.
32
+ */
33
+ export type Scalar<T extends ScalarType> = ({
34
+ [K in Exclude<ScalarType, 'i64' | 'u64'>]: number;
28
35
  } & {
29
- [T in BigIntScalar]: bigint;
30
- };
31
- export type Scalar<T extends ScalarType> = ScalarValues[T];
36
+ [K in 'i64' | 'u64']: bigint;
37
+ })[T];
32
38
  interface ScalarViews {
33
39
  i8: Int8Array;
34
40
  u8: Uint8Array;
@@ -15,10 +15,14 @@ export interface TransformableState {
15
15
  values: Float32Array;
16
16
  cache?: TransformCache;
17
17
  }
18
+ /** Native state required by transform mutation methods. @inline */
18
19
  export interface TransformableHost {
20
+ /** Native mutable-value brand. @internal */
19
21
  readonly [mutableValue]: true;
22
+ /** Native transform mapping. @internal */
20
23
  readonly [transformableState]: TransformableState;
21
24
  }
25
+ /** Public transform methods shared by all transformable objects. @inline */
22
26
  export interface TransformableMethods extends TransformableHost {
23
27
  /**
24
28
  * Set the object's origin in parent coordinates, copying position.
@@ -15,8 +15,92 @@ export declare const glyphStorage: unique symbol;
15
15
  export declare const glyphNative: unique symbol;
16
16
  export declare const transformStorage: unique symbol;
17
17
  export declare const transformNative: unique symbol;
18
+ /**
19
+ * Internal brand removed from recursive const views.
20
+ * @internal
21
+ */
18
22
  export declare const mutableValue: unique symbol;
19
- type ReadonlyFloatArray = Readonly<Pick<Float32Array, number | 'length' | 'byteLength' | 'byteOffset' | typeof Symbol.iterator | 'slice' | 'entries' | 'keys' | 'values'>>;
23
+ /**
24
+ * Numeric reads and independent copies of a shared float view.
25
+ * @zh 共享浮点视图的数值读取和独立副本。
26
+ * @ja 共有浮動小数点ビューの数値読み取りと独立したコピー。
27
+ * @ko 공유 부동 소수점 뷰의 숫자 읽기와 독립적인 복사본입니다.
28
+ * @inline
29
+ */
30
+ interface ReadonlyFloatArray {
31
+ readonly [index: number]: number;
32
+ /**
33
+ * Number of float32 components.
34
+ * @zh float32 分量数。
35
+ * @ja float32 成分数。
36
+ * @ko float32 성분 수입니다.
37
+ */
38
+ readonly length: number;
39
+ /**
40
+ * Size of the view in bytes.
41
+ * @zh 视图的字节长度。
42
+ * @ja ビューのバイト長。
43
+ * @ko 뷰의 바이트 길이입니다.
44
+ */
45
+ readonly byteLength: number;
46
+ /**
47
+ * Byte offset within the backing storage.
48
+ * @zh 视图在底层存储中的字节偏移。
49
+ * @ja 基になるストレージ内でのバイトオフセット。
50
+ * @ko 기반 저장소 내의 바이트 오프셋입니다.
51
+ */
52
+ readonly byteOffset: number;
53
+ /**
54
+ * Copies the selected components into independent mutable storage.
55
+ * @zh 将选中分量复制到独立的可变存储。
56
+ * @ja 選択した成分を独立した変更可能なストレージにコピーします。
57
+ * @ko 선택한 성분을 독립적인 수정 가능 저장소에 복사합니다.
58
+ *
59
+ * @param start - Inclusive component index; defaults to zero.
60
+ * @zh start - 包含的起始分量索引,默认 0。
61
+ * @ja start - 開始成分インデックス。この位置を含み、既定値は 0。
62
+ * @ko start - 포함되는 시작 성분 인덱스입니다. 기본값은 0입니다.
63
+ *
64
+ * @param end - Exclusive component index; defaults to length.
65
+ * @zh end - 不包含的结束分量索引,默认 length。
66
+ * @ja end - 終了成分インデックス。この位置を含まず、既定値は length。
67
+ * @ko end - 포함되지 않는 끝 성분 인덱스입니다. 기본값은 length입니다.
68
+ *
69
+ * @return An independent float32 array.
70
+ * @zh 独立的 float32 数组。
71
+ * @ja 独立した float32 配列。
72
+ * @ko 독립적인 float32 배열입니다.
73
+ */
74
+ slice(start?: number, end?: number): Float32Array;
75
+ /**
76
+ * Iterates component indices and values without exposing writable storage.
77
+ * @zh 遍历分量索引和值,不暴露可写存储。
78
+ * @ja 書き込み可能なストレージを公開せず、成分のインデックスと値を走査します。
79
+ * @ko 쓰기 가능한 저장소를 노출하지 않고 성분 인덱스와 값을 순회합니다.
80
+ */
81
+ entries(): IterableIterator<[number, number]>;
82
+ /**
83
+ * Iterates component indices.
84
+ * @zh 遍历分量索引。
85
+ * @ja 成分のインデックスを走査します。
86
+ * @ko 성분 인덱스를 순회합니다.
87
+ */
88
+ keys(): IterableIterator<number>;
89
+ /**
90
+ * Iterates component values.
91
+ * @zh 遍历分量值。
92
+ * @ja 成分の値を走査します。
93
+ * @ko 성분 값을 순회합니다.
94
+ */
95
+ values(): IterableIterator<number>;
96
+ /**
97
+ * Iterates component values in storage order.
98
+ * @zh 按存储顺序遍历分量值。
99
+ * @ja ストレージの順序で成分の値を走査します。
100
+ * @ko 저장 순서대로 성분 값을 순회합니다.
101
+ */
102
+ [Symbol.iterator](): IterableIterator<number>;
103
+ }
20
104
  /**
21
105
  * Const data members recurse; methods still return independent mutable values.
22
106
  * @zh 数据成员递归只读;方法仍可返回独立的可变值。
@@ -18,4 +18,8 @@ exports.glyphStorage = Symbol('Glyph.storage');
18
18
  exports.glyphNative = Symbol('Glyph.native');
19
19
  exports.transformStorage = Symbol('Transform.storage');
20
20
  exports.transformNative = Symbol('Transform.native');
21
+ /**
22
+ * Internal brand removed from recursive const views.
23
+ * @internal
24
+ */
21
25
  exports.mutableValue = Symbol('Value.mutable');
@@ -5,6 +5,7 @@
5
5
  import { EventEmitter } from 'node:events';
6
6
  import { Time } from '../system/time';
7
7
  import type { ReadonlyValue } from '../internal/value-storage';
8
+ /** Timeout duration, preserving the caller's Time value. @inline */
8
9
  export type NetworkTime = ReadonlyValue<Time>;
9
10
  export declare function millisecondsOf(time: NetworkTime): number;
10
11
  export declare function uint(value: number, max?: number): number;
@@ -300,6 +300,7 @@ export declare class HttpRequest {
300
300
  * @ko 요청 본문 바이트를 복사하며 문자열은 UTF-8로 인코딩합니다.
301
301
  */
302
302
  setBody(body: string | Uint8Array): void;
303
+ /** Creates the request snapshot consumed by the native client. @internal */
303
304
  [prepareRequest](host: string): PreparedRequest;
304
305
  }
305
306
  /**
@@ -318,6 +318,7 @@ class HttpRequest {
318
318
  setBody(body) {
319
319
  this.body = Buffer.from(typeof body === 'string' ? body : (0, common_1.bytes)(body));
320
320
  }
321
+ /** Creates the request snapshot consumed by the native client. @internal */
321
322
  [prepareRequest](host) {
322
323
  const fields = new Map(this.fields);
323
324
  if (!fields.has('host')) {
@@ -1,6 +1,7 @@
1
1
  import { IpAddress } from './ip-address';
2
+ import { Time } from '../system/time';
3
+ import type { ReadonlyValue } from '../internal/value-storage';
2
4
  import { TimeoutWithPredicate } from '../system/timeout-with-predicate';
3
- import { type NetworkTime } from './common';
4
5
  import { SftpResultValue as Value, SftpHostKeyType } from './gen/constants';
5
6
  export { SftpResultValue, SftpHostKeyType } from './gen/constants';
6
7
  /**
@@ -12,7 +13,7 @@ export { SftpResultValue, SftpHostKeyType } from './gen/constants';
12
13
  * @ko 진행이 없을 때의 제한 시간 설정. 데이터 수신 또는 RPC 완료 시 타이머를
13
14
  * 재설정하며 기간이 0이면 제한 시간이 없습니다.
14
15
  */
15
- export type SftpTimeout = NetworkTime | TimeoutWithPredicate;
16
+ export type SftpTimeout = ReadonlyValue<Time> | TimeoutWithPredicate;
16
17
  /**
17
18
  * SFTP operation status and message.
18
19
  * @zh SFTP 操作状态和消息。
@@ -24,6 +24,7 @@ export declare class Angle {
24
24
  */
25
25
  constructor(source?: ReadonlyValue<Angle>);
26
26
  get [angleStorage](): Float32Array;
27
+ /** Lazily creates the native view of shared angle storage. @internal */
27
28
  get [angleNative](): NativeValueHandle<'angle'>;
28
29
  /**
29
30
  * Return the value in degrees, with 360 degrees per revolution.
@@ -51,6 +51,7 @@ class Angle {
51
51
  get [(_a = value_storage_1.mutableValue, value_storage_1.angleStorage)]() {
52
52
  return this.state.values;
53
53
  }
54
+ /** Lazily creates the native view of shared angle storage. @internal */
54
55
  get [value_storage_1.angleNative]() {
55
56
  return (0, lazy_value_1.nativeValue)(this, value_storage_1.angleNative, this.state);
56
57
  }