sfml.js 0.0.1 → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.ja.md +173 -0
- package/README.ko.md +173 -0
- package/README.md +129 -20
- package/README.zh-CN.md +173 -0
- package/assets/branding/sfml-js-symbol-pentagon.svg +24 -0
- package/assets/branding/sfml-js-wordmark-dark.svg +20 -0
- package/assets/branding/sfml-js-wordmark.svg +19 -0
- package/assets/breakout.png +0 -0
- package/binding.gyp +95 -183
- package/dist/audio/effect-processor.d.ts +67 -0
- package/dist/audio/effect-processor.js +58 -0
- package/dist/audio/input-sound-file.d.ts +138 -0
- package/dist/audio/input-sound-file.js +253 -0
- package/dist/audio/listener.d.ts +90 -0
- package/dist/audio/listener.js +148 -0
- package/dist/audio/music.d.ts +210 -0
- package/dist/audio/music.js +353 -0
- package/dist/audio/output-sound-file.d.ts +47 -0
- package/dist/audio/output-sound-file.js +102 -0
- package/dist/audio/playback-device.d.ts +121 -0
- package/dist/audio/playback-device.js +152 -0
- package/dist/audio/sound-buffer-recorder.d.ts +114 -0
- package/dist/audio/sound-buffer-recorder.js +142 -0
- package/dist/audio/sound-buffer.d.ts +150 -0
- package/dist/audio/sound-buffer.js +237 -0
- package/dist/audio/sound-file-factory.d.ts +100 -0
- package/dist/audio/sound-file-factory.js +225 -0
- package/dist/audio/sound-file-reader.d.ts +191 -0
- package/dist/audio/sound-file-reader.js +132 -0
- package/dist/audio/sound-file-writer.d.ts +59 -0
- package/dist/audio/sound-file-writer.js +20 -0
- package/dist/audio/sound-recorder.d.ts +184 -0
- package/dist/audio/sound-recorder.js +286 -0
- package/dist/audio/sound-source.d.ts +336 -0
- package/dist/audio/sound-source.js +389 -0
- package/dist/audio/sound-stream.d.ts +76 -0
- package/dist/audio/sound-stream.js +83 -0
- package/dist/audio/sound.d.ts +41 -0
- package/dist/audio/sound.js +66 -0
- package/dist/audio/value.d.ts +359 -0
- package/dist/audio/value.js +353 -0
- package/dist/audio/worker.d.ts +306 -0
- package/dist/audio/worker.js +2 -0
- package/dist/graphics/blend-mode.d.ts +248 -0
- package/dist/graphics/blend-mode.js +234 -0
- package/dist/graphics/boolean-vector.d.ts +134 -0
- package/dist/graphics/boolean-vector.js +202 -0
- package/dist/graphics/circle-shape.d.ts +84 -0
- package/dist/graphics/circle-shape.js +72 -0
- package/dist/graphics/color.d.ts +278 -0
- package/dist/graphics/color.js +291 -0
- package/dist/graphics/convex-shape.d.ts +56 -0
- package/dist/graphics/convex-shape.js +59 -0
- package/dist/graphics/drawable.d.ts +22 -0
- package/dist/graphics/drawable.js +20 -0
- package/dist/graphics/font.d.ts +199 -0
- package/dist/graphics/font.js +319 -0
- package/dist/graphics/glsl-matrix.d.ts +62 -0
- package/dist/graphics/glsl-matrix.js +106 -0
- package/dist/graphics/glsl.d.ts +165 -0
- package/dist/graphics/glsl.js +215 -0
- package/dist/graphics/glyph.d.ts +133 -0
- package/dist/graphics/glyph.js +138 -0
- package/dist/graphics/image.d.ts +192 -0
- package/dist/graphics/image.js +285 -0
- package/dist/graphics/primitive-type.d.ts +51 -0
- package/dist/graphics/primitive-type.js +60 -0
- package/dist/graphics/rect.d.ts +203 -0
- package/dist/graphics/rect.js +249 -0
- package/dist/graphics/rectangle-shape.d.ts +55 -0
- package/dist/graphics/rectangle-shape.js +60 -0
- package/dist/graphics/render-states.d.ts +188 -0
- package/dist/graphics/render-states.js +115 -0
- package/dist/graphics/render-target.d.ts +222 -0
- package/dist/graphics/render-target.js +434 -0
- package/dist/graphics/render-texture.d.ts +130 -0
- package/dist/graphics/render-texture.js +187 -0
- package/dist/graphics/render-window.d.ts +138 -0
- package/dist/graphics/render-window.js +154 -0
- package/dist/graphics/shader.d.ts +192 -0
- package/dist/graphics/shader.js +321 -0
- package/dist/graphics/shape.d.ts +189 -0
- package/dist/graphics/shape.js +277 -0
- package/dist/graphics/sprite.d.ts +104 -0
- package/dist/graphics/sprite.js +164 -0
- package/dist/graphics/stencil-mode.d.ts +230 -0
- package/dist/graphics/stencil-mode.js +173 -0
- package/dist/graphics/swap.d.ts +17 -0
- package/dist/graphics/swap.js +16 -0
- package/dist/graphics/text.d.ts +759 -0
- package/dist/graphics/text.js +724 -0
- package/dist/graphics/texture.d.ts +255 -0
- package/dist/graphics/texture.js +390 -0
- package/dist/graphics/transform.d.ts +129 -0
- package/dist/graphics/transform.js +274 -0
- package/dist/graphics/transformable.d.ts +24 -0
- package/dist/graphics/transformable.js +38 -0
- package/dist/graphics/vertex-array.d.ts +123 -0
- package/dist/graphics/vertex-array.js +234 -0
- package/dist/graphics/vertex-buffer.d.ts +205 -0
- package/dist/graphics/vertex-buffer.js +256 -0
- package/dist/graphics/vertex.d.ts +111 -0
- package/dist/graphics/vertex.js +134 -0
- package/dist/graphics/view.d.ts +172 -0
- package/dist/graphics/view.js +296 -0
- package/dist/index.d.ts +116 -0
- package/dist/index.js +251 -0
- package/dist/internal/audio-codec-registry.d.ts +13 -0
- package/dist/internal/audio-codec-registry.js +64 -0
- package/dist/internal/audio-input-stream.d.ts +13 -0
- package/dist/internal/audio-input-stream.js +44 -0
- package/dist/internal/audio-music-pump.d.ts +63 -0
- package/dist/internal/audio-music-pump.js +193 -0
- package/dist/internal/audio-native.d.ts +145 -0
- package/dist/internal/audio-native.js +24 -0
- package/dist/internal/audio-recorder-session.d.ts +77 -0
- package/dist/internal/audio-recorder-session.js +182 -0
- package/dist/internal/audio-worker-session.d.ts +18 -0
- package/dist/internal/audio-worker-session.js +82 -0
- package/dist/internal/audio-worker.d.ts +1 -0
- package/dist/internal/audio-worker.js +134 -0
- package/dist/internal/glsl-value.d.ts +51 -0
- package/dist/internal/glsl-value.js +69 -0
- package/dist/internal/graphics-state.d.ts +45 -0
- package/dist/internal/graphics-state.js +123 -0
- package/dist/internal/input-stream.d.ts +4 -0
- package/dist/internal/input-stream.js +25 -0
- package/dist/internal/lazy-value.d.ts +17 -0
- package/dist/internal/lazy-value.js +43 -0
- package/dist/internal/native.d.ts +317 -0
- package/dist/internal/native.js +8 -0
- package/dist/internal/numeric-properties.d.ts +2 -0
- package/dist/internal/numeric-properties.js +39 -0
- package/dist/internal/render-states.d.ts +4 -0
- package/dist/internal/render-states.js +44 -0
- package/dist/internal/scalar.d.ts +52 -0
- package/dist/internal/scalar.js +95 -0
- package/dist/internal/shaped-glyph.d.ts +32 -0
- package/dist/internal/shaped-glyph.js +51 -0
- package/dist/internal/struct-view.d.ts +11 -0
- package/dist/internal/struct-view.js +39 -0
- package/dist/internal/text-indices.d.ts +7 -0
- package/dist/internal/text-indices.js +22 -0
- package/dist/internal/transformable.d.ts +124 -0
- package/dist/internal/transformable.js +121 -0
- package/dist/internal/value-storage.d.ts +33 -0
- package/dist/internal/value-storage.js +21 -0
- package/dist/network/common.d.ts +23 -0
- package/dist/network/common.js +78 -0
- package/dist/network/dns.d.ts +124 -0
- package/dist/network/dns.js +142 -0
- package/dist/network/ftp.d.ts +265 -0
- package/dist/network/ftp.js +417 -0
- package/dist/network/gen/constants.d.ts +878 -0
- package/dist/network/gen/constants.js +886 -0
- package/dist/network/http.d.ts +458 -0
- package/dist/network/http.js +732 -0
- package/dist/network/ip-address.d.ts +210 -0
- package/dist/network/ip-address.js +301 -0
- package/dist/network/packet.d.ts +249 -0
- package/dist/network/packet.js +326 -0
- package/dist/network/sftp.d.ts +661 -0
- package/dist/network/sftp.js +826 -0
- package/dist/network/socket-selector.d.ts +132 -0
- package/dist/network/socket-selector.js +214 -0
- package/dist/network/socket.d.ts +301 -0
- package/dist/network/socket.js +402 -0
- package/dist/network/tcp-listener.d.ts +114 -0
- package/dist/network/tcp-listener.js +199 -0
- package/dist/network/tcp-socket.d.ts +307 -0
- package/dist/network/tcp-socket.js +493 -0
- package/dist/network/tls-material.d.ts +22 -0
- package/dist/network/tls-material.js +52 -0
- package/dist/network/udp-socket.d.ts +178 -0
- package/dist/network/udp-socket.js +285 -0
- package/dist/system/angle.d.ts +77 -0
- package/dist/system/angle.js +122 -0
- package/dist/system/clock.d.ts +65 -0
- package/dist/system/clock.js +99 -0
- package/dist/system/err.d.ts +18 -0
- package/dist/system/err.js +61 -0
- package/dist/system/error.d.ts +15 -0
- package/dist/system/error.js +22 -0
- package/dist/system/file-input-stream.d.ts +68 -0
- package/dist/system/file-input-stream.js +148 -0
- package/dist/system/input-stream.d.ts +114 -0
- package/dist/system/input-stream.js +106 -0
- package/dist/system/operators.d.ts +291 -0
- package/dist/system/operators.js +505 -0
- package/dist/system/sleep.d.ts +9 -0
- package/dist/system/sleep.js +28 -0
- package/dist/system/suspend-aware-clock.d.ts +22 -0
- package/dist/system/suspend-aware-clock.js +29 -0
- package/dist/system/time.d.ts +100 -0
- package/dist/system/time.js +188 -0
- package/dist/system/timeout-with-predicate.d.ts +60 -0
- package/dist/system/timeout-with-predicate.js +52 -0
- package/dist/system/unicode.d.ts +54 -0
- package/dist/system/unicode.js +67 -0
- package/dist/system/vector2.d.ts +302 -0
- package/dist/system/vector2.js +314 -0
- package/dist/system/vector3.d.ts +249 -0
- package/dist/system/vector3.js +266 -0
- package/dist/system/version.d.ts +51 -0
- package/dist/system/version.js +24 -0
- package/dist/window/clipboard.d.ts +14 -0
- package/dist/window/clipboard.js +26 -0
- package/dist/window/context-settings.d.ts +94 -0
- package/dist/window/context-settings.js +84 -0
- package/dist/window/context.d.ts +87 -0
- package/dist/window/context.js +122 -0
- package/dist/window/cursor.d.ts +58 -0
- package/dist/window/cursor.js +80 -0
- package/dist/window/event.d.ts +529 -0
- package/dist/window/event.js +87 -0
- package/dist/window/gen/constants.d.ts +2213 -0
- package/dist/window/gen/constants.js +2227 -0
- package/dist/window/joystick.d.ts +81 -0
- package/dist/window/joystick.js +80 -0
- package/dist/window/keyboard.d.ts +50 -0
- package/dist/window/keyboard.js +59 -0
- package/dist/window/mouse.d.ts +31 -0
- package/dist/window/mouse.js +57 -0
- package/dist/window/sensor.d.ts +26 -0
- package/dist/window/sensor.js +40 -0
- package/dist/window/touch.d.ts +27 -0
- package/dist/window/touch.js +44 -0
- package/dist/window/video-mode.d.ts +77 -0
- package/dist/window/video-mode.js +99 -0
- package/dist/window/vulkan.d.ts +32 -0
- package/dist/window/vulkan.js +45 -0
- package/dist/window/window.d.ts +355 -0
- package/dist/window/window.js +434 -0
- package/docs/README.ja.md +30 -0
- package/docs/README.ko.md +30 -0
- package/docs/README.md +30 -0
- package/docs/README.zh-CN.md +30 -0
- package/docs/api.ja.md +84 -0
- package/docs/api.ko.md +84 -0
- package/docs/api.md +81 -0
- package/docs/api.zh-CN.md +81 -0
- package/docs/audio.ja.md +249 -0
- package/docs/audio.ko.md +251 -0
- package/docs/audio.md +252 -0
- package/docs/audio.zh-CN.md +252 -0
- package/docs/concepts.ja.md +130 -0
- package/docs/concepts.ko.md +130 -0
- package/docs/concepts.md +131 -0
- package/docs/concepts.zh-CN.md +131 -0
- package/docs/development.ja.md +148 -0
- package/docs/development.ko.md +148 -0
- package/docs/development.md +150 -0
- package/docs/development.zh-CN.md +150 -0
- package/docs/getting-started.ja.md +154 -0
- package/docs/getting-started.ko.md +154 -0
- package/docs/getting-started.md +156 -0
- package/docs/getting-started.zh-CN.md +156 -0
- package/docs/graphics.ja.md +256 -0
- package/docs/graphics.ko.md +254 -0
- package/docs/graphics.md +255 -0
- package/docs/graphics.zh-CN.md +257 -0
- package/docs/network.ja.md +214 -0
- package/docs/network.ko.md +216 -0
- package/docs/network.md +218 -0
- package/docs/network.zh-CN.md +218 -0
- package/docs/system.ja.md +169 -0
- package/docs/system.ko.md +171 -0
- package/docs/system.md +173 -0
- package/docs/system.zh-CN.md +173 -0
- package/docs/window.ja.md +138 -0
- package/docs/window.ko.md +140 -0
- package/docs/window.md +141 -0
- package/docs/window.zh-CN.md +141 -0
- package/native/addon.cc +129 -0
- package/native/audio-binding.cc +543 -0
- package/native/audio-codec-binding.cc +246 -0
- package/native/audio-device-binding.cc +160 -0
- package/native/audio-file-binding.cc +192 -0
- package/native/audio-recorder-binding.cc +237 -0
- package/native/audio-recorder.h +39 -0
- package/native/audio-state.h +220 -0
- package/native/audio-stream-binding.cc +284 -0
- package/native/audio-stream.h +28 -0
- package/native/audio-worker-binding.cc +447 -0
- package/native/audio-worker.h +121 -0
- package/native/batch-drawable.cc +189 -0
- package/native/batch-drawable.h +57 -0
- package/native/context-binding.cc +180 -0
- package/native/context-settings.h +74 -0
- package/native/deferred-delete.cc +49 -0
- package/native/deferred-delete.h +84 -0
- package/native/error-stream-binding.cc +270 -0
- package/native/exception-boundary.h +97 -0
- package/native/font-binding.cc +210 -0
- package/native/font-state.h +27 -0
- package/native/graphics-binding.cc +338 -0
- package/native/graphics-state.h +253 -0
- package/native/image-binding.cc +258 -0
- package/native/image-state.h +93 -0
- package/native/input-binding.cc +246 -0
- package/native/numeric-fields.h +96 -0
- package/native/render-window-binding.cc +103 -0
- package/native/render-window-state.h +22 -0
- package/native/shader-binding.cc +292 -0
- package/native/shape-binding.cc +283 -0
- package/native/shape-state.h +68 -0
- package/native/shaped-glyph-storage.h +45 -0
- package/native/shared-handle.h +69 -0
- package/native/stream-binding.cc +286 -0
- package/native/system-binding.cc +91 -0
- package/native/text-binding.cc +205 -0
- package/native/text-state.h +101 -0
- package/native/texture-binding.cc +330 -0
- package/native/texture-resource.h +52 -0
- package/native/time-value.h +28 -0
- package/native/transformable-binding.cc +23 -0
- package/native/transformable-state.h +44 -0
- package/native/value-binding.h +200 -0
- package/native/value-layout.h +116 -0
- package/native/values-binding.cc +27 -0
- package/native/vertex-binding.cc +50 -0
- package/native/vertex-buffer-binding.cc +232 -0
- package/native/vertex-storage.h +20 -0
- package/native/view-data.h +24 -0
- package/native/window-binding.cc +388 -0
- package/native/window-event.h +92 -0
- package/native/window-owner.h +81 -0
- package/package.json +87 -35
- package/src/audio/effect-processor.ts +86 -0
- package/src/audio/input-sound-file.ts +259 -0
- package/src/audio/listener.ts +136 -0
- package/src/audio/music.ts +357 -0
- package/src/audio/output-sound-file.ts +96 -0
- package/src/audio/playback-device.ts +145 -0
- package/src/audio/sound-buffer-recorder.ts +141 -0
- package/src/audio/sound-buffer.ts +275 -0
- package/src/audio/sound-file-factory.ts +235 -0
- package/src/audio/sound-file-reader.ts +224 -0
- package/src/audio/sound-file-writer.ts +61 -0
- package/src/audio/sound-recorder.ts +315 -0
- package/src/audio/sound-source.ts +396 -0
- package/src/audio/sound-stream.ts +108 -0
- package/src/audio/sound.ts +63 -0
- package/src/audio/value.ts +408 -0
- package/src/audio/worker.ts +308 -0
- package/src/graphics/blend-mode.ts +291 -0
- package/src/graphics/boolean-vector.ts +225 -0
- package/src/graphics/circle-shape.ts +113 -0
- package/src/graphics/color.ts +374 -0
- package/src/graphics/convex-shape.ts +76 -0
- package/src/graphics/drawable.ts +32 -0
- package/src/graphics/font.ts +377 -0
- package/src/graphics/glsl-matrix.ts +110 -0
- package/src/graphics/glsl.ts +229 -0
- package/src/graphics/glyph.ts +186 -0
- package/src/graphics/image.ts +366 -0
- package/src/graphics/primitive-type.ts +56 -0
- package/src/graphics/rect.ts +350 -0
- package/src/graphics/rectangle-shape.ts +76 -0
- package/src/graphics/render-states.ts +238 -0
- package/src/graphics/render-target.ts +554 -0
- package/src/graphics/render-texture.ts +234 -0
- package/src/graphics/render-window.ts +250 -0
- package/src/graphics/shader.ts +353 -0
- package/src/graphics/shape.ts +343 -0
- package/src/graphics/sprite.ts +203 -0
- package/src/graphics/stencil-mode.ts +258 -0
- package/src/graphics/swap.ts +28 -0
- package/src/graphics/text.ts +944 -0
- package/src/graphics/texture.ts +529 -0
- package/src/graphics/transform.ts +321 -0
- package/src/graphics/transformable.ts +37 -0
- package/src/graphics/vertex-array.ts +270 -0
- package/src/graphics/vertex-buffer.ts +345 -0
- package/src/graphics/vertex.ts +211 -0
- package/src/graphics/view.ts +355 -0
- package/src/index.ts +147 -0
- package/src/internal/audio-codec-registry.ts +68 -0
- package/src/internal/audio-input-stream.ts +42 -0
- package/src/internal/audio-music-pump.ts +199 -0
- package/src/internal/audio-native.ts +176 -0
- package/src/internal/audio-recorder-session.ts +234 -0
- package/src/internal/audio-worker-session.ts +89 -0
- package/src/internal/audio-worker.ts +146 -0
- package/src/internal/glsl-value.ts +79 -0
- package/src/internal/graphics-state.ts +131 -0
- package/src/internal/input-stream.ts +30 -0
- package/src/internal/lazy-value.ts +62 -0
- package/src/internal/native.ts +581 -0
- package/src/internal/numeric-properties.ts +37 -0
- package/src/internal/render-states.ts +42 -0
- package/src/internal/scalar.ts +117 -0
- package/src/internal/shaped-glyph.ts +68 -0
- package/src/internal/struct-view.ts +49 -0
- package/src/internal/text-indices.ts +19 -0
- package/src/internal/transformable.ts +260 -0
- package/src/internal/value-storage.ts +40 -0
- package/src/network/common.ts +58 -0
- package/src/network/dns.ts +191 -0
- package/src/network/ftp.ts +386 -0
- package/src/network/gen/constants.ts +879 -0
- package/src/network/http.ts +680 -0
- package/src/network/ip-address.ts +311 -0
- package/src/network/packet.ts +388 -0
- package/src/network/sftp.ts +1015 -0
- package/src/network/socket-selector.ts +206 -0
- package/src/network/socket.ts +415 -0
- package/src/network/tcp-listener.ts +193 -0
- package/src/network/tcp-socket.ts +569 -0
- package/src/network/tls-material.ts +46 -0
- package/src/network/udp-socket.ts +294 -0
- package/src/system/angle.ts +132 -0
- package/src/system/clock.ts +104 -0
- package/src/system/err.ts +58 -0
- package/src/system/error.ts +18 -0
- package/src/system/file-input-stream.ts +147 -0
- package/src/system/input-stream.ts +150 -0
- package/src/system/operators.ts +681 -0
- package/src/system/sleep.ts +25 -0
- package/src/system/suspend-aware-clock.ts +27 -0
- package/src/system/time.ts +218 -0
- package/src/system/timeout-with-predicate.ts +94 -0
- package/src/system/unicode.ts +64 -0
- package/src/system/vector2.ts +549 -0
- package/src/system/vector3.ts +433 -0
- package/src/system/version.ts +66 -0
- package/src/window/clipboard.ts +22 -0
- package/src/window/context-settings.ts +143 -0
- package/src/window/context.ts +152 -0
- package/src/window/cursor.ts +116 -0
- package/src/window/event.ts +580 -0
- package/src/window/gen/constants.ts +2231 -0
- package/src/window/joystick.ts +108 -0
- package/src/window/keyboard.ts +78 -0
- package/src/window/mouse.ts +58 -0
- package/src/window/sensor.ts +37 -0
- package/src/window/touch.ts +42 -0
- package/src/window/video-mode.ts +136 -0
- package/src/window/vulkan.ts +42 -0
- package/src/window/window.ts +579 -0
- package/test/native/audio-probes.cc +181 -0
- package/test/native/deferred-delete-probes.cc +62 -0
- package/test/native/drawable-probes.cc +168 -0
- package/test/native/exception-probes.cc +83 -0
- package/test/native/image-probes.cc +105 -0
- package/test/native/matrix-probes.cc +67 -0
- package/test/native/network-oracle.cc +32 -0
- package/test/native/render-texture-probes.cc +193 -0
- package/test/native/shader-probes.cc +69 -0
- package/test/native/shape-probes.cc +160 -0
- package/test/native/sprite-probes.cc +146 -0
- package/test/native/system-probes.cc +109 -0
- package/test/native/text-probes.cc +211 -0
- package/test/native/texture-probes.cc +200 -0
- package/test/native/time-probes.cc +143 -0
- package/test/native/transform-probes.cc +92 -0
- package/test/native/transformable-probes.cc +152 -0
- package/test/native/value-oracle.h +88 -0
- package/test/native/value-probes.cc +379 -0
- package/test/native/vertex-array-probes.cc +82 -0
- package/test/native/vertex-buffer-probes.cc +87 -0
- package/test/native/view-probes.cc +150 -0
- package/test/native/window-probes.cc +172 -0
- package/test/tsconfig.json +8 -0
- package/tools/configure-lsp.cjs +23 -0
- package/tools/constant-docs.cjs +109 -0
- package/tools/constant-docs.json +1318 -0
- package/tools/generate-network-constants.cjs +59 -0
- package/tools/generate-window-constants.cjs +178 -0
- package/tools/lib_downloader.cjs +92 -0
- package/tools/lib_downloader_urls.cjs +23 -0
- package/tsconfig.json +11 -4
- package/index.d.ts +0 -1
- package/lib/clock.d.ts +0 -8
- package/lib/clock.js +0 -5
- package/lib/color.d.ts +0 -11
- package/lib/color.js +0 -98
- package/lib/common.js +0 -47
- package/lib/drawable/circle_shape.d.ts +0 -5
- package/lib/drawable/circle_shape.js +0 -26
- package/lib/drawable/convex_shape.d.ts +0 -5
- package/lib/drawable/convex_shape.js +0 -35
- package/lib/drawable/drawable.d.ts +0 -6
- package/lib/drawable/drawable.js +0 -18
- package/lib/drawable/plugin_package.d.ts +0 -31
- package/lib/drawable/plugin_package.js +0 -102
- package/lib/drawable/rectangle_shape.d.ts +0 -9
- package/lib/drawable/rectangle_shape.js +0 -28
- package/lib/drawable/shape.d.ts +0 -14
- package/lib/drawable/shape.js +0 -30
- package/lib/drawable/sprite.d.ts +0 -17
- package/lib/drawable/sprite.js +0 -53
- package/lib/drawable/text.d.ts +0 -26
- package/lib/drawable/text.js +0 -88
- package/lib/drawable/transformable.d.ts +0 -28
- package/lib/drawable/transformable.js +0 -113
- package/lib/drawable/vertex_array.d.ts +0 -40
- package/lib/drawable/vertex_array.js +0 -128
- package/lib/font.d.ts +0 -24
- package/lib/font.js +0 -137
- package/lib/image.d.ts +0 -26
- package/lib/image.js +0 -147
- package/lib/joystick.d.ts +0 -21
- package/lib/joystick.js +0 -72
- package/lib/keyboard.d.ts +0 -113
- package/lib/keyboard.js +0 -17
- package/lib/mouse.d.ts +0 -6
- package/lib/mouse.js +0 -39
- package/lib/poll_event.d.ts +0 -138
- package/lib/rect.d.ts +0 -18
- package/lib/rect.js +0 -119
- package/lib/render_window.d.ts +0 -67
- package/lib/render_window.js +0 -197
- package/lib/sensor.d.ts +0 -12
- package/lib/sensor.js +0 -34
- package/lib/sfml.d.ts +0 -32
- package/lib/sfml.js +0 -36
- package/lib/sound/base.d.ts +0 -33
- package/lib/sound/base.js +0 -109
- package/lib/sound/music.d.ts +0 -15
- package/lib/sound/music.js +0 -65
- package/lib/sound/sound.d.ts +0 -16
- package/lib/sound/sound.js +0 -55
- package/lib/sound/sound_buffer.d.ts +0 -14
- package/lib/sound/sound_buffer.js +0 -78
- package/lib/texture.d.ts +0 -21
- package/lib/texture.js +0 -127
- package/lib/time.d.ts +0 -13
- package/lib/time.js +0 -41
- package/lib/touch.d.ts +0 -7
- package/lib/touch.js +0 -34
- package/lib/vector2.d.ts +0 -49
- package/lib/vector2.js +0 -141
- package/lib/vector3.d.ts +0 -47
- package/lib/vector3.js +0 -154
- package/lib/vertex.d.ts +0 -14
- package/lib/vertex.js +0 -177
- package/lib/video_mode.d.ts +0 -12
- package/lib/video_mode.js +0 -99
- package/src/base_class_with_loading.h +0 -21
- package/src/clock.cc +0 -71
- package/src/clock.h +0 -30
- package/src/color.cc +0 -189
- package/src/color.h +0 -49
- package/src/drawable/circle_shape.cc +0 -78
- package/src/drawable/circle_shape.h +0 -28
- package/src/drawable/convex_shape.cc +0 -57
- package/src/drawable/convex_shape.h +0 -29
- package/src/drawable/drawable-inl.h +0 -29
- package/src/drawable/drawable.cc +0 -41
- package/src/drawable/drawable.h +0 -49
- package/src/drawable/package_plugin-inl.h +0 -191
- package/src/drawable/package_plugin.h +0 -60
- package/src/drawable/rectangle_shape.cc +0 -69
- package/src/drawable/rectangle_shape.h +0 -29
- package/src/drawable/shape.cc +0 -67
- package/src/drawable/shape.h +0 -39
- package/src/drawable/sprite.cc +0 -122
- package/src/drawable/sprite.h +0 -45
- package/src/drawable/text.cc +0 -133
- package/src/drawable/text.h +0 -54
- package/src/drawable/vertex_array.cc +0 -248
- package/src/drawable/vertex_array.h +0 -46
- package/src/font.cc +0 -214
- package/src/font.h +0 -44
- package/src/gen/.gitkeep +0 -0
- package/src/gen/joystick_axis.cc +0 -30
- package/src/gen/keycode.cc +0 -226
- package/src/gen/mouse_button.cc +0 -30
- package/src/gen/sensor_type.cc +0 -26
- package/src/image.cc +0 -379
- package/src/image.h +0 -72
- package/src/joystick.cc +0 -132
- package/src/joystick.h +0 -32
- package/src/keyboard.cc +0 -65
- package/src/keyboard.h +0 -27
- package/src/mouse.cc +0 -95
- package/src/mouse.h +0 -30
- package/src/plugins/transformable_plugin-inl.h +0 -121
- package/src/plugins/transformable_plugin.h +0 -42
- package/src/poll_event.cc +0 -326
- package/src/poll_event.h +0 -18
- package/src/rect-inl.h +0 -154
- package/src/rect.cc +0 -28
- package/src/rect.h +0 -105
- package/src/render_window.cc +0 -413
- package/src/render_window.h +0 -111
- package/src/render_window_async_display.cc +0 -49
- package/src/render_window_async_draw.cc +0 -56
- package/src/resizable_buffer.h +0 -104
- package/src/sensor.cc +0 -82
- package/src/sensor.h +0 -28
- package/src/sfml.cc +0 -85
- package/src/sound/music.cc +0 -113
- package/src/sound/music.h +0 -35
- package/src/sound/sound.cc +0 -116
- package/src/sound/sound.h +0 -41
- package/src/sound/sound_buffer.cc +0 -226
- package/src/sound/sound_buffer.h +0 -46
- package/src/sound/sound_source.cc +0 -124
- package/src/sound/sound_source.h +0 -80
- package/src/texture.cc +0 -246
- package/src/texture.h +0 -47
- package/src/time.cc +0 -177
- package/src/time.h +0 -42
- package/src/touch.cc +0 -54
- package/src/touch.h +0 -23
- package/src/utils-inl.h +0 -48
- package/src/utils.h +0 -21
- package/src/vector2-inl.h +0 -198
- package/src/vector2.cc +0 -36
- package/src/vector2.h +0 -133
- package/src/vector3-inl.h +0 -200
- package/src/vector3.cc +0 -36
- package/src/vector3.h +0 -134
- package/src/vertex.cc +0 -238
- package/src/vertex.h +0 -114
- package/src/video_mode.cc +0 -184
- package/src/video_mode.h +0 -38
- package/src/workers/load_from_file_worker.h +0 -79
- package/src/workers/save_to_file_worker.h +0 -79
- package/third_party/sfml/include/SFML/Audio/AlResource.hpp +0 -70
- package/third_party/sfml/include/SFML/Audio/Export.hpp +0 -48
- package/third_party/sfml/include/SFML/Audio/InputSoundFile.hpp +0 -268
- package/third_party/sfml/include/SFML/Audio/Listener.hpp +0 -234
- package/third_party/sfml/include/SFML/Audio/Music.hpp +0 -337
- package/third_party/sfml/include/SFML/Audio/OutputSoundFile.hpp +0 -133
- package/third_party/sfml/include/SFML/Audio/Sound.hpp +0 -264
- package/third_party/sfml/include/SFML/Audio/SoundBuffer.hpp +0 -352
- package/third_party/sfml/include/SFML/Audio/SoundBufferRecorder.hpp +0 -144
- package/third_party/sfml/include/SFML/Audio/SoundFileFactory.hpp +0 -197
- package/third_party/sfml/include/SFML/Audio/SoundFileFactory.inl +0 -100
- package/third_party/sfml/include/SFML/Audio/SoundFileReader.hpp +0 -165
- package/third_party/sfml/include/SFML/Audio/SoundFileWriter.hpp +0 -125
- package/third_party/sfml/include/SFML/Audio/SoundRecorder.hpp +0 -410
- package/third_party/sfml/include/SFML/Audio/SoundSource.hpp +0 -332
- package/third_party/sfml/include/SFML/Audio/SoundStream.hpp +0 -420
- package/third_party/sfml/include/SFML/Audio.hpp +0 -56
- package/third_party/sfml/include/SFML/Config.hpp +0 -248
- package/third_party/sfml/include/SFML/GpuPreference.hpp +0 -74
- package/third_party/sfml/include/SFML/Graphics/BlendMode.hpp +0 -219
- package/third_party/sfml/include/SFML/Graphics/CircleShape.hpp +0 -154
- package/third_party/sfml/include/SFML/Graphics/Color.hpp +0 -275
- package/third_party/sfml/include/SFML/Graphics/ConvexShape.hpp +0 -153
- package/third_party/sfml/include/SFML/Graphics/Drawable.hpp +0 -126
- package/third_party/sfml/include/SFML/Graphics/Export.hpp +0 -48
- package/third_party/sfml/include/SFML/Graphics/Font.hpp +0 -496
- package/third_party/sfml/include/SFML/Graphics/Glsl.hpp +0 -227
- package/third_party/sfml/include/SFML/Graphics/Glsl.inl +0 -155
- package/third_party/sfml/include/SFML/Graphics/Glyph.hpp +0 -81
- package/third_party/sfml/include/SFML/Graphics/Image.hpp +0 -346
- package/third_party/sfml/include/SFML/Graphics/PrimitiveType.hpp +0 -58
- package/third_party/sfml/include/SFML/Graphics/Rect.hpp +0 -274
- package/third_party/sfml/include/SFML/Graphics/Rect.inl +0 -171
- package/third_party/sfml/include/SFML/Graphics/RectangleShape.hpp +0 -132
- package/third_party/sfml/include/SFML/Graphics/RenderStates.hpp +0 -174
- package/third_party/sfml/include/SFML/Graphics/RenderTarget.hpp +0 -518
- package/third_party/sfml/include/SFML/Graphics/RenderTexture.hpp +0 -334
- package/third_party/sfml/include/SFML/Graphics/RenderWindow.hpp +0 -302
- package/third_party/sfml/include/SFML/Graphics/Shader.hpp +0 -875
- package/third_party/sfml/include/SFML/Graphics/Shape.hpp +0 -355
- package/third_party/sfml/include/SFML/Graphics/Sprite.hpp +0 -279
- package/third_party/sfml/include/SFML/Graphics/Text.hpp +0 -513
- package/third_party/sfml/include/SFML/Graphics/Texture.hpp +0 -733
- package/third_party/sfml/include/SFML/Graphics/Transform.hpp +0 -497
- package/third_party/sfml/include/SFML/Graphics/Transformable.hpp +0 -429
- package/third_party/sfml/include/SFML/Graphics/Vertex.hpp +0 -148
- package/third_party/sfml/include/SFML/Graphics/VertexArray.hpp +0 -223
- package/third_party/sfml/include/SFML/Graphics/VertexBuffer.hpp +0 -408
- package/third_party/sfml/include/SFML/Graphics/View.hpp +0 -343
- package/third_party/sfml/include/SFML/Graphics.hpp +0 -68
- package/third_party/sfml/include/SFML/Main.hpp +0 -43
- package/third_party/sfml/include/SFML/Network/Export.hpp +0 -48
- package/third_party/sfml/include/SFML/Network/Ftp.hpp +0 -616
- package/third_party/sfml/include/SFML/Network/Http.hpp +0 -482
- package/third_party/sfml/include/SFML/Network/IpAddress.hpp +0 -328
- package/third_party/sfml/include/SFML/Network/Packet.hpp +0 -545
- package/third_party/sfml/include/SFML/Network/Socket.hpp +0 -219
- package/third_party/sfml/include/SFML/Network/SocketHandle.hpp +0 -57
- package/third_party/sfml/include/SFML/Network/SocketSelector.hpp +0 -263
- package/third_party/sfml/include/SFML/Network/TcpListener.hpp +0 -170
- package/third_party/sfml/include/SFML/Network/TcpSocket.hpp +0 -316
- package/third_party/sfml/include/SFML/Network/UdpSocket.hpp +0 -292
- package/third_party/sfml/include/SFML/Network.hpp +0 -53
- package/third_party/sfml/include/SFML/OpenGL.hpp +0 -78
- package/third_party/sfml/include/SFML/System/Clock.hpp +0 -117
- package/third_party/sfml/include/SFML/System/Err.hpp +0 -80
- package/third_party/sfml/include/SFML/System/Export.hpp +0 -48
- package/third_party/sfml/include/SFML/System/FileInputStream.hpp +0 -169
- package/third_party/sfml/include/SFML/System/InputStream.hpp +0 -152
- package/third_party/sfml/include/SFML/System/Lock.hpp +0 -139
- package/third_party/sfml/include/SFML/System/MemoryInputStream.hpp +0 -148
- package/third_party/sfml/include/SFML/System/Mutex.hpp +0 -148
- package/third_party/sfml/include/SFML/System/NativeActivity.hpp +0 -62
- package/third_party/sfml/include/SFML/System/NonCopyable.hpp +0 -129
- package/third_party/sfml/include/SFML/System/Sleep.hpp +0 -52
- package/third_party/sfml/include/SFML/System/String.hpp +0 -669
- package/third_party/sfml/include/SFML/System/String.inl +0 -53
- package/third_party/sfml/include/SFML/System/Thread.hpp +0 -282
- package/third_party/sfml/include/SFML/System/Thread.inl +0 -90
- package/third_party/sfml/include/SFML/System/ThreadLocal.hpp +0 -103
- package/third_party/sfml/include/SFML/System/ThreadLocalPtr.hpp +0 -158
- package/third_party/sfml/include/SFML/System/ThreadLocalPtr.inl +0 -77
- package/third_party/sfml/include/SFML/System/Time.hpp +0 -488
- package/third_party/sfml/include/SFML/System/Utf.hpp +0 -763
- package/third_party/sfml/include/SFML/System/Utf.inl +0 -752
- package/third_party/sfml/include/SFML/System/Vector2.hpp +0 -301
- package/third_party/sfml/include/SFML/System/Vector2.inl +0 -161
- package/third_party/sfml/include/SFML/System/Vector3.hpp +0 -302
- package/third_party/sfml/include/SFML/System/Vector3.inl +0 -168
- package/third_party/sfml/include/SFML/System.hpp +0 -60
- package/third_party/sfml/include/SFML/Window/Clipboard.hpp +0 -119
- package/third_party/sfml/include/SFML/Window/Context.hpp +0 -195
- package/third_party/sfml/include/SFML/Window/ContextSettings.hpp +0 -149
- package/third_party/sfml/include/SFML/Window/Cursor.hpp +0 -241
- package/third_party/sfml/include/SFML/Window/Event.hpp +0 -285
- package/third_party/sfml/include/SFML/Window/Export.hpp +0 -48
- package/third_party/sfml/include/SFML/Window/GlResource.hpp +0 -109
- package/third_party/sfml/include/SFML/Window/Joystick.hpp +0 -227
- package/third_party/sfml/include/SFML/Window/Keyboard.hpp +0 -491
- package/third_party/sfml/include/SFML/Window/Mouse.hpp +0 -180
- package/third_party/sfml/include/SFML/Window/Sensor.hpp +0 -150
- package/third_party/sfml/include/SFML/Window/Touch.hpp +0 -137
- package/third_party/sfml/include/SFML/Window/VideoMode.hpp +0 -228
- package/third_party/sfml/include/SFML/Window/Vulkan.hpp +0 -115
- package/third_party/sfml/include/SFML/Window/Window.hpp +0 -354
- package/third_party/sfml/include/SFML/Window/WindowBase.hpp +0 -518
- package/third_party/sfml/include/SFML/Window/WindowHandle.hpp +0 -101
- package/third_party/sfml/include/SFML/Window/WindowStyle.hpp +0 -53
- package/third_party/sfml/include/SFML/Window.hpp +0 -58
- package/tools/clang_format.js +0 -9
- package/tools/copier/linux.js +0 -21
- package/tools/copier/macos.js +0 -34
- package/tools/copier/windows.js +0 -33
- package/tools/joystick_axis.js +0 -63
- package/tools/keycode.js +0 -92
- package/tools/lib_downloader.js +0 -107
- package/tools/lib_downloader_urls.js +0 -59
- package/tools/mouse_button.js +0 -92
- package/tools/sensor_type.js +0 -63
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
import { Vector2, Vector2i, Vector2u } from '../system/vector2';
|
|
2
|
+
import { Vector3, Vector3f } from '../system/vector3';
|
|
3
|
+
import type {
|
|
4
|
+
KeyboardKey, KeyboardScancode, MouseButton, MouseWheel,
|
|
5
|
+
JoystickAxis, SensorType,
|
|
6
|
+
} from './gen/constants';
|
|
7
|
+
|
|
8
|
+
interface KeyEvent {
|
|
9
|
+
/**
|
|
10
|
+
* A logical key code affected by the keyboard layout.
|
|
11
|
+
* @zh 受键盘布局影响的逻辑键码。
|
|
12
|
+
* @ja キーボード配列の影響を受ける論理キーコード。
|
|
13
|
+
* @ko 키보드 레이아웃의 영향을 받는 논리 키 코드.
|
|
14
|
+
*/
|
|
15
|
+
code: KeyboardKey;
|
|
16
|
+
/**
|
|
17
|
+
* A physical scancode independent of the keyboard layout.
|
|
18
|
+
* @zh 与键盘布局无关的物理扫描码。
|
|
19
|
+
* @ja キーボード配列に依存しない物理スキャンコード。
|
|
20
|
+
* @ko 키보드 레이아웃과 무관한 물리 스캔 코드.
|
|
21
|
+
*/
|
|
22
|
+
scancode: KeyboardScancode;
|
|
23
|
+
/**
|
|
24
|
+
* Whether Alt was pressed when the event occurred.
|
|
25
|
+
* @zh 事件发生时 Alt 是否按下。
|
|
26
|
+
* @ja イベント発生時に Alt が押されていたかどうか。
|
|
27
|
+
* @ko 이벤트 발생 시 Alt가 눌려 있었는지 여부.
|
|
28
|
+
*/
|
|
29
|
+
alt: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Whether Control was pressed when the event occurred.
|
|
32
|
+
* @zh 事件发生时 Control 是否按下。
|
|
33
|
+
* @ja イベント発生時に Control が押されていたかどうか。
|
|
34
|
+
* @ko 이벤트 발생 시 Control이 눌려 있었는지 여부.
|
|
35
|
+
*/
|
|
36
|
+
control: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Whether Shift was pressed when the event occurred.
|
|
39
|
+
* @zh 事件发生时 Shift 是否按下。
|
|
40
|
+
* @ja イベント発生時に Shift が押されていたかどうか。
|
|
41
|
+
* @ko 이벤트 발생 시 Shift가 눌려 있었는지 여부.
|
|
42
|
+
*/
|
|
43
|
+
shift: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the system modifier key (such as Command) was pressed when the
|
|
46
|
+
* event occurred.
|
|
47
|
+
* @zh 事件发生时系统修饰键(如 Command)是否按下。
|
|
48
|
+
* @ja イベント発生時にシステム修飾キー(Command など)が押されていたかどうか。
|
|
49
|
+
* @ko 이벤트 발생 시 시스템 보조 키(Command 등)가 눌려 있었는지 여부.
|
|
50
|
+
*/
|
|
51
|
+
system: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Window event kinds and their payloads; all positions are client-area
|
|
56
|
+
* pixel coordinates.
|
|
57
|
+
* @zh 窗口事件种类及其附带数据;位置均为客户区像素坐标。
|
|
58
|
+
* @ja ウィンドウイベントの種類と付随データ。位置はすべてクライアント領域の
|
|
59
|
+
* ピクセル座標。
|
|
60
|
+
* @ko 윈도우 이벤트 종류와 부속 데이터. 위치는 모두 클라이언트 영역 픽셀 좌표이다.
|
|
61
|
+
*/
|
|
62
|
+
export interface EventPayloads {
|
|
63
|
+
/**
|
|
64
|
+
* The user requested closing the window; the application must call close().
|
|
65
|
+
* @zh 用户请求关闭窗口,需要应用自行调用 close()。
|
|
66
|
+
* @ja ユーザーがウィンドウを閉じるよう要求した。アプリが自ら close() を呼ぶ必要がある。
|
|
67
|
+
* @ko 사용자가 윈도우 닫기를 요청했다. 애플리케이션이 직접 close()를 호출해야 한다.
|
|
68
|
+
*/
|
|
69
|
+
Closed: {};
|
|
70
|
+
/**
|
|
71
|
+
* The client area changed size.
|
|
72
|
+
* @zh 客户区尺寸变化。
|
|
73
|
+
* @ja クライアント領域のサイズが変化した。
|
|
74
|
+
* @ko 클라이언트 영역의 크기가 변경되었다.
|
|
75
|
+
*/
|
|
76
|
+
Resized: {
|
|
77
|
+
/**
|
|
78
|
+
* The new client-area pixel dimensions.
|
|
79
|
+
* @zh 新客户区像素尺寸。
|
|
80
|
+
* @ja 新しいクライアント領域のピクセル寸法。
|
|
81
|
+
* @ko 새로운 클라이언트 영역 픽셀 크기.
|
|
82
|
+
*/
|
|
83
|
+
size: Vector2u;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Input focus was lost.
|
|
87
|
+
* @zh 失去输入焦点。
|
|
88
|
+
* @ja 入力フォーカスを失った。
|
|
89
|
+
* @ko 입력 포커스를 잃었다.
|
|
90
|
+
*/
|
|
91
|
+
FocusLost: {};
|
|
92
|
+
/**
|
|
93
|
+
* Input focus was gained.
|
|
94
|
+
* @zh 获得输入焦点。
|
|
95
|
+
* @ja 入力フォーカスを得た。
|
|
96
|
+
* @ko 입력 포커스를 얻었다.
|
|
97
|
+
*/
|
|
98
|
+
FocusGained: {};
|
|
99
|
+
/**
|
|
100
|
+
* A Unicode character was entered.
|
|
101
|
+
* @zh 输入了一个 Unicode 字符。
|
|
102
|
+
* @ja Unicode 文字が入力された。
|
|
103
|
+
* @ko Unicode 문자가 입력되었다.
|
|
104
|
+
*/
|
|
105
|
+
TextEntered: {
|
|
106
|
+
/**
|
|
107
|
+
* A Unicode code point, not a UTF-16 code unit.
|
|
108
|
+
* @zh Unicode 码点,不是 UTF-16 代码单元。
|
|
109
|
+
* @ja UTF-16 コード単位ではなく、Unicode コードポイント。
|
|
110
|
+
* @ko UTF-16 코드 단위가 아닌 Unicode 코드 포인트.
|
|
111
|
+
*/
|
|
112
|
+
unicode: number;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* A keyboard key was pressed.
|
|
116
|
+
* @zh 键盘按键按下。
|
|
117
|
+
* @ja キーボードのキーが押された。
|
|
118
|
+
* @ko 키보드 키가 눌렸다.
|
|
119
|
+
*/
|
|
120
|
+
KeyPressed: KeyEvent;
|
|
121
|
+
/**
|
|
122
|
+
* A keyboard key was released.
|
|
123
|
+
* @zh 键盘按键释放。
|
|
124
|
+
* @ja キーボードのキーが離された。
|
|
125
|
+
* @ko 키보드 키가 놓였다.
|
|
126
|
+
*/
|
|
127
|
+
KeyReleased: KeyEvent;
|
|
128
|
+
/**
|
|
129
|
+
* A mouse wheel was scrolled.
|
|
130
|
+
* @zh 鼠标滚轮滚动。
|
|
131
|
+
* @ja マウスホイールがスクロールされた。
|
|
132
|
+
* @ko 마우스 휠이 스크롤되었다.
|
|
133
|
+
*/
|
|
134
|
+
MouseWheelScrolled: {
|
|
135
|
+
/**
|
|
136
|
+
* The vertical or horizontal wheel.
|
|
137
|
+
* @zh 垂直或水平滚轮。
|
|
138
|
+
* @ja 垂直または水平ホイール。
|
|
139
|
+
* @ko 수직 또는 수평 휠.
|
|
140
|
+
*/
|
|
141
|
+
wheel: MouseWheel;
|
|
142
|
+
/**
|
|
143
|
+
* Scroll amount, possibly fractional; positive values mean up or left.
|
|
144
|
+
* @zh 滚动量,可为小数;正值向上或向左。
|
|
145
|
+
* @ja スクロール量。小数も可能で、正の値は上または左方向。
|
|
146
|
+
* @ko 스크롤 양. 소수도 가능하며 양수는 위쪽 또는 왼쪽을 뜻한다.
|
|
147
|
+
*/
|
|
148
|
+
delta: number;
|
|
149
|
+
/**
|
|
150
|
+
* The client-area pixel position when scrolling occurred.
|
|
151
|
+
* @zh 滚动时的客户区像素位置。
|
|
152
|
+
* @ja スクロール時のクライアント領域内のピクセル位置。
|
|
153
|
+
* @ko 스크롤 발생 시 클라이언트 영역 픽셀 위치.
|
|
154
|
+
*/
|
|
155
|
+
position: Vector2i;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* A mouse button was pressed.
|
|
159
|
+
* @zh 鼠标按钮按下。
|
|
160
|
+
* @ja マウスボタンが押された。
|
|
161
|
+
* @ko 마우스 버튼이 눌렸다.
|
|
162
|
+
*/
|
|
163
|
+
MouseButtonPressed: {
|
|
164
|
+
/**
|
|
165
|
+
* The pressed button.
|
|
166
|
+
* @zh 按下的按钮。
|
|
167
|
+
* @ja 押されたボタン。
|
|
168
|
+
* @ko 눌린 버튼.
|
|
169
|
+
*/
|
|
170
|
+
button: MouseButton;
|
|
171
|
+
/**
|
|
172
|
+
* The client-area pixel position.
|
|
173
|
+
* @zh 客户区像素位置。
|
|
174
|
+
* @ja クライアント領域内のピクセル位置。
|
|
175
|
+
* @ko 클라이언트 영역 픽셀 위치.
|
|
176
|
+
*/
|
|
177
|
+
position: Vector2i;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* A mouse button was released.
|
|
181
|
+
* @zh 鼠标按钮释放。
|
|
182
|
+
* @ja マウスボタンが離された。
|
|
183
|
+
* @ko 마우스 버튼이 놓였다.
|
|
184
|
+
*/
|
|
185
|
+
MouseButtonReleased: {
|
|
186
|
+
/**
|
|
187
|
+
* The released button.
|
|
188
|
+
* @zh 释放的按钮。
|
|
189
|
+
* @ja 離されたボタン。
|
|
190
|
+
* @ko 놓인 버튼.
|
|
191
|
+
*/
|
|
192
|
+
button: MouseButton;
|
|
193
|
+
/**
|
|
194
|
+
* The client-area pixel position.
|
|
195
|
+
* @zh 客户区像素位置。
|
|
196
|
+
* @ja クライアント領域内のピクセル位置。
|
|
197
|
+
* @ko 클라이언트 영역 픽셀 위치.
|
|
198
|
+
*/
|
|
199
|
+
position: Vector2i;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* The mouse moved within the client area.
|
|
203
|
+
* @zh 鼠标在客户区移动。
|
|
204
|
+
* @ja マウスがクライアント領域内で移動した。
|
|
205
|
+
* @ko 마우스가 클라이언트 영역 안에서 이동했다.
|
|
206
|
+
*/
|
|
207
|
+
MouseMoved: {
|
|
208
|
+
/**
|
|
209
|
+
* The client-area pixel position.
|
|
210
|
+
* @zh 客户区像素位置。
|
|
211
|
+
* @ja クライアント領域内のピクセル位置。
|
|
212
|
+
* @ko 클라이언트 영역 픽셀 위치.
|
|
213
|
+
*/
|
|
214
|
+
position: Vector2i;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* Raw mouse movement without system acceleration.
|
|
218
|
+
* @zh 未经过系统加速的原始鼠标移动。
|
|
219
|
+
* @ja システムの加速処理を受けていない生のマウス移動。
|
|
220
|
+
* @ko 시스템 가속을 적용하지 않은 원시 마우스 이동.
|
|
221
|
+
*/
|
|
222
|
+
MouseMovedRaw: {
|
|
223
|
+
/**
|
|
224
|
+
* The relative movement reported by the device.
|
|
225
|
+
* @zh 设备报告的相对移动量。
|
|
226
|
+
* @ja デバイスが報告した相対移動量。
|
|
227
|
+
* @ko 장치가 보고한 상대 이동량.
|
|
228
|
+
*/
|
|
229
|
+
delta: Vector2i;
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* The mouse entered the client area.
|
|
233
|
+
* @zh 鼠标进入客户区。
|
|
234
|
+
* @ja マウスがクライアント領域に入った。
|
|
235
|
+
* @ko 마우스가 클라이언트 영역에 들어왔다.
|
|
236
|
+
*/
|
|
237
|
+
MouseEntered: {};
|
|
238
|
+
/**
|
|
239
|
+
* The mouse left the client area.
|
|
240
|
+
* @zh 鼠标离开客户区。
|
|
241
|
+
* @ja マウスがクライアント領域から出た。
|
|
242
|
+
* @ko 마우스가 클라이언트 영역을 벗어났다.
|
|
243
|
+
*/
|
|
244
|
+
MouseLeft: {};
|
|
245
|
+
/**
|
|
246
|
+
* A joystick button was pressed.
|
|
247
|
+
* @zh 游戏手柄按钮按下。
|
|
248
|
+
* @ja ジョイスティックのボタンが押された。
|
|
249
|
+
* @ko 조이스틱 버튼이 눌렸다.
|
|
250
|
+
*/
|
|
251
|
+
JoystickButtonPressed: {
|
|
252
|
+
/**
|
|
253
|
+
* The zero-based joystick index.
|
|
254
|
+
* @zh 从零开始的手柄编号。
|
|
255
|
+
* @ja ゼロから始まるジョイスティック番号。
|
|
256
|
+
* @ko 0부터 시작하는 조이스틱 번호.
|
|
257
|
+
*/
|
|
258
|
+
joystickId: number;
|
|
259
|
+
/**
|
|
260
|
+
* The zero-based button index.
|
|
261
|
+
* @zh 从零开始的按钮编号。
|
|
262
|
+
* @ja ゼロから始まるボタン番号。
|
|
263
|
+
* @ko 0부터 시작하는 버튼 번호.
|
|
264
|
+
*/
|
|
265
|
+
button: number;
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* A joystick button was released.
|
|
269
|
+
* @zh 游戏手柄按钮释放。
|
|
270
|
+
* @ja ジョイスティックのボタンが離された。
|
|
271
|
+
* @ko 조이스틱 버튼이 놓였다.
|
|
272
|
+
*/
|
|
273
|
+
JoystickButtonReleased: {
|
|
274
|
+
/**
|
|
275
|
+
* The zero-based joystick index.
|
|
276
|
+
* @zh 从零开始的手柄编号。
|
|
277
|
+
* @ja ゼロから始まるジョイスティック番号。
|
|
278
|
+
* @ko 0부터 시작하는 조이스틱 번호.
|
|
279
|
+
*/
|
|
280
|
+
joystickId: number;
|
|
281
|
+
/**
|
|
282
|
+
* The zero-based button index.
|
|
283
|
+
* @zh 从零开始的按钮编号。
|
|
284
|
+
* @ja ゼロから始まるボタン番号。
|
|
285
|
+
* @ko 0부터 시작하는 버튼 번호.
|
|
286
|
+
*/
|
|
287
|
+
button: number;
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* A joystick axis moved.
|
|
291
|
+
* @zh 游戏手柄轴移动。
|
|
292
|
+
* @ja ジョイスティックの軸が動いた。
|
|
293
|
+
* @ko 조이스틱 축이 움직였다.
|
|
294
|
+
*/
|
|
295
|
+
JoystickMoved: {
|
|
296
|
+
/**
|
|
297
|
+
* The zero-based joystick index.
|
|
298
|
+
* @zh 从零开始的手柄编号。
|
|
299
|
+
* @ja ゼロから始まるジョイスティック番号。
|
|
300
|
+
* @ko 0부터 시작하는 조이스틱 번호.
|
|
301
|
+
*/
|
|
302
|
+
joystickId: number;
|
|
303
|
+
/**
|
|
304
|
+
* The axis that changed.
|
|
305
|
+
* @zh 发生变化的轴。
|
|
306
|
+
* @ja 変化した軸。
|
|
307
|
+
* @ko 변경된 축.
|
|
308
|
+
*/
|
|
309
|
+
axis: JoystickAxis;
|
|
310
|
+
/**
|
|
311
|
+
* The axis position, from -100 to 100.
|
|
312
|
+
* @zh 轴位置,范围 -100~100。
|
|
313
|
+
* @ja 軸の位置。範囲は -100~100。
|
|
314
|
+
* @ko 축 위치. 범위는 -100~100.
|
|
315
|
+
*/
|
|
316
|
+
position: number;
|
|
317
|
+
};
|
|
318
|
+
/**
|
|
319
|
+
* A joystick was connected.
|
|
320
|
+
* @zh 游戏手柄接入。
|
|
321
|
+
* @ja ジョイスティックが接続された。
|
|
322
|
+
* @ko 조이스틱이 연결되었다.
|
|
323
|
+
*/
|
|
324
|
+
JoystickConnected: {
|
|
325
|
+
/**
|
|
326
|
+
* The index of the connected joystick.
|
|
327
|
+
* @zh 接入的手柄编号。
|
|
328
|
+
* @ja 接続されたジョイスティックの番号。
|
|
329
|
+
* @ko 연결된 조이스틱의 번호.
|
|
330
|
+
*/
|
|
331
|
+
joystickId: number;
|
|
332
|
+
};
|
|
333
|
+
/**
|
|
334
|
+
* A joystick was disconnected.
|
|
335
|
+
* @zh 游戏手柄断开。
|
|
336
|
+
* @ja ジョイスティックが切断された。
|
|
337
|
+
* @ko 조이스틱 연결이 끊어졌다.
|
|
338
|
+
*/
|
|
339
|
+
JoystickDisconnected: {
|
|
340
|
+
/**
|
|
341
|
+
* The index of the disconnected joystick.
|
|
342
|
+
* @zh 断开的手柄编号。
|
|
343
|
+
* @ja 切断されたジョイスティックの番号。
|
|
344
|
+
* @ko 연결이 끊어진 조이스틱의 번호.
|
|
345
|
+
*/
|
|
346
|
+
joystickId: number;
|
|
347
|
+
};
|
|
348
|
+
/**
|
|
349
|
+
* A touch began.
|
|
350
|
+
* @zh 触点开始。
|
|
351
|
+
* @ja タッチが開始した。
|
|
352
|
+
* @ko 터치가 시작되었다.
|
|
353
|
+
*/
|
|
354
|
+
TouchBegan: {
|
|
355
|
+
/**
|
|
356
|
+
* The touch index.
|
|
357
|
+
* @zh 触点编号。
|
|
358
|
+
* @ja タッチの番号。
|
|
359
|
+
* @ko 터치 번호.
|
|
360
|
+
*/
|
|
361
|
+
finger: number;
|
|
362
|
+
/**
|
|
363
|
+
* The client-area pixel position.
|
|
364
|
+
* @zh 客户区像素位置。
|
|
365
|
+
* @ja クライアント領域内のピクセル位置。
|
|
366
|
+
* @ko 클라이언트 영역 픽셀 위치.
|
|
367
|
+
*/
|
|
368
|
+
position: Vector2i;
|
|
369
|
+
};
|
|
370
|
+
/**
|
|
371
|
+
* A touch moved.
|
|
372
|
+
* @zh 触点移动。
|
|
373
|
+
* @ja タッチが移動した。
|
|
374
|
+
* @ko 터치가 이동했다.
|
|
375
|
+
*/
|
|
376
|
+
TouchMoved: {
|
|
377
|
+
/**
|
|
378
|
+
* The touch index.
|
|
379
|
+
* @zh 触点编号。
|
|
380
|
+
* @ja タッチの番号。
|
|
381
|
+
* @ko 터치 번호.
|
|
382
|
+
*/
|
|
383
|
+
finger: number;
|
|
384
|
+
/**
|
|
385
|
+
* The client-area pixel position.
|
|
386
|
+
* @zh 客户区像素位置。
|
|
387
|
+
* @ja クライアント領域内のピクセル位置。
|
|
388
|
+
* @ko 클라이언트 영역 픽셀 위치.
|
|
389
|
+
*/
|
|
390
|
+
position: Vector2i;
|
|
391
|
+
};
|
|
392
|
+
/**
|
|
393
|
+
* A touch ended.
|
|
394
|
+
* @zh 触点结束。
|
|
395
|
+
* @ja タッチが終了した。
|
|
396
|
+
* @ko 터치가 종료되었다.
|
|
397
|
+
*/
|
|
398
|
+
TouchEnded: {
|
|
399
|
+
/**
|
|
400
|
+
* The touch index.
|
|
401
|
+
* @zh 触点编号。
|
|
402
|
+
* @ja タッチの番号。
|
|
403
|
+
* @ko 터치 번호.
|
|
404
|
+
*/
|
|
405
|
+
finger: number;
|
|
406
|
+
/**
|
|
407
|
+
* The client-area pixel position.
|
|
408
|
+
* @zh 客户区像素位置。
|
|
409
|
+
* @ja クライアント領域内のピクセル位置。
|
|
410
|
+
* @ko 클라이언트 영역 픽셀 위치.
|
|
411
|
+
*/
|
|
412
|
+
position: Vector2i;
|
|
413
|
+
};
|
|
414
|
+
/**
|
|
415
|
+
* A sensor measurement was updated.
|
|
416
|
+
* @zh 传感器测量值更新。
|
|
417
|
+
* @ja センサーの測定値が更新された。
|
|
418
|
+
* @ko 센서 측정값이 갱신되었다.
|
|
419
|
+
*/
|
|
420
|
+
SensorChanged: {
|
|
421
|
+
/**
|
|
422
|
+
* The sensor type, which determines the measurement unit.
|
|
423
|
+
* @zh 传感器类型,决定测量单位。
|
|
424
|
+
* @ja 測定単位を決定するセンサーの種類。
|
|
425
|
+
* @ko 측정 단위를 결정하는 센서 타입.
|
|
426
|
+
*/
|
|
427
|
+
type: SensorType;
|
|
428
|
+
/**
|
|
429
|
+
* The three-axis measurement.
|
|
430
|
+
* @zh 三轴测量值。
|
|
431
|
+
* @ja 3 軸の測定値。
|
|
432
|
+
* @ko 3축 측정값.
|
|
433
|
+
*/
|
|
434
|
+
value: Vector3f;
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Names of supported window event kinds.
|
|
440
|
+
* @zh 支持的窗口事件种类名称。
|
|
441
|
+
* @ja 対応するウィンドウイベントの種類名。
|
|
442
|
+
* @ko 지원하는 윈도우 이벤트 종류의 이름.
|
|
443
|
+
*/
|
|
444
|
+
export type EventKind = keyof EventPayloads;
|
|
445
|
+
/**
|
|
446
|
+
* An event-data union discriminated by the kind field.
|
|
447
|
+
* @zh 带 kind 判别字段的事件数据联合类型。
|
|
448
|
+
* @ja kind フィールドで判別するイベントデータの共用体型。
|
|
449
|
+
* @ko kind 필드로 판별하는 이벤트 데이터 유니온 타입.
|
|
450
|
+
*/
|
|
451
|
+
export type EventData<K extends EventKind = EventKind> = {
|
|
452
|
+
[P in K]: {
|
|
453
|
+
/**
|
|
454
|
+
* The event kind, used to narrow the corresponding data fields.
|
|
455
|
+
* @zh 事件种类,用于收窄对应的数据字段。
|
|
456
|
+
* @ja 対応するデータフィールドの型を絞り込むイベントの種類。
|
|
457
|
+
* @ko 해당 데이터 필드의 타입을 좁히는 데 사용하는 이벤트 종류.
|
|
458
|
+
*/
|
|
459
|
+
readonly kind: P;
|
|
460
|
+
} & EventPayloads[P];
|
|
461
|
+
}[K];
|
|
462
|
+
/**
|
|
463
|
+
* Optional synchronous handlers for each event kind.
|
|
464
|
+
* @zh 按事件种类选择性提供的同步处理函数。
|
|
465
|
+
* @ja イベントの種類ごとに任意で指定する同期ハンドラー。
|
|
466
|
+
* @ko 이벤트 종류별로 선택적으로 제공하는 동기 핸들러.
|
|
467
|
+
*/
|
|
468
|
+
export type EventHandlers = {
|
|
469
|
+
[K in EventKind]?: (event: EventData<K>) => void;
|
|
470
|
+
};
|
|
471
|
+
/**
|
|
472
|
+
* A visitor receiving data for any window event.
|
|
473
|
+
* @zh 接收任意窗口事件数据的访问函数。
|
|
474
|
+
* @ja 任意のウィンドウイベントデータを受け取るビジター関数。
|
|
475
|
+
* @ko 모든 윈도우 이벤트 데이터를 받는 방문 함수.
|
|
476
|
+
*/
|
|
477
|
+
export type EventVisitor<T = void> = (event: EventData) => T;
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* SFML's variant: `kind` identifies the subtype; payload fields stay intact.
|
|
481
|
+
* @zh SFML 的变体:`kind` 标识子类型,载荷字段保持完整。
|
|
482
|
+
* @ja SFML のバリアント。`kind` がサブタイプを識別し、ペイロードフィールドは保たれる。
|
|
483
|
+
* @ko SFML의 변형 타입. `kind`로 하위 타입을 식별하며 페이로드 필드는 그대로 유지된다.
|
|
484
|
+
*/
|
|
485
|
+
export class Event<K extends EventKind = EventKind> {
|
|
486
|
+
/**
|
|
487
|
+
* An event-data snapshot whose field types can be distinguished by kind.
|
|
488
|
+
* @zh 事件数据快照,可通过 kind 区分字段类型。
|
|
489
|
+
* @ja kind でフィールドの型を区別できるイベントデータのスナップショット。
|
|
490
|
+
* @ko kind로 필드 타입을 구분할 수 있는 이벤트 데이터 스냅샷.
|
|
491
|
+
*/
|
|
492
|
+
readonly data: EventData<K>;
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Create an event snapshot, copying its vector fields as well.
|
|
496
|
+
* @zh 创建事件快照,同时复制其中的向量字段。
|
|
497
|
+
* @ja ベクトルフィールドもコピーしてイベントのスナップショットを作成する。
|
|
498
|
+
* @ko 벡터 필드도 함께 복사하여 이벤트 스냅샷을 생성한다.
|
|
499
|
+
*/
|
|
500
|
+
constructor(data: EventData<K>) {
|
|
501
|
+
const copy = { ...data };
|
|
502
|
+
for (const key of Object.keys(copy)) {
|
|
503
|
+
const value = (copy as Record<string, unknown>)[key];
|
|
504
|
+
if (value instanceof Vector2 || value instanceof Vector3) {
|
|
505
|
+
(copy as Record<string, unknown>)[key] = value instanceof Vector3
|
|
506
|
+
? new Vector3f(value as Vector3f)
|
|
507
|
+
: value.scalarType === 'u32' ? new Vector2u(value as Vector2u)
|
|
508
|
+
: new Vector2i(value as Vector2i);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
this.data = copy;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* The event kind name.
|
|
516
|
+
* @zh 事件种类名称。
|
|
517
|
+
* @ja イベントの種類名。
|
|
518
|
+
* @ko 이벤트 종류의 이름.
|
|
519
|
+
*/
|
|
520
|
+
get kind(): K {
|
|
521
|
+
return this.data.kind;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Test the event kind and narrow the event type in TypeScript.
|
|
526
|
+
* @zh 判断事件种类,并在 TypeScript 中收窄事件类型。
|
|
527
|
+
* @ja イベントの種類を判定し、TypeScript でイベントの型を絞り込む。
|
|
528
|
+
* @ko 이벤트 종류를 판별하고 TypeScript에서 이벤트 타입을 좁힌다.
|
|
529
|
+
*/
|
|
530
|
+
is<P extends EventKind>(kind: P): this is Event<K> & Event<P> {
|
|
531
|
+
return (this.kind as EventKind) === kind;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Return the data if the kind matches, or undefined otherwise.
|
|
536
|
+
* @zh 种类匹配时返回数据,否则返回 undefined。
|
|
537
|
+
* @ja 種類が一致すればデータを、それ以外は undefined を返す。
|
|
538
|
+
* @ko 종류가 일치하면 데이터를, 그렇지 않으면 undefined를 반환한다.
|
|
539
|
+
*/
|
|
540
|
+
getIf<P extends EventKind>(kind: P): EventData<P> | undefined {
|
|
541
|
+
return this.is(kind) ? this.data as EventData<P> : undefined;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Visit event data synchronously and return the result of visitor.
|
|
546
|
+
* @zh 同步访问事件数据,返回 visitor 的结果。
|
|
547
|
+
* @ja イベントデータを同期的に訪問し、visitor の結果を返す。
|
|
548
|
+
* @ko 이벤트 데이터를 동기적으로 방문하고 visitor의 결과를 반환한다.
|
|
549
|
+
*/
|
|
550
|
+
visit<T>(visitor: (event: EventData<K>) => T): T {
|
|
551
|
+
return visitor(this.data);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
type NativeFields<T> = {
|
|
556
|
+
[K in keyof T]: T[K] extends Vector2<'i32' | 'u32'>
|
|
557
|
+
? [number, number] : T[K] extends Vector3f
|
|
558
|
+
? [number, number, number] : T[K];
|
|
559
|
+
};
|
|
560
|
+
export type NativeWindowEvent = {
|
|
561
|
+
[K in EventKind]: NativeFields<EventData<K>>;
|
|
562
|
+
}[EventKind];
|
|
563
|
+
|
|
564
|
+
export function windowEvent(raw: NativeWindowEvent): Event {
|
|
565
|
+
const data = { ...raw } as unknown as EventData;
|
|
566
|
+
if (data.kind === 'Resized') {
|
|
567
|
+
data.size = new Vector2u(...(raw as NativeFields<EventData<'Resized'>>).size);
|
|
568
|
+
}
|
|
569
|
+
if ('position' in data && 'position' in raw && Array.isArray(raw.position)) {
|
|
570
|
+
data.position = new Vector2i(...raw.position as [number, number]);
|
|
571
|
+
}
|
|
572
|
+
if (data.kind === 'MouseMovedRaw' && raw.kind === 'MouseMovedRaw') {
|
|
573
|
+
data.delta = new Vector2i(...raw.delta);
|
|
574
|
+
}
|
|
575
|
+
if (data.kind === 'SensorChanged' && raw.kind === 'SensorChanged') {
|
|
576
|
+
data.value = new Vector3f(...raw.value);
|
|
577
|
+
}
|
|
578
|
+
// Native events are already unique snapshots; avoid a second payload copy.
|
|
579
|
+
return Object.assign(Object.create(Event.prototype), { data }) as Event;
|
|
580
|
+
}
|