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
package/docs/system.md DELETED
@@ -1,173 +0,0 @@
1
- # System
2
-
3
- **English** ยท [็ฎ€ไฝ“ไธญๆ–‡](system.zh-CN.md) ยท [ๆ—ฅๆœฌ่ชž](system.ja.md) ยท [ํ•œ๊ตญ์–ด](system.ko.md)
4
-
5
- > System provides value types, time, input streams, Unicode boundaries and error handling. Ordinary numeric calculations run in JS; resource-related operations enter native code through the relevant APIs.
6
-
7
- [API guide](api.md) ยท [Core concepts](concepts.md)
8
-
9
- ## Vectors and operations
10
-
11
- ```typescript
12
- import { Vector2f, Vector2i, add, multiply, addAssign } from 'sfml.js';
13
-
14
- const position = new Vector2f(10, 20);
15
- const velocity = new Vector2f(2, 3);
16
- const next = add(position, velocity);
17
- const doubled = multiply(velocity, 2);
18
- addAssign(position, velocity);
19
- const pixels = new Vector2i(position);
20
- ```
21
-
22
- Ordinary operations return independent values; `*Assign` modifies and returns the left operand. Assignment does not automatically convert a vector's scalar type; use the corresponding constructor for conversion.
23
-
24
- | Scalar tag | JS component type | Storage |
25
- | --- | --- | --- |
26
- | `i8`/`u8` | number | Int8Array/Uint8Array |
27
- | `i16`/`u16` | number | Int16Array/Uint16Array |
28
- | `i32`/`u32` | number | Int32Array/Uint32Array |
29
- | `i64`/`u64` | bigint | BigInt64Array/BigUint64Array |
30
- | `f32`/`f64` | number | Float32Array/Float64Array |
31
-
32
- `Vector2i/u/f` and `Vector3i/u/f` correspond to i32/u32/f32. For other scalars, use forms such as `new Vector2('f64', x, y)`.
33
-
34
- Both vector types provide `lengthSquared()`, `dot()`, `cross()` and component-wise multiplication and division; 2D vectors also provide `perpendicular()`. Floating-point vectors provide `length()` and `normalized()`, with additional angle, rotation and projection operations for floating-point 2D vectors. Integer vectors do not support floating-point-only methods.
35
-
36
- Vector `multiply()`/`divide()` use scalars; use `componentWiseMul()`/`componentWiseDiv()` for component-wise operations. Zero divisors, normalizing a zero vector and projecting onto a zero axis throw errors. 64-bit integer calculations retain bigint; f32 calculations round according to SFML precision rules, with limited platform math-library differences allowed for trigonometric operations.
37
-
38
- ## Angles
39
-
40
- ```typescript
41
- import { Angle, degrees, radians, divide } from 'sfml.js';
42
-
43
- const heading = degrees(90);
44
- const turn = radians(Math.PI);
45
- const copy = new Angle(heading);
46
- const ratio = divide(turn, heading);
47
- console.log(copy.asDegrees(), ratio);
48
- ```
49
-
50
- Rotation APIs accept Angle. `wrapSigned()` and `wrapUnsigned()` return wrapped angles; comparisons do not wrap automatically. `Angle.Zero` is a read-only constant; copy it before modifying it. Angle uses float32, and modulo requires a positive divisor.
51
-
52
- ## Time and clocks
53
-
54
- ```typescript
55
- import { Clock, milliseconds, microseconds, sleep } from 'sfml.js';
56
-
57
- const clock = new Clock();
58
- await sleep(milliseconds(16));
59
- const elapsed = clock.restart();
60
- console.log(elapsed.asSeconds(), elapsed.asMicroseconds());
61
- console.log(microseconds(1000n).asMilliseconds());
62
- ```
63
-
64
- | API | Semantics |
65
- | --- | --- |
66
- | `new Time()`/`new Time(source)`/`new Time(bigint)` | Construct zero duration, a copy or a microsecond value |
67
- | `seconds(number)` | Convert seconds to Time |
68
- | `milliseconds(number)` | int32 millisecond input, with fractions truncated toward zero |
69
- | `microseconds(bigint)` | Microsecond input |
70
- | `asMicroseconds()`/`toDuration()` | Microsecond bigint |
71
- | `asSeconds()`/`asMilliseconds()` | float32 seconds/int32 milliseconds |
72
- | `Clock.start()`/`stop()` | Resume/pause timing |
73
- | `Clock.restart()`/`reset()` | Return previous elapsed time, then zero and run/pause |
74
-
75
- Time stores signed int64 microseconds, using bigint for integer scaling and number for floating-point scaling. `Time.Zero` is a read-only constant. Out-of-range values and invalid division throw RangeError; failed in-place operations preserve the original value.
76
-
77
- Clock uses `process.hrtime.bigint()` and returns independent Time snapshots. It has no timer of its own; clock resolution and system-suspend semantics are determined by Node.js and the platform.
78
-
79
- `sleep(time)` returns a promise and waits using a Node timer without blocking the event loop. Positive durations round up to milliseconds; zero and negative durations complete immediately. Actual resumption time depends on scheduling.
80
-
81
- ### Timeout configuration
82
-
83
- `TimeoutWithPredicate` stores a polling period and predicate; it does not start a timer itself:
84
-
85
- - `new TimeoutWithPredicate(time)`: fixed period; the predicate always returns false.
86
- - `new TimeoutWithPredicate(predicate, period?)`: default period of 1 ms; true means continue waiting.
87
- - `getPeriod()` returns a read-only Time, and `getPredicate()` returns the original function.
88
-
89
- The receiving API determines when checks occur. SFTP currently uses it to control waiting without progress; see [Network](network.md#sftp).
90
-
91
- `SuspendAwareClock.now()` returns a native nanosecond time point that includes system suspend time. Only the Android branch supports it; desktop calls throw SFMLError. The current automatic download flow has no Android build target.
92
-
93
- ## Colors, rectangles and vertices
94
-
95
- | Type | Construction and main operations |
96
- | --- | --- |
97
- | Color | RGB/RGBA, `0xRRGGBBAA`, copying; `r/g/b/a`, `toInteger()` |
98
- | FloatRect/IntRect | `position` + `size`, copying, explicit conversion; `contains()`, `findIntersection()`, `getCenter()` |
99
- | Vertex | `position`, `color`, `texCoords`, or copy construction |
100
-
101
- These values are primarily used by graphics APIs. Color components are stored as uint8, and direct writes narrow to that type. Color addition and subtraction saturate; multiplication computes `floor(a * b / 255)` per channel. Color constants are read-only.
102
-
103
- Rectangle and vertex members are shared views. Rectangles include the left and top edges and exclude the right and bottom edges. Negative sizes use normalized bounds; an intersection without positive area returns `undefined`. Vertex defaults to zero position and texture coordinates, with white color.
104
-
105
- <a id="input-streams"></a>
106
-
107
- ## Input streams
108
-
109
- InputStream is a seekable byte-stream protocol whose methods may return synchronous values or promises:
110
-
111
- | Method | Return value |
112
- | --- | --- |
113
- | `read(data)` | Writes into a Uint8Array and returns the actual byte count as bigint; EOF is `0n` |
114
- | `seek(position)` | Actual byte position as bigint |
115
- | `tell()` | Current byte position as bigint |
116
- | `getSize()` | Total byte count as bigint |
117
-
118
- `undefined` indicates I/O failure; thrown errors propagate unchanged. Any object implementing these four methods can also be passed as a stream; a Node Readable needs an additional adapter to support seeking.
119
-
120
- `MemoryInputStream(data)` retains a reference to the input bytes. Keep contents unchanged during loading and give each operation exclusive cursor access. `FileInputStream` uses a Node file handle, serializing asynchronous I/O and seeking per object:
121
-
122
- ```typescript
123
- import { FileInputStream, Image } from 'sfml.js';
124
-
125
- async function readImage(filename: string) {
126
- const stream = new FileInputStream();
127
- try {
128
- if (!await stream.open(filename)) throw new Error('Cannot open file');
129
- const image = new Image();
130
- if (!await image.loadFromStream(stream)) throw new Error('Cannot decode image');
131
- return image;
132
- } finally {
133
- await stream.close();
134
- }
135
- }
136
- ```
137
-
138
- Wait for loading to finish before closing the stream. Await multiple loads on the same stream sequentially. FileInputStream supports file offsets from 0 to 2^53 - 1; EOF does not automatically close the file, so seeking again is allowed.
139
-
140
- ## Unicode and version
141
-
142
- `Unicode.isGraphemeBoundary(text, position)`, `isWordBoundary()` and `isSentenceBoundary()` use SFML's Unicode rules. position is a UTF-16 index into a JS string, ranging from 0 to `text.length`; the middle of a surrogate pair is not a boundary.
143
-
144
- `version()` returns a cached, read-only SFML runtime version containing `major`, `minor`, `patch`, `isRelease` and `string`. It is not the npm package version.
145
-
146
- ## Errors and logging
147
-
148
- SFMLError indicates a binding or SFML runtime failure; test it with `instanceof SFMLError`. Argument errors use TypeError/RangeError; errors thrown by user callbacks propagate unchanged. Ordinary SFML failure statuses remain false/undefined rather than all being converted to exceptions.
149
-
150
- `err()` returns a singleton Node Writable that writes to `sf::err()`. `setErrorOutput(writable)` redirects SFML logs; pass null to silence them, or no arguments to restore the default stderr:
151
-
152
- ```typescript
153
- import { createWriteStream } from 'node:fs';
154
- import { finished } from 'node:stream/promises';
155
- import { err, setErrorOutput } from 'sfml.js';
156
-
157
- const output = createWriteStream('sfml.log');
158
- setErrorOutput(output);
159
- err().write('SFML diagnostic\n');
160
- setErrorOutput();
161
- output.end();
162
- await finished(output);
163
- ```
164
-
165
- Log routing is process-wide, and Workers share the latest setting; Node's own stderr is unaffected. Background logs are dispatched in byte chunks without guaranteed UTF-8 character or line boundaries; use StringDecoder when parsing text.
166
-
167
- <a id="sfml-cpp-reference"></a>
168
-
169
- ## SFML C++ reference
170
-
171
- The original references for [Vector2](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1Vector2.html), [Angle](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1Angle.html), [Time](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1Time.html), [Clock](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1Clock.html) and [InputStream](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1InputStream.html) describe the upstream math, time and stream concepts.
172
-
173
- For JavaScript, follow this guide's named operators, bigint time representation, promise-based sleep and stream method contracts rather than copying C++ signatures.
@@ -1,173 +0,0 @@
1
- # System
2
-
3
- [English](system.md) ยท **็ฎ€ไฝ“ไธญๆ–‡** ยท [ๆ—ฅๆœฌ่ชž](system.ja.md) ยท [ํ•œ๊ตญ์–ด](system.ko.md)
4
-
5
- > System ๆไพ›ๅ€ผ็ฑปๅž‹ใ€ๆ—ถ้—ดใ€่พ“ๅ…ฅๆตใ€Unicode ่พน็•Œๅ’Œ้”™่ฏฏๅค„็†ใ€‚ๆ™ฎ้€šๆ•ฐๅ€ผ่ฎก็ฎ—ๅœจ JS ไธญๅฎŒๆˆ๏ผŒ่ต„ๆบ็›ธๅ…ณๆ“ไฝœๆŒ‰ๆŽฅๅฃ่ฟ›ๅ…ฅ Nativeใ€‚
6
-
7
- [API ๅฏผ่ˆช](api.zh-CN.md) ยท [ๆ ธๅฟƒๆฆ‚ๅฟต](concepts.zh-CN.md)
8
-
9
- ## ๅ‘้‡ไธŽ่ฟ็ฎ—
10
-
11
- ```typescript
12
- import { Vector2f, Vector2i, add, multiply, addAssign } from 'sfml.js';
13
-
14
- const position = new Vector2f(10, 20);
15
- const velocity = new Vector2f(2, 3);
16
- const next = add(position, velocity);
17
- const doubled = multiply(velocity, 2);
18
- addAssign(position, velocity);
19
- const pixels = new Vector2i(position);
20
- ```
21
-
22
- ๆ™ฎ้€š่ฟ็ฎ—่ฟ”ๅ›ž็‹ฌ็ซ‹ๅ€ผ๏ผŒ`*Assign` ไฟฎๆ”นๅทฆๆ“ไฝœๆ•ฐๅนถ่ฟ”ๅ›žๅฎƒใ€‚่ต‹ๅ€ผไธ่‡ชๅŠจ่ฝฌๆขๅ‘้‡็š„ๆ ‡้‡็ฑปๅž‹๏ผ›้œ€่ฆ่ฝฌๆขๆ—ถไฝฟ็”จๅฏนๅบ”ๆž„้€ ๅ‡ฝๆ•ฐใ€‚
23
-
24
- | ๆ ‡้‡ๆ ‡็ญพ | JS ๅˆ†้‡็ฑปๅž‹ | ๅญ˜ๅ‚จ |
25
- | --- | --- | --- |
26
- | `i8`๏ผ`u8` | number | Int8Array๏ผUint8Array |
27
- | `i16`๏ผ`u16` | number | Int16Array๏ผUint16Array |
28
- | `i32`๏ผ`u32` | number | Int32Array๏ผUint32Array |
29
- | `i64`๏ผ`u64` | bigint | BigInt64Array๏ผBigUint64Array |
30
- | `f32`๏ผ`f64` | number | Float32Array๏ผFloat64Array |
31
-
32
- `Vector2i/u/f` ๅ’Œ `Vector3i/u/f` ๅˆ†ๅˆซๅฏนๅบ” i32๏ผu32๏ผf32ใ€‚ๅ…ถไป–ๆ ‡้‡ไฝฟ็”จ `new Vector2('f64', x, y)` ็ญ‰ๅฝขๅผใ€‚
33
-
34
- ไธค็งๅ‘้‡ๆไพ› `lengthSquared()`ใ€`dot()`ใ€`cross()` ๅ’Œ้€ๅˆ†้‡ไน˜้™ค๏ผŒไบŒ็ปดๅ‘้‡ๅฆๆœ‰ `perpendicular()`ใ€‚ๆตฎ็‚นๅ‘้‡ๆไพ› `length()` ไธŽ `normalized()`๏ผŒๆตฎ็‚นไบŒ็ปดๅ‘้‡่ฟ˜ๆไพ›่ง’ๅบฆใ€ๆ—‹่ฝฌๅ’ŒๆŠ•ๅฝฑๆ“ไฝœใ€‚ๆ•ดๆ•ฐๅ‘้‡ไธๆ”ฏๆŒๆตฎ็‚นไธ“ๅฑžๆ–นๆณ•ใ€‚
35
-
36
- ๅ‘้‡็š„ `multiply()`๏ผ`divide()` ไฝฟ็”จๆ ‡้‡๏ผŒ้€ๅˆ†้‡ๆ“ไฝœไฝฟ็”จ `componentWiseMul()`๏ผ`componentWiseDiv()`ใ€‚้›ถ้™คๆ•ฐใ€้›ถๅ‘้‡ๅฝ’ไธ€ๅŒ–ๅ’Œๅ‘้›ถ่ฝดๆŠ•ๅฝฑไผšๆŠ›้”™ใ€‚64 ไฝๆ•ดๆ•ฐ่ฎก็ฎ—ไฟ็•™ bigint๏ผ›f32 ่ฎก็ฎ—ๆŒ‰ SFML ็š„็ฒพๅบฆ่ง„ๅˆ™่ˆๅ…ฅ๏ผŒไธ‰่ง’่ฟ็ฎ—ๅ…่ฎธๅนณๅฐๆ•ฐๅญฆๅบ“็š„ๆœ‰้™ๅทฎๅผ‚ใ€‚
37
-
38
- ## ่ง’ๅบฆ
39
-
40
- ```typescript
41
- import { Angle, degrees, radians, divide } from 'sfml.js';
42
-
43
- const heading = degrees(90);
44
- const turn = radians(Math.PI);
45
- const copy = new Angle(heading);
46
- const ratio = divide(turn, heading);
47
- console.log(copy.asDegrees(), ratio);
48
- ```
49
-
50
- ๆ—‹่ฝฌๆŽฅๅฃๆŽฅๅ— Angleใ€‚`wrapSigned()`ใ€`wrapUnsigned()` ่ฟ”ๅ›žๆŠ˜ๅ›žๅŽ็š„่ง’ๅบฆ๏ผ›ๆฏ”่พƒไธไผš่‡ชๅŠจๆŠ˜ๅ›žใ€‚`Angle.Zero` ไธบๅช่ฏปๅธธ้‡๏ผŒๅคๅˆถๅŽๅฏไฟฎๆ”นใ€‚Angle ไฝฟ็”จ float32๏ผŒๅ–ๆจก่ฆๆฑ‚ๆญฃ้™คๆ•ฐใ€‚
51
-
52
- ## ๆ—ถ้—ดไธŽๆ—ถ้’Ÿ
53
-
54
- ```typescript
55
- import { Clock, milliseconds, microseconds, sleep } from 'sfml.js';
56
-
57
- const clock = new Clock();
58
- await sleep(milliseconds(16));
59
- const elapsed = clock.restart();
60
- console.log(elapsed.asSeconds(), elapsed.asMicroseconds());
61
- console.log(microseconds(1000n).asMilliseconds());
62
- ```
63
-
64
- | ๆŽฅๅฃ | ่ฏญไน‰ |
65
- | --- | --- |
66
- | `new Time()`๏ผ`new Time(source)`๏ผ`new Time(bigint)` | ้›ถๆ—ถ้•ฟใ€ๅคๅˆถใ€ๅพฎ็ง’ๆž„้€  |
67
- | `seconds(number)` | ็ง’่ฝฌๆขไธบ Time |
68
- | `milliseconds(number)` | int32 ๆฏซ็ง’่พ“ๅ…ฅ๏ผŒๅฐๆ•ฐๅ‘้›ถๆˆชๆ–ญ |
69
- | `microseconds(bigint)` | ๅพฎ็ง’่พ“ๅ…ฅ |
70
- | `asMicroseconds()`๏ผ`toDuration()` | ๅพฎ็ง’ bigint |
71
- | `asSeconds()`๏ผ`asMilliseconds()` | float32 ็ง’๏ผint32 ๆฏซ็ง’ |
72
- | `Clock.start()`๏ผ`stop()` | ็ปง็ปญ๏ผๆš‚ๅœ่ฎกๆ—ถ |
73
- | `Clock.restart()`๏ผ`reset()` | ่ฟ”ๅ›žๅŽŸ่€—ๆ—ถ๏ผŒๆธ…้›ถๅŽ่ฟ่กŒ๏ผๆš‚ๅœ |
74
-
75
- Time ไฟๅญ˜ๆœ‰็ฌฆๅท int64 ๅพฎ็ง’๏ผŒๆ•ดๆ•ฐๅ€่ฟ็ฎ—ไฝฟ็”จ bigint๏ผŒๆตฎ็‚นๅ€ๆ•ฐไฝฟ็”จ numberใ€‚`Time.Zero` ไธบๅช่ฏปๅธธ้‡ใ€‚่ถ…่Œƒๅ›ดๅ’Œ้žๆณ•้™คๆณ•ๆŠ›ๅ‡บ RangeError๏ผŒๅคฑ่ดฅ็š„ๅŽŸไฝ่ฟ็ฎ—ไฟ็•™ๅŽŸๅ€ผใ€‚
76
-
77
- Clock ไฝฟ็”จ `process.hrtime.bigint()`๏ผŒ่ฟ”ๅ›ž็‹ฌ็ซ‹ Time ๅฟซ็…งใ€‚ๅฎƒๆฒกๆœ‰่‡ชๅทฑ็š„ๅฎšๆ—ถๅ™จ๏ผŒๆ—ถ้’Ÿๅˆ†่พจ็އไธŽ็ณป็ปŸไผ‘็œ ่ฏญไน‰็”ฑ Node.js ๅ’Œๅนณๅฐๅ†ณๅฎšใ€‚
78
-
79
- `sleep(time)` ่ฟ”ๅ›ž Promise๏ผŒ้€š่ฟ‡ Node ๅฎšๆ—ถๅ™จ็ญ‰ๅพ…๏ผŒไธ้˜ปๅกžไบ‹ไปถๅพช็Žฏใ€‚ๆญฃๆ—ถ้•ฟๅ‘ไธŠๅ–ๆ•ดๅˆฐๆฏซ็ง’๏ผ›้›ถไธŽ่ดŸๆ—ถ้•ฟ็›ดๆŽฅๅฎŒๆˆ๏ผŒๅฎž้™…ๆขๅคๆ—ถ้—ดๅ—่ฐƒๅบฆๅฝฑๅ“ใ€‚
80
-
81
- ### ่ถ…ๆ—ถ้…็ฝฎ
82
-
83
- `TimeoutWithPredicate` ไฟๅญ˜ๆฃ€ๆŸฅๅ‘จๆœŸไธŽ่ฐ“่ฏ๏ผŒๆœฌ่บซไธๅฏๅŠจ่ฎกๆ—ถๅ™จ๏ผš
84
-
85
- - `new TimeoutWithPredicate(time)`๏ผšๅ›บๅฎšๅ‘จๆœŸ๏ผŒ่ฐ“่ฏๅง‹็ปˆ่ฟ”ๅ›ž falseใ€‚
86
- - `new TimeoutWithPredicate(predicate, period?)`๏ผš้ป˜่ฎคๅ‘จๆœŸ 1 ms๏ผŒtrue ่กจ็คบ็ปง็ปญ็ญ‰ๅพ…ใ€‚
87
- - `getPeriod()` ่ฟ”ๅ›žๅช่ฏป Time๏ผŒ`getPredicate()` ่ฟ”ๅ›žๅŽŸๅ‡ฝๆ•ฐใ€‚
88
-
89
- ๆŽฅๆ”ถๅฎƒ็š„ๆŽฅๅฃๅ†ณๅฎšไฝ•ๆ—ถๆฃ€ๆŸฅ๏ผŒๅฝ“ๅ‰ SFTP ไฝฟ็”จๅฎƒๆŽงๅˆถๆ— ่ฟ›ๅฑ•็ญ‰ๅพ…๏ผŒ่ฏฆ่ง [Network](network.zh-CN.md#sftp)ใ€‚
90
-
91
- `SuspendAwareClock.now()` ่ฟ”ๅ›žๅŒ…ๅซ็ณป็ปŸไผ‘็œ ๆ—ถ้—ด็š„ๅŽŸ็”Ÿ็บณ็ง’ๆ—ถ้—ด็‚น๏ผŒไป… Android ๅˆ†ๆ”ฏๆ”ฏๆŒ๏ผ›ๆกŒ้ข่ฐƒ็”จๆŠ›ๅ‡บ SFMLErrorใ€‚ๅฝ“ๅ‰่‡ชๅŠจไธ‹่ฝฝๆต็จ‹ๆฒกๆœ‰ Android ๆž„ๅปบ็›ฎๆ ‡ใ€‚
92
-
93
- ## ้ขœ่‰ฒใ€็ŸฉๅฝขไธŽ้กถ็‚น
94
-
95
- | ็ฑปๅž‹ | ๆž„้€ ไธŽไธป่ฆๆ“ไฝœ |
96
- | --- | --- |
97
- | Color | RGB๏ผRGBAใ€`0xRRGGBBAA`ใ€ๅคๅˆถ๏ผ›`r/g/b/a`ใ€`toInteger()` |
98
- | FloatRect๏ผIntRect | `position` + `size`ใ€ๅคๅˆถใ€ๆ˜พๅผ่ฝฌๆข๏ผ›`contains()`ใ€`findIntersection()`ใ€`getCenter()` |
99
- | Vertex | `position`ใ€`color`ใ€`texCoords`๏ผŒๆˆ–ๅคๅˆถๆž„้€  |
100
-
101
- ่ฟ™ไบ›ๅ€ผไธป่ฆ็”จไบŽๅ›พๅฝขๆŽฅๅฃใ€‚Color ๅˆ†้‡ๆŒ‰ uint8 ๅญ˜ๅ‚จ๏ผŒ็›ดๆŽฅๅ†™ๅ…ฅไผš็ช„ๅŒ–๏ผ›้ขœ่‰ฒๅŠ ๅ‡ๆ˜ฏ้ฅฑๅ’Œ่ฟ็ฎ—๏ผŒ้ขœ่‰ฒ็›ธไน˜ๆŒ‰้€š้“่ฎก็ฎ— `floor(a * b / 255)`ใ€‚Color ๅธธ้‡ๅช่ฏปใ€‚
102
-
103
- ็Ÿฉๅฝขๆˆๅ‘˜ๅ’Œ้กถ็‚นๆˆๅ‘˜ๆ˜ฏๅ…ฑไบซ่ง†ๅ›พใ€‚็ŸฉๅฝขๅŒ…ๅซๅทฆใ€ไธŠ่พน็•Œ๏ผŒๆŽ’้™คๅณใ€ไธ‹่พน็•Œ๏ผ›่ดŸๅฐบๅฏธๆŒ‰ๅฝ’ไธ€ๅŒ–่Œƒๅ›ด่ฎก็ฎ—๏ผŒไบค้›†ๆ— ๆญฃ้ข็งฏๆ—ถ่ฟ”ๅ›ž `undefined`ใ€‚Vertex ้ป˜่ฎคไฝ็ฝฎใ€็บน็†ๅๆ ‡ไธบ้›ถ๏ผŒ้ขœ่‰ฒไธบ็™ฝ่‰ฒใ€‚
104
-
105
- <a id="input-streams"></a>
106
-
107
- ## ่พ“ๅ…ฅๆต
108
-
109
- InputStream ๆ˜ฏๅฏๅฏปๅ€ๅญ—่Š‚ๆตๅ่ฎฎ๏ผŒๆ–นๆณ•ๅฏ่ฟ”ๅ›žๅŒๆญฅๅ€ผๆˆ– Promise๏ผš
110
-
111
- | ๆ–นๆณ• | ่ฟ”ๅ›žๅ€ผ |
112
- | --- | --- |
113
- | `read(data)` | ๅ†™ๅ…ฅ Uint8Array๏ผŒ่ฟ”ๅ›žๅฎž้™…ๅญ—่Š‚ๆ•ฐ bigint๏ผ›EOF ไธบ `0n` |
114
- | `seek(position)` | ่ฟ”ๅ›žๅฎž้™…ๅญ—่Š‚ไฝ็ฝฎ bigint |
115
- | `tell()` | ๅฝ“ๅ‰ๅญ—่Š‚ไฝ็ฝฎ bigint |
116
- | `getSize()` | ๆ€ปๅญ—่Š‚ๆ•ฐ bigint |
117
-
118
- `undefined` ่กจ็คบ I/O ๅคฑ่ดฅ๏ผŒๆŠ›ๅ‡บ็š„้”™่ฏฏๅŽŸๆ ทไผ ๆ’ญใ€‚ๅฎž็Žฐ่ฟ™ๅ››ไธชๆ–นๆณ•็š„ๅฏน่ฑกไนŸๅฏไปฅไฝœไธบๆตไผ ๅ…ฅ๏ผ›Node Readable ้œ€้ขๅค–้€‚้…ๅฏปๅ€่ƒฝๅŠ›ใ€‚
119
-
120
- `MemoryInputStream(data)` ไฟ็•™่พ“ๅ…ฅๅญ—่Š‚ๅผ•็”จใ€‚ๅŠ ่ฝฝๆœŸ้—ดไฟๆŒๅ†…ๅฎนไธๅ˜๏ผŒๅนถ่ฎฉๅ•ๆฌกๆ“ไฝœ็‹ฌๅ ๆธธๆ ‡ใ€‚`FileInputStream` ไฝฟ็”จ Node ๆ–‡ไปถๅฅๆŸ„๏ผŒๆŒ‰ๅฏน่ฑกไธฒ่กŒๆ‰ง่กŒๅผ‚ๆญฅ่ฏปๅ†™ไธŽๅฏปๅ€๏ผš
121
-
122
- ```typescript
123
- import { FileInputStream, Image } from 'sfml.js';
124
-
125
- async function readImage(filename: string) {
126
- const stream = new FileInputStream();
127
- try {
128
- if (!await stream.open(filename)) throw new Error('Cannot open file');
129
- const image = new Image();
130
- if (!await image.loadFromStream(stream)) throw new Error('Cannot decode image');
131
- return image;
132
- } finally {
133
- await stream.close();
134
- }
135
- }
136
- ```
137
-
138
- ็ญ‰ๅพ…ๅŠ ่ฝฝๅฎŒๆˆๅŽๅ†ๅ…ณ้—ญๆตใ€‚ๅŒไธ€ไธชๆต็š„ๅคšๆฌกๅŠ ่ฝฝๅบ”้€ๆฌก awaitใ€‚FileInputStream ็š„ๆ–‡ไปถๅ็งป่Œƒๅ›ดไธบ 0๏ฝž2โตยณโˆ’1๏ผ›EOF ไธไผš่‡ชๅŠจๅ…ณ้—ญๆ–‡ไปถ๏ผŒๅ…่ฎธๅ†ๆฌก seekใ€‚
139
-
140
- ## Unicode ไธŽ็‰ˆๆœฌ
141
-
142
- `Unicode.isGraphemeBoundary(text, position)`ใ€`isWordBoundary()`ใ€`isSentenceBoundary()` ไฝฟ็”จ SFML ็š„ Unicode ่ง„ๅˆ™ใ€‚position ๆ˜ฏ JS ๅญ—็ฌฆไธฒ็š„ UTF-16 ไธ‹ๆ ‡๏ผŒ่Œƒๅ›ดไธบ 0๏ฝž`text.length`๏ผ›ไปฃ็†ๅฏนไธญ้—ดไธๆ˜ฏ่พน็•Œใ€‚
143
-
144
- `version()` ่ฟ”ๅ›ž็ผ“ๅญ˜็š„ๅช่ฏป SFML ่ฟ่กŒๆ—ถ็‰ˆๆœฌ๏ผŒๅŒ…ๅซ `major`ใ€`minor`ใ€`patch`ใ€`isRelease` ไธŽ `string`ใ€‚ๅฎƒไธๆ˜ฏ npm ๅŒ…็‰ˆๆœฌใ€‚
145
-
146
- ## ้”™่ฏฏไธŽๆ—ฅๅฟ—
147
-
148
- SFMLError ่กจ็คบ็ป‘ๅฎšๅฑ‚ๆˆ– SFML ่ฟ่กŒๅคฑ่ดฅ๏ผŒๅฏ็”จ `instanceof SFMLError` ๅˆคๆ–ญใ€‚ๅ‚ๆ•ฐ้”™่ฏฏไฝฟ็”จ TypeError๏ผRangeError๏ผ›็”จๆˆทๅ›ž่ฐƒๆŠ›ๅ‡บ็š„้”™่ฏฏๅŽŸๆ ทไผ ๆ’ญใ€‚SFML ่ฟ”ๅ›ž็š„ๆ™ฎ้€šๅคฑ่ดฅ็Šถๆ€ไปๆ˜ฏ false๏ผundefined๏ผŒไธไผšๅ…จ้ƒจ่ฝฌๆขๆˆๅผ‚ๅธธใ€‚
149
-
150
- `err()` ่ฟ”ๅ›žๅ•ไพ‹ Node Writable๏ผŒๅ†™ๅ…ฅ `sf::err()`ใ€‚`setErrorOutput(writable)` ้‡ๅฎšๅ‘ SFML ๆ—ฅๅฟ—๏ผŒไผ ๅ…ฅ null ้™้Ÿณ๏ผŒไธไผ ๅ‚ๆ•ฐๆขๅค้ป˜่ฎค stderr๏ผš
151
-
152
- ```typescript
153
- import { createWriteStream } from 'node:fs';
154
- import { finished } from 'node:stream/promises';
155
- import { err, setErrorOutput } from 'sfml.js';
156
-
157
- const output = createWriteStream('sfml.log');
158
- setErrorOutput(output);
159
- err().write('SFML diagnostic\n');
160
- setErrorOutput();
161
- output.end();
162
- await finished(output);
163
- ```
164
-
165
- ๆ—ฅๅฟ—่ทฏ็”ฑๆ˜ฏ่ฟ›็จ‹็บง้…็ฝฎ๏ผŒWorker ๅ…ฑ็”จๆœ€่ฟ‘็š„่ฎพ็ฝฎ๏ผ›Node ่‡ช่บซ็š„ stderr ไธๅ—ๅฝฑๅ“ใ€‚ๅŽๅฐๆ—ฅๅฟ—ๆŒ‰ๅญ—่Š‚ๅ—ๆดพๅ‘๏ผŒไธไฟ่ฏ UTF-8 ๅญ—็ฌฆๆˆ–่กŒ่พน็•Œ๏ผŒ่งฃๆžๆ–‡ๆœฌๆ—ถๅฏไฝฟ็”จ StringDecoderใ€‚
166
-
167
- <a id="sfml-cpp-reference"></a>
168
-
169
- ## SFML C++ ๅ‚่€ƒ
170
-
171
- ๆ•ฐๅญฆไธŽๆ—ถ้—ดๅ‚่€ƒ [sf::Vector2](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1Vector2.html)ใ€[sf::Angle](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1Angle.html)ใ€[sf::Time](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1Time.html) ๅ’Œ [sf::Clock](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1Clock.html)๏ผ›ๆตๅ่ฎฎๅ‚่€ƒ [sf::InputStream](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1InputStream.html)ใ€‚
172
-
173
- ไธŠๆธธ่ฏดๆ˜Žๅฏ็”จไบŽ็†่งฃๆ•ฐๅญฆใ€ๆ—ถ้—ดๅ’Œๆต็š„ๆฆ‚ๅฟตใ€‚JS ไฝฟ็”จๅ…ทๅ่ฟ็ฎ—็ฌฆใ€bigint ๅพฎ็ง’ใ€Promise sleep ๅ’Œๅฏๅผ‚ๆญฅ็š„่พ“ๅ…ฅๆตๆ–นๆณ•๏ผŒ่ฐƒ็”จๆ–นๅผๅŠ่พน็•Œไปฅๆœฌๆ–‡ไธบๅ‡†ใ€‚
package/docs/window.ja.md DELETED
@@ -1,138 +0,0 @@
1
- # Window
2
-
3
- [English](window.md) / [็ฎ€ไฝ“ไธญๆ–‡](window.zh-CN.md) / **ๆ—ฅๆœฌ่ชž** / [ํ•œ๊ตญ์–ด](window.ko.md)
4
-
5
- > 2D ๆ็”ปใซใฏ RenderWindow ใ‚’ไฝฟใ„ใ€OpenGL ใ‚’่‡ชๅˆ†ใง็ต„ใฟ่พผใ‚€ๅ ดๅˆใฏ Window ใ‚’ๅˆฉ็”จใงใใพใ™ใ€‚ใ‚ฆใ‚ฃใƒณใƒ‰ใ‚ฆๆ“ไฝœใฏใƒกใ‚คใƒณใ‚นใƒฌใƒƒใƒ‰ใงๅฎŸ่กŒใ—ใพใ™ใ€‚
6
-
7
- [API ใƒŠใƒ“ใ‚ฒใƒผใ‚ทใƒงใƒณ](api.ja.md) ยท [Graphics](graphics.ja.md) ยท [ใ‚ฏใ‚คใƒƒใ‚ฏใ‚นใ‚ฟใƒผใƒˆ](getting-started.ja.md)
8
-
9
- ## ไฝœๆˆใจ็ต‚ไบ†
10
-
11
- ```typescript
12
- import { RenderWindow, VideoMode, Vector2u, State, Style } from 'sfml.js';
13
-
14
- const window = new RenderWindow(
15
- new VideoMode(new Vector2u(800, 600)),
16
- 'sfml.js',
17
- {
18
- style: Style.Default,
19
- state: State.Windowed,
20
- settings: { depthBits: 24, stencilBits: 8 },
21
- },
22
- );
23
- window.close();
24
- ```
25
-
26
- Window ใจ RenderWindow ใฏ็ฉบใฎใ‚ณใƒณใ‚นใƒˆใƒฉใ‚ฏใ‚ฟใƒผใงไฝœๆˆใ—ใฆใ‹ใ‚‰ `create()` ใ‚’ๅ‘ผใถๆ–นๆณ•ใซๅฏพๅฟœใ—ใฆใ„ใพใ™ใ€‚Vector2u ใฎใ‚ตใ‚คใ‚บใ‚„ใ€ๆ—ขๅญ˜ใฎ OS ใ‚ฆใ‚ฃใƒณใƒ‰ใ‚ฆใฎ bigint ใƒใƒณใƒ‰ใƒซใ‚‚ๅ—ใ‘ๅ–ใ‚Œใพใ™ใ€‚`close()` ใฏใ‚ฆใ‚ฃใƒณใƒ‰ใ‚ฆใ‚’้–‰ใ˜ใพใ™ใŒใ€JS ใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆใฏๅ†ใณ create ใงใใพใ™ใ€‚
27
-
28
- RenderWindow ใฏ `instanceof Window` ใจ `instanceof RenderTarget` ใฎไธกๆ–นใ‚’ๆบ€ใŸใ—ใพใ™ใ€‚็›ดๆŽฅๆ็”ปใงใใ€ใƒžใ‚ฆใ‚นใฎ็›ธๅฏพๅบงๆจ™ใ‚’็…งไผšใงใใ‚‹ใปใ‹ใ€`Texture.update(window)` ใฎๅ…ฅๅŠ›ๅ…ƒใซใ‚‚ไฝฟใˆใพใ™ใ€‚
29
-
30
- | ใ‚คใƒณใ‚ฟใƒผใƒ•ใ‚งใƒผใ‚น | ็”จ้€” |
31
- | --- | --- |
32
- | `get/setPosition()`ใ€`get/setSize()` | ใ‚ฆใ‚ฃใƒณใƒ‰ใ‚ฆใฎไฝ็ฝฎใจใ‚ฏใƒฉใ‚คใ‚ขใƒณใƒˆ้ ˜ๅŸŸใฎใ‚ตใ‚คใ‚บ |
33
- | `setMinimumSize()`ใ€`setMaximumSize()` | ใ‚ตใ‚คใ‚บๅˆถ้™ใ€‚undefined ใงๅˆถ้™ใ‚’่งฃ้™ค |
34
- | `setTitle()`ใ€`setVisible()`ใ€`setIcon()` | ใ‚ฟใ‚คใƒˆใƒซใ€่กจ็คบใจ้ž่กจ็คบใ€RGBA ใ‚ขใ‚คใ‚ณใƒณ |
35
- | `requestFocus()`ใ€`hasFocus()` | ใƒ•ใ‚ฉใƒผใ‚ซใ‚นใฎ่ฆๆฑ‚ใจ็…งไผš |
36
- | `setMouseCursor()`ใ€`setMouseCursorVisible()`ใ€`setMouseCursorGrabbed()` | ใ‚ซใƒผใ‚ฝใƒซใจใƒžใ‚ฆใ‚นใฎ็งปๅ‹•็ฏ„ๅ›ฒใฎๅˆถ้™ |
37
- | `setKeyRepeatEnabled()`ใ€`setJoystickThreshold()` | ๅ…ฅๅŠ›ใฎๆŒ™ๅ‹• |
38
- | `setVerticalSyncEnabled()`ใ€`setFramerateLimit()` | ่กจ็คบใฎใ‚ฟใ‚คใƒŸใƒณใ‚ฐ |
39
- | `getSettings()`ใ€`getNativeHandle()` | ๅฎŸ้š›ใฎใ‚ณใƒณใƒ†ใ‚ญใ‚นใƒˆ่จญๅฎšใจ OS ใ‚ฆใ‚ฃใƒณใƒ‰ใ‚ฆใฎใƒใƒณใƒ‰ใƒซ |
40
-
41
- ไฝ็ฝฎใซใฏ Vector2iใ€ใ‚ตใ‚คใ‚บใซใฏ Vector2u ใ‚’ไฝฟใ„ใพใ™ใ€‚`setIcon(size, pixels)` ใฏ RGBA8 ใฎใƒใ‚คใƒˆๅˆ—ใ‚’ๅ—ใ‘ๅ–ใ‚Šใ€RenderWindow ใงใฏ Image ใ‚‚ๅ—ใ‘ๅ–ใ‚Œใพใ™ใ€‚
42
-
43
- ## ใ‚คใƒ™ใƒณใƒˆใƒซใƒผใƒ—
44
-
45
- ```typescript
46
- import { RenderWindow, Vector2u, Keyboard } from 'sfml.js';
47
-
48
- const window = new RenderWindow(new Vector2u(800, 600), 'Events');
49
- window.setFramerateLimit(60);
50
-
51
- function frame() {
52
- window.handleEvents({
53
- Closed: () => window.close(),
54
- KeyPressed: event => {
55
- if (event.code === Keyboard.Key.Escape) window.close();
56
- },
57
- Resized: event => console.log(event.size.x, event.size.y),
58
- });
59
- if (!window.isOpen()) return;
60
- window.clear();
61
- window.display();
62
- setImmediate(frame);
63
- }
64
- frame();
65
- ```
66
-
67
- `handleEvents(handlers, fallback?)` ใฏใ‚คใƒ™ใƒณใƒˆใ‚ญใƒฅใƒผใ‚’็ฉบใซใชใ‚‹ใพใงๅ‡ฆ็†ใ—ใ€ๅฏพๅฟœใ™ใ‚‹ๅž‹ใฎใƒใƒณใƒ‰ใƒฉใƒผใ‚’ๅ„ชๅ…ˆใ—ใฆๅ‘ผใณๅ‡บใ—ใพใ™ใ€‚ๅ˜ไธ€ใฎ้–ขๆ•ฐใ‚’ๆธกใ—ใฆใ€ใ™ในใฆใฎใ‚คใƒ™ใƒณใƒˆใ‚’ๅ‡ฆ็†ใ™ใ‚‹ใ“ใจใ‚‚ใงใใพใ™ใ€‚
68
-
69
- ๆ‰‹ๅ‹•ใงๆŒฏใ‚Šๅˆ†ใ‘ใŸใ„ๅ ดๅˆใฏ `pollEvent()` ใ‚’ไฝฟใ„ใพใ™ใ€‚
70
-
71
- ```typescript
72
- let event;
73
- while ((event = window.pollEvent())) {
74
- if (event.is('Closed')) window.close();
75
- const key = event.getIf('KeyPressed');
76
- if (key) console.log(key.code, key.scancode);
77
- }
78
- ```
79
-
80
- `pollEvent()` ใฏใ‚คใƒ™ใƒณใƒˆใŒใชใ‘ใ‚Œใฐ undefined ใ‚’่ฟ”ใ—ใพใ™ใ€‚Event ใฎ data ใฏ kind ใ‚’ๅˆคๅˆฅๅญใจใ™ใ‚‹ใƒฆใƒ‹ใ‚ชใƒณๅž‹ใงใ™ใ€‚`is()`ใ€`getIf()`ใ€`visit()` ใงๅž‹ใ‚’็ตžใ‚Š่พผใ‚“ใ ใ‚Šใƒ‡ใƒผใ‚ฟใซใ‚ขใ‚ฏใ‚ปใ‚นใ—ใŸใ‚Šใงใใพใ™ใ€‚TextEntered ใฏ Unicode ใ‚ณใƒผใƒ‰ใƒใ‚คใƒณใƒˆใ‚’ไฝฟใ„ใพใ™ใ€‚
81
-
82
- `waitEvent(timeout = Time.Zero)` ใฏๅŒๆœŸ็š„ใซใƒ–ใƒญใƒƒใ‚ฏใ™ใ‚‹ใ‚คใƒณใ‚ฟใƒผใƒ•ใ‚งใƒผใ‚นใงใ€ใ‚ฟใ‚คใƒ ใ‚ขใ‚ฆใƒˆใพใŸใฏใ‚ฆใ‚ฃใƒณใƒ‰ใ‚ฆใฎ็ต‚ไบ†ๆ™‚ใซ undefined ใ‚’่ฟ”ใ—ใพใ™ใ€‚Node ใฎ I/O ใ‚‚ๅ‡ฆ็†ใ™ใ‚‹ใƒ•ใƒฌใƒผใƒ ใƒซใƒผใƒ—ใงใฏ pollEvent๏ผhandleEvents ใ‚’ไฝฟใ„ใ€ใƒ•ใƒฌใƒผใƒ ้–“ใงใ‚คใƒ™ใƒณใƒˆใƒซใƒผใƒ—ใซๅˆถๅพกใ‚’่ฟ”ใ—ใฆใใ ใ•ใ„ใ€‚
83
-
84
- ## ใƒชใ‚ขใƒซใ‚ฟใ‚คใƒ ๅ…ฅๅŠ›ใจใ‚ทใ‚นใƒ†ใƒ ๆฉŸ่ƒฝ
85
-
86
- | ใ‚คใƒณใ‚ฟใƒผใƒ•ใ‚งใƒผใ‚น | ่ชฌๆ˜Ž |
87
- | --- | --- |
88
- | `Keyboard.isKeyPressed(key)` | ็พๅœจใฎใ‚ญใƒผใ‚ณใƒผใƒ‰ใฎ็Šถๆ…‹ |
89
- | `Keyboard.isKeyPressed(scancode, 'scancode')` | ็พๅœจใฎ็‰ฉ็†ใ‚นใ‚ญใƒฃใƒณใ‚ณใƒผใƒ‰ใฎ็Šถๆ…‹ |
90
- | `Keyboard.localize()`๏ผ`delocalize()`๏ผ`getDescription()` | ็พๅœจใฎใ‚ญใƒผใƒœใƒผใƒ‰้…ๅˆ—ใจใฎใƒžใƒƒใƒ”ใƒณใ‚ฐใจ่ชฌๆ˜Ž |
91
- | `Mouse.getPosition(window?)`๏ผ`setPosition(position, window?)` | ใ‚ฆใ‚ฃใƒณใƒ‰ใ‚ฆใ‚’็œ็•ฅใ—ใŸๅ ดๅˆใฏใ‚นใ‚ฏใƒชใƒผใƒณๅบงๆจ™ใ‚’ไฝฟ็”จ |
92
- | `Mouse.isButtonPressed(button)` | ็พๅœจใฎใƒžใ‚ฆใ‚นใƒœใ‚ฟใƒณใฎ็Šถๆ…‹ |
93
- | Joystick | ๆŽฅ็ถšใ€ใƒœใ‚ฟใƒณใ€่ปธใ€ใƒ‡ใƒใ‚คใ‚น่ญ˜ๅˆฅๆƒ…ๅ ฑใ€‚ใ‚ฆใ‚ฃใƒณใƒ‰ใ‚ฆใƒซใƒผใƒ—ใŒใชใ„ๅ ดๅˆใฏ `update()` ใ‚’ๅ‘ผใถ |
94
- | Sensor | ๆœ€ๅˆใซ `isAvailable()` ใ‚’็ขบ่ชใ—ใ€ใใฎๅพŒใซๆœ‰ๅŠนๅŒ–ใจ่ชญใฟๅ–ใ‚Šใ‚’่กŒใ† |
95
- | Clipboard | `getString()`๏ผ`setString()`ใ€‚JS ใฎ Unicode ๆ–‡ๅญ—ๅˆ—ใซๅฏพๅฟœ |
96
- | Touch | ใ‚ฟใƒƒใƒ็‚นใฎ็Šถๆ…‹ใจไฝ็ฝฎใ€‚SFML 3.1.0 ใงใฏใƒชใ‚ขใƒซใ‚ฟใ‚คใƒ  Touch API ใฏ้žๆŽจๅฅจ |
97
-
98
- ๅ…ฅๅŠ›ๅๅ‰็ฉบ้–“ๅ†…ใฎๅˆ—ๆŒ™ๅž‹ใจใƒˆใƒƒใƒ—ใƒฌใƒ™ใƒซใฎๅˆ—ๆŒ™ๅž‹ใฏๅŒใ˜ใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆใ‚’ๅ…ฑๆœ‰ใ—ใพใ™ใ€‚ใŸใจใˆใฐ `Keyboard.Key` ใจ `KeyboardKey` ใŒ่ฉฒๅฝ“ใ—ใพใ™ใ€‚
99
-
100
- `Cursor.createFromSystem()`ใ€`createFromPixels()` ใฏๅคฑๆ•—ๆ™‚ใซ undefined ใ‚’่ฟ”ใ—ใ€ใ‚ณใƒณใ‚นใƒˆใƒฉใ‚ฏใ‚ฟใƒผใฏๅคฑๆ•—ๆ™‚ใซไพ‹ๅค–ใ‚’ๆŠ•ใ’ใพใ™ใ€‚ใ‚ฆใ‚ฃใƒณใƒ‰ใ‚ฆใฏไฝฟ็”จไธญใฎ Cursor ใฎๅฏฟๅ‘ฝใ‚’็ถญๆŒใ—ใพใ™ใ€‚macOS ใงใฏใ€ใ‚ทใ‚นใƒ†ใƒ ใ‚ซใƒผใ‚ฝใƒซใ‚’ไฝฟใ†ๅ‰ใซใ‚ฆใ‚ฃใƒณใƒ‰ใ‚ฆใ‚’ไฝœๆˆใ™ใ‚‹ๅฟ…่ฆใŒใ‚ใ‚Šใพใ™ใ€‚
101
-
102
- VideoMode ใฏ `size` ใจ `bitsPerPixel` ใ‚’ไฝฟใ„ใพใ™ใ€‚`getDesktopMode()`ใ€`getFullscreenModes()` ใงใƒ‡ใƒใ‚คใ‚นใฎใƒขใƒผใƒ‰ใ‚’็…งไผšใ—ใ€`isValid()` ใงใƒ•ใƒซใ‚นใ‚ฏใƒชใƒผใƒณใƒขใƒผใƒ‰ใฎๆœ‰ๅŠนๆ€งใ‚’ๅˆคๅฎšใ—ใพใ™ใ€‚็‰นๅฎšใฎๆ•ฐใฎใƒ•ใƒซใ‚นใ‚ฏใƒชใƒผใƒณใƒขใƒผใƒ‰ใŒๅฟ…ใšๆไพ›ใ•ใ‚Œใ‚‹ใจใฏๆƒณๅฎšใ—ใชใ„ใงใใ ใ•ใ„ใ€‚
103
-
104
- ## OpenGL ใจ Vulkan
105
-
106
- Context ใฏ็‹ฌ็ซ‹ใ—ใŸ OpenGL ใ‚ณใƒณใƒ†ใ‚ญใ‚นใƒˆใ‚’ไฝœๆˆใงใใ€ๆœ‰ๅŠนๅŒ–ใ€ๅฎŸ้š›ใฎ่จญๅฎšใ€ๆ‹กๅผตใฎ็…งไผšใ€้–ขๆ•ฐใ‚ขใƒ‰ใƒฌใ‚นใฎ็…งไผšใ‚’ๆไพ›ใ—ใพใ™ใ€‚`Context.getActiveContextId()` ใฏ bigint ใ‚’่ฟ”ใ—ใ€ๆœ‰ๅŠนใชใ‚ณใƒณใƒ†ใ‚ญใ‚นใƒˆใŒใชใ‘ใ‚Œใฐ `0n` ใงใ™ใ€‚`getFunction()` ใฏใ‚ขใƒ‰ใƒฌใ‚นใ‚’ bigint ใง่ฟ”ใ—ใพใ™ใ€‚ใใฎ้–ขๆ•ฐใ‚’ๅ‘ผใณๅ‡บใ™ใซใฏใ€ใ‚ทใ‚ฐใƒใƒใƒฃใŒไธ€่‡ดใ™ใ‚‹ใƒใ‚คใƒ†ใ‚ฃใƒ–ใ‚ณใƒผใƒ‰ใŒๅฟ…่ฆใงใ™ใ€‚
107
-
108
- RenderWindow ใฎ `setActive()`ใ€`pushGLStates()`ใ€`popGLStates()`ใ€`resetGLStates()` ใฏใ€SFML ใจ็‹ฌ่‡ชใฎ OpenGL ๅ‡ฆ็†ใ‚’ๆททๅœจใ•ใ›ใ‚‹ใŸใ‚ใซไฝฟใ„ใพใ™ใ€‚GL ใฎ็Šถๆ…‹ใ‚’็›ดๆŽฅๅค‰ๆ›ดใ™ใ‚‹ๅ‰ใซ SFML ใฎใ‚ณใƒžใƒณใƒ‰ใ‚’้€ไฟกใ—ใฆใใ ใ•ใ„ใ€‚push๏ผpop ใฏๅŒใ˜ใ‚ณใƒณใƒ†ใ‚ญใ‚นใƒˆๅ†…ใงๅฏพใซใ™ใ‚‹ๅฟ…่ฆใŒใ‚ใ‚Šใพใ™ใ€‚
109
-
110
- Vulkan ๅๅ‰็ฉบ้–“ใฏไปฅไธ‹ใ‚’ๆไพ›ใ—ใพใ™ใ€‚
111
-
112
- - `isAvailable(requireGraphics = true)`ใ€‚
113
- - `getFunction(name)`ใ€‚
114
- - `getGraphicsRequiredInstanceExtensions()`ใ€‚
115
-
116
- `window.createVulkanSurface(instance, allocator = 0n)` ใฏใ‚ตใƒผใƒ•ใ‚งใ‚นใƒใƒณใƒ‰ใƒซใ‚’ bigint ใง่ฟ”ใ—ใ€ๅคฑๆ•—ๆ™‚ใฏ undefined ใงใ™ใ€‚ใ‚คใƒณใ‚นใ‚ฟใƒณใ‚นใ€ใ‚ขใƒญใ‚ฑใƒผใ‚ฟใƒผใ€ใ‚ตใƒผใƒ•ใ‚งใ‚นใฎ็ ดๆฃ„ใฏๅ‘ผใณๅ‡บใ—ๅดใŒ็ฎก็†ใ—ใพใ™ใ€‚
117
-
118
- SFML 3.1.0 ใฎ macOS ใƒ“ใƒซใƒ‰ใซใฏ Vulkan ใƒใƒƒใ‚ฏใ‚จใƒณใƒ‰ใŒใ‚ใ‚Šใพใ›ใ‚“ใ€‚ใ“ใ‚Œใ‚‰ใฎ็…งไผšใฏๅˆฉ็”จไธๅฏใ‚’็คบใ—ใ€MoltenVK ใ‚’ใ‚คใƒณใ‚นใƒˆใƒผใƒซใ—ใฆใ‚‚ SFML ใฎใ“ใฎใƒ—ใƒฉใƒƒใƒˆใƒ•ใ‚ฉใƒผใƒ ๅˆ†ๅฒใฏๅค‰ใ‚ใ‚Šใพใ›ใ‚“ใ€‚Windows๏ผX11 ใฎๆˆๅŠŸ็ตŒ่ทฏใฏใ€ใใ‚Œใžใ‚Œใฎ็’ฐๅขƒใงๆคœ่จผใ™ใ‚‹ๅฟ…่ฆใŒใ‚ใ‚Šใพใ™ใ€‚
119
-
120
- ## ใƒ‡ใƒขใฎๅฎŸ่กŒ
121
-
122
- ใƒ“ใƒซใƒ‰ๅพŒใซ `node examples/window.cjs --frames=120` ใ‚’ๅฎŸ่กŒใ™ใ‚‹ใจใ€ใ‚คใƒ™ใƒณใƒˆใ€ใ‚ญใƒผใ‚ณใƒผใƒ‰ใ€ใƒใ‚คใƒณใ‚ฟใƒผใฎไฝ็ฝฎใ€ใ‚ฆใ‚ฃใƒณใƒ‰ใ‚ฆใฎใƒ—ใƒญใƒ‘ใƒ†ใ‚ฃใ‚’็ขบ่ชใงใใพใ™ใ€‚ใƒ•ใƒฌใƒผใƒ ๆ•ฐใ‚’็œ็•ฅใ™ใ‚‹ใจ็ถ™็ถšใ—ใฆๅฎŸ่กŒใ—ใพใ™ใ€‚
123
-
124
- | ใ‚ญใƒผ | ๅ‹•ไฝœ |
125
- | --- | --- |
126
- | F1๏ผF2 | ใ‚ซใƒผใ‚ฝใƒซใฎ็จฎ้กž๏ผ่กจ็คบใจ้ž่กจ็คบ |
127
- | F3๏ผF4 | ใ‚ญใƒผใƒชใƒ”ใƒผใƒˆ๏ผๅž‚็›ดๅŒๆœŸ |
128
- | F5๏ผF6 | ใ‚ฆใ‚ฃใƒณใƒ‰ใ‚ฆใ‚ตใ‚คใ‚บ๏ผใ‚ตใ‚คใ‚บๅˆถ้™ |
129
- | F7๏ผF8 | ใ‚ฟใ‚คใƒˆใƒซใฎๅค‰ๆ›ด๏ผ1 ็ง’้–“้ž่กจ็คบใซใ—ใฆใ‹ใ‚‰ๅพฉๅ…ƒ |
130
- | F9๏ผF10 | ใ‚คใƒ™ใƒณใƒˆ API๏ผใ‚ฆใ‚ฃใƒณใƒ‰ใ‚ฆใฎ็งปๅ‹• |
131
- | Esc | ้–‰ใ˜ใ‚‹ |
132
-
133
- macOS ใงใฏ Fn ใ‚ญใƒผใ‚‚ๅŒๆ™‚ใซๆŠผใ™ๅฟ…่ฆใŒใ‚ใ‚‹ๅ ดๅˆใŒใ‚ใ‚Šใพใ™ใ€‚ใ‚ธใƒงใ‚คใ‚นใƒ†ใ‚ฃใƒƒใ‚ฏใ€ใ‚ปใƒณใ‚ตใƒผใ€ใ‚ฟใƒƒใƒใ€Vulkan ใฎๆฉŸ่ƒฝใฏใ€ใƒ‡ใƒใ‚คใ‚นใฎ็…งไผš็ตๆžœใซๅŸบใฅใ„ใฆๅˆคๆ–ญใ—ใฆใใ ใ•ใ„ใ€‚CI ใฎใƒ“ใƒซใƒ‰ๆˆๅŠŸใฏใ€ใ“ใ‚Œใ‚‰ใฎใƒใƒผใƒ‰ใ‚ฆใ‚งใ‚ขๅ›บๆœ‰ใฎๅ‡ฆ็†ใŒใ™ในใฆๆคœ่จผๆธˆใฟใงใ‚ใ‚‹ใ“ใจใ‚’ๆ„ๅ‘ณใ—ใพใ›ใ‚“ใ€‚
134
-
135
- <a id="sfml-cpp-reference"></a>
136
- ## SFML C++ ใƒชใƒ•ใ‚กใƒฌใƒณใ‚น
137
-
138
- ไธŠๆตใฎ [Window](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1Window.html)ใ€[RenderWindow](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1RenderWindow.html)ใ€[Event](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1Event.html)ใ€[VideoMode](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1VideoMode.html)ใ€[Cursor](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1Cursor.html) ใงใฏใ€ใ‚ฆใ‚ฃใƒณใƒ‰ใ‚ฆใ€ใ‚คใƒ™ใƒณใƒˆๅž‹ใ€ๅบงๆจ™่ฆๅ‰‡ใ‚’็ขบ่ชใงใใพใ™ใ€‚ใใ‚Œใ‚‰ใฎๆฆ‚ๅฟตใฏใ“ใฎใ‚ฌใ‚คใƒ‰ใง่ชฌๆ˜Žใ™ใ‚‹็ฏ„ๅ›ฒใง้ฉ็”จใ•ใ‚Œใพใ™ใŒใ€JS ใงใฏๆ–‡ๅญ—ๅˆ—ใจๅž‹ไป˜ใใƒšใ‚คใƒญใƒผใƒ‰ใงใ‚คใƒ™ใƒณใƒˆใ‚’ๆŒฏใ‚Šๅˆ†ใ‘ใ€`setImmediate()` ใงใ‚คใƒ™ใƒณใƒˆใƒซใƒผใƒ—ใซๅˆถๅพกใ‚’่ฟ”ใ—ใพใ™ใ€‚`waitEvent()` ใฏๅŒๆœŸ็š„ใซๅพ…ๆฉŸใ™ใ‚‹็‚นใซๆณจๆ„ใ—ใฆใใ ใ•ใ„ใ€‚
package/docs/window.ko.md DELETED
@@ -1,140 +0,0 @@
1
- # Window
2
-
3
- [English](window.md) / [็ฎ€ไฝ“ไธญๆ–‡](window.zh-CN.md) / [ๆ—ฅๆœฌ่ชž](window.ja.md) / **ํ•œ๊ตญ์–ด**
4
-
5
- > 2D ๊ทธ๋ฆฌ๊ธฐ์—๋Š” RenderWindow๋ฅผ ์‚ฌ์šฉํ•˜๊ณ , OpenGL์„ ์ง์ ‘ ์—ฐ๊ฒฐํ•  ๋•Œ๋Š” Window๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ฐฝ ์ž‘์—…์€ ๋ฉ”์ธ ์Šค๋ ˆ๋“œ์—์„œ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
6
-
7
- [API ์•ˆ๋‚ด](api.ko.md) ยท [Graphics](graphics.ko.md) ยท [๋น ๋ฅธ ์‹œ์ž‘](getting-started.ko.md)
8
-
9
- ## ์ƒ์„ฑ๊ณผ ๋‹ซ๊ธฐ
10
-
11
- ```typescript
12
- import { RenderWindow, VideoMode, Vector2u, State, Style } from 'sfml.js';
13
-
14
- const window = new RenderWindow(
15
- new VideoMode(new Vector2u(800, 600)),
16
- 'sfml.js',
17
- {
18
- style: Style.Default,
19
- state: State.Windowed,
20
- settings: { depthBits: 24, stencilBits: 8 },
21
- },
22
- );
23
- window.close();
24
- ```
25
-
26
- Window์™€ RenderWindow๋Š” ๋นˆ ์ƒ์„ฑ์ž๋กœ ๋งŒ๋“  ๋’ค `create()`๋ฅผ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, Vector2u ํฌ๊ธฐ๋‚˜ ๊ธฐ์กด ์‹œ์Šคํ…œ ์ฐฝ์˜ bigint ํ•ธ๋“ค๋„ ๋ฐ›์Šต๋‹ˆ๋‹ค. `close()`๋Š” ์ฐฝ์„ ๋‹ซ์œผ๋ฉฐ, JS ๊ฐ์ฒด์—์„œ๋Š” ๋‹ค์‹œ create๋ฅผ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
27
-
28
- RenderWindow๋Š” `instanceof Window`์™€ `instanceof RenderTarget`์„ ๋ชจ๋‘ ๋งŒ์กฑํ•ฉ๋‹ˆ๋‹ค. ์ง์ ‘ ๊ทธ๋ฆฌ๊ฑฐ๋‚˜ ์ฐฝ ๊ธฐ์ค€ ๋งˆ์šฐ์Šค ์ขŒํ‘œ๋ฅผ ์กฐํšŒํ•  ์ˆ˜ ์žˆ๊ณ , `Texture.update(window)`์˜ ์†Œ์Šค๋กœ๋„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
29
-
30
- | ์ธํ„ฐํŽ˜์ด์Šค | ์šฉ๋„ |
31
- | --- | --- |
32
- | `get/setPosition()`, `get/setSize()` | ์ฐฝ ์œ„์น˜์™€ ํด๋ผ์ด์–ธํŠธ ์˜์—ญ ํฌ๊ธฐ |
33
- | `setMinimumSize()`, `setMaximumSize()` | ํฌ๊ธฐ ์ œํ•œ. undefined๋กœ ์ œํ•œ ํ•ด์ œ |
34
- | `setTitle()`, `setVisible()`, `setIcon()` | ์ œ๋ชฉ, ํ‘œ์‹œ ์—ฌ๋ถ€, RGBA ์•„์ด์ฝ˜ |
35
- | `requestFocus()`, `hasFocus()` | ํฌ์ปค์Šค ์š”์ฒญ๊ณผ ์กฐํšŒ |
36
- | `setMouseCursor()`, `setMouseCursorVisible()`, `setMouseCursorGrabbed()` | ์ปค์„œ ๋ฐ ๋งˆ์šฐ์Šค ์ด๋™ ์ œํ•œ |
37
- | `setKeyRepeatEnabled()`, `setJoystickThreshold()` | ์ž…๋ ฅ ๋™์ž‘ |
38
- | `setVerticalSyncEnabled()`, `setFramerateLimit()` | ํ”„๋ ˆ์ž„ ํ‘œ์‹œ ๊ฐ„๊ฒฉ |
39
- | `getSettings()`, `getNativeHandle()` | ์‹ค์ œ ์ปจํ…์ŠคํŠธ ์„ค์ •๊ณผ ์‹œ์Šคํ…œ ์ฐฝ ํ•ธ๋“ค |
40
-
41
- ์œ„์น˜๋Š” Vector2i, ํฌ๊ธฐ๋Š” Vector2u๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. `setIcon(size, pixels)`๋Š” RGBA8 ๋ฐ”์ดํŠธ๋ฅผ ๋ฐ›์œผ๋ฉฐ, RenderWindow์—์„œ๋Š” Image๋„ ๋ฐ›์Šต๋‹ˆ๋‹ค.
42
-
43
- ## ์ด๋ฒคํŠธ ๋ฃจํ”„
44
-
45
- ```typescript
46
- import { RenderWindow, Vector2u, Keyboard } from 'sfml.js';
47
-
48
- const window = new RenderWindow(new Vector2u(800, 600), 'Events');
49
- window.setFramerateLimit(60);
50
-
51
- function frame() {
52
- window.handleEvents({
53
- Closed: () => window.close(),
54
- KeyPressed: event => {
55
- if (event.code === Keyboard.Key.Escape) window.close();
56
- },
57
- Resized: event => console.log(event.size.x, event.size.y),
58
- });
59
- if (!window.isOpen()) return;
60
- window.clear();
61
- window.display();
62
- setImmediate(frame);
63
- }
64
- frame();
65
- ```
66
-
67
- `handleEvents(handlers, fallback?)`๋Š” ์ด๋ฒคํŠธ ํ๋ฅผ ๋น„์šฐ๋ฉฐ, ํ•ด๋‹น ํƒ€์ž…์˜ ํ•ธ๋“ค๋Ÿฌ๋ฅผ ์šฐ์„  ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค. ํ•˜๋‚˜์˜ ํ•จ์ˆ˜๋กœ ๋ชจ๋“  ์ด๋ฒคํŠธ๋ฅผ ์ฒ˜๋ฆฌํ•˜๋„๋ก ์ „๋‹ฌํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.
68
-
69
- ์ง์ ‘ ๋ถ„๊ธฐํ•ด์•ผ ํ•œ๋‹ค๋ฉด `pollEvent()`๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”.
70
-
71
- ```typescript
72
- let event;
73
- while ((event = window.pollEvent())) {
74
- if (event.is('Closed')) window.close();
75
- const key = event.getIf('KeyPressed');
76
- if (key) console.log(key.code, key.scancode);
77
- }
78
- ```
79
-
80
- `pollEvent()`๋Š” ์ด๋ฒคํŠธ๊ฐ€ ์—†์œผ๋ฉด undefined๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. Event์˜ data๋Š” kind๋กœ ๊ตฌ๋ถ„ํ•˜๋Š” ์œ ๋‹ˆ์˜จ ํƒ€์ž…์ด๋ฉฐ, `is()`, `getIf()`, `visit()`์œผ๋กœ ํƒ€์ž…์„ ์ขํžˆ๊ฑฐ๋‚˜ ๋ฐ์ดํ„ฐ์— ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. TextEntered๋Š” Unicode ์ฝ”๋“œ ํฌ์ธํŠธ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
81
-
82
- `waitEvent(timeout = Time.Zero)`๋Š” ๋™๊ธฐ์‹ ๋ธ”๋กœํ‚น ์ธํ„ฐํŽ˜์ด์Šค๋กœ, ํƒ€์ž„์•„์›ƒ๋˜๊ฑฐ๋‚˜ ์ฐฝ์ด ๋‹ซํžˆ๋ฉด undefined๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. Node I/O๋ฅผ ํ•จ๊ป˜ ์ฒ˜๋ฆฌํ•ด์•ผ ํ•˜๋Š” ํ”„๋ ˆ์ž„ ๋ฃจํ”„์—์„œ๋Š” pollEvent/handleEvents๋ฅผ ์‚ฌ์šฉํ•˜๊ณ , ํ”„๋ ˆ์ž„ ์‚ฌ์ด์— ์ด๋ฒคํŠธ ๋ฃจํ”„์— ์ œ์–ด๊ถŒ์„ ๋„˜๊ธฐ์„ธ์š”.
83
-
84
- ## ์‹ค์‹œ๊ฐ„ ์ž…๋ ฅ๊ณผ ์‹œ์Šคํ…œ ๊ธฐ๋Šฅ
85
-
86
- | ์ธํ„ฐํŽ˜์ด์Šค | ์„ค๋ช… |
87
- | --- | --- |
88
- | `Keyboard.isKeyPressed(key)` | ํ˜„์žฌ ํ‚ค ์ฝ”๋“œ ์ƒํƒœ |
89
- | `Keyboard.isKeyPressed(scancode, 'scancode')` | ํ˜„์žฌ ๋ฌผ๋ฆฌ ์Šค์บ” ์ฝ”๋“œ ์ƒํƒœ |
90
- | `Keyboard.localize()`/`delocalize()`/`getDescription()` | ํ˜„์žฌ ํ‚ค๋ณด๋“œ ๋ ˆ์ด์•„์›ƒ ๋งคํ•‘๊ณผ ์„ค๋ช… |
91
- | `Mouse.getPosition(window?)`/`setPosition(position, window?)` | ์ฐฝ์„ ์ƒ๋žตํ•˜๋ฉด ํ™”๋ฉด ์ขŒํ‘œ ์‚ฌ์šฉ |
92
- | `Mouse.isButtonPressed(button)` | ํ˜„์žฌ ๋งˆ์šฐ์Šค ๋ฒ„ํŠผ ์ƒํƒœ |
93
- | Joystick | ์—ฐ๊ฒฐ, ๋ฒ„ํŠผ, ์ถ•, ์žฅ์น˜ ์‹๋ณ„ ์ •๋ณด. ์ฐฝ ๋ฃจํ”„๊ฐ€ ์—†์œผ๋ฉด `update()` ํ˜ธ์ถœ |
94
- | Sensor | ๋จผ์ € `isAvailable()`๋กœ ํ™•์ธํ•œ ๋’ค ํ™œ์„ฑํ™”ํ•˜๊ณ  ์ฝ๊ธฐ |
95
- | Clipboard | `getString()`/`setString()`, JS Unicode ๋ฌธ์ž์—ด ์ง€์› |
96
- | Touch | ํ„ฐ์น˜ ์ ‘์  ์ƒํƒœ์™€ ์œ„์น˜. SFML 3.1.0์—์„œ ์‹ค์‹œ๊ฐ„ Touch API๋Š” ์‚ฌ์šฉ ์ค‘๋‹จ ์˜ˆ์ •์œผ๋กœ ์ง€์ •๋จ |
97
-
98
- ์ž…๋ ฅ ๋„ค์ž„์ŠคํŽ˜์ด์Šค์˜ ์—ด๊ฑฐํ˜•๊ณผ ์ตœ์ƒ์œ„ ์—ด๊ฑฐํ˜•์€ ๊ฐ™์€ ๊ฐ์ฒด๋ฅผ ๊ณต์œ ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด `Keyboard.Key`์™€ `KeyboardKey`๊ฐ€ ๊ทธ๋ ‡์Šต๋‹ˆ๋‹ค.
99
-
100
- `Cursor.createFromSystem()`, `createFromPixels()`๋Š” ์‹คํŒจ ์‹œ undefined๋ฅผ ๋ฐ˜ํ™˜ํ•˜์ง€๋งŒ, ์ƒ์„ฑ์ž ์‹คํŒจ๋Š” ์˜ˆ์™ธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ต๋‹ˆ๋‹ค. ์ฐฝ์€ ์‚ฌ์šฉ ์ค‘์ธ Cursor์˜ ์ˆ˜๋ช…์„ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค. macOS์—์„œ๋Š” ์‹œ์Šคํ…œ ์ปค์„œ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์ „์— ์ฐฝ์„ ๋จผ์ € ์ƒ์„ฑํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
101
-
102
- VideoMode๋Š” `size`์™€ `bitsPerPixel`์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. `getDesktopMode()`, `getFullscreenModes()`๋Š” ์žฅ์น˜ ๋ชจ๋“œ๋ฅผ ์กฐํšŒํ•˜๊ณ , `isValid()`๋Š” ์ „์ฒด ํ™”๋ฉด ๋ชจ๋“œ์˜ ์œ ํšจ์„ฑ์„ ํŒ๋‹จํ•ฉ๋‹ˆ๋‹ค. ๋ชจ๋“  ์ปดํ“จํ„ฐ๊ฐ€ ํŠน์ • ๊ฐœ์ˆ˜์˜ ์ „์ฒด ํ™”๋ฉด ๋ชจ๋“œ๋ฅผ ์ œ๊ณตํ•œ๋‹ค๊ณ  ๊ฐ€์ •ํ•˜์ง€ ๋งˆ์„ธ์š”.
103
-
104
- ## OpenGL๊ณผ Vulkan
105
-
106
- Context๋Š” ๋…๋ฆฝ์ ์ธ OpenGL ์ปจํ…์ŠคํŠธ๋ฅผ ์ƒ์„ฑํ•˜๋ฉฐ, ํ™œ์„ฑํ™”, ์‹ค์ œ ์„ค์ •, ํ™•์žฅ ์กฐํšŒ, ํ•จ์ˆ˜ ์ฃผ์†Œ ์กฐํšŒ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. `Context.getActiveContextId()`๋Š” bigint๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ณ , ํ™œ์„ฑ ์ปจํ…์ŠคํŠธ๊ฐ€ ์—†์œผ๋ฉด `0n`์ž…๋‹ˆ๋‹ค. `getFunction()`์€ ์ฃผ์†Œ๋ฅผ bigint๋กœ ๋ฐ˜ํ™˜ํ•˜๋ฉฐ, ์ด๋ฅผ ํ˜ธ์ถœํ•˜๋ ค๋ฉด ์ผ์น˜ํ•˜๋Š” ์‹œ๊ทธ๋‹ˆ์ฒ˜์˜ ๋„ค์ดํ‹ฐ๋ธŒ ์ฝ”๋“œ๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
107
-
108
- RenderWindow์˜ `setActive()`, `pushGLStates()`, `popGLStates()`, `resetGLStates()`๋Š” SFML๊ณผ ์‚ฌ์šฉ์ž ์ •์˜ OpenGL์„ ํ•จ๊ป˜ ์‚ฌ์šฉํ•  ๋•Œ ์“ฐ์ž…๋‹ˆ๋‹ค. GL ์ƒํƒœ๋ฅผ ์ง์ ‘ ์ˆ˜์ •ํ•˜๊ธฐ ์ „์— SFML ๋ช…๋ น์„ ์ œ์ถœํ•˜์„ธ์š”. push/pop์€ ๊ฐ™์€ ์ปจํ…์ŠคํŠธ์—์„œ ์Œ์„ ์ด๋ฃจ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
109
-
110
- Vulkan ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋Š” ๋‹ค์Œ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
111
-
112
- - `isAvailable(requireGraphics = true)`.
113
- - `getFunction(name)`.
114
- - `getGraphicsRequiredInstanceExtensions()`.
115
-
116
- `window.createVulkanSurface(instance, allocator = 0n)`๋Š” bigint ์„œํ”ผ์Šค ํ•ธ๋“ค์„ ๋ฐ˜ํ™˜ํ•˜๊ณ , ์‹คํŒจํ•˜๋ฉด undefined๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ์ธ์Šคํ„ด์Šค, ํ• ๋‹น์ž, ์„œํ”ผ์Šค์˜ ํ•ด์ œ๋Š” ํ˜ธ์ถœ์ž๊ฐ€ ์ฑ…์ž„์ง‘๋‹ˆ๋‹ค.
117
-
118
- SFML 3.1.0์˜ macOS ๋นŒ๋“œ๋Š” Vulkan ๋ฐฑ์—”๋“œ๋ฅผ ์ œ๊ณตํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ด ์กฐํšŒ ํ•จ์ˆ˜๋“ค์€ ์‚ฌ์šฉ ๋ถˆ๊ฐ€ ์ƒํƒœ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋ฉฐ, MoltenVK๋ฅผ ์„ค์น˜ํ•ด๋„ SFML์˜ ํ•ด๋‹น ํ”Œ๋žซํผ ๋ถ„๊ธฐ๋Š” ๋ฐ”๋€Œ์ง€ ์•Š์Šต๋‹ˆ๋‹ค. Windows/X11์—์„œ์˜ ์„ฑ๊ณต ๊ฒฝ๋กœ๋Š” ํ•ด๋‹น ํ™˜๊ฒฝ์—์„œ ๊ฒ€์ฆํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
119
-
120
- ## ๋ฐ๋ชจ ์‹คํ–‰
121
-
122
- ๋นŒ๋“œ ํ›„ `node examples/window.cjs --frames=120`์„ ์‹คํ–‰ํ•˜๋ฉด ์ด๋ฒคํŠธ, ํ‚ค ์ฝ”๋“œ, ํฌ์ธํ„ฐ ์œ„์น˜, ์ฐฝ ์†์„ฑ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ”„๋ ˆ์ž„ ์ˆ˜๋ฅผ ์ƒ๋žตํ•˜๋ฉด ๊ณ„์† ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.
123
-
124
- | ํ‚ค | ๋™์ž‘ |
125
- | --- | --- |
126
- | F1/F2 | ์ปค์„œ ์ข…๋ฅ˜/ํ‘œ์‹œ ์—ฌ๋ถ€ |
127
- | F3/F4 | ํ‚ค ๋ฐ˜๋ณต/์ˆ˜์ง ๋™๊ธฐํ™” |
128
- | F5/F6 | ์ฐฝ ํฌ๊ธฐ/ํฌ๊ธฐ ์ œํ•œ |
129
- | F7/F8 | ์ œ๋ชฉ ๋ณ€๊ฒฝ/1์ดˆ ๋™์•ˆ ์ˆจ๊ธด ๋’ค ๋ณต์› |
130
- | F9/F10 | ์ด๋ฒคํŠธ API/์ฐฝ ์ด๋™ |
131
- | Esc | ๋‹ซ๊ธฐ |
132
-
133
- macOS์—์„œ๋Š” Fn ํ‚ค๋ฅผ ํ•จ๊ป˜ ๋ˆŒ๋Ÿฌ์•ผ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์กฐ์ด์Šคํ‹ฑ, ์„ผ์„œ, ํ„ฐ์น˜, Vulkan ๊ธฐ๋Šฅ์€ ์žฅ์น˜ ์กฐํšŒ ๊ฒฐ๊ณผ๋กœ ํŒ๋‹จํ•˜์„ธ์š”. CI ๋นŒ๋“œ ํ†ต๊ณผ๊ฐ€ ์ด๋Ÿฌํ•œ ํ•˜๋“œ์›จ์–ด ๊ฒฝ๋กœ๋ฅผ ๋ชจ๋‘ ๊ฒ€์ฆํ–ˆ๋‹ค๋Š” ๋œป์€ ์•„๋‹™๋‹ˆ๋‹ค.
134
-
135
- <a id="sfml-cpp-reference"></a>
136
- ## SFML C++ ๋ ˆํผ๋Ÿฐ์Šค
137
-
138
- ์›๋ณธ ํด๋ž˜์Šค ๋ฌธ์„œ: [Window](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1Window.html), [RenderWindow](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1RenderWindow.html), [Event](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1Event.html), [VideoMode](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1VideoMode.html), [Cursor](https://www.sfml-dev.org/documentation/3.1.0/classsf_1_1Cursor.html).
139
-
140
- C++ ๋ฌธ์„œ์˜ ์ด๋ฒคํŠธ ํƒ€์ž…๊ณผ ์ขŒํ‘œ ๊ทœ์น™์„ ์ฐธ๊ณ ํ•˜๋˜, JS์—์„œ๋Š” ๋ฌธ์ž์—ด๊ณผ ํƒ€์ž…์ด ์ง€์ •๋œ ํŽ˜์ด๋กœ๋“œ๋กœ ์ด๋ฒคํŠธ๋ฅผ ๋ถ„๊ธฐํ•ฉ๋‹ˆ๋‹ค. ํ”„๋ ˆ์ž„ ์‚ฌ์ด์—๋Š” `setImmediate()`๋กœ ์ œ์–ด๊ถŒ์„ ๋„˜๊ธฐ๋ฉฐ, `waitEvent()`๋Š” ๋™๊ธฐ์‹์ด๋ผ๋Š” ์ ์„ ์œ ์ง€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.