sfml.js 0.0.1-preview.41 → 0.0.1-preview.44
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/README.md +57 -7
- package/binding.gyp +71 -19
- package/lib/joystick.d.ts +21 -0
- package/lib/joystick.js +72 -0
- package/lib/keyboard.d.ts +1 -0
- package/lib/mouse.d.ts +1 -1
- package/lib/poll_event.d.ts +73 -9
- package/lib/rect.d.ts +1 -1
- package/lib/render_window.d.ts +36 -10
- package/lib/render_window.js +76 -0
- package/lib/sensor.d.ts +12 -0
- package/lib/sensor.js +34 -0
- package/lib/sfml.d.ts +4 -0
- package/lib/sfml.js +4 -0
- package/lib/touch.d.ts +7 -0
- package/lib/touch.js +34 -0
- package/lib/vector3.d.ts +47 -0
- package/lib/vector3.js +154 -0
- package/package.json +12 -18
- package/src/gen/joystick_axis.cc +30 -0
- package/src/gen/sensor_type.cc +26 -0
- package/src/joystick.cc +132 -0
- package/src/joystick.h +32 -0
- package/src/poll_event.cc +74 -1
- package/src/render_window.cc +177 -0
- package/src/render_window.h +45 -0
- package/src/render_window_async_display.cc +49 -0
- package/src/render_window_async_draw.cc +56 -0
- package/src/sensor.cc +82 -0
- package/src/sensor.h +28 -0
- package/src/sfml.cc +12 -0
- package/src/touch.cc +54 -0
- package/src/touch.h +23 -0
- package/src/vector3-inl.h +200 -0
- package/src/vector3.cc +36 -0
- package/src/vector3.h +134 -0
- package/tools/copier/linux.js +21 -0
- package/tools/copier/macos.js +34 -0
- package/tools/copier/windows.js +33 -0
- package/tools/joystick_axis.js +62 -0
- package/tools/keycode.js +5 -3
- package/tools/lib_downloader.js +102 -0
- package/tools/lib_downloader_urls.js +58 -0
- package/tools/mouse_button.js +9 -5
- package/tools/sensor_type.js +62 -0
- package/third_party/sfml/platform/linux/lib/libsfml-audio.so.2.5.1 +0 -0
- package/third_party/sfml/platform/linux/lib/libsfml-graphics.so.2.5.1 +0 -0
- package/third_party/sfml/platform/linux/lib/libsfml-network.so.2.5.1 +0 -0
- package/third_party/sfml/platform/linux/lib/libsfml-system.so.2.5.1 +0 -0
- package/third_party/sfml/platform/linux/lib/libsfml-window.so.2.5.1 +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/FLAC.framework/Versions/A/FLAC +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/FLAC.framework/Versions/A/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/OpenAL.framework/Versions/A/OpenAL +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/OpenAL.framework/Versions/A/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/AlResource.hpp +0 -70
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/Export.hpp +0 -48
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/InputSoundFile.hpp +0 -263
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/Listener.hpp +0 -234
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/Music.hpp +0 -337
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/OutputSoundFile.hpp +0 -133
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/Sound.hpp +0 -264
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundBuffer.hpp +0 -352
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundBufferRecorder.hpp +0 -144
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundFileFactory.hpp +0 -197
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundFileFactory.inl +0 -100
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundFileReader.hpp +0 -165
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundFileWriter.hpp +0 -125
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundRecorder.hpp +0 -408
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundSource.hpp +0 -332
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundStream.hpp +0 -405
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio.hpp +0 -56
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Config.hpp +0 -236
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/GpuPreference.hpp +0 -74
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/BlendMode.hpp +0 -215
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/CircleShape.hpp +0 -154
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Color.hpp +0 -275
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/ConvexShape.hpp +0 -153
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Drawable.hpp +0 -126
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Export.hpp +0 -48
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Font.hpp +0 -439
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Glsl.hpp +0 -227
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Glsl.inl +0 -155
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Glyph.hpp +0 -79
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Image.hpp +0 -324
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/PrimitiveType.hpp +0 -58
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Rect.hpp +0 -254
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Rect.inl +0 -159
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/RectangleShape.hpp +0 -132
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/RenderStates.hpp +0 -174
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/RenderTarget.hpp +0 -510
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/RenderTexture.hpp +0 -314
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/RenderWindow.hpp +0 -284
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Shader.hpp +0 -875
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Shape.hpp +0 -355
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Sprite.hpp +0 -279
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Text.hpp +0 -513
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Texture.hpp +0 -733
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Transform.hpp +0 -479
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Transformable.hpp +0 -429
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Vertex.hpp +0 -148
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/VertexArray.hpp +0 -223
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/VertexBuffer.hpp +0 -408
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/View.hpp +0 -343
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics.hpp +0 -68
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Main.hpp +0 -43
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/Export.hpp +0 -48
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/Ftp.hpp +0 -616
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/Http.hpp +0 -482
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/IpAddress.hpp +0 -328
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/Packet.hpp +0 -532
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/Socket.hpp +0 -219
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/SocketHandle.hpp +0 -57
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/SocketSelector.hpp +0 -263
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/TcpListener.hpp +0 -166
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/TcpSocket.hpp +0 -316
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/UdpSocket.hpp +0 -291
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network.hpp +0 -53
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/OpenGL.hpp +0 -78
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Clock.hpp +0 -117
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Err.hpp +0 -80
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Export.hpp +0 -48
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/FileInputStream.hpp +0 -169
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/InputStream.hpp +0 -152
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Lock.hpp +0 -139
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/MemoryInputStream.hpp +0 -148
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Mutex.hpp +0 -148
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/NativeActivity.hpp +0 -62
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/NonCopyable.hpp +0 -129
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Sleep.hpp +0 -52
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/String.hpp +0 -669
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/String.inl +0 -53
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Thread.hpp +0 -282
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Thread.inl +0 -90
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/ThreadLocal.hpp +0 -103
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/ThreadLocalPtr.hpp +0 -158
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/ThreadLocalPtr.inl +0 -77
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Time.hpp +0 -488
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Utf.hpp +0 -763
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Utf.inl +0 -752
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Vector2.hpp +0 -301
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Vector2.inl +0 -161
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Vector3.hpp +0 -302
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Vector3.inl +0 -168
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System.hpp +0 -60
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Clipboard.hpp +0 -119
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Context.hpp +0 -195
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/ContextSettings.hpp +0 -149
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Cursor.hpp +0 -222
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Event.hpp +0 -284
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Export.hpp +0 -48
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/GlResource.hpp +0 -109
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Joystick.hpp +0 -227
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Keyboard.hpp +0 -232
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Mouse.hpp +0 -177
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Sensor.hpp +0 -150
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Touch.hpp +0 -137
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/VideoMode.hpp +0 -228
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Window.hpp +0 -622
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/WindowHandle.hpp +0 -101
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/WindowStyle.hpp +0 -53
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window.hpp +0 -58
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Resources/CMake/SFMLConfig.cmake +0 -148
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Resources/CMake/SFMLConfigDependencies.cmake +0 -86
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Resources/CMake/SFMLConfigVersion.cmake +0 -46
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Resources/CMake/SFMLSharedTargets-release.cmake +0 -59
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Resources/CMake/SFMLSharedTargets.cmake +0 -158
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/SFML +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/freetype.framework/Versions/A/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/freetype.framework/Versions/A/freetype +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/ogg.framework/Versions/A/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/ogg.framework/Versions/A/ogg +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/sfml-audio.framework/Versions/2.5.1/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/sfml-audio.framework/Versions/2.5.1/sfml-audio +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/sfml-graphics.framework/Versions/2.5.1/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/sfml-graphics.framework/Versions/2.5.1/sfml-graphics +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/sfml-network.framework/Versions/2.5.1/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/sfml-network.framework/Versions/2.5.1/sfml-network +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/sfml-system.framework/Versions/2.5.1/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/sfml-system.framework/Versions/2.5.1/sfml-system +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/sfml-window.framework/Versions/2.5.1/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/sfml-window.framework/Versions/2.5.1/sfml-window +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/vorbis.framework/Versions/A/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/vorbis.framework/Versions/A/vorbis +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/vorbisenc.framework/Versions/A/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/vorbisenc.framework/Versions/A/vorbisenc +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/vorbisfile.framework/Versions/A/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/vorbisfile.framework/Versions/A/vorbisfile +0 -0
- package/third_party/sfml/platform/macOS/lib/libsfml-audio.2.5.1.dylib +0 -0
- package/third_party/sfml/platform/macOS/lib/libsfml-graphics.2.5.1.dylib +0 -0
- package/third_party/sfml/platform/macOS/lib/libsfml-network.2.5.1.dylib +0 -0
- package/third_party/sfml/platform/macOS/lib/libsfml-system.2.5.1.dylib +0 -0
- package/third_party/sfml/platform/macOS/lib/libsfml-window.2.5.1.dylib +0 -0
- package/third_party/sfml/platform/win64/bin/openal32.dll +0 -0
- package/third_party/sfml/platform/win64/bin/sfml-audio-2.dll +0 -0
- package/third_party/sfml/platform/win64/bin/sfml-graphics-2.dll +0 -0
- package/third_party/sfml/platform/win64/bin/sfml-network-2.dll +0 -0
- package/third_party/sfml/platform/win64/bin/sfml-system-2.dll +0 -0
- package/third_party/sfml/platform/win64/bin/sfml-window-2.dll +0 -0
- package/third_party/sfml/platform/win64/lib/flac.lib +0 -0
- package/third_party/sfml/platform/win64/lib/freetype.lib +0 -0
- package/third_party/sfml/platform/win64/lib/ogg.lib +0 -0
- package/third_party/sfml/platform/win64/lib/openal32.lib +0 -0
- package/third_party/sfml/platform/win64/lib/sfml-audio.lib +0 -0
- package/third_party/sfml/platform/win64/lib/sfml-graphics.lib +0 -0
- package/third_party/sfml/platform/win64/lib/sfml-main.lib +0 -0
- package/third_party/sfml/platform/win64/lib/sfml-network.lib +0 -0
- package/third_party/sfml/platform/win64/lib/sfml-system.lib +0 -0
- package/third_party/sfml/platform/win64/lib/sfml-window.lib +0 -0
- package/third_party/sfml/platform/win64/lib/vorbis.lib +0 -0
- package/third_party/sfml/platform/win64/lib/vorbisenc.lib +0 -0
- package/third_party/sfml/platform/win64/lib/vorbisfile.lib +0 -0
- package/tools/symlinks.js +0 -122
package/README.md
CHANGED
|
@@ -1,13 +1,63 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://github.com/XadillaX/node-sfml/blob/main/assets/sfml.js.png?raw=true" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<p align="center">
|
|
6
|
+
Node.js binding for <a href="https://www.sfml-dev.org/">SFML</a> - a Simple and Fast cross-platform Multimedia Library.
|
|
7
|
+
</p>
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.org/package/sfml.js">
|
|
11
|
+
<img src="http://img.shields.io/npm/v/sfml.js.svg?style=for-the-badge&colorA=FF7800&colorB=CC5600&label=NPM" />
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://www.npmjs.org/package/sfml.js">
|
|
14
|
+
<img src="http://img.shields.io/npm/dm/sfml.js.svg?style=for-the-badge&colorA=5DDB61&colorB=4BC74F&label=DOWNLOADS" />
|
|
15
|
+
</a>
|
|
16
|
+
<!-- [](https://www.npmjs.org/package/sfml.js) -->
|
|
17
|
+
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
18
|
+
<a href="#contributors-"><img src="https://img.shields.io/badge/2-ALL%20CONTRIBUTORS?style=for-the-badge&colorA=FF69b4&colorB=cc47a4&label=ALL%20CONTRIBUTORS" />
|
|
19
|
+
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
20
|
+
<a href="https://github.com/XadillaX/node-sfml">
|
|
21
|
+
<img src="https://img.shields.io/github/stars/XadillaX/node-sfml.svg?style=for-the-badge&colorA=FBBD30&colorB=F2AA08&label=STAR" />
|
|
22
|
+
</a>
|
|
23
|
+
</p>
|
|
8
24
|
|
|
9
25
|
## Installation
|
|
10
26
|
|
|
11
27
|
```bash
|
|
12
|
-
$
|
|
13
|
-
```
|
|
28
|
+
$ npm install --save sfml.js
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
- Refer to TypeDoc: [https://sfml.js.org/](https://sfml.js.org/);
|
|
34
|
+
- Refer to Typing Definitions: [https://github.com/XadillaX/node-sfml/blob/main/index.d.ts](https://github.com/XadillaX/node-sfml/blob/main/index.d.ts);
|
|
35
|
+
- And SFML's official documentation: [https://www.sfml-dev.org/documentation/2.5.1/](https://www.sfml-dev.org/documentation/2.5.1/).
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
+ [node-sfml-demos](https://github.com/XadillaX/node-sfml-demos): Several small example games;
|
|
40
|
+
+ [play-nes](https://github.com/XadillaX/play-nes): A cross-platform desktop NES emulator powered by OpenGL in Node.js.
|
|
41
|
+
|
|
42
|
+
> PR is welcomed. You can add your own sfml.js example.
|
|
43
|
+
|
|
44
|
+
## Contributors ✨
|
|
45
|
+
|
|
46
|
+
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
47
|
+
|
|
48
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
49
|
+
<!-- prettier-ignore-start -->
|
|
50
|
+
<!-- markdownlint-disable -->
|
|
51
|
+
<table>
|
|
52
|
+
<tr>
|
|
53
|
+
<td align="center"><a href="https://xcoder.in/"><img src="https://avatars.githubusercontent.com/u/2842176?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Khaidi Chu</b></sub></a><br /><a href="#maintenance-XadillaX" title="Maintenance">🚧</a> <a href="https://github.com/XadillaX/node-sfml/commits?author=XadillaX" title="Code">💻</a></td>
|
|
54
|
+
<td align="center"><a href="https://pokemonworkshop.com/forum"><img src="https://avatars.githubusercontent.com/u/7335788?v=4?s=100" width="100px;" alt=""/><br /><sub><b>NuriYuri</b></sub></a><br /><a href="https://github.com/XadillaX/node-sfml/commits?author=NuriYuri" title="Code">💻</a></td>
|
|
55
|
+
</tr>
|
|
56
|
+
</table>
|
|
57
|
+
|
|
58
|
+
<!-- markdownlint-restore -->
|
|
59
|
+
<!-- prettier-ignore-end -->
|
|
60
|
+
|
|
61
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
62
|
+
|
|
63
|
+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
package/binding.gyp
CHANGED
|
@@ -41,6 +41,48 @@
|
|
|
41
41
|
"./tools/keycode.js"
|
|
42
42
|
]
|
|
43
43
|
}]
|
|
44
|
+
}, {
|
|
45
|
+
"target_name": "joystick_axis.cc",
|
|
46
|
+
"type": "none",
|
|
47
|
+
"sources": [
|
|
48
|
+
"./third_party/sfml/include/SFML/Window/Joystick.hpp",
|
|
49
|
+
"./tools/joystick_axis.js"
|
|
50
|
+
],
|
|
51
|
+
"actions": [{
|
|
52
|
+
"action_name": "gen_joystick_axis",
|
|
53
|
+
"inputs": [
|
|
54
|
+
"./third_party/sfml/include/SFML/Window/Joystick.hpp",
|
|
55
|
+
"./tools/joystick_axis.js"
|
|
56
|
+
],
|
|
57
|
+
"outputs": [
|
|
58
|
+
"./src/gen/joystick_axis.cc"
|
|
59
|
+
],
|
|
60
|
+
"action": [
|
|
61
|
+
"node",
|
|
62
|
+
"./tools/joystick_axis.js"
|
|
63
|
+
]
|
|
64
|
+
}]
|
|
65
|
+
}, {
|
|
66
|
+
"target_name": "sensor_type.cc",
|
|
67
|
+
"type": "none",
|
|
68
|
+
"sources": [
|
|
69
|
+
"./third_party/sfml/include/SFML/Window/Sensor.hpp",
|
|
70
|
+
"./tools/sensor_type.js"
|
|
71
|
+
],
|
|
72
|
+
"actions": [{
|
|
73
|
+
"action_name": "gen_sensor_type",
|
|
74
|
+
"inputs": [
|
|
75
|
+
"./third_party/sfml/include/SFML/Window/Sensor.hpp",
|
|
76
|
+
"./tools/sensor_type.js"
|
|
77
|
+
],
|
|
78
|
+
"outputs": [
|
|
79
|
+
"./src/gen/sensor_type.cc"
|
|
80
|
+
],
|
|
81
|
+
"action": [
|
|
82
|
+
"node",
|
|
83
|
+
"./tools/sensor_type.js"
|
|
84
|
+
]
|
|
85
|
+
}]
|
|
44
86
|
}, {
|
|
45
87
|
"target_name": "binding",
|
|
46
88
|
"include_dirs": [
|
|
@@ -67,28 +109,28 @@
|
|
|
67
109
|
"copies": [{
|
|
68
110
|
"destination": "<(module_root_dir)/build/Release/",
|
|
69
111
|
"files": [
|
|
70
|
-
"<(module_root_dir)/third_party/sfml/platform/
|
|
71
|
-
"<(module_root_dir)/third_party/sfml/platform/
|
|
72
|
-
"<(module_root_dir)/third_party/sfml/platform/
|
|
73
|
-
"<(module_root_dir)/third_party/sfml/platform/
|
|
74
|
-
"<(module_root_dir)/third_party/sfml/platform/
|
|
75
|
-
"<(module_root_dir)/third_party/sfml/platform/
|
|
112
|
+
"<(module_root_dir)/third_party/sfml/platform/win/bin/openal32.dll",
|
|
113
|
+
"<(module_root_dir)/third_party/sfml/platform/win/bin/sfml-audio-2.dll",
|
|
114
|
+
"<(module_root_dir)/third_party/sfml/platform/win/bin/sfml-graphics-2.dll",
|
|
115
|
+
"<(module_root_dir)/third_party/sfml/platform/win/bin/sfml-network-2.dll",
|
|
116
|
+
"<(module_root_dir)/third_party/sfml/platform/win/bin/sfml-system-2.dll",
|
|
117
|
+
"<(module_root_dir)/third_party/sfml/platform/win/bin/sfml-window-2.dll"
|
|
76
118
|
]
|
|
77
119
|
}],
|
|
78
120
|
"libraries": [
|
|
79
|
-
"../third_party/sfml/platform/
|
|
80
|
-
"../third_party/sfml/platform/
|
|
81
|
-
"../third_party/sfml/platform/
|
|
82
|
-
"../third_party/sfml/platform/
|
|
83
|
-
"../third_party/sfml/platform/
|
|
84
|
-
"../third_party/sfml/platform/
|
|
85
|
-
"../third_party/sfml/platform/
|
|
86
|
-
"../third_party/sfml/platform/
|
|
87
|
-
"../third_party/sfml/platform/
|
|
88
|
-
"../third_party/sfml/platform/
|
|
89
|
-
"../third_party/sfml/platform/
|
|
90
|
-
"../third_party/sfml/platform/
|
|
91
|
-
"../third_party/sfml/platform/
|
|
121
|
+
"../third_party/sfml/platform/win/lib/flac.lib",
|
|
122
|
+
"../third_party/sfml/platform/win/lib/freetype.lib",
|
|
123
|
+
"../third_party/sfml/platform/win/lib/ogg.lib",
|
|
124
|
+
"../third_party/sfml/platform/win/lib/openal32.lib",
|
|
125
|
+
"../third_party/sfml/platform/win/lib/sfml-audio.lib",
|
|
126
|
+
"../third_party/sfml/platform/win/lib/sfml-graphics.lib",
|
|
127
|
+
"../third_party/sfml/platform/win/lib/sfml-main.lib",
|
|
128
|
+
"../third_party/sfml/platform/win/lib/sfml-network.lib",
|
|
129
|
+
"../third_party/sfml/platform/win/lib/sfml-system.lib",
|
|
130
|
+
"../third_party/sfml/platform/win/lib/sfml-window.lib",
|
|
131
|
+
"../third_party/sfml/platform/win/lib/vorbis.lib",
|
|
132
|
+
"../third_party/sfml/platform/win/lib/vorbisenc.lib",
|
|
133
|
+
"../third_party/sfml/platform/win/lib/vorbisfile.lib",
|
|
92
134
|
],
|
|
93
135
|
}],
|
|
94
136
|
["OS==\"mac\"", {
|
|
@@ -115,14 +157,20 @@
|
|
|
115
157
|
"./src/color.cc",
|
|
116
158
|
"./src/font.cc",
|
|
117
159
|
"./src/image.cc",
|
|
160
|
+
"./src/joystick.cc",
|
|
118
161
|
"./src/keyboard.cc",
|
|
119
162
|
"./src/mouse.cc",
|
|
120
163
|
"./src/poll_event.cc",
|
|
121
164
|
"./src/rect.cc",
|
|
122
165
|
"./src/render_window.cc",
|
|
166
|
+
"./src/render_window_async_display.cc",
|
|
167
|
+
"./src/render_window_async_draw.cc",
|
|
168
|
+
"./src/sensor.cc",
|
|
169
|
+
"./src/touch.cc",
|
|
123
170
|
"./src/texture.cc",
|
|
124
171
|
"./src/time.cc",
|
|
125
172
|
"./src/vector2.cc",
|
|
173
|
+
"./src/vector3.cc",
|
|
126
174
|
"./src/vertex.cc",
|
|
127
175
|
"./src/video_mode.cc",
|
|
128
176
|
|
|
@@ -135,8 +183,10 @@
|
|
|
135
183
|
"./src/drawable/text.cc",
|
|
136
184
|
"./src/drawable/vertex_array.cc",
|
|
137
185
|
|
|
186
|
+
"./src/gen/joystick_axis.cc",
|
|
138
187
|
"./src/gen/keycode.cc",
|
|
139
188
|
"./src/gen/mouse_button.cc",
|
|
189
|
+
"./src/gen/sensor_type.cc",
|
|
140
190
|
|
|
141
191
|
"./src/sound/music.cc",
|
|
142
192
|
"./src/sound/sound.cc",
|
|
@@ -145,6 +195,8 @@
|
|
|
145
195
|
],
|
|
146
196
|
"dependencies": [
|
|
147
197
|
"keycode.cc",
|
|
198
|
+
"joystick_axis.cc",
|
|
199
|
+
"sensor_type.cc",
|
|
148
200
|
"mouse_button.cc"
|
|
149
201
|
]
|
|
150
202
|
}]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export enum Axis {
|
|
2
|
+
X = 0, Y = 1, Z = 2, R = 3,
|
|
3
|
+
U = 4, V = 5, PovX = 6, PovY = 7
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export type AxisStr = keyof typeof Axis;
|
|
7
|
+
type UnsignedInteger = number;
|
|
8
|
+
|
|
9
|
+
type Identification = {
|
|
10
|
+
name: string;
|
|
11
|
+
vendorId: number;
|
|
12
|
+
productId: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function isConnected(joystickId: UnsignedInteger): boolean;
|
|
16
|
+
export function getButtonCount(joystickId: UnsignedInteger): number;
|
|
17
|
+
export function hasAxis(joystickId: UnsignedInteger, axis: Axis): boolean;
|
|
18
|
+
export function isButtonPressed(joystickId: UnsignedInteger, button: UnsignedInteger): boolean;
|
|
19
|
+
export function getAxisPosition(joystickId: UnsignedInteger, axis: Axis): number;
|
|
20
|
+
export function getIdentification(joystickId: UnsignedInteger): Identification;
|
|
21
|
+
export function update(): void;
|
package/lib/joystick.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
joystickIsConnected: _isConnected,
|
|
5
|
+
joystickGetButtonCount: _getButtonCount,
|
|
6
|
+
joystickHasAxis: _hasAxis,
|
|
7
|
+
joystickIsJoystickButtonPressed: _isButtonPressed,
|
|
8
|
+
joystickGetAxisPosition: _getAxisPosition,
|
|
9
|
+
joystickGetIdentification: _getIdentification,
|
|
10
|
+
joystickUpdate: update,
|
|
11
|
+
joystickAxis: Axis,
|
|
12
|
+
} = require('../build/Release/binding.node');
|
|
13
|
+
|
|
14
|
+
const AxisValues = Object.values(Axis);
|
|
15
|
+
|
|
16
|
+
const validateJoystickId = joystickId => {
|
|
17
|
+
if (!Number.isInteger(joystickId) || Math.sign(joystickId) < 0) {
|
|
18
|
+
throw new TypeError(
|
|
19
|
+
`Unexpected value ${joystickId} for joystickId, expected usigned integer.`
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const validateButton = button => {
|
|
25
|
+
if (!Number.isInteger(button) || Math.sign(button) < 0) {
|
|
26
|
+
throw new TypeError(
|
|
27
|
+
`Unexpected value ${button} for button, expected usigned integer.`
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const validateAxis = axis => {
|
|
33
|
+
if (!AxisValues.includes(axis)) {
|
|
34
|
+
throw new TypeError('Invalid Axis value.');
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
module.exports.isConnected = joystickId => {
|
|
39
|
+
validateJoystickId(joystickId);
|
|
40
|
+
return _isConnected(joystickId);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
module.exports.getButtonCount = joystickId => {
|
|
44
|
+
validateJoystickId(joystickId);
|
|
45
|
+
return _getButtonCount(joystickId);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
module.exports.hasAxis = (joystickId, axis) => {
|
|
49
|
+
validateJoystickId(joystickId);
|
|
50
|
+
validateAxis(axis);
|
|
51
|
+
return _hasAxis(joystickId, axis);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
module.exports.isButtonPressed = (joystickId, button) => {
|
|
55
|
+
validateJoystickId(joystickId);
|
|
56
|
+
validateButton(button);
|
|
57
|
+
return _isButtonPressed(joystickId, button);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
module.exports.getAxisPosition = (joystickId, axis) => {
|
|
61
|
+
validateJoystickId(joystickId);
|
|
62
|
+
validateAxis(axis);
|
|
63
|
+
return _getAxisPosition(joystickId, axis);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
module.exports.getIdentification = joystickId => {
|
|
67
|
+
validateJoystickId(joystickId);
|
|
68
|
+
return _getIdentification(joystickId);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
module.exports.update = update;
|
|
72
|
+
module.exports.Axis = Axis;
|
package/lib/keyboard.d.ts
CHANGED
package/lib/mouse.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PointType, Vector2I } from './vector2';
|
|
2
|
-
import
|
|
2
|
+
import { RenderWindow } from './render_window';
|
|
3
3
|
|
|
4
4
|
export function isButtonPressed(button: number | string): boolean;
|
|
5
5
|
export function getPosition(window?: RenderWindow): Vector2I;
|
package/lib/poll_event.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { Keys, KeysStr } from './keyboard';
|
|
2
|
+
import * as Joystick from './joystick';
|
|
3
|
+
import * as Sensor from './sensor';
|
|
4
|
+
|
|
1
5
|
interface OtherEvent {
|
|
2
|
-
type:
|
|
3
|
-
|
|
4
|
-
|
|
6
|
+
type:
|
|
7
|
+
| 'Closed'
|
|
8
|
+
| 'LostFocus'
|
|
9
|
+
| 'GainedFocus'
|
|
10
|
+
| 'MouseLeft'
|
|
11
|
+
| 'MouseEntered';
|
|
5
12
|
}
|
|
6
13
|
|
|
7
14
|
interface SizeEvent {
|
|
@@ -15,8 +22,8 @@ interface SizeEvent {
|
|
|
15
22
|
interface KeyEvent {
|
|
16
23
|
type: 'KeyPressed' | 'KeyReleased';
|
|
17
24
|
key: {
|
|
18
|
-
code:
|
|
19
|
-
codeStr:
|
|
25
|
+
code: Keys;
|
|
26
|
+
codeStr: KeysStr;
|
|
20
27
|
alt: boolean;
|
|
21
28
|
shift: boolean;
|
|
22
29
|
control: boolean;
|
|
@@ -46,7 +53,7 @@ interface MouseButtonEvent {
|
|
|
46
53
|
x: number;
|
|
47
54
|
y: number;
|
|
48
55
|
button: number;
|
|
49
|
-
buttonStr:
|
|
56
|
+
buttonStr: 'Left' | 'Right' | 'Middle' | 'XButton1' | 'XButton2';
|
|
50
57
|
};
|
|
51
58
|
}
|
|
52
59
|
|
|
@@ -66,9 +73,66 @@ interface MouseWheelScrollEvent {
|
|
|
66
73
|
y: number;
|
|
67
74
|
delta: number;
|
|
68
75
|
wheel: number;
|
|
69
|
-
wheelStr:
|
|
76
|
+
wheelStr: 'VerticalWheel' | 'HorizontalWheel';
|
|
70
77
|
};
|
|
71
78
|
}
|
|
72
79
|
|
|
73
|
-
|
|
74
|
-
|
|
80
|
+
interface JoystickButtonEvent {
|
|
81
|
+
type: 'JoystickButtonPressed' | 'JoystickButtonReleased';
|
|
82
|
+
joystickButton: {
|
|
83
|
+
joystickId: number;
|
|
84
|
+
button: number;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
interface JoystickConnectEvent {
|
|
89
|
+
type: 'JoystickConnected' | 'JoystickDisconnected';
|
|
90
|
+
joystickConnect: {
|
|
91
|
+
joystickId: number;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
interface JoystickMoveEvent {
|
|
96
|
+
type: 'JoystickMoved',
|
|
97
|
+
joystickMove: {
|
|
98
|
+
joystickId: number;
|
|
99
|
+
axis: Joystick.Axis;
|
|
100
|
+
axisStr: Joystick.AxisStr;
|
|
101
|
+
position: number;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface TouchEvent {
|
|
106
|
+
type: 'TouchBegan' | 'TouchMoved' | 'TouchEnded';
|
|
107
|
+
touch: {
|
|
108
|
+
finger: number;
|
|
109
|
+
x: number;
|
|
110
|
+
y: number;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
interface SensorEvent {
|
|
115
|
+
type: 'SensorChanged',
|
|
116
|
+
sensor: {
|
|
117
|
+
type: Sensor.Type;
|
|
118
|
+
typeStr: Sensor.TypeStr;
|
|
119
|
+
x: number;
|
|
120
|
+
y: number;
|
|
121
|
+
z: number;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type Event =
|
|
126
|
+
| OtherEvent
|
|
127
|
+
| SizeEvent
|
|
128
|
+
| KeyEvent
|
|
129
|
+
| TextEvent
|
|
130
|
+
| MouseMoveEvent
|
|
131
|
+
| MouseButtonEvent
|
|
132
|
+
| MouseWheelEvent
|
|
133
|
+
| MouseWheelScrollEvent
|
|
134
|
+
| JoystickButtonEvent
|
|
135
|
+
| JoystickConnectEvent
|
|
136
|
+
| JoystickMoveEvent
|
|
137
|
+
| TouchEvent
|
|
138
|
+
| SensorEvent;
|
package/lib/rect.d.ts
CHANGED
package/lib/render_window.d.ts
CHANGED
|
@@ -4,30 +4,56 @@ import { Event } from './poll_event';
|
|
|
4
4
|
import { Image } from './image';
|
|
5
5
|
import { VideoMode } from './video_mode';
|
|
6
6
|
import { Vector2U } from './vector2';
|
|
7
|
+
import { Vector2I } from '..';
|
|
8
|
+
|
|
9
|
+
type ContextSettings = {
|
|
10
|
+
depthBits: number;
|
|
11
|
+
stencilBits: number;
|
|
12
|
+
antialiasingLevel: number;
|
|
13
|
+
majorVersion: number;
|
|
14
|
+
minorVersion: number;
|
|
15
|
+
attributeFlags: number;
|
|
16
|
+
sRgbCapable: boolean;
|
|
17
|
+
};
|
|
7
18
|
|
|
8
19
|
export class RenderWindow {
|
|
9
|
-
constructor(
|
|
20
|
+
constructor(
|
|
21
|
+
videoMode?: VideoMode,
|
|
22
|
+
title?: string,
|
|
23
|
+
style?: RenderWindow.Style
|
|
24
|
+
);
|
|
10
25
|
|
|
26
|
+
create(windowHandle: number): void;
|
|
27
|
+
create(videoMode: VideoMode, title: string, style?: RenderWindow.Style): void;
|
|
11
28
|
capture(): Image;
|
|
12
29
|
clear(color: number | Color): void;
|
|
13
30
|
close(): void;
|
|
14
31
|
draw(content: Drawable): void;
|
|
32
|
+
drawAsync(content: Drawable): Promise<void>;
|
|
15
33
|
display(): void;
|
|
34
|
+
displayAsync(): Promise<void>;
|
|
35
|
+
|
|
36
|
+
getPosition(): Vector2I;
|
|
37
|
+
getSettings(): ContextSettings;
|
|
38
|
+
getSize(): Vector2U;
|
|
39
|
+
|
|
40
|
+
hasFocus(): boolean;
|
|
16
41
|
isOpen(): boolean;
|
|
17
42
|
|
|
18
43
|
pollEvent(): Event;
|
|
44
|
+
requestFocus(): void;
|
|
19
45
|
|
|
20
|
-
|
|
21
|
-
|
|
46
|
+
setActive(active?: boolean): void;
|
|
47
|
+
setFramerateLimit(limit: number): void;
|
|
48
|
+
setIcon(width: number, height: number, icon: Buffer): void;
|
|
49
|
+
setJoystickThreshold(threshold: number): void;
|
|
50
|
+
setKeyRepeatEnabled(enabled: boolean): void;
|
|
22
51
|
setMouseCursorVisible(visible: boolean): void;
|
|
23
52
|
setMouseCursorGrabbed(grabbed: boolean): void;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
getSize(): Vector2U;
|
|
29
|
-
|
|
30
|
-
hasFocus(): boolean;
|
|
53
|
+
setPosition(position: Vector2I): void;
|
|
54
|
+
setTitle(title: string): void;
|
|
55
|
+
setVisible(visible: boolean): void;
|
|
56
|
+
setVerticalSyncEnabled(enabled: boolean): void;
|
|
31
57
|
}
|
|
32
58
|
export namespace RenderWindow {
|
|
33
59
|
enum Style {
|
package/lib/render_window.js
CHANGED
|
@@ -7,6 +7,7 @@ const {
|
|
|
7
7
|
} = require('../build/Release/binding.node');
|
|
8
8
|
const { validateTypeOf } = require('./common');
|
|
9
9
|
const { VideoMode } = require('./video_mode');
|
|
10
|
+
const { Vector2I } = require('./vector2');
|
|
10
11
|
|
|
11
12
|
const DRAW_DRAWABLE = Symbol('RenderWindow::drawDrawable');
|
|
12
13
|
const RAW_RENDER_WINDOW = Symbol('RenderWindow::rawRenderWindow');
|
|
@@ -28,6 +29,23 @@ class RenderWindow {
|
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
create(videoMode, title, style) {
|
|
33
|
+
if (Number.isInteger(videoMode) && videoMode >= 0) {
|
|
34
|
+
this[RAW_RENDER_WINDOW].create(videoMode);
|
|
35
|
+
} else {
|
|
36
|
+
validateTypeOf(videoMode, 'videoMode', VideoMode, false);
|
|
37
|
+
validateTypeOf(title, 'title', 'string', false);
|
|
38
|
+
validateTypeOf(style, 'style', 'number', true);
|
|
39
|
+
|
|
40
|
+
videoMode = videoMode[VideoMode.RAW_VIDEO_MODE];
|
|
41
|
+
if (style === undefined) {
|
|
42
|
+
this[RAW_RENDER_WINDOW].create(videoMode, title);
|
|
43
|
+
} else {
|
|
44
|
+
this[RAW_RENDER_WINDOW].create(videoMode, title, style);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
31
49
|
capture() {
|
|
32
50
|
return this[RAW_RENDER_WINDOW].capture();
|
|
33
51
|
}
|
|
@@ -54,10 +72,37 @@ class RenderWindow {
|
|
|
54
72
|
this[RAW_RENDER_WINDOW].drawDrawable(content._raw());
|
|
55
73
|
}
|
|
56
74
|
|
|
75
|
+
drawAsync(content) {
|
|
76
|
+
if (content instanceof Drawable) {
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
this[RAW_RENDER_WINDOW].drawDrawableAsync((err, res) => {
|
|
79
|
+
err ? reject(new Error(err)) : resolve(res);
|
|
80
|
+
}, content._raw());
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return Promise.reject(new Error('Expected Drawable Instance'));
|
|
84
|
+
}
|
|
85
|
+
|
|
57
86
|
display() {
|
|
58
87
|
this[RAW_RENDER_WINDOW].display();
|
|
59
88
|
}
|
|
60
89
|
|
|
90
|
+
displayAsync() {
|
|
91
|
+
return new Promise((resolve, reject) => {
|
|
92
|
+
this[RAW_RENDER_WINDOW].displayAsync((err, res) => {
|
|
93
|
+
err ? reject(new Error(err)) : resolve(res);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
getPosition() {
|
|
99
|
+
return this[RAW_RENDER_WINDOW].getPosition();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
getSettings() {
|
|
103
|
+
return this[RAW_RENDER_WINDOW].getSettings();
|
|
104
|
+
}
|
|
105
|
+
|
|
61
106
|
isOpen() {
|
|
62
107
|
return this[RAW_RENDER_WINDOW].isOpen();
|
|
63
108
|
}
|
|
@@ -66,6 +111,10 @@ class RenderWindow {
|
|
|
66
111
|
return this[RAW_RENDER_WINDOW].pollEvent();
|
|
67
112
|
}
|
|
68
113
|
|
|
114
|
+
requestFocus() {
|
|
115
|
+
this[RAW_RENDER_WINDOW].requestFocus();
|
|
116
|
+
}
|
|
117
|
+
|
|
69
118
|
setVisible(visible) {
|
|
70
119
|
validateTypeOf(visible, 'visible', 'boolean');
|
|
71
120
|
this[RAW_RENDER_WINDOW].setVisible(visible);
|
|
@@ -106,6 +155,33 @@ class RenderWindow {
|
|
|
106
155
|
this[RAW_RENDER_WINDOW].setActive(active);
|
|
107
156
|
}
|
|
108
157
|
|
|
158
|
+
setIcon(width, height, icon) {
|
|
159
|
+
validateTypeOf(width, 'width', 'number', false);
|
|
160
|
+
validateTypeOf(height, 'height', 'number', false);
|
|
161
|
+
validateTypeOf(icon, 'icon', Buffer, false);
|
|
162
|
+
|
|
163
|
+
if (icon.byteLength !== 4 * width * height) {
|
|
164
|
+
throw new Error('Invalid icon size, must be 4 * width * height');
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
this[RAW_RENDER_WINDOW].setIcon(width, height, icon);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
setJoystickThreshold(threshold) {
|
|
171
|
+
validateTypeOf(threshold, 'threshold', 'number', false);
|
|
172
|
+
this[RAW_RENDER_WINDOW].setJoystickThreshold(threshold);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
setPosition(position) {
|
|
176
|
+
validateTypeOf(position, 'position', Vector2I, false);
|
|
177
|
+
this[RAW_RENDER_WINDOW].setPosition(position);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
setTitle(title) {
|
|
181
|
+
validateTypeOf(title, 'title', 'string', false);
|
|
182
|
+
this[RAW_RENDER_WINDOW].setTitle(title);
|
|
183
|
+
}
|
|
184
|
+
|
|
109
185
|
getSize() {
|
|
110
186
|
return this[RAW_RENDER_WINDOW].getSize();
|
|
111
187
|
}
|
package/lib/sensor.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Vector3F } from './vector3';
|
|
2
|
+
|
|
3
|
+
export enum Type {
|
|
4
|
+
Accelerometer = 0, Gyroscope = 1, Magnetometer = 2, Gravity = 3,
|
|
5
|
+
UserAcceleration = 4, Orientation = 5
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type TypeStr = keyof typeof Type;
|
|
9
|
+
|
|
10
|
+
export function isAvailable(sensor: Type): boolean;
|
|
11
|
+
export function setEnabled(sensor: Type, enabled: boolean): void;
|
|
12
|
+
export function getValue(sensor: Type): Vector3F;
|
package/lib/sensor.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
sensorIsAvailable: _isAvailable,
|
|
5
|
+
sensorSetEnabled: _setEnabled,
|
|
6
|
+
sensorGetValue: _getValue,
|
|
7
|
+
sensorType: Type,
|
|
8
|
+
} = require('../build/Release/binding.node');
|
|
9
|
+
|
|
10
|
+
const SensorTypeValues = Object.values(Type);
|
|
11
|
+
|
|
12
|
+
const validateSensorType = sensor => {
|
|
13
|
+
if (!SensorTypeValues.includes(sensor)) {
|
|
14
|
+
throw new TypeError('Invalid Sensor::Type value.');
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
module.exports.isAvailable = sensor => {
|
|
19
|
+
validateSensorType(sensor);
|
|
20
|
+
return _isAvailable(sensor);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
module.exports.setEnabled = (sensor, enabled) => {
|
|
24
|
+
validateSensorType(sensor);
|
|
25
|
+
_setEnabled(sensor, !!enabled);
|
|
26
|
+
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
module.exports.getValue = sensor => {
|
|
30
|
+
validateSensorType(sensor);
|
|
31
|
+
return _getValue(sensor);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
module.exports.Type = Type;
|
package/lib/sfml.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ export * from './font';
|
|
|
4
4
|
export * from './image';
|
|
5
5
|
export * as Keyboard from './keyboard';
|
|
6
6
|
export * as Mouse from './mouse';
|
|
7
|
+
export * as Joystick from './joystick';
|
|
8
|
+
export * as Sensor from './sensor';
|
|
9
|
+
export * as Touch from './touch';
|
|
7
10
|
export * from './rect';
|
|
8
11
|
export * from './render_window';
|
|
9
12
|
export * from './texture';
|
|
@@ -11,6 +14,7 @@ export * from './texture';
|
|
|
11
14
|
export * as Time from './time';
|
|
12
15
|
|
|
13
16
|
export * from './vector2';
|
|
17
|
+
export * from './vector3';
|
|
14
18
|
export * from './vertex';
|
|
15
19
|
export * from './video_mode';
|
|
16
20
|
|