sfml.js 1.0.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +44 -51
  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
@@ -212,42 +212,54 @@ class Cone {
212
212
  * @ja 内側コーンの全角のコピー。
213
213
  * @ko 내부 원뿔 전체 각도의 복사본입니다.
214
214
  */
215
- get innerAngle() { return (0, angle_1.radians)(this.values[0]); }
215
+ get innerAngle() {
216
+ return (0, angle_1.radians)(this.values[0]);
217
+ }
216
218
  /**
217
219
  * Copy the inner cone angle.
218
220
  * @zh 复制内锥角度。
219
221
  * @ja 内側コーンの角度をコピーします。
220
222
  * @ko 내부 원뿔 각도를 복사합니다.
221
223
  */
222
- set innerAngle(value) { this.values[0] = angle(value); }
224
+ set innerAngle(value) {
225
+ this.values[0] = angle(value);
226
+ }
223
227
  /**
224
228
  * Copy of the full outer cone angle.
225
229
  * @zh 外锥完整角度的副本。
226
230
  * @ja 外側コーンの全角のコピー。
227
231
  * @ko 외부 원뿔 전체 각도의 복사본입니다.
228
232
  */
229
- get outerAngle() { return (0, angle_1.radians)(this.values[1]); }
233
+ get outerAngle() {
234
+ return (0, angle_1.radians)(this.values[1]);
235
+ }
230
236
  /**
231
237
  * Copy the outer cone angle.
232
238
  * @zh 复制外锥角度。
233
239
  * @ja 外側コーンの角度をコピーします。
234
240
  * @ko 외부 원뿔 각도를 복사합니다.
235
241
  */
236
- set outerAngle(value) { this.values[1] = angle(value); }
242
+ set outerAngle(value) {
243
+ this.values[1] = angle(value);
244
+ }
237
245
  /**
238
246
  * Gain multiplier outside the outer cone.
239
247
  * @zh 外锥之外的增益倍率。
240
248
  * @ja 外側コーンの外でのゲイン倍率。
241
249
  * @ko 외부 원뿔 바깥의 게인 배율입니다.
242
250
  */
243
- get outerGain() { return this.values[2]; }
251
+ get outerGain() {
252
+ return this.values[2];
253
+ }
244
254
  /**
245
255
  * Set the outer cone gain multiplier.
246
256
  * @zh 设置外锥增益倍率。
247
257
  * @ja 外側コーンのゲイン倍率を設定します。
248
258
  * @ko 외부 원뿔의 게인 배율을 설정합니다.
249
259
  */
250
- set outerGain(value) { this.values[2] = float(value); }
260
+ set outerGain(value) {
261
+ this.values[2] = float(value);
262
+ }
251
263
  }
252
264
  exports.Cone = Cone;
253
265
  /**
@@ -276,39 +288,49 @@ class TimeSpan {
276
288
  * @ja 開始オフセットのコピー。
277
289
  * @ko 시작 오프셋의 복사본입니다.
278
290
  */
279
- get offset() { return new time_1.Time(this.values[0]); }
291
+ get offset() {
292
+ return new time_1.Time(this.values[0]);
293
+ }
280
294
  /**
281
295
  * Copy the starting offset.
282
296
  * @zh 复制起点偏移。
283
297
  * @ja 開始オフセットをコピーします。
284
298
  * @ko 시작 오프셋을 복사합니다.
285
299
  */
286
- set offset(value) { this.values[0] = duration(value); }
300
+ set offset(value) {
301
+ this.values[0] = duration(value);
302
+ }
287
303
  /**
288
304
  * Copy of the duration.
289
305
  * @zh 时长的副本。
290
306
  * @ja 長さのコピー。
291
307
  * @ko 길이의 복사본입니다.
292
308
  */
293
- get length() { return new time_1.Time(this.values[1]); }
309
+ get length() {
310
+ return new time_1.Time(this.values[1]);
311
+ }
294
312
  /**
295
313
  * Copy the time span length.
296
314
  * @zh 复制时间段长度。
297
315
  * @ja 時間範囲の長さをコピーします。
298
316
  * @ko 시간 구간의 길이를 복사합니다.
299
317
  */
300
- set length(value) { this.values[1] = duration(value); }
318
+ set length(value) {
319
+ this.values[1] = duration(value);
320
+ }
301
321
  }
302
322
  exports.TimeSpan = TimeSpan;
303
323
  function float(value) {
304
- if (typeof value !== 'number')
324
+ if (typeof value !== 'number') {
305
325
  throw new TypeError('Expected a number');
326
+ }
306
327
  return Math.fround(value);
307
328
  }
308
329
  exports.float = float;
309
330
  function flag(value) {
310
- if (typeof value !== 'boolean')
331
+ if (typeof value !== 'boolean') {
311
332
  throw new TypeError('Expected a boolean');
333
+ }
312
334
  return +value;
313
335
  }
314
336
  exports.flag = flag;
@@ -320,14 +342,16 @@ function unsigned(value) {
320
342
  }
321
343
  exports.unsigned = unsigned;
322
344
  function duration(value) {
323
- if (!(value instanceof time_1.Time))
345
+ if (!(value instanceof time_1.Time)) {
324
346
  throw new TypeError('Expected a Time');
347
+ }
325
348
  return value.asMicroseconds();
326
349
  }
327
350
  exports.duration = duration;
328
351
  function angle(value) {
329
- if (!(value instanceof angle_1.Angle))
352
+ if (!(value instanceof angle_1.Angle)) {
330
353
  throw new TypeError('Expected an Angle');
354
+ }
331
355
  return value.asRadians();
332
356
  }
333
357
  exports.angle = angle;
@@ -339,7 +363,8 @@ function vector(value) {
339
363
  exports.vector = vector;
340
364
  function channels(map) {
341
365
  const values = Array.from(map);
342
- if (values.some(value => !Number.isInteger(value) || value < 0 ||
366
+ if (values.some(value => !Number.isInteger(value) ||
367
+ value < 0 ||
343
368
  value > SoundChannel.TopBackCenter)) {
344
369
  throw new RangeError('Unknown sound channel');
345
370
  }
@@ -347,7 +372,8 @@ function channels(map) {
347
372
  }
348
373
  exports.channels = channels;
349
374
  function samples(value) {
350
- if (!(value instanceof Int16Array))
375
+ if (!(value instanceof Int16Array)) {
351
376
  throw new TypeError('Expected an Int16Array');
377
+ }
352
378
  }
353
379
  exports.samples = samples;
@@ -148,8 +148,9 @@ class BlendMode {
148
148
  alphaDstFactor: BlendFactor.OneMinusSrcAlpha,
149
149
  alphaEquation: BlendEquation.Add,
150
150
  });
151
- if (args.length === 0)
151
+ if (args.length === 0) {
152
152
  return;
153
+ }
153
154
  if (args.length === 1 && args[0] instanceof BlendMode) {
154
155
  const source = args[0];
155
156
  this.colorSrcFactor = source.colorSrcFactor;
@@ -77,8 +77,7 @@ export declare class Bvec2 extends BooleanVector<'vector2'> {
77
77
  componentWiseDiv(rhs: R<Bvec2>): Bvec2;
78
78
  }
79
79
  type Source3 = R<Bvec3> | R<Vector3<ScalarType>>;
80
- type Arguments3 = [
81
- ] | [x: boolean, y: boolean, z: boolean] | [source: Source3];
80
+ type Arguments3 = [] | [x: boolean, y: boolean, z: boolean] | [source: Source3];
82
81
  /**
83
82
  * sf::Vector3<bool>, sharing the same native family as numeric Vector3.
84
83
  * @zh sf::Vector3<bool>,与数值 Vector3 共用同一个原生类型族。
@@ -30,8 +30,9 @@ class BooleanVector extends glsl_value_1.BooleanComponents {
30
30
  const a = this[glsl_value_1.glslStorage];
31
31
  const b = rhs[glsl_value_1.glslStorage];
32
32
  let sum = 0;
33
- for (let i = 0; i < a.length; i++)
33
+ for (let i = 0; i < a.length; i++) {
34
34
  sum += a[i] * b[i];
35
+ }
35
36
  return sum !== 0;
36
37
  }
37
38
  /**
@@ -67,15 +68,18 @@ class Bvec2 extends BooleanVector {
67
68
  */
68
69
  constructor(...args) {
69
70
  const source = args[0];
70
- const components = args.length === 0 || (args.length === 2 &&
71
- typeof source === 'boolean' && typeof args[1] === 'boolean');
71
+ const components = args.length === 0 ||
72
+ (args.length === 2 &&
73
+ typeof source === 'boolean' &&
74
+ typeof args[1] === 'boolean');
72
75
  const copy = args.length === 1 &&
73
76
  (source instanceof Bvec2 || source instanceof vector2_1.Vector2);
74
77
  if (!components && !copy) {
75
78
  throw new TypeError('Expected a boolean pair or a two-dimensional vector');
76
79
  }
77
80
  super(typeof source === 'object'
78
- ? [source.x, source.y] : [source ?? false, args[1] ?? false], buffer => native_1.native.wrapVector2('bool', buffer));
81
+ ? [source.x, source.y]
82
+ : [source ?? false, args[1] ?? false], buffer => native_1.native.wrapVector2('bool', buffer));
79
83
  }
80
84
  /**
81
85
  * Returns a new vector from (-y, x) converted to boolean components, namely
@@ -139,9 +143,11 @@ class Bvec3 extends BooleanVector {
139
143
  */
140
144
  constructor(...args) {
141
145
  const source = args[0];
142
- const components = args.length === 0 || (args.length === 3 &&
143
- typeof source === 'boolean' && typeof args[1] === 'boolean' &&
144
- typeof args[2] === 'boolean');
146
+ const components = args.length === 0 ||
147
+ (args.length === 3 &&
148
+ typeof source === 'boolean' &&
149
+ typeof args[1] === 'boolean' &&
150
+ typeof args[2] === 'boolean');
145
151
  const copy = args.length === 1 &&
146
152
  (source instanceof Bvec3 || source instanceof vector3_1.Vector3);
147
153
  if (!components && !copy) {
@@ -157,14 +163,18 @@ class Bvec3 extends BooleanVector {
157
163
  * @ja Z ブール成分。
158
164
  * @ko Z 불리언 성분입니다.
159
165
  */
160
- get z() { return this[glsl_value_1.glslStorage][2] !== 0; }
166
+ get z() {
167
+ return this[glsl_value_1.glslStorage][2] !== 0;
168
+ }
161
169
  /**
162
170
  * Sets the Z component, stored as a 0/1 byte.
163
171
  * @zh 设置 Z 分量,按 0/1 字节存储。
164
172
  * @ja Z 成分を設定し、0/1 のバイトで格納します。
165
173
  * @ko Z 성분을 설정하며 0/1 바이트로 저장합니다.
166
174
  */
167
- set z(value) { this[glsl_value_1.glslStorage][2] = value ? 1 : 0; }
175
+ set z(value) {
176
+ this[glsl_value_1.glslStorage][2] = value ? 1 : 0;
177
+ }
168
178
  /**
169
179
  * Computes the 3D cross product and converts each nonzero component to true.
170
180
  * @zh 计算三维叉积后将各分量按非零为 true 转换。
@@ -26,8 +26,9 @@ class Color {
26
26
  */
27
27
  this.state = new lazy_value_1.LazyValue(new Uint8Array(4), buffer => native_1.native.wrapColor(buffer));
28
28
  this.state.values[3] = 255;
29
- if (redOrSource === undefined)
29
+ if (redOrSource === undefined) {
30
30
  return;
31
+ }
31
32
  if (redOrSource instanceof Color) {
32
33
  this[value_storage_1.colorStorage].set(redOrSource[value_storage_1.colorStorage]);
33
34
  }
@@ -10,10 +10,12 @@ const shape_1 = require("./shape");
10
10
  */
11
11
  class ConvexShape extends shape_1.Shape {
12
12
  constructor(source = 0) {
13
- if (source instanceof ConvexShape)
13
+ if (source instanceof ConvexShape) {
14
14
  super({ kind: 3, source });
15
- else
15
+ }
16
+ else {
16
17
  super({ kind: 3, x: (0, shape_1.shapeCount)(source) });
18
+ }
17
19
  }
18
20
  /**
19
21
  * Sets the outline point count and updates geometry.
@@ -41,7 +43,9 @@ class ConvexShape extends shape_1.Shape {
41
43
  * @ko 로컬 꼭짓점 좌표를 복사합니다. 인덱스는 0부터 시작하며 꼭짓점은 윤곽 순서로 볼록 다각형을 구성해야 합니다.
42
44
  */
43
45
  setPoint(index, point) {
44
- if (!Number.isInteger(index) || index < 0 || index >= this.getPointCount()) {
46
+ if (!Number.isInteger(index) ||
47
+ index < 0 ||
48
+ index >= this.getPointCount()) {
45
49
  throw new RangeError('Shape point index is out of bounds');
46
50
  }
47
51
  this.changeGeometry(5, index, ...(0, shape_1.shapeVector)(point));
@@ -18,24 +18,28 @@ function fontUnsigned(value, maximum = 0xffffffff) {
18
18
  }
19
19
  exports.fontUnsigned = fontUnsigned;
20
20
  function textFloat(value) {
21
- if (typeof value !== 'number')
21
+ if (typeof value !== 'number') {
22
22
  throw new TypeError('Expected a number');
23
+ }
23
24
  const result = Math.fround(value);
24
- if (!Number.isFinite(result))
25
+ if (!Number.isFinite(result)) {
25
26
  throw new RangeError('Expected a finite float32 value');
27
+ }
26
28
  return result;
27
29
  }
28
30
  exports.textFloat = textFloat;
29
31
  function flag(value) {
30
- if (typeof value !== 'boolean')
32
+ if (typeof value !== 'boolean') {
31
33
  throw new TypeError('Expected a boolean');
34
+ }
32
35
  }
33
36
  function fontViews(mapping) {
34
37
  const { smooth, ...fields } = mapping.fields;
35
38
  return {
36
39
  info: (0, struct_view_1.nativeStruct)({ buffers: mapping.buffers, fields }, { family: mapping.family }),
37
40
  sampling: (0, struct_view_1.nativeStruct)({
38
- buffers: mapping.buffers, fields: { smooth },
41
+ buffers: mapping.buffers,
42
+ fields: { smooth },
39
43
  }),
40
44
  };
41
45
  }
@@ -86,8 +90,9 @@ class Font {
86
90
  * @ko 인코딩된 글꼴 바이트를 비동기로 열고 성공 여부를 반환합니다.
87
91
  */
88
92
  async openFromMemory(data) {
89
- if (!(data instanceof Uint8Array))
93
+ if (!(data instanceof Uint8Array)) {
90
94
  throw new TypeError('Expected a Uint8Array');
95
+ }
91
96
  return this.open(data);
92
97
  }
93
98
  /**
@@ -98,26 +103,32 @@ class Font {
98
103
  * @ko 스트림 시작부터 모든 글꼴 바이트를 읽고 비동기로 엽니다. 성공 여부를 반환하며 스트림 예외는 Promise를 거부합니다.
99
104
  */
100
105
  async openFromStream(stream) {
101
- if (!(stream instanceof input_stream_1.InputStream))
106
+ if (!(stream instanceof input_stream_1.InputStream)) {
102
107
  throw new TypeError('Expected an InputStream');
108
+ }
103
109
  const size = await stream.getSize();
104
- if (size === undefined || size === 0n)
110
+ if (size === undefined || size === 0n) {
105
111
  return false;
112
+ }
106
113
  if (typeof size !== 'bigint' || size < 0n || size > 0x7fffffffn) {
107
114
  throw new RangeError('Font stream size exceeds the buffer limit');
108
115
  }
109
116
  const position = await stream.seek(0n);
110
- if (position === undefined)
117
+ if (position === undefined) {
111
118
  return false;
112
- if (position !== 0n)
119
+ }
120
+ if (position !== 0n) {
113
121
  throw new RangeError('Font stream must seek to its beginning');
122
+ }
114
123
  const bytes = new Uint8Array(Number(size));
115
124
  let offset = 0;
116
125
  while (offset < bytes.length) {
117
126
  const count = await stream.read(bytes.subarray(offset));
118
- if (count === undefined || count === 0n)
127
+ if (count === undefined || count === 0n) {
119
128
  return false;
120
- if (typeof count !== 'bigint' || count < 0n ||
129
+ }
130
+ if (typeof count !== 'bigint' ||
131
+ count < 0n ||
121
132
  count > BigInt(bytes.length - offset)) {
122
133
  throw new RangeError('Invalid font stream read count');
123
134
  }
@@ -131,7 +142,9 @@ class Font {
131
142
  * @ja 現在のフォント情報の読み取り専用ビューを返します。
132
143
  * @ko 현재 글꼴 정보의 읽기 전용 뷰를 반환합니다.
133
144
  */
134
- getInfo() { return this.state.info; }
145
+ getInfo() {
146
+ return this.state.info;
147
+ }
135
148
  /**
136
149
  * Gets the cached glyph for a Unicode code point; size and outline thickness
137
150
  * are in pixels, and bold controls emboldening.
@@ -196,14 +209,18 @@ class Font {
196
209
  * @ja 指定ピクセル文字サイズでのアセントをピクセル単位で返します。
197
210
  * @ko 지정한 픽셀 글자 크기의 어센트를 픽셀 단위로 반환합니다.
198
211
  */
199
- getAscent(size) { return this.metric(0, size); }
212
+ getAscent(size) {
213
+ return this.metric(0, size);
214
+ }
200
215
  /**
201
216
  * Returns the descent in pixels for the specified pixel character size.
202
217
  * @zh 返回指定像素字号的下降度量,单位为像素。
203
218
  * @ja 指定ピクセル文字サイズでのディセントをピクセル単位で返します。
204
219
  * @ko 지정한 픽셀 글자 크기의 디센트를 픽셀 단위로 반환합니다.
205
220
  */
206
- getDescent(size) { return this.metric(1, size); }
221
+ getDescent(size) {
222
+ return this.metric(1, size);
223
+ }
207
224
  /**
208
225
  * Returns recommended baseline spacing for the specified pixel character
209
226
  * size.
@@ -211,21 +228,27 @@ class Font {
211
228
  * @ja 指定ピクセル文字サイズでの推奨ベースライン間隔を返します。
212
229
  * @ko 지정한 픽셀 글자 크기의 권장 기준선 간격을 반환합니다.
213
230
  */
214
- getLineSpacing(size) { return this.metric(2, size); }
231
+ getLineSpacing(size) {
232
+ return this.metric(2, size);
233
+ }
215
234
  /**
216
235
  * Returns the underline position relative to the baseline in pixels.
217
236
  * @zh 返回下划线相对基线的位置,单位为像素。
218
237
  * @ja ベースラインに対する下線位置をピクセル単位で返します。
219
238
  * @ko 기준선에 대한 밑줄 위치를 픽셀 단위로 반환합니다.
220
239
  */
221
- getUnderlinePosition(size) { return this.metric(3, size); }
240
+ getUnderlinePosition(size) {
241
+ return this.metric(3, size);
242
+ }
222
243
  /**
223
244
  * Returns the underline thickness in pixels.
224
245
  * @zh 返回下划线厚度,单位为像素。
225
246
  * @ja 下線の太さをピクセル単位で返します。
226
247
  * @ko 밑줄 두께를 픽셀 단위로 반환합니다.
227
248
  */
228
- getUnderlineThickness(size) { return this.metric(4, size); }
249
+ getUnderlineThickness(size) {
250
+ return this.metric(4, size);
251
+ }
229
252
  /**
230
253
  * Returns a read-only glyph atlas texture reference for the specified pixel
231
254
  * character size; loading more glyphs may update its contents.
@@ -252,8 +275,9 @@ class Font {
252
275
  */
253
276
  setSmooth(smooth) {
254
277
  flag(smooth);
255
- if (smooth === this.state.sampling.smooth)
278
+ if (smooth === this.state.sampling.smooth) {
256
279
  return;
280
+ }
257
281
  (0, graphics_state_1.flushGraphics)();
258
282
  native_1.native.setFontSmooth(this[graphics_state_1.graphicsNative], smooth);
259
283
  }
@@ -263,12 +287,15 @@ class Font {
263
287
  * @ja フォントテクスチャで平滑化フィルタリングが有効かを返します。
264
288
  * @ko 글꼴 텍스처의 부드러운 필터링 사용 여부를 반환합니다.
265
289
  */
266
- isSmooth() { return this.state.sampling.smooth; }
290
+ isSmooth() {
291
+ return this.state.sampling.smooth;
292
+ }
267
293
  metric(metric, size) {
268
294
  fontUnsigned(size);
269
295
  let values = this.metrics.get(size);
270
- if (!values)
271
- this.metrics.set(size, values = []);
296
+ if (!values) {
297
+ this.metrics.set(size, (values = []));
298
+ }
272
299
  let value = values[metric];
273
300
  if (value === undefined) {
274
301
  value = native_1.native.fontMetric(this[graphics_state_1.graphicsNative], metric, size);
@@ -293,10 +320,12 @@ class Font {
293
320
  open(input) {
294
321
  return new Promise((resolve, reject) => {
295
322
  native_1.native.openFont(input, (error, data) => {
296
- if (error)
323
+ if (error) {
297
324
  return reject(error);
298
- if (!data)
325
+ }
326
+ if (!data) {
299
327
  return resolve(false);
328
+ }
300
329
  try {
301
330
  (0, graphics_state_1.flushGraphics)();
302
331
  this.state = fontViews(native_1.native.commitFont(this[graphics_state_1.graphicsNative], data));
@@ -40,8 +40,9 @@ class Matrix extends glsl_value_1.GlslValue {
40
40
  // Copy the nine SFML entries as bits, including signed zero and NaN.
41
41
  const input = new Uint32Array(data.buffer, data.byteOffset, 16);
42
42
  const output = new Uint32Array(values.buffer);
43
- for (let i = 0; i < 9; i++)
43
+ for (let i = 0; i < 9; i++) {
44
44
  output[i] = input[transform3Indices[i]];
45
+ }
45
46
  }
46
47
  }
47
48
  else if (source instanceof Matrix) {
@@ -57,14 +58,18 @@ class Matrix extends glsl_value_1.GlslValue {
57
58
  * @ja 列優先の行列データの変更可能な共有ビュー。
58
59
  * @ko 열 우선 행렬 데이터의 수정 가능한 공유 뷰입니다.
59
60
  */
60
- get array() { return this[glsl_value_1.glslStorage]; }
61
+ get array() {
62
+ return this[glsl_value_1.glslStorage];
63
+ }
61
64
  /**
62
65
  * Copies an array of the same length into existing matrix storage.
63
66
  * @zh 复制同长度数组到矩阵的现有存储。
64
67
  * @ja 同じ長さの配列を行列の既存ストレージにコピーします。
65
68
  * @ko 길이가 같은 배열을 기존 행렬 저장 공간에 복사합니다.
66
69
  */
67
- set array(source) { copyArray(this[glsl_value_1.glslStorage], source); }
70
+ set array(source) {
71
+ copyArray(this[glsl_value_1.glslStorage], source);
72
+ }
68
73
  }
69
74
  /**
70
75
  * GLSL mat3 with nine column-major float32 components.
@@ -63,63 +63,81 @@ class Vector4 extends glsl_value_1.GlslValue {
63
63
  * @ja 成分の格納型。i32 または f32。
64
64
  * @ko 성분의 저장 형식은 i32 또는 f32입니다.
65
65
  */
66
- get scalarType() { return this.type; }
66
+ get scalarType() {
67
+ return this.type;
68
+ }
67
69
  /**
68
70
  * X component.
69
71
  * @zh X 分量。
70
72
  * @ja X 成分。
71
73
  * @ko X 성분입니다.
72
74
  */
73
- get x() { return this[glsl_value_1.glslStorage][0]; }
75
+ get x() {
76
+ return this[glsl_value_1.glslStorage][0];
77
+ }
74
78
  /**
75
79
  * Sets the X component, converting to the storage type.
76
80
  * @zh 设置 X 分量,按存储类型转换。
77
81
  * @ja X 成分を格納型に変換して設定します。
78
82
  * @ko X 성분을 저장 형식으로 변환하여 설정합니다.
79
83
  */
80
- set x(value) { this[glsl_value_1.glslStorage][0] = value; }
84
+ set x(value) {
85
+ this[glsl_value_1.glslStorage][0] = value;
86
+ }
81
87
  /**
82
88
  * Y component.
83
89
  * @zh Y 分量。
84
90
  * @ja Y 成分。
85
91
  * @ko Y 성분입니다.
86
92
  */
87
- get y() { return this[glsl_value_1.glslStorage][1]; }
93
+ get y() {
94
+ return this[glsl_value_1.glslStorage][1];
95
+ }
88
96
  /**
89
97
  * Sets the Y component, converting to the storage type.
90
98
  * @zh 设置 Y 分量,按存储类型转换。
91
99
  * @ja Y 成分を格納型に変換して設定します。
92
100
  * @ko Y 성분을 저장 형식으로 변환하여 설정합니다.
93
101
  */
94
- set y(value) { this[glsl_value_1.glslStorage][1] = value; }
102
+ set y(value) {
103
+ this[glsl_value_1.glslStorage][1] = value;
104
+ }
95
105
  /**
96
106
  * Z component.
97
107
  * @zh Z 分量。
98
108
  * @ja Z 成分。
99
109
  * @ko Z 성분입니다.
100
110
  */
101
- get z() { return this[glsl_value_1.glslStorage][2]; }
111
+ get z() {
112
+ return this[glsl_value_1.glslStorage][2];
113
+ }
102
114
  /**
103
115
  * Sets the Z component, converting to the storage type.
104
116
  * @zh 设置 Z 分量,按存储类型转换。
105
117
  * @ja Z 成分を格納型に変換して設定します。
106
118
  * @ko Z 성분을 저장 형식으로 변환하여 설정합니다.
107
119
  */
108
- set z(value) { this[glsl_value_1.glslStorage][2] = value; }
120
+ set z(value) {
121
+ this[glsl_value_1.glslStorage][2] = value;
122
+ }
109
123
  /**
110
124
  * W component.
111
125
  * @zh W 分量。
112
126
  * @ja W 成分。
113
127
  * @ko W 성분입니다.
114
128
  */
115
- get w() { return this[glsl_value_1.glslStorage][3]; }
129
+ get w() {
130
+ return this[glsl_value_1.glslStorage][3];
131
+ }
116
132
  /**
117
133
  * Sets the W component, converting to the storage type.
118
134
  * @zh 设置 W 分量,按存储类型转换。
119
135
  * @ja W 成分を格納型に変換して設定します。
120
136
  * @ko W 성분을 저장 형식으로 변환하여 설정합니다.
121
137
  */
122
- set w(value) { this[glsl_value_1.glslStorage][3] = value; }
138
+ set w(value) {
139
+ this[glsl_value_1.glslStorage][3] = value;
140
+ }
123
141
  }
124
142
  /**
125
143
  * GLSL vec4 with four float32 components.
@@ -135,7 +153,9 @@ class Vec4 extends Vector4 {
135
153
  * @ja ゼロベクトルを作成するか、四成分を指定するか、ベクトルをコピーします。Color からの作成では RGBA を [0, 1] に正規化します。
136
154
  * @ko 영벡터를 만들거나 네 성분을 지정하거나 벡터를 복사합니다. Color로 만들면 RGBA를 [0, 1]로 정규화합니다.
137
155
  */
138
- constructor(...args) { super('f32', ...args); }
156
+ constructor(...args) {
157
+ super('f32', ...args);
158
+ }
139
159
  }
140
160
  exports.Vec4 = Vec4;
141
161
  /**
@@ -152,7 +172,9 @@ class Ivec4 extends Vector4 {
152
172
  * @ja ゼロベクトルを作成するか、四成分を指定するか、ベクトルをコピーします。Color からの作成では 0~255 の RGBA を保持します。
153
173
  * @ko 영벡터를 만들거나 네 성분을 지정하거나 벡터를 복사합니다. Color로 만들면 0~255의 RGBA 값을 유지합니다.
154
174
  */
155
- constructor(...args) { super('i32', ...args); }
175
+ constructor(...args) {
176
+ super('i32', ...args);
177
+ }
156
178
  }
157
179
  exports.Ivec4 = Ivec4;
158
180
  /**
@@ -176,7 +198,8 @@ class Bvec4 extends glsl_value_1.BooleanComponents {
176
198
  }
177
199
  else if (args.length === 0 ||
178
200
  (args.length === 4 && args.every(value => typeof value === 'boolean'))) {
179
- super(args.length === 0 ? [false, false, false, false]
201
+ super(args.length === 0
202
+ ? [false, false, false, false]
180
203
  : args, buffer => native_1.native.wrapVector4('bool', buffer));
181
204
  }
182
205
  else {
@@ -189,27 +212,35 @@ class Bvec4 extends glsl_value_1.BooleanComponents {
189
212
  * @ja Z ブール成分。
190
213
  * @ko Z 불리언 성분입니다.
191
214
  */
192
- get z() { return this[glsl_value_1.glslStorage][2] !== 0; }
215
+ get z() {
216
+ return this[glsl_value_1.glslStorage][2] !== 0;
217
+ }
193
218
  /**
194
219
  * Sets the Z component.
195
220
  * @zh 设置 Z 分量。
196
221
  * @ja Z 成分を設定します。
197
222
  * @ko Z 성분을 설정합니다.
198
223
  */
199
- set z(value) { this[glsl_value_1.glslStorage][2] = value ? 1 : 0; }
224
+ set z(value) {
225
+ this[glsl_value_1.glslStorage][2] = value ? 1 : 0;
226
+ }
200
227
  /**
201
228
  * W boolean component.
202
229
  * @zh W 布尔分量。
203
230
  * @ja W ブール成分。
204
231
  * @ko W 불리언 성분입니다.
205
232
  */
206
- get w() { return this[glsl_value_1.glslStorage][3] !== 0; }
233
+ get w() {
234
+ return this[glsl_value_1.glslStorage][3] !== 0;
235
+ }
207
236
  /**
208
237
  * Sets the W component.
209
238
  * @zh 设置 W 分量。
210
239
  * @ja W 成分を設定します。
211
240
  * @ko W 성분을 설정합니다.
212
241
  */
213
- set w(value) { this[glsl_value_1.glslStorage][3] = value ? 1 : 0; }
242
+ set w(value) {
243
+ this[glsl_value_1.glslStorage][3] = value ? 1 : 0;
244
+ }
214
245
  }
215
246
  exports.Bvec4 = Bvec4;