sfml.js 1.0.0 → 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.
Files changed (313) hide show
  1. package/README.ja.md +10 -9
  2. package/README.ko.md +10 -9
  3. package/README.md +10 -9
  4. package/README.zh-CN.md +10 -9
  5. package/binding.gyp +23 -16
  6. package/dist/audio/effect-processor.js +9 -3
  7. package/dist/audio/input-sound-file.js +41 -15
  8. package/dist/audio/listener.js +33 -11
  9. package/dist/audio/music.js +41 -18
  10. package/dist/audio/output-sound-file.js +4 -2
  11. package/dist/audio/playback-device.js +11 -3
  12. package/dist/audio/sound-buffer-recorder.js +8 -5
  13. package/dist/audio/sound-buffer.js +40 -17
  14. package/dist/audio/sound-file-factory.js +21 -9
  15. package/dist/audio/sound-file-reader.js +21 -7
  16. package/dist/audio/sound-recorder.js +36 -15
  17. package/dist/audio/sound-source.js +117 -40
  18. package/dist/audio/sound-stream.js +14 -5
  19. package/dist/audio/sound.js +9 -4
  20. package/dist/audio/value.js +42 -16
  21. package/dist/graphics/blend-mode.js +2 -1
  22. package/dist/graphics/boolean-vector.d.ts +1 -2
  23. package/dist/graphics/boolean-vector.js +19 -9
  24. package/dist/graphics/color.js +2 -1
  25. package/dist/graphics/convex-shape.js +7 -3
  26. package/dist/graphics/font.js +52 -23
  27. package/dist/graphics/glsl-matrix.js +8 -3
  28. package/dist/graphics/glsl.js +47 -16
  29. package/dist/graphics/glyph.js +27 -10
  30. package/dist/graphics/image.js +30 -14
  31. package/dist/graphics/rect.js +15 -8
  32. package/dist/graphics/render-states.js +18 -9
  33. package/dist/graphics/render-target.js +49 -23
  34. package/dist/graphics/render-texture.js +24 -12
  35. package/dist/graphics/render-window.js +6 -3
  36. package/dist/graphics/shader.js +67 -32
  37. package/dist/graphics/shape.js +25 -13
  38. package/dist/graphics/sprite.js +19 -9
  39. package/dist/graphics/stencil-mode.js +10 -6
  40. package/dist/graphics/swap.js +2 -1
  41. package/dist/graphics/text.js +123 -48
  42. package/dist/graphics/texture.js +48 -24
  43. package/dist/graphics/transform.js +29 -13
  44. package/dist/graphics/transformable.js +2 -1
  45. package/dist/graphics/vertex-array.js +40 -18
  46. package/dist/graphics/vertex-buffer.js +39 -19
  47. package/dist/graphics/vertex.js +6 -3
  48. package/dist/graphics/view.js +30 -14
  49. package/dist/index.d.ts +4 -4
  50. package/dist/internal/audio-codec-registry.js +12 -6
  51. package/dist/internal/audio-input-stream.js +2 -1
  52. package/dist/internal/audio-music-pump.js +58 -24
  53. package/dist/internal/audio-recorder-session.js +17 -7
  54. package/dist/internal/audio-worker-session.js +28 -10
  55. package/dist/internal/audio-worker.js +40 -21
  56. package/dist/internal/glsl-value.d.ts +3 -1
  57. package/dist/internal/glsl-value.js +18 -8
  58. package/dist/internal/graphics-state.js +29 -15
  59. package/dist/internal/input-stream.d.ts +3 -1
  60. package/dist/internal/input-stream.js +16 -7
  61. package/dist/internal/numeric-properties.js +2 -1
  62. package/dist/internal/render-states.js +2 -1
  63. package/dist/internal/scalar.js +22 -13
  64. package/dist/internal/shaped-glyph.d.ts +3 -1
  65. package/dist/internal/shaped-glyph.js +12 -4
  66. package/dist/internal/struct-view.d.ts +3 -1
  67. package/dist/internal/struct-view.js +3 -1
  68. package/dist/internal/transformable.js +2 -1
  69. package/dist/network/common.js +23 -11
  70. package/dist/network/dns.js +25 -17
  71. package/dist/network/ftp.js +43 -18
  72. package/dist/network/http.js +126 -56
  73. package/dist/network/ip-address.js +50 -25
  74. package/dist/network/packet.js +63 -25
  75. package/dist/network/sftp.js +175 -74
  76. package/dist/network/socket-selector.js +28 -14
  77. package/dist/network/socket.js +71 -30
  78. package/dist/network/tcp-listener.js +42 -19
  79. package/dist/network/tcp-socket.js +111 -53
  80. package/dist/network/tls-material.js +2 -1
  81. package/dist/network/udp-socket.js +68 -33
  82. package/dist/system/angle.js +2 -1
  83. package/dist/system/clock.js +4 -2
  84. package/dist/system/err.js +5 -2
  85. package/dist/system/file-input-stream.js +8 -4
  86. package/dist/system/input-stream.js +6 -3
  87. package/dist/system/operators.d.ts +1 -1
  88. package/dist/system/operators.js +90 -50
  89. package/dist/system/sleep.js +4 -2
  90. package/dist/system/time.js +12 -6
  91. package/dist/system/vector2.js +6 -7
  92. package/dist/system/vector3.js +11 -6
  93. package/dist/window/clipboard.js +2 -1
  94. package/dist/window/context.js +10 -5
  95. package/dist/window/cursor.js +2 -1
  96. package/dist/window/event.js +9 -5
  97. package/dist/window/mouse.js +4 -2
  98. package/dist/window/video-mode.js +2 -1
  99. package/dist/window/window.js +19 -12
  100. package/native/addon.cc +25 -12
  101. package/native/audio-binding.cc +266 -126
  102. package/native/audio-codec-binding.cc +147 -77
  103. package/native/audio-device-binding.cc +76 -49
  104. package/native/audio-file-binding.cc +116 -67
  105. package/native/audio-recorder-binding.cc +147 -98
  106. package/native/audio-recorder.h +1 -1
  107. package/native/audio-state.h +53 -30
  108. package/native/audio-stream-binding.cc +148 -94
  109. package/native/audio-stream.h +5 -4
  110. package/native/audio-worker-binding.cc +163 -81
  111. package/native/audio-worker.h +35 -19
  112. package/native/batch-drawable.cc +29 -16
  113. package/native/batch-drawable.h +11 -8
  114. package/native/context-binding.cc +40 -27
  115. package/native/context-settings.h +15 -8
  116. package/native/deferred-delete.cc +9 -6
  117. package/native/deferred-delete.h +7 -8
  118. package/native/error-stream-binding.cc +42 -28
  119. package/native/font-binding.cc +89 -48
  120. package/native/graphics-binding.cc +122 -72
  121. package/native/graphics-state.h +50 -36
  122. package/native/image-binding.cc +38 -24
  123. package/native/image-state.h +26 -18
  124. package/native/input-binding.cc +42 -27
  125. package/native/render-window-binding.cc +38 -23
  126. package/native/shader-binding.cc +115 -50
  127. package/native/shape-binding.cc +94 -49
  128. package/native/shape-state.h +18 -9
  129. package/native/shaped-glyph-storage.h +9 -5
  130. package/native/stream-binding.cc +143 -117
  131. package/native/system-binding.cc +17 -12
  132. package/native/text-binding.cc +68 -35
  133. package/native/text-state.h +25 -18
  134. package/native/texture-binding.cc +42 -33
  135. package/native/texture-resource.h +20 -12
  136. package/native/time-value.h +3 -1
  137. package/native/transformable-binding.cc +12 -6
  138. package/native/transformable-state.h +6 -6
  139. package/native/value-binding.h +46 -28
  140. package/native/value-layout.h +10 -10
  141. package/native/values-binding.cc +29 -23
  142. package/native/vertex-binding.cc +18 -12
  143. package/native/vertex-buffer-binding.cc +38 -24
  144. package/native/vertex-storage.h +2 -2
  145. package/native/view-data.h +4 -3
  146. package/native/window-binding.cc +75 -45
  147. package/native/window-event.h +20 -11
  148. package/native/window-owner.h +15 -12
  149. package/package.json +40 -48
  150. package/src/audio/effect-processor.ts +9 -3
  151. package/src/audio/input-sound-file.ts +108 -36
  152. package/src/audio/listener.ts +39 -13
  153. package/src/audio/music.ts +112 -47
  154. package/src/audio/output-sound-file.ts +40 -11
  155. package/src/audio/playback-device.ts +23 -8
  156. package/src/audio/sound-buffer-recorder.ts +35 -13
  157. package/src/audio/sound-buffer.ts +166 -58
  158. package/src/audio/sound-file-factory.ts +127 -49
  159. package/src/audio/sound-file-reader.ts +49 -15
  160. package/src/audio/sound-recorder.ts +100 -34
  161. package/src/audio/sound-source.ts +142 -45
  162. package/src/audio/sound-stream.ts +15 -5
  163. package/src/audio/sound.ts +12 -4
  164. package/src/audio/value.ts +89 -26
  165. package/src/graphics/blend-mode.ts +3 -1
  166. package/src/graphics/boolean-vector.ts +56 -26
  167. package/src/graphics/color.ts +3 -1
  168. package/src/graphics/convex-shape.ts +10 -3
  169. package/src/graphics/font.ts +171 -50
  170. package/src/graphics/glsl-matrix.ts +9 -3
  171. package/src/graphics/glsl.ts +81 -35
  172. package/src/graphics/glyph.ts +67 -26
  173. package/src/graphics/image.ts +119 -45
  174. package/src/graphics/rect.ts +56 -24
  175. package/src/graphics/render-states.ts +31 -14
  176. package/src/graphics/render-target.ts +197 -81
  177. package/src/graphics/render-texture.ts +36 -12
  178. package/src/graphics/render-window.ts +9 -3
  179. package/src/graphics/shader.ts +186 -61
  180. package/src/graphics/shape.ts +93 -35
  181. package/src/graphics/sprite.ts +64 -25
  182. package/src/graphics/stencil-mode.ts +12 -6
  183. package/src/graphics/swap.ts +3 -2
  184. package/src/graphics/text.ts +229 -74
  185. package/src/graphics/texture.ts +180 -61
  186. package/src/graphics/transform.ts +132 -47
  187. package/src/graphics/transformable.ts +3 -1
  188. package/src/graphics/vertex-array.ts +87 -35
  189. package/src/graphics/vertex-buffer.ts +97 -33
  190. package/src/graphics/vertex.ts +9 -3
  191. package/src/graphics/view.ts +59 -21
  192. package/src/index.ts +101 -23
  193. package/src/internal/audio-codec-registry.ts +18 -6
  194. package/src/internal/audio-input-stream.ts +6 -2
  195. package/src/internal/audio-music-pump.ts +116 -41
  196. package/src/internal/audio-native.ts +249 -96
  197. package/src/internal/audio-recorder-session.ts +68 -24
  198. package/src/internal/audio-worker-session.ts +65 -21
  199. package/src/internal/audio-worker.ts +85 -41
  200. package/src/internal/glsl-value.ts +26 -11
  201. package/src/internal/graphics-state.ts +57 -20
  202. package/src/internal/input-stream.ts +23 -10
  203. package/src/internal/native.ts +252 -99
  204. package/src/internal/numeric-properties.ts +2 -1
  205. package/src/internal/render-states.ts +3 -1
  206. package/src/internal/scalar.ts +33 -14
  207. package/src/internal/shaped-glyph.ts +25 -12
  208. package/src/internal/struct-view.ts +40 -13
  209. package/src/internal/transformable.ts +3 -1
  210. package/src/network/common.ts +35 -11
  211. package/src/network/dns.ts +95 -38
  212. package/src/network/ftp.ts +129 -47
  213. package/src/network/http.ts +232 -77
  214. package/src/network/ip-address.ts +118 -48
  215. package/src/network/packet.ts +161 -54
  216. package/src/network/sftp.ts +498 -168
  217. package/src/network/socket-selector.ts +66 -26
  218. package/src/network/socket.ts +133 -46
  219. package/src/network/tcp-listener.ts +78 -29
  220. package/src/network/tcp-socket.ts +240 -95
  221. package/src/network/tls-material.ts +6 -2
  222. package/src/network/udp-socket.ts +147 -53
  223. package/src/system/angle.ts +3 -1
  224. package/src/system/clock.ts +12 -4
  225. package/src/system/err.ts +5 -2
  226. package/src/system/file-input-stream.ts +12 -4
  227. package/src/system/input-stream.ts +9 -3
  228. package/src/system/operators.ts +290 -115
  229. package/src/system/sleep.ts +6 -2
  230. package/src/system/time.ts +18 -6
  231. package/src/system/timeout-with-predicate.ts +19 -8
  232. package/src/system/vector2.ts +101 -49
  233. package/src/system/vector3.ts +85 -36
  234. package/src/window/clipboard.ts +3 -1
  235. package/src/window/context.ts +15 -5
  236. package/src/window/cursor.ts +3 -1
  237. package/src/window/event.ts +26 -12
  238. package/src/window/mouse.ts +6 -2
  239. package/src/window/video-mode.ts +3 -1
  240. package/src/window/window.ts +119 -37
  241. package/test/native/audio-probes.cc +74 -36
  242. package/test/native/deferred-delete-probes.cc +17 -11
  243. package/test/native/drawable-probes.cc +70 -36
  244. package/test/native/exception-probes.cc +14 -9
  245. package/test/native/image-probes.cc +20 -10
  246. package/test/native/matrix-probes.cc +8 -4
  247. package/test/native/network-oracle.cc +17 -11
  248. package/test/native/render-texture-probes.cc +33 -24
  249. package/test/native/shader-probes.cc +9 -9
  250. package/test/native/shape-probes.cc +37 -23
  251. package/test/native/sprite-probes.cc +41 -25
  252. package/test/native/system-probes.cc +58 -35
  253. package/test/native/text-probes.cc +77 -44
  254. package/test/native/texture-probes.cc +43 -26
  255. package/test/native/time-probes.cc +18 -12
  256. package/test/native/transform-probes.cc +15 -10
  257. package/test/native/transformable-probes.cc +23 -17
  258. package/test/native/value-oracle.h +9 -4
  259. package/test/native/value-probes.cc +31 -23
  260. package/test/native/vertex-array-probes.cc +22 -14
  261. package/test/native/vertex-buffer-probes.cc +28 -17
  262. package/test/native/view-probes.cc +29 -17
  263. package/test/native/window-probes.cc +66 -33
  264. package/tools/ensure-sfml.cjs +9 -0
  265. package/tools/generate-network-constants.cjs +11 -6
  266. package/tools/generate-window-constants.cjs +31 -12
  267. package/docs/README.ja.md +0 -30
  268. package/docs/README.ko.md +0 -30
  269. package/docs/README.md +0 -30
  270. package/docs/README.zh-CN.md +0 -30
  271. package/docs/api.ja.md +0 -84
  272. package/docs/api.ko.md +0 -84
  273. package/docs/api.md +0 -81
  274. package/docs/api.zh-CN.md +0 -81
  275. package/docs/audio.ja.md +0 -249
  276. package/docs/audio.ko.md +0 -251
  277. package/docs/audio.md +0 -252
  278. package/docs/audio.zh-CN.md +0 -252
  279. package/docs/concepts.ja.md +0 -130
  280. package/docs/concepts.ko.md +0 -130
  281. package/docs/concepts.md +0 -131
  282. package/docs/concepts.zh-CN.md +0 -131
  283. package/docs/development.ja.md +0 -144
  284. package/docs/development.ko.md +0 -144
  285. package/docs/development.md +0 -146
  286. package/docs/development.zh-CN.md +0 -146
  287. package/docs/getting-started.ja.md +0 -154
  288. package/docs/getting-started.ko.md +0 -154
  289. package/docs/getting-started.md +0 -156
  290. package/docs/getting-started.zh-CN.md +0 -156
  291. package/docs/graphics.ja.md +0 -256
  292. package/docs/graphics.ko.md +0 -254
  293. package/docs/graphics.md +0 -255
  294. package/docs/graphics.zh-CN.md +0 -257
  295. package/docs/network.ja.md +0 -214
  296. package/docs/network.ko.md +0 -216
  297. package/docs/network.md +0 -218
  298. package/docs/network.zh-CN.md +0 -218
  299. package/docs/system.ja.md +0 -169
  300. package/docs/system.ko.md +0 -171
  301. package/docs/system.md +0 -173
  302. package/docs/system.zh-CN.md +0 -173
  303. package/docs/window.ja.md +0 -138
  304. package/docs/window.ko.md +0 -140
  305. package/docs/window.md +0 -141
  306. package/docs/window.zh-CN.md +0 -141
  307. package/native/exception-boundary.h +0 -97
  308. package/native/numeric-fields.h +0 -96
  309. package/native/shared-handle.h +0 -107
  310. package/test/tsconfig.json +0 -8
  311. package/tools/configure-lsp.cjs +0 -23
  312. package/tools/lib_downloader.cjs +0 -92
  313. package/tools/lib_downloader_urls.cjs +0 -23
@@ -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, values: new Float32Array(mapping.transform),
271
+ handle: mapping.transformable,
272
+ values: new Float32Array(mapping.transform),
270
273
  };
271
274
  if (options instanceof TextResource) {
272
- if (!this.geometry[0] && options.revision === this.font[font_1.fontRevision]) {
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
- if (init.characterSize !== undefined)
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() { return this.string; }
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() { return this.font; }
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) { this.set(0, (0, font_1.fontUnsigned)(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() { return this.words[0]; }
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) { this.set(1, (0, font_1.textFloat)(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() { return this.floats[1]; }
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) { this.set(2, (0, font_1.textFloat)(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() { return this.floats[2]; }
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) { this.set(3, (0, font_1.fontUnsigned)(style, 15)); }
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() { return this.words[3]; }
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) { this.setColor(4, colorInteger(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() { return new color_1.Color(this.colors.getUint32(16)); }
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) { this.setColor(5, colorInteger(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() { return new color_1.Color(this.colors.getUint32(20)); }
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) { this.set(6, (0, font_1.textFloat)(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() { return this.floats[6]; }
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) { this.set(7, (0, font_1.fontUnsigned)(alignment, 3)); }
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() { return this.words[7]; }
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) { this.set(8, (0, font_1.fontUnsigned)(orientation, 2)); }
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() { return this.words[8]; }
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) { this.set(9, (0, font_1.fontUnsigned)(grouping, 2)); }
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() { return this.words[9]; }
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() { this.prepare(); return this.vertices; }
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() { this.prepare(); return this.outline; }
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
- else
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
- ? this.floats : this.words;
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() { return fillColor; },
648
- set fillColor(value) { fillColor = new color_1.Color(value); },
649
- get outlineColor() { return outlineColor; },
650
- set outlineColor(value) { outlineColor = new color_1.Color(value); },
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), colorInteger(appearance.fillColor),
656
- colorInteger(appearance.outlineColor), (0, font_1.textFloat)(appearance.outlineThickness),
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
  }
@@ -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
- if (!(area instanceof rect_1.IntRect))
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 && !(source instanceof Texture) &&
39
- !(source instanceof image_1.Image))
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 && !this.loadFromImage(source, sRgb, area)) {
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
- if (source === this)
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
- if (dest !== undefined)
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) && !(source instanceof Texture) &&
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
- if (this.resourceOwner)
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 || y > this.state.height ||
363
- width > this.state.width - x || height > this.state.height - y) {
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
  }