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
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
#ifndef SRC_VECTOR3_INL_H_
|
|
2
|
+
#define SRC_VECTOR3_INL_H_
|
|
3
|
+
|
|
4
|
+
#include "utils-inl.h"
|
|
5
|
+
#include "vector3.h"
|
|
6
|
+
|
|
7
|
+
namespace node_sfml {
|
|
8
|
+
namespace vector3 {
|
|
9
|
+
|
|
10
|
+
template <class T>
|
|
11
|
+
NAN_METHOD(Subtract) {
|
|
12
|
+
T* left = Nan::ObjectWrap::Unwrap<T>(info[0].As<v8::Object>());
|
|
13
|
+
T* right = Nan::ObjectWrap::Unwrap<T>(info[1].As<v8::Object>());
|
|
14
|
+
|
|
15
|
+
Nan::TryCatch try_catch;
|
|
16
|
+
v8::MaybeLocal<v8::Value> ret =
|
|
17
|
+
T::NewRealInstance(info.GetIsolate(), left->vector3() - right->vector3());
|
|
18
|
+
if (ret.IsEmpty()) {
|
|
19
|
+
try_catch.ReThrow();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
info.GetReturnValue().Set(ret.ToLocalChecked());
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
template <class T>
|
|
27
|
+
NAN_METHOD(Add) {
|
|
28
|
+
T* left = Nan::ObjectWrap::Unwrap<T>(info[0].As<v8::Object>());
|
|
29
|
+
T* right = Nan::ObjectWrap::Unwrap<T>(info[1].As<v8::Object>());
|
|
30
|
+
|
|
31
|
+
Nan::TryCatch try_catch;
|
|
32
|
+
v8::MaybeLocal<v8::Value> ret =
|
|
33
|
+
T::NewRealInstance(info.GetIsolate(), left->vector3() + right->vector3());
|
|
34
|
+
if (ret.IsEmpty()) {
|
|
35
|
+
try_catch.ReThrow();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
info.GetReturnValue().Set(ret.ToLocalChecked());
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
template <class Self, typename T, typename NAN_T>
|
|
43
|
+
NAN_METHOD(Multiply) {
|
|
44
|
+
Self* left = Nan::ObjectWrap::Unwrap<Self>(info[0].As<v8::Object>());
|
|
45
|
+
T right = static_cast<T>(Nan::To<NAN_T>(info[1]).FromJust());
|
|
46
|
+
|
|
47
|
+
Nan::TryCatch try_catch;
|
|
48
|
+
v8::MaybeLocal<v8::Value> ret =
|
|
49
|
+
Self::NewRealInstance(info.GetIsolate(), left->vector3() * right);
|
|
50
|
+
if (ret.IsEmpty()) {
|
|
51
|
+
try_catch.ReThrow();
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
info.GetReturnValue().Set(ret.ToLocalChecked());
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
template <class Self, typename T, typename NAN_T>
|
|
59
|
+
NAN_METHOD(Div) {
|
|
60
|
+
Self* left = Nan::ObjectWrap::Unwrap<Self>(info[0].As<v8::Object>());
|
|
61
|
+
T right = static_cast<T>(Nan::To<NAN_T>(info[1]).FromJust());
|
|
62
|
+
|
|
63
|
+
Nan::TryCatch try_catch;
|
|
64
|
+
v8::MaybeLocal<v8::Value> ret =
|
|
65
|
+
Self::NewRealInstance(info.GetIsolate(), left->vector3() / right);
|
|
66
|
+
if (ret.IsEmpty()) {
|
|
67
|
+
try_catch.ReThrow();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
info.GetReturnValue().Set(ret.ToLocalChecked());
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
template <class T>
|
|
75
|
+
NAN_METHOD(Equals) {
|
|
76
|
+
T* left = Nan::ObjectWrap::Unwrap<T>(info[0].As<v8::Object>());
|
|
77
|
+
T* right = Nan::ObjectWrap::Unwrap<T>(info[1].As<v8::Object>());
|
|
78
|
+
info.GetReturnValue().Set(left->vector3() == right->vector3());
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
template <class T>
|
|
82
|
+
NAN_METHOD(NotEquals) {
|
|
83
|
+
T* left = Nan::ObjectWrap::Unwrap<T>(info[0].As<v8::Object>());
|
|
84
|
+
T* right = Nan::ObjectWrap::Unwrap<T>(info[1].As<v8::Object>());
|
|
85
|
+
info.GetReturnValue().Set(left->vector3() != right->vector3());
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
#define TEMPLATE_INNER T, NAN_T, V8_T
|
|
89
|
+
|
|
90
|
+
template <typename T, typename NAN_T, class V8_T>
|
|
91
|
+
v8::MaybeLocal<v8::Value> Vector3<TEMPLATE_INNER>::NewRealInstance(
|
|
92
|
+
v8::Isolate* isolate, size_t argc, v8::Local<v8::Value>* argv) {
|
|
93
|
+
v8::Local<v8::Function> cons = real_constructor.Get(isolate);
|
|
94
|
+
if (cons.IsEmpty()) {
|
|
95
|
+
Nan::ThrowError("`real_constructor` is not set.");
|
|
96
|
+
return v8::MaybeLocal<v8::Value>();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
v8::MaybeLocal<v8::Value> maybe_ret = Nan::Call(cons, cons, argc, argv);
|
|
100
|
+
cons->NewInstance(isolate->GetCurrentContext(), argc, argv);
|
|
101
|
+
return maybe_ret;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
template <typename T, typename NAN_T, class V8_T>
|
|
105
|
+
v8::MaybeLocal<v8::Value> Vector3<TEMPLATE_INNER>::NewRealInstance(
|
|
106
|
+
v8::Isolate* isolate, const sf::Vector3<T>& src) {
|
|
107
|
+
v8::MaybeLocal<v8::Value> maybe =
|
|
108
|
+
Vector3<TEMPLATE_INNER>::NewRealInstance(isolate);
|
|
109
|
+
if (maybe.IsEmpty()) return maybe;
|
|
110
|
+
|
|
111
|
+
v8::Local<v8::Object> vec = maybe.ToLocalChecked().As<v8::Object>();
|
|
112
|
+
Vector3<TEMPLATE_INNER>* vec_wrapper =
|
|
113
|
+
Nan::ObjectWrap::Unwrap<Vector3<TEMPLATE_INNER>>(vec);
|
|
114
|
+
sf::Vector3<T>& v = vec_wrapper->vector3();
|
|
115
|
+
v.x = src.x;
|
|
116
|
+
v.y = src.y;
|
|
117
|
+
v.z = src.z;
|
|
118
|
+
|
|
119
|
+
return vec;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
template <typename T, typename NAN_T, class V8_T>
|
|
123
|
+
NAN_METHOD(Vector3<TEMPLATE_INNER>::New) {
|
|
124
|
+
Vector3<T, NAN_T, V8_T>* rect = nullptr;
|
|
125
|
+
if (info.Length() == 0) {
|
|
126
|
+
rect = new Vector3<T, NAN_T, V8_T>();
|
|
127
|
+
rect->Wrap(info.This());
|
|
128
|
+
info.GetReturnValue().Set(info.This());
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (info.Length() == 1) {
|
|
133
|
+
Vector3<T, NAN_T, V8_T>* another =
|
|
134
|
+
Nan::ObjectWrap::Unwrap<Vector3<T, NAN_T, V8_T>>(
|
|
135
|
+
info[0].As<v8::Object>());
|
|
136
|
+
rect = new Vector3(*another);
|
|
137
|
+
rect->Wrap(info.This());
|
|
138
|
+
info.GetReturnValue().Set(info.This());
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
T val[3];
|
|
143
|
+
if (!ParseParameters<T, NAN_T, V8_T>(info, 3, val)) return;
|
|
144
|
+
rect = new Vector3<T, NAN_T, V8_T>(val[0], val[1], val[2]);
|
|
145
|
+
|
|
146
|
+
rect->Wrap(info.This());
|
|
147
|
+
info.GetReturnValue().Set(info.This());
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
#define V(name, lowercase) \
|
|
151
|
+
template <typename T, typename NAN_T, class V8_T> \
|
|
152
|
+
NAN_METHOD(Vector3<TEMPLATE_INNER>::name##Getter) { \
|
|
153
|
+
Vector3<T, NAN_T, V8_T>* vec = \
|
|
154
|
+
Nan::ObjectWrap::Unwrap<Vector3<T, NAN_T, V8_T>>(info.This()); \
|
|
155
|
+
v8::Local<V8_T> ret = \
|
|
156
|
+
Nan::New<V8_T>(static_cast<NAN_T>(vec->vector3().lowercase)); \
|
|
157
|
+
info.GetReturnValue().Set(ret); \
|
|
158
|
+
} \
|
|
159
|
+
\
|
|
160
|
+
template <typename T, typename NAN_T, class V8_T> \
|
|
161
|
+
NAN_METHOD(Vector3<TEMPLATE_INNER>::name##Setter) { \
|
|
162
|
+
v8::MaybeLocal<V8_T> maybe_value = info[0].As<V8_T>(); \
|
|
163
|
+
if (maybe_value.IsEmpty()) { \
|
|
164
|
+
Nan::ThrowTypeError("Invalid type for `" #lowercase "`."); \
|
|
165
|
+
} \
|
|
166
|
+
\
|
|
167
|
+
NAN_T val = maybe_value.ToLocalChecked()->Value(); \
|
|
168
|
+
Vector3<T, NAN_T, V8_T>* vec = \
|
|
169
|
+
Nan::ObjectWrap::Unwrap<Vector3<T, NAN_T, V8_T>>(info.This()); \
|
|
170
|
+
vec->vector3().lowercase = static_cast<T>(val); \
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
VECTOR3_PROPERTIES(V);
|
|
174
|
+
#undef V
|
|
175
|
+
|
|
176
|
+
template <typename T, typename NAN_T, class V8_T>
|
|
177
|
+
NAN_METHOD(Vector3<TEMPLATE_INNER>::SetRealConstructor) {
|
|
178
|
+
real_constructor.Reset(info[0].As<v8::Function>());
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
template <typename T, typename NAN_T, class V8_T>
|
|
182
|
+
Vector3<T, NAN_T, V8_T>::Vector3() : Nan::ObjectWrap(), _vec() {}
|
|
183
|
+
|
|
184
|
+
template <typename T, typename NAN_T, class V8_T>
|
|
185
|
+
Vector3<T, NAN_T, V8_T>::Vector3(T x, T y, T z)
|
|
186
|
+
: Nan::ObjectWrap(), _vec(x, y, z) {}
|
|
187
|
+
|
|
188
|
+
template <typename T, typename NAN_T, class V8_T>
|
|
189
|
+
Vector3<T, NAN_T, V8_T>::Vector3(const Vector3<T, NAN_T, V8_T>& vec)
|
|
190
|
+
: Nan::ObjectWrap(), _vec(vec.vector3()) {}
|
|
191
|
+
|
|
192
|
+
template <typename T, typename NAN_T, class V8_T>
|
|
193
|
+
Vector3<T, NAN_T, V8_T>::~Vector3() {}
|
|
194
|
+
|
|
195
|
+
#undef TEMPLATE_INNER
|
|
196
|
+
|
|
197
|
+
} // namespace vector3
|
|
198
|
+
} // namespace node_sfml
|
|
199
|
+
|
|
200
|
+
#endif // SRC_VECTOR3_INL_H_
|
package/src/vector3.cc
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#include "vector3.h"
|
|
2
|
+
#include "vector3-inl.h"
|
|
3
|
+
|
|
4
|
+
namespace node_sfml {
|
|
5
|
+
namespace vector3 {
|
|
6
|
+
|
|
7
|
+
template <typename T, typename NAN_T, class V8_T>
|
|
8
|
+
Nan::Persistent<v8::Function> Vector3<T, NAN_T, V8_T>::constructor;
|
|
9
|
+
|
|
10
|
+
template <typename T, typename NAN_T, class V8_T>
|
|
11
|
+
Nan::Persistent<v8::Function> Vector3<T, NAN_T, V8_T>::real_constructor;
|
|
12
|
+
|
|
13
|
+
const char int_name[] = "Vector3I";
|
|
14
|
+
NAN_MODULE_INIT(Vector3I::Init) {
|
|
15
|
+
Vector3<int, int, v8::Int32>::Init<Vector3I, int_name>(target);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
Vector3I::~Vector3I() {}
|
|
19
|
+
|
|
20
|
+
const char uint_name[] = "Vector3U";
|
|
21
|
+
NAN_MODULE_INIT(Vector3U::Init) {
|
|
22
|
+
Vector3<sf::Uint32, sf::Uint32, v8::Uint32>::Init<Vector3U, uint_name>(
|
|
23
|
+
target);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
Vector3U::~Vector3U() {}
|
|
27
|
+
|
|
28
|
+
const char float_name[] = "Vector3F";
|
|
29
|
+
NAN_MODULE_INIT(Vector3F::Init) {
|
|
30
|
+
Vector3<float, double, v8::Number>::Init<Vector3F, float_name>(target);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Vector3F::~Vector3F() {}
|
|
34
|
+
|
|
35
|
+
} // namespace vector3
|
|
36
|
+
} // namespace node_sfml
|
package/src/vector3.h
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#ifndef SRC_VECTOR3_H_
|
|
2
|
+
#define SRC_VECTOR3_H_
|
|
3
|
+
|
|
4
|
+
#include <nan.h>
|
|
5
|
+
|
|
6
|
+
#include <SFML/Config.hpp>
|
|
7
|
+
#include <SFML/System/Vector3.hpp>
|
|
8
|
+
|
|
9
|
+
namespace node_sfml {
|
|
10
|
+
namespace vector3 {
|
|
11
|
+
|
|
12
|
+
#define VECTOR3_PROPERTIES(V) \
|
|
13
|
+
V(X, x) \
|
|
14
|
+
V(Y, y) \
|
|
15
|
+
V(Z, z)
|
|
16
|
+
|
|
17
|
+
template <class T>
|
|
18
|
+
NAN_METHOD(Subtract);
|
|
19
|
+
|
|
20
|
+
template <class T>
|
|
21
|
+
NAN_METHOD(Add);
|
|
22
|
+
|
|
23
|
+
template <class Self, typename T, typename NAN_T>
|
|
24
|
+
NAN_METHOD(Multiply);
|
|
25
|
+
|
|
26
|
+
template <class Self, typename T, typename NAN_T>
|
|
27
|
+
NAN_METHOD(Div);
|
|
28
|
+
|
|
29
|
+
template <class T>
|
|
30
|
+
NAN_METHOD(Equals);
|
|
31
|
+
|
|
32
|
+
template <class T>
|
|
33
|
+
NAN_METHOD(NotEquals);
|
|
34
|
+
|
|
35
|
+
// TODO(XadillaX): Pure JavaScript vertion for performance.
|
|
36
|
+
template <typename T, typename NAN_T, class V8_T>
|
|
37
|
+
class Vector3 : public Nan::ObjectWrap {
|
|
38
|
+
public:
|
|
39
|
+
inline const sf::Vector3<T>& vector3() const { return _vec; }
|
|
40
|
+
inline sf::Vector3<T>& vector3() { return _vec; }
|
|
41
|
+
|
|
42
|
+
static Nan::Persistent<v8::Function> constructor;
|
|
43
|
+
static Nan::Persistent<v8::Function> real_constructor;
|
|
44
|
+
|
|
45
|
+
template <class Self, const char* class_name>
|
|
46
|
+
static NAN_MODULE_INIT(Init) {
|
|
47
|
+
v8::Local<v8::String> name = Nan::New(class_name).ToLocalChecked();
|
|
48
|
+
v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
|
|
49
|
+
|
|
50
|
+
#define V(name, lowercase) \
|
|
51
|
+
tpl->PrototypeTemplate()->SetAccessorProperty( \
|
|
52
|
+
Nan::New(#lowercase).ToLocalChecked(), \
|
|
53
|
+
Nan::New<v8::FunctionTemplate>(name##Getter), \
|
|
54
|
+
Nan::New<v8::FunctionTemplate>(name##Setter), \
|
|
55
|
+
v8::PropertyAttribute::DontDelete);
|
|
56
|
+
|
|
57
|
+
VECTOR3_PROPERTIES(V);
|
|
58
|
+
#undef V
|
|
59
|
+
|
|
60
|
+
tpl->SetClassName(name);
|
|
61
|
+
tpl->InstanceTemplate()->SetInternalFieldCount(1);
|
|
62
|
+
|
|
63
|
+
v8::Local<v8::Function> func = Nan::GetFunction(tpl).ToLocalChecked();
|
|
64
|
+
constructor.Reset(func);
|
|
65
|
+
|
|
66
|
+
Nan::Set(target, name, func);
|
|
67
|
+
|
|
68
|
+
Nan::SetMethod(func, "setRealConstructor", SetRealConstructor);
|
|
69
|
+
Nan::SetMethod(func, "subtract", Subtract<Self>);
|
|
70
|
+
Nan::SetMethod(func, "add", Add<Self>);
|
|
71
|
+
Nan::SetMethod(func, "multiply", Multiply<Self, T, NAN_T>);
|
|
72
|
+
Nan::SetMethod(func, "div", Div<Self, T, NAN_T>);
|
|
73
|
+
|
|
74
|
+
Nan::SetMethod(func, "equals", Equals<Self>);
|
|
75
|
+
Nan::SetMethod(func, "notEquals", NotEquals<Self>);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static v8::MaybeLocal<v8::Value> NewRealInstance(
|
|
79
|
+
v8::Isolate* isolate,
|
|
80
|
+
size_t argc = 0,
|
|
81
|
+
v8::Local<v8::Value>* argv = nullptr);
|
|
82
|
+
static v8::MaybeLocal<v8::Value> NewRealInstance(v8::Isolate* isolate,
|
|
83
|
+
const sf::Vector3<T>& src);
|
|
84
|
+
|
|
85
|
+
protected:
|
|
86
|
+
static NAN_METHOD(New);
|
|
87
|
+
|
|
88
|
+
#define V(name, lowercase) \
|
|
89
|
+
static NAN_METHOD(name##Getter); \
|
|
90
|
+
static NAN_METHOD(name##Setter);
|
|
91
|
+
|
|
92
|
+
VECTOR3_PROPERTIES(V);
|
|
93
|
+
#undef V
|
|
94
|
+
|
|
95
|
+
static NAN_METHOD(SetRealConstructor);
|
|
96
|
+
|
|
97
|
+
protected:
|
|
98
|
+
Vector3();
|
|
99
|
+
Vector3(T x, T y, T z);
|
|
100
|
+
explicit Vector3(const Vector3<T, NAN_T, V8_T>& vec);
|
|
101
|
+
virtual ~Vector3();
|
|
102
|
+
|
|
103
|
+
protected:
|
|
104
|
+
sf::Vector3<T> _vec;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
class Vector3I : public Vector3<int, int, v8::Int32> {
|
|
108
|
+
public:
|
|
109
|
+
static NAN_MODULE_INIT(Init);
|
|
110
|
+
|
|
111
|
+
private:
|
|
112
|
+
~Vector3I();
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
class Vector3U : public Vector3<sf::Uint32, sf::Uint32, v8::Uint32> {
|
|
116
|
+
public:
|
|
117
|
+
static NAN_MODULE_INIT(Init);
|
|
118
|
+
|
|
119
|
+
private:
|
|
120
|
+
~Vector3U();
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
class Vector3F : public Vector3<float, double, v8::Number> {
|
|
124
|
+
public:
|
|
125
|
+
static NAN_MODULE_INIT(Init);
|
|
126
|
+
|
|
127
|
+
private:
|
|
128
|
+
~Vector3F();
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
} // namespace vector3
|
|
132
|
+
} // namespace node_sfml
|
|
133
|
+
|
|
134
|
+
#endif // SRC_VECTOR3_H_
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs').promises;
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const baseDir = path.join(__dirname, '../../dest');
|
|
7
|
+
const targetDir = path.join(__dirname, '../../third_party/sfml/platform/linux');
|
|
8
|
+
|
|
9
|
+
exports.move = async function move(spinner) {
|
|
10
|
+
spinner.start('Moving SFML files...');
|
|
11
|
+
await fs.rm(targetDir, { recursive: true, force: true });
|
|
12
|
+
await fs.mkdir(targetDir, { recursive: true });
|
|
13
|
+
|
|
14
|
+
const srcLibDir = path.join(baseDir, 'lib');
|
|
15
|
+
const destLibDir = path.join(targetDir, 'lib');
|
|
16
|
+
await fs.rename(srcLibDir, destLibDir);
|
|
17
|
+
|
|
18
|
+
await fs.rm(path.join(destLibDir, 'cmake'), { recursive: true, force: true });
|
|
19
|
+
|
|
20
|
+
spinner.stop(`[sfml.js] SFML files moved to ${destLibDir}.`);
|
|
21
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs').promises;
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const baseDir = path.join(__dirname, '../../dest');
|
|
7
|
+
const targetDir = path.join(__dirname, '../../third_party/sfml/platform/macOS');
|
|
8
|
+
|
|
9
|
+
exports.move = async function move(spinner) {
|
|
10
|
+
spinner.start('Moving SFML files...');
|
|
11
|
+
await fs.rm(targetDir, { recursive: true, force: true });
|
|
12
|
+
await fs.mkdir(targetDir, { recursive: true });
|
|
13
|
+
|
|
14
|
+
const srcFrameworksDir = path.join(baseDir, 'Frameworks');
|
|
15
|
+
const destFrameworksDir = path.join(targetDir, 'Frameworks');
|
|
16
|
+
await fs.rename(srcFrameworksDir, destFrameworksDir);
|
|
17
|
+
|
|
18
|
+
const srcExtlibsDir = path.join(baseDir, 'extlibs');
|
|
19
|
+
const extlibs = await fs.readdir(srcExtlibsDir);
|
|
20
|
+
for (const extlib of extlibs) {
|
|
21
|
+
const srcExtlibDir = path.join(srcExtlibsDir, extlib);
|
|
22
|
+
if (!(await fs.stat(srcExtlibDir)).isDirectory()) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const destExtlibDir = path.join(destFrameworksDir, extlib);
|
|
27
|
+
await fs.rename(srcExtlibDir, destExtlibDir);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const srcLibDir = path.join(baseDir, 'lib');
|
|
31
|
+
const destLibDir = path.join(targetDir, 'lib');
|
|
32
|
+
await fs.rename(srcLibDir, destLibDir);
|
|
33
|
+
spinner.stop(`[sfml.js] SFML files moved to ${destLibDir}.`);
|
|
34
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs').promises;
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const baseDir = path.join(__dirname, '../../dest');
|
|
7
|
+
const targetDir = path.join(__dirname, '../../third_party/sfml/platform/win');
|
|
8
|
+
|
|
9
|
+
exports.move = async function move(spinner) {
|
|
10
|
+
spinner.start('Moving SFML files...');
|
|
11
|
+
await fs.rm(targetDir, { recursive: true, force: true });
|
|
12
|
+
await fs.mkdir(targetDir, { recursive: true });
|
|
13
|
+
|
|
14
|
+
const srcLibDir = path.join(baseDir, 'lib');
|
|
15
|
+
const destLibDir = path.join(targetDir, 'lib');
|
|
16
|
+
const moves = [];
|
|
17
|
+
const libs = await fs.readdir(srcLibDir);
|
|
18
|
+
await fs.mkdir(destLibDir, { recursive: true });
|
|
19
|
+
for (const lib of libs) {
|
|
20
|
+
// TODO(XadillaX): Use `-d.lib` if Debug.
|
|
21
|
+
if (lib.endsWith('.lib') && !lib.endsWith('-d.lib')) {
|
|
22
|
+
moves.push(
|
|
23
|
+
fs.rename(path.join(srcLibDir, lib), path.join(destLibDir, lib)));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
await Promise.all(moves);
|
|
27
|
+
|
|
28
|
+
const srcBinDir = path.join(baseDir, 'bin');
|
|
29
|
+
const destBinDir = path.join(targetDir, 'bin');
|
|
30
|
+
await fs.rename(srcBinDir, destBinDir);
|
|
31
|
+
|
|
32
|
+
spinner.stop(`[sfml.js] SFML files moved to ${destLibDir}.`);
|
|
33
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const cp = require('child_process');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const joystickHpp = fs.readFileSync(
|
|
8
|
+
path.join(__dirname, '../third_party/sfml/include/SFML/Window/Joystick.hpp'));
|
|
9
|
+
|
|
10
|
+
let current = -1;
|
|
11
|
+
const extracted = /enum Axis\W+{([^}]*)\};/
|
|
12
|
+
.exec(joystickHpp)[1]
|
|
13
|
+
.trim()
|
|
14
|
+
.split('\n')
|
|
15
|
+
.map(line => {
|
|
16
|
+
line = line.trim().replace(/(,|)\W*\/\/\/.+/, '');
|
|
17
|
+
|
|
18
|
+
const arr = line.split('=').map(c => c.trim());
|
|
19
|
+
if (arr.length >= 2) {
|
|
20
|
+
current = parseInt(arr[1]);
|
|
21
|
+
} else {
|
|
22
|
+
current++;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return [ arr[0], current ];
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const str = `#include <map>
|
|
29
|
+
#include <string>
|
|
30
|
+
|
|
31
|
+
namespace node_sfml {
|
|
32
|
+
namespace gen {
|
|
33
|
+
|
|
34
|
+
std::map<int, std::string> joystick_axis_itoa;
|
|
35
|
+
std::map<std::string, int> joystick_axis_atoi;
|
|
36
|
+
|
|
37
|
+
void InitJoystickAxis() {
|
|
38
|
+
${extracted
|
|
39
|
+
.map(([ key, code ]) => {
|
|
40
|
+
return `joystick_axis_itoa[${code}] = "${key}";
|
|
41
|
+
joystick_axis_atoi["${key}"] = ${code};
|
|
42
|
+
`;
|
|
43
|
+
})
|
|
44
|
+
.join(' ')
|
|
45
|
+
.trim()}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
} // namespace gen
|
|
49
|
+
} // namespace node_sfml
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
fs.writeFileSync(path.join(__dirname, '../src/gen/joystick_axis.cc'), str);
|
|
53
|
+
|
|
54
|
+
if (process.platform !== 'win32') {
|
|
55
|
+
cp.execFileSync(path.join(__dirname, 'clang_format.js'), [
|
|
56
|
+
'-style=file',
|
|
57
|
+
'-i',
|
|
58
|
+
path.join(__dirname, '../src/gen/joystick_axis.cc'),
|
|
59
|
+
]);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
console.log('./src/gen/joystick_axis.cc generated.');
|
package/tools/keycode.js
CHANGED
|
@@ -38,13 +38,15 @@ void InitKeyCode() {
|
|
|
38
38
|
${extracted
|
|
39
39
|
.map(([ key, code ]) => {
|
|
40
40
|
return `keycode_itoa[${code}] = "${key}";
|
|
41
|
-
|
|
41
|
+
keycode_atoi["${key}"] = ${code};
|
|
42
|
+
`;
|
|
42
43
|
})
|
|
43
|
-
.join('')
|
|
44
|
+
.join(' ')
|
|
45
|
+
.trim()}
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
} // namespace node_sfml
|
|
47
48
|
} // namespace gen
|
|
49
|
+
} // namespace node_sfml
|
|
48
50
|
`;
|
|
49
51
|
|
|
50
52
|
fs.writeFileSync(path.join(__dirname, '../src/gen/keycode.cc'), str);
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
const download = require('download');
|
|
8
|
+
const Spinner = require('tiny-spinner');
|
|
9
|
+
|
|
10
|
+
const urls = require('./lib_downloader_urls');
|
|
11
|
+
|
|
12
|
+
const spinner = new Spinner();
|
|
13
|
+
const platform = os.platform();
|
|
14
|
+
let type;
|
|
15
|
+
|
|
16
|
+
switch (platform) {
|
|
17
|
+
case 'darwin': {
|
|
18
|
+
if (process.arch !== 'x64') {
|
|
19
|
+
throw new Error('Unsupported architecture: ' + process.arch);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type = 'macOS';
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
case 'aix':
|
|
27
|
+
case 'freebsd':
|
|
28
|
+
case 'netbsd':
|
|
29
|
+
case 'openbsd':
|
|
30
|
+
case 'sunos':
|
|
31
|
+
case 'linux': {
|
|
32
|
+
if (process.arch !== 'x64') {
|
|
33
|
+
throw new Error('Unsupported architecture: ' + process.arch);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type = 'linux';
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
case 'win32': {
|
|
41
|
+
if (process.arch === 'x64') {
|
|
42
|
+
type = 'win64';
|
|
43
|
+
} else if (process.arch === 'ia32') {
|
|
44
|
+
type = 'win32';
|
|
45
|
+
} else {
|
|
46
|
+
throw new Error('Unsupported architecture: ' + process.arch);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
default:
|
|
53
|
+
throw new Error('Unsupported platform: ' + platform);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function downloadTarball(url) {
|
|
57
|
+
spinner.start(`Downloading and extracting ${url}...`);
|
|
58
|
+
|
|
59
|
+
await download(url, path.join(__dirname, '../dest'), {
|
|
60
|
+
extract: true,
|
|
61
|
+
strip: 1,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
spinner.stop(`[sfml.js] ${url} Downloaded.`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
(async () => {
|
|
68
|
+
fs.rmSync(path.join(__dirname, '../dest'), { recursive: true, force: true });
|
|
69
|
+
fs.rmSync(
|
|
70
|
+
path.join(__dirname, '../third_party/sfml/platform/macOS'),
|
|
71
|
+
{ recursive: true, force: true });
|
|
72
|
+
fs.rmSync(
|
|
73
|
+
path.join(__dirname, '../third_party/sfml/platform/linux'),
|
|
74
|
+
{ recursive: true, force: true });
|
|
75
|
+
fs.rmSync(
|
|
76
|
+
path.join(__dirname, '../third_party/sfml/platform/win'),
|
|
77
|
+
{ recursive: true, force: true });
|
|
78
|
+
|
|
79
|
+
await downloadTarball((await urls.get())[type]);
|
|
80
|
+
let copier;
|
|
81
|
+
switch (type) {
|
|
82
|
+
case 'macOS':
|
|
83
|
+
copier = require('./copier/macos');
|
|
84
|
+
break;
|
|
85
|
+
|
|
86
|
+
case 'linux':
|
|
87
|
+
copier = require('./copier/linux');
|
|
88
|
+
break;
|
|
89
|
+
|
|
90
|
+
case 'win64':
|
|
91
|
+
case 'win32':
|
|
92
|
+
copier = require('./copier/windows');
|
|
93
|
+
break;
|
|
94
|
+
|
|
95
|
+
default:
|
|
96
|
+
throw new Error('Unsupported platform: ' + platform);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
await copier.move(spinner);
|
|
100
|
+
|
|
101
|
+
fs.rmSync(path.join(__dirname, '../dest'), { recursive: true, force: true });
|
|
102
|
+
})();
|