sfml.js 0.0.1-preview.39 → 0.0.1-preview.42
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 +43 -6
- package/binding.gyp +53 -0
- 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/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 +3 -2
- 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/resizable_buffer.h +1 -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/utils-inl.h +2 -2
- package/src/vector3-inl.h +200 -0
- package/src/vector3.cc +36 -0
- package/src/vector3.h +134 -0
- package/tools/joystick_axis.js +62 -0
- package/tools/keycode.js +5 -3
- package/tools/mouse_button.js +9 -5
- package/tools/sensor_type.js +62 -0
- package/third_party/sfml/platform/macOS/Frameworks/FLAC.framework/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/FLAC.framework/Versions/Current/FLAC +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/FLAC.framework/Versions/Current/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/OpenAL.framework/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/OpenAL.framework/Versions/Current/OpenAL +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/OpenAL.framework/Versions/Current/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/AlResource.hpp +0 -70
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/Export.hpp +0 -48
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/InputSoundFile.hpp +0 -263
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/Listener.hpp +0 -234
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/Music.hpp +0 -337
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/OutputSoundFile.hpp +0 -133
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/Sound.hpp +0 -264
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundBuffer.hpp +0 -352
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundBufferRecorder.hpp +0 -144
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundFileFactory.hpp +0 -197
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundFileFactory.inl +0 -100
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundFileReader.hpp +0 -165
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundFileWriter.hpp +0 -125
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundRecorder.hpp +0 -408
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundSource.hpp +0 -332
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundStream.hpp +0 -405
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio.hpp +0 -56
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Config.hpp +0 -236
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/GpuPreference.hpp +0 -74
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/BlendMode.hpp +0 -215
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/CircleShape.hpp +0 -154
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Color.hpp +0 -275
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/ConvexShape.hpp +0 -153
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Drawable.hpp +0 -126
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Export.hpp +0 -48
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Font.hpp +0 -439
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Glsl.hpp +0 -227
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Glsl.inl +0 -155
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Glyph.hpp +0 -79
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Image.hpp +0 -324
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/PrimitiveType.hpp +0 -58
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Rect.hpp +0 -254
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Rect.inl +0 -159
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/RectangleShape.hpp +0 -132
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/RenderStates.hpp +0 -174
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/RenderTarget.hpp +0 -510
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/RenderTexture.hpp +0 -314
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/RenderWindow.hpp +0 -284
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Shader.hpp +0 -875
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Shape.hpp +0 -355
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Sprite.hpp +0 -279
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Text.hpp +0 -513
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Texture.hpp +0 -733
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Transform.hpp +0 -479
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Transformable.hpp +0 -429
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Vertex.hpp +0 -148
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/VertexArray.hpp +0 -223
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/VertexBuffer.hpp +0 -408
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/View.hpp +0 -343
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics.hpp +0 -68
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Main.hpp +0 -43
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/Export.hpp +0 -48
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/Ftp.hpp +0 -616
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/Http.hpp +0 -482
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/IpAddress.hpp +0 -328
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/Packet.hpp +0 -532
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/Socket.hpp +0 -219
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/SocketHandle.hpp +0 -57
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/SocketSelector.hpp +0 -263
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/TcpListener.hpp +0 -166
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/TcpSocket.hpp +0 -316
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/UdpSocket.hpp +0 -291
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network.hpp +0 -53
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/OpenGL.hpp +0 -78
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Clock.hpp +0 -117
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Err.hpp +0 -80
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Export.hpp +0 -48
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/FileInputStream.hpp +0 -169
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/InputStream.hpp +0 -152
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Lock.hpp +0 -139
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/MemoryInputStream.hpp +0 -148
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Mutex.hpp +0 -148
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/NativeActivity.hpp +0 -62
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/NonCopyable.hpp +0 -129
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Sleep.hpp +0 -52
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/String.hpp +0 -669
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/String.inl +0 -53
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Thread.hpp +0 -282
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Thread.inl +0 -90
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/ThreadLocal.hpp +0 -103
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/ThreadLocalPtr.hpp +0 -158
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/ThreadLocalPtr.inl +0 -77
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Time.hpp +0 -488
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Utf.hpp +0 -763
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Utf.inl +0 -752
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Vector2.hpp +0 -301
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Vector2.inl +0 -161
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Vector3.hpp +0 -302
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Vector3.inl +0 -168
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System.hpp +0 -60
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Clipboard.hpp +0 -119
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Context.hpp +0 -195
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/ContextSettings.hpp +0 -149
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Cursor.hpp +0 -222
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Event.hpp +0 -284
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Export.hpp +0 -48
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/GlResource.hpp +0 -109
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Joystick.hpp +0 -227
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Keyboard.hpp +0 -232
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Mouse.hpp +0 -177
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Sensor.hpp +0 -150
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Touch.hpp +0 -137
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/VideoMode.hpp +0 -228
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Window.hpp +0 -622
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/WindowHandle.hpp +0 -101
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/WindowStyle.hpp +0 -53
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window.hpp +0 -58
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Resources/CMake/SFMLConfig.cmake +0 -148
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Resources/CMake/SFMLConfigDependencies.cmake +0 -86
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Resources/CMake/SFMLConfigVersion.cmake +0 -46
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Resources/CMake/SFMLSharedTargets-release.cmake +0 -59
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Resources/CMake/SFMLSharedTargets.cmake +0 -158
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/AlResource.hpp +0 -70
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/Export.hpp +0 -48
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/InputSoundFile.hpp +0 -263
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/Listener.hpp +0 -234
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/Music.hpp +0 -337
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/OutputSoundFile.hpp +0 -133
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/Sound.hpp +0 -264
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundBuffer.hpp +0 -352
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundBufferRecorder.hpp +0 -144
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundFileFactory.hpp +0 -197
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundFileFactory.inl +0 -100
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundFileReader.hpp +0 -165
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundFileWriter.hpp +0 -125
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundRecorder.hpp +0 -408
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundSource.hpp +0 -332
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundStream.hpp +0 -405
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio.hpp +0 -56
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Config.hpp +0 -236
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/GpuPreference.hpp +0 -74
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/BlendMode.hpp +0 -215
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/CircleShape.hpp +0 -154
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Color.hpp +0 -275
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/ConvexShape.hpp +0 -153
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Drawable.hpp +0 -126
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Export.hpp +0 -48
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Font.hpp +0 -439
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Glsl.hpp +0 -227
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Glsl.inl +0 -155
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Glyph.hpp +0 -79
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Image.hpp +0 -324
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/PrimitiveType.hpp +0 -58
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Rect.hpp +0 -254
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Rect.inl +0 -159
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/RectangleShape.hpp +0 -132
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/RenderStates.hpp +0 -174
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/RenderTarget.hpp +0 -510
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/RenderTexture.hpp +0 -314
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/RenderWindow.hpp +0 -284
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Shader.hpp +0 -875
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Shape.hpp +0 -355
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Sprite.hpp +0 -279
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Text.hpp +0 -513
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Texture.hpp +0 -733
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Transform.hpp +0 -479
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Transformable.hpp +0 -429
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Vertex.hpp +0 -148
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/VertexArray.hpp +0 -223
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/VertexBuffer.hpp +0 -408
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/View.hpp +0 -343
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics.hpp +0 -68
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Main.hpp +0 -43
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/Export.hpp +0 -48
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/Ftp.hpp +0 -616
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/Http.hpp +0 -482
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/IpAddress.hpp +0 -328
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/Packet.hpp +0 -532
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/Socket.hpp +0 -219
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/SocketHandle.hpp +0 -57
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/SocketSelector.hpp +0 -263
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/TcpListener.hpp +0 -166
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/TcpSocket.hpp +0 -316
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/UdpSocket.hpp +0 -291
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network.hpp +0 -53
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/OpenGL.hpp +0 -78
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Clock.hpp +0 -117
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Err.hpp +0 -80
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Export.hpp +0 -48
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/FileInputStream.hpp +0 -169
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/InputStream.hpp +0 -152
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Lock.hpp +0 -139
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/MemoryInputStream.hpp +0 -148
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Mutex.hpp +0 -148
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/NativeActivity.hpp +0 -62
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/NonCopyable.hpp +0 -129
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Sleep.hpp +0 -52
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/String.hpp +0 -669
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/String.inl +0 -53
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Thread.hpp +0 -282
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Thread.inl +0 -90
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/ThreadLocal.hpp +0 -103
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/ThreadLocalPtr.hpp +0 -158
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/ThreadLocalPtr.inl +0 -77
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Time.hpp +0 -488
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Utf.hpp +0 -763
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Utf.inl +0 -752
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Vector2.hpp +0 -301
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Vector2.inl +0 -161
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Vector3.hpp +0 -302
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Vector3.inl +0 -168
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System.hpp +0 -60
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Clipboard.hpp +0 -119
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Context.hpp +0 -195
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/ContextSettings.hpp +0 -149
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Cursor.hpp +0 -222
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Event.hpp +0 -284
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Export.hpp +0 -48
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/GlResource.hpp +0 -109
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Joystick.hpp +0 -227
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Keyboard.hpp +0 -232
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Mouse.hpp +0 -177
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Sensor.hpp +0 -150
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Touch.hpp +0 -137
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/VideoMode.hpp +0 -228
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Window.hpp +0 -622
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/WindowHandle.hpp +0 -101
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/WindowStyle.hpp +0 -53
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window.hpp +0 -58
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Resources/CMake/SFMLConfig.cmake +0 -148
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Resources/CMake/SFMLConfigDependencies.cmake +0 -86
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Resources/CMake/SFMLConfigVersion.cmake +0 -46
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Resources/CMake/SFMLSharedTargets-release.cmake +0 -59
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Resources/CMake/SFMLSharedTargets.cmake +0 -158
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/SFML +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/freetype.framework/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/freetype.framework/Versions/Current/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/freetype.framework/Versions/Current/freetype +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/ogg.framework/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/ogg.framework/Versions/Current/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/ogg.framework/Versions/Current/ogg +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/sfml-audio.framework/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/sfml-audio.framework/Versions/Current/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/sfml-audio.framework/Versions/Current/sfml-audio +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/sfml-graphics.framework/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/sfml-graphics.framework/Versions/Current/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/sfml-graphics.framework/Versions/Current/sfml-graphics +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/sfml-network.framework/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/sfml-network.framework/Versions/Current/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/sfml-network.framework/Versions/Current/sfml-network +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/sfml-system.framework/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/sfml-system.framework/Versions/Current/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/sfml-system.framework/Versions/Current/sfml-system +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/sfml-window.framework/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/sfml-window.framework/Versions/Current/Resources/Info.plist +0 -26
- package/third_party/sfml/platform/macOS/Frameworks/sfml-window.framework/Versions/Current/sfml-window +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/vorbis.framework/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/vorbis.framework/Versions/Current/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/vorbis.framework/Versions/Current/vorbis +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/vorbisenc.framework/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/vorbisenc.framework/Versions/Current/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/vorbisenc.framework/Versions/Current/vorbisenc +0 -0
- package/third_party/sfml/platform/macOS/Frameworks/vorbisfile.framework/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/vorbisfile.framework/Versions/Current/Resources/Info.plist +0 -22
- package/third_party/sfml/platform/macOS/Frameworks/vorbisfile.framework/Versions/Current/vorbisfile +0 -0
package/lib/vector3.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const util = require('util');
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
Vector3I: _Vector3I,
|
|
7
|
+
Vector3F: _Vector3F,
|
|
8
|
+
Vector3U: _Vector3U,
|
|
9
|
+
} = require('../build/Release/binding.node');
|
|
10
|
+
const { validateTypeOf } = require('./common');
|
|
11
|
+
|
|
12
|
+
function createClass(name, BaseClz, checkRange, formatBaseValue = v => v) {
|
|
13
|
+
return class Vector3 extends BaseClz {
|
|
14
|
+
[util.inspect.custom](depth, opts) {
|
|
15
|
+
return `${name} ${util.inspect({
|
|
16
|
+
...this.toJSON(),
|
|
17
|
+
}, opts)}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
toJSON() {
|
|
21
|
+
return { x: this.x, y: this.y, z: this.z };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
constructor(xOrVector, y, z) {
|
|
25
|
+
if (arguments.length === 3) {
|
|
26
|
+
validateTypeOf(xOrVector, 'x', 'number');
|
|
27
|
+
validateTypeOf(y, 'y', 'number');
|
|
28
|
+
validateTypeOf(z, 'z', 'number');
|
|
29
|
+
|
|
30
|
+
checkRange(xOrVector);
|
|
31
|
+
checkRange(y);
|
|
32
|
+
checkRange(z);
|
|
33
|
+
|
|
34
|
+
xOrVector = formatBaseValue(xOrVector);
|
|
35
|
+
y = formatBaseValue(y);
|
|
36
|
+
z = formatBaseValue(z);
|
|
37
|
+
|
|
38
|
+
super(xOrVector, y, z);
|
|
39
|
+
} else if (arguments.length === 1) {
|
|
40
|
+
validateTypeOf(xOrVector, 'vector', BaseClz);
|
|
41
|
+
super(xOrVector);
|
|
42
|
+
} else if (arguments.length === 0) {
|
|
43
|
+
super();
|
|
44
|
+
} else {
|
|
45
|
+
throw new Error(`Invalid parameter count ${arguments.length}.`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
get x() {
|
|
50
|
+
return super.x;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
set x(val) {
|
|
54
|
+
validateTypeOf(val, 'x', 'number');
|
|
55
|
+
checkRange(val);
|
|
56
|
+
super.x = formatBaseValue(val);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get y() {
|
|
60
|
+
return super.y;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
set y(val) {
|
|
64
|
+
validateTypeOf(val, 'y', 'number');
|
|
65
|
+
checkRange(val);
|
|
66
|
+
super.y = formatBaseValue(val);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
get z() {
|
|
70
|
+
return super.z;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
set z(val) {
|
|
74
|
+
validateTypeOf(val, 'z', 'number');
|
|
75
|
+
checkRange(val);
|
|
76
|
+
super.z = formatBaseValue(val);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
static subtract(a, b) {
|
|
80
|
+
if (!(a instanceof Vector3) || !(b instanceof Vector3)) {
|
|
81
|
+
throw new Error('Invalid parameter type.');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return BaseClz.subtract(a, b);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
static add(a, b) {
|
|
88
|
+
if (!(a instanceof Vector3) || !(b instanceof Vector3)) {
|
|
89
|
+
throw new Error('Invalid parameter type.');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return BaseClz.add(a, b);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
static multiply(a, b) {
|
|
96
|
+
if (!(a instanceof Vector3)) {
|
|
97
|
+
throw new Error('Invalid left parameter type.');
|
|
98
|
+
}
|
|
99
|
+
validateTypeOf(b, 'b', 'number');
|
|
100
|
+
checkRange(b);
|
|
101
|
+
|
|
102
|
+
return BaseClz.multiply(a, formatBaseValue(b));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static div(a, b) {
|
|
106
|
+
if (!(a instanceof Vector3)) {
|
|
107
|
+
throw new Error('Invalid left parameter type.');
|
|
108
|
+
}
|
|
109
|
+
validateTypeOf(b, 'b', 'number');
|
|
110
|
+
checkRange(b);
|
|
111
|
+
|
|
112
|
+
return BaseClz.div(a, formatBaseValue(b));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
static equals(a, b) {
|
|
116
|
+
if (!(a instanceof Vector3) || !(b instanceof Vector3)) {
|
|
117
|
+
throw new Error('Invalid parameter type.');
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return BaseClz.equals(a, b);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
static notEequals(a, b) {
|
|
124
|
+
if (!(a instanceof Vector3) || !(b instanceof Vector3)) {
|
|
125
|
+
throw new Error('Invalid parameter type.');
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return BaseClz.notEequals(a, b);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const Vector3I = createClass(
|
|
134
|
+
'Vector3I',
|
|
135
|
+
_Vector3I,
|
|
136
|
+
() => true,
|
|
137
|
+
v => parseInt(v));
|
|
138
|
+
_Vector3I.setRealConstructor((...args) => new Vector3I(...args));
|
|
139
|
+
|
|
140
|
+
const Vector3U = createClass(
|
|
141
|
+
'Vector3U',
|
|
142
|
+
_Vector3U,
|
|
143
|
+
v => {
|
|
144
|
+
if (v < 0) {
|
|
145
|
+
throw new Error('Value should greater than or equal to 0.');
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
v => parseInt(v));
|
|
149
|
+
_Vector3U.setRealConstructor((...args) => new Vector3U(...args));
|
|
150
|
+
|
|
151
|
+
const Vector3F = createClass('Vector3F', _Vector3F, () => true);
|
|
152
|
+
_Vector3F.setRealConstructor((...args) => new Vector3F(...args));
|
|
153
|
+
|
|
154
|
+
module.exports = { Vector3I, Vector3U, Vector3F };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sfml.js",
|
|
3
|
-
"version": "0.0.1-preview.
|
|
3
|
+
"version": "0.0.1-preview.42",
|
|
4
4
|
"description": "SFML's Node.js binding.",
|
|
5
5
|
"main": "lib/sfml.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"generate_compile_commands": "node-gyp -- configure -f=gyp.generator.compile_commands_json.py && mv Release/compile_commands.json compile_commands.json && rm -rf Release && rm -rf Debug",
|
|
9
9
|
"clang-format": "./tools/clang_format.js --style=file -i ./src/*.cc ./src/*.h ./src/drawable/*.cc ./src/drawable/*.h ./src/sound/*.cc ./src/sound/*.h ./src/workers/*.h",
|
|
10
10
|
"preinstall": "node tools/symlinks.js",
|
|
11
|
-
"cpplint": "./third_party/cpplint/cpplint.py src/**/*",
|
|
11
|
+
"cpplint": "./third_party/cpplint/cpplint.py src/*.* src/**/*",
|
|
12
12
|
"jslint": "./node_modules/.bin/eslint ./**/*.js",
|
|
13
13
|
"install": "node-gyp rebuild"
|
|
14
14
|
},
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^16.11.6",
|
|
32
32
|
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
|
33
|
+
"all-contributors-cli": "^6.20.0",
|
|
33
34
|
"eslint": "^7.0.0",
|
|
34
35
|
"eslint-config-egg": "^9.0.0",
|
|
35
36
|
"eslint-plugin-import": "^2.25.2",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#include <map>
|
|
2
|
+
#include <string>
|
|
3
|
+
|
|
4
|
+
namespace node_sfml {
|
|
5
|
+
namespace gen {
|
|
6
|
+
|
|
7
|
+
std::map<int, std::string> joystick_axis_itoa;
|
|
8
|
+
std::map<std::string, int> joystick_axis_atoi;
|
|
9
|
+
|
|
10
|
+
void InitJoystickAxis() {
|
|
11
|
+
joystick_axis_itoa[0] = "X";
|
|
12
|
+
joystick_axis_atoi["X"] = 0;
|
|
13
|
+
joystick_axis_itoa[1] = "Y";
|
|
14
|
+
joystick_axis_atoi["Y"] = 1;
|
|
15
|
+
joystick_axis_itoa[2] = "Z";
|
|
16
|
+
joystick_axis_atoi["Z"] = 2;
|
|
17
|
+
joystick_axis_itoa[3] = "R";
|
|
18
|
+
joystick_axis_atoi["R"] = 3;
|
|
19
|
+
joystick_axis_itoa[4] = "U";
|
|
20
|
+
joystick_axis_atoi["U"] = 4;
|
|
21
|
+
joystick_axis_itoa[5] = "V";
|
|
22
|
+
joystick_axis_atoi["V"] = 5;
|
|
23
|
+
joystick_axis_itoa[6] = "PovX";
|
|
24
|
+
joystick_axis_atoi["PovX"] = 6;
|
|
25
|
+
joystick_axis_itoa[7] = "PovY";
|
|
26
|
+
joystick_axis_atoi["PovY"] = 7;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
} // namespace gen
|
|
30
|
+
} // namespace node_sfml
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#include <map>
|
|
2
|
+
#include <string>
|
|
3
|
+
|
|
4
|
+
namespace node_sfml {
|
|
5
|
+
namespace gen {
|
|
6
|
+
|
|
7
|
+
std::map<int, std::string> sensor_type_itoa;
|
|
8
|
+
std::map<std::string, int> sensor_type_atoi;
|
|
9
|
+
|
|
10
|
+
void InitSensorType() {
|
|
11
|
+
sensor_type_itoa[0] = "Accelerometer";
|
|
12
|
+
sensor_type_atoi["Accelerometer"] = 0;
|
|
13
|
+
sensor_type_itoa[1] = "Gyroscope";
|
|
14
|
+
sensor_type_atoi["Gyroscope"] = 1;
|
|
15
|
+
sensor_type_itoa[2] = "Magnetometer";
|
|
16
|
+
sensor_type_atoi["Magnetometer"] = 2;
|
|
17
|
+
sensor_type_itoa[3] = "Gravity";
|
|
18
|
+
sensor_type_atoi["Gravity"] = 3;
|
|
19
|
+
sensor_type_itoa[4] = "UserAcceleration";
|
|
20
|
+
sensor_type_atoi["UserAcceleration"] = 4;
|
|
21
|
+
sensor_type_itoa[5] = "Orientation";
|
|
22
|
+
sensor_type_atoi["Orientation"] = 5;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
} // namespace gen
|
|
26
|
+
} // namespace node_sfml
|
package/src/joystick.cc
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#include "joystick.h"
|
|
2
|
+
|
|
3
|
+
namespace node_sfml {
|
|
4
|
+
namespace gen {
|
|
5
|
+
extern void InitJoystickAxis();
|
|
6
|
+
} // namespace gen
|
|
7
|
+
|
|
8
|
+
namespace joystick {
|
|
9
|
+
|
|
10
|
+
using std::map;
|
|
11
|
+
using std::string;
|
|
12
|
+
using v8::Local;
|
|
13
|
+
using v8::MaybeLocal;
|
|
14
|
+
using v8::Object;
|
|
15
|
+
using v8::String;
|
|
16
|
+
using v8::Value;
|
|
17
|
+
|
|
18
|
+
NAN_MODULE_INIT(Init) {
|
|
19
|
+
gen::InitJoystickAxis();
|
|
20
|
+
|
|
21
|
+
Nan::SetMethod(target, "joystickIsConnected", IsConnected);
|
|
22
|
+
Nan::SetMethod(target, "joystickGetButtonCount", GetButtonCount);
|
|
23
|
+
Nan::SetMethod(target, "joystickHasAxis", HasAxis);
|
|
24
|
+
Nan::SetMethod(target, "joystickIsButtonPressed", IsButtonPressed);
|
|
25
|
+
Nan::SetMethod(target, "joystickGetAxisPosition", GetAxisPosition);
|
|
26
|
+
Nan::SetMethod(target, "joystickGetIdentification", GetIdentification);
|
|
27
|
+
Nan::SetMethod(target, "joystickUpdate", Update);
|
|
28
|
+
|
|
29
|
+
Local<Object> axis = Nan::New<Object>();
|
|
30
|
+
for (auto it = gen::joystick_axis_atoi.begin();
|
|
31
|
+
it != gen::joystick_axis_atoi.end();
|
|
32
|
+
it++) {
|
|
33
|
+
Nan::Set(axis,
|
|
34
|
+
Nan::New<String>(it->first).ToLocalChecked(),
|
|
35
|
+
Nan::New(it->second));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
Nan::Set(target, Nan::New<String>("joystickAxis").ToLocalChecked(), axis);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
NAN_METHOD(IsConnected) {
|
|
42
|
+
if (info.Length() != 1) {
|
|
43
|
+
Nan::ThrowError("Invalid arguments count.");
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
sf::Uint32 joystick_id =
|
|
48
|
+
Nan::To<sf::Uint32>(info[0].As<v8::Uint32>()).FromJust();
|
|
49
|
+
info.GetReturnValue().Set(sf::Joystick::isConnected(joystick_id));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
NAN_METHOD(GetButtonCount) {
|
|
53
|
+
if (info.Length() != 1) {
|
|
54
|
+
Nan::ThrowError("Invalid arguments count.");
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
sf::Uint32 joystick_id =
|
|
59
|
+
Nan::To<sf::Uint32>(info[0].As<v8::Uint32>()).FromJust();
|
|
60
|
+
info.GetReturnValue().Set(sf::Joystick::getButtonCount(joystick_id));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
NAN_METHOD(HasAxis) {
|
|
64
|
+
if (info.Length() != 2) {
|
|
65
|
+
Nan::ThrowError("Invalid arguments count.");
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
sf::Uint32 joystick_id =
|
|
70
|
+
Nan::To<sf::Uint32>(info[0].As<v8::Uint32>()).FromJust();
|
|
71
|
+
sf::Joystick::Axis axis = static_cast<sf::Joystick::Axis>(
|
|
72
|
+
Nan::To<sf::Int32>(info[1].As<v8::Int32>()).FromJust());
|
|
73
|
+
info.GetReturnValue().Set(sf::Joystick::hasAxis(joystick_id, axis));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
NAN_METHOD(IsButtonPressed) {
|
|
77
|
+
if (info.Length() != 2) {
|
|
78
|
+
Nan::ThrowError("Invalid arguments count.");
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
sf::Uint32 joystick_id =
|
|
83
|
+
Nan::To<sf::Uint32>(info[0].As<v8::Uint32>()).FromJust();
|
|
84
|
+
sf::Uint32 button = Nan::To<sf::Uint32>(info[0].As<v8::Uint32>()).FromJust();
|
|
85
|
+
info.GetReturnValue().Set(sf::Joystick::isButtonPressed(joystick_id, button));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
NAN_METHOD(GetAxisPosition) {
|
|
89
|
+
if (info.Length() != 2) {
|
|
90
|
+
Nan::ThrowError("Invalid arguments count.");
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
sf::Uint32 joystick_id =
|
|
95
|
+
Nan::To<sf::Uint32>(info[0].As<v8::Uint32>()).FromJust();
|
|
96
|
+
sf::Joystick::Axis axis = static_cast<sf::Joystick::Axis>(
|
|
97
|
+
Nan::To<sf::Int32>(info[1].As<v8::Int32>()).FromJust());
|
|
98
|
+
info.GetReturnValue().Set(sf::Joystick::getAxisPosition(joystick_id, axis));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
NAN_METHOD(GetIdentification) {
|
|
102
|
+
if (info.Length() != 1) {
|
|
103
|
+
Nan::ThrowError("Invalid arguments count.");
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
sf::Uint32 joystick_id =
|
|
108
|
+
Nan::To<sf::Uint32>(info[0].As<v8::Uint32>()).FromJust();
|
|
109
|
+
sf::Joystick::Identification identification =
|
|
110
|
+
sf::Joystick::getIdentification(joystick_id);
|
|
111
|
+
|
|
112
|
+
std::basic_string<sf::Uint16> name = identification.name.toUtf16();
|
|
113
|
+
Local<String> v8_name =
|
|
114
|
+
Nan::New<String>(name.c_str(), name.size()).ToLocalChecked();
|
|
115
|
+
|
|
116
|
+
Local<Object> ret = Nan::New<Object>();
|
|
117
|
+
Nan::Set(ret, Nan::New<String>("name").ToLocalChecked(), v8_name);
|
|
118
|
+
Nan::Set(ret,
|
|
119
|
+
Nan::New<String>("vendorId").ToLocalChecked(),
|
|
120
|
+
Nan::New(identification.vendorId));
|
|
121
|
+
Nan::Set(ret,
|
|
122
|
+
Nan::New<String>("productId").ToLocalChecked(),
|
|
123
|
+
Nan::New(identification.productId));
|
|
124
|
+
info.GetReturnValue().Set(ret);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
NAN_METHOD(Update) {
|
|
128
|
+
sf::Joystick::update();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
} // namespace joystick
|
|
132
|
+
} // namespace node_sfml
|
package/src/joystick.h
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#ifndef SRC_JOYSTICK_H_
|
|
2
|
+
#define SRC_JOYSTICK_H_
|
|
3
|
+
|
|
4
|
+
#include <nan.h>
|
|
5
|
+
|
|
6
|
+
#include <map>
|
|
7
|
+
#include <string>
|
|
8
|
+
|
|
9
|
+
#include <SFML/Window/Joystick.hpp>
|
|
10
|
+
|
|
11
|
+
namespace node_sfml {
|
|
12
|
+
namespace gen {
|
|
13
|
+
extern std::map<int, std::string> joystick_axis_itoa;
|
|
14
|
+
extern std::map<std::string, int> joystick_axis_atoi;
|
|
15
|
+
} // namespace gen
|
|
16
|
+
|
|
17
|
+
namespace joystick {
|
|
18
|
+
|
|
19
|
+
NAN_MODULE_INIT(Init);
|
|
20
|
+
|
|
21
|
+
NAN_METHOD(IsConnected);
|
|
22
|
+
NAN_METHOD(GetButtonCount);
|
|
23
|
+
NAN_METHOD(HasAxis);
|
|
24
|
+
NAN_METHOD(IsButtonPressed);
|
|
25
|
+
NAN_METHOD(GetAxisPosition);
|
|
26
|
+
NAN_METHOD(GetIdentification);
|
|
27
|
+
NAN_METHOD(Update);
|
|
28
|
+
|
|
29
|
+
} // namespace joystick
|
|
30
|
+
} // namespace node_sfml
|
|
31
|
+
|
|
32
|
+
#endif // SRC_JOYSTICK_H_
|
package/src/poll_event.cc
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
#include <map>
|
|
2
2
|
|
|
3
|
+
#include "joystick.h"
|
|
3
4
|
#include "keyboard.h"
|
|
4
5
|
#include "mouse.h"
|
|
5
6
|
#include "poll_event.h"
|
|
7
|
+
#include "sensor.h"
|
|
6
8
|
|
|
7
9
|
namespace node_sfml {
|
|
8
10
|
namespace poll_event {
|
|
@@ -225,7 +227,78 @@ MaybeLocal<Object> EventToV8Object(Isolate* isolate, const sf::Event& event) {
|
|
|
225
227
|
break;
|
|
226
228
|
}
|
|
227
229
|
|
|
228
|
-
|
|
230
|
+
case sf::Event::JoystickButtonPressed:
|
|
231
|
+
case sf::Event::JoystickButtonReleased: {
|
|
232
|
+
Local<Object> joystick_button = Nan::New<Object>();
|
|
233
|
+
Nan::Set(joystick_button,
|
|
234
|
+
GetCachedColumn(isolate, "joystickId"),
|
|
235
|
+
Nan::New(event.joystickButton.joystickId));
|
|
236
|
+
Nan::Set(joystick_button,
|
|
237
|
+
GetCachedColumn(isolate, "button"),
|
|
238
|
+
Nan::New(event.joystickButton.button));
|
|
239
|
+
Nan::Set(
|
|
240
|
+
ret, GetCachedColumn(isolate, "joystickButton"), joystick_button);
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
case sf::Event::JoystickConnected:
|
|
245
|
+
case sf::Event::JoystickDisconnected: {
|
|
246
|
+
Local<Object> joystick_connect = Nan::New<Object>();
|
|
247
|
+
Nan::Set(joystick_connect,
|
|
248
|
+
GetCachedColumn(isolate, "joystickId"),
|
|
249
|
+
Nan::New(event.joystickConnect.joystickId));
|
|
250
|
+
Nan::Set(
|
|
251
|
+
ret, GetCachedColumn(isolate, "joystickConnect"), joystick_connect);
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
case sf::Event::JoystickMoved: {
|
|
256
|
+
Local<Object> joystick_move = Nan::New<Object>();
|
|
257
|
+
Nan::Set(joystick_move,
|
|
258
|
+
GetCachedColumn(isolate, "joystickId"),
|
|
259
|
+
Nan::New(event.joystickMove.joystickId));
|
|
260
|
+
Nan::Set(joystick_move,
|
|
261
|
+
GetCachedColumn(isolate, "axis"),
|
|
262
|
+
Nan::New(event.joystickMove.axis));
|
|
263
|
+
Nan::Set(joystick_move,
|
|
264
|
+
GetCachedColumn(isolate, "axisStr"),
|
|
265
|
+
Nan::New(gen::joystick_axis_itoa[event.joystickMove.axis])
|
|
266
|
+
.ToLocalChecked());
|
|
267
|
+
Nan::Set(joystick_move,
|
|
268
|
+
GetCachedColumn(isolate, "position"),
|
|
269
|
+
Nan::New(event.joystickMove.position));
|
|
270
|
+
Nan::Set(ret, GetCachedColumn(isolate, "joystickMove"), joystick_move);
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
case sf::Event::TouchBegan:
|
|
275
|
+
case sf::Event::TouchMoved:
|
|
276
|
+
case sf::Event::TouchEnded: {
|
|
277
|
+
Local<Object> touch = Nan::New<Object>();
|
|
278
|
+
Nan::Set(touch,
|
|
279
|
+
GetCachedColumn(isolate, "finger"),
|
|
280
|
+
Nan::New(event.touch.finger));
|
|
281
|
+
Nan::Set(touch, GetCachedColumn(isolate, "x"), Nan::New(event.touch.x));
|
|
282
|
+
Nan::Set(touch, GetCachedColumn(isolate, "y"), Nan::New(event.touch.y));
|
|
283
|
+
Nan::Set(ret, GetCachedColumn(isolate, "touch"), touch);
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
case sf::Event::SensorChanged: {
|
|
288
|
+
Local<Object> sensor = Nan::New<Object>();
|
|
289
|
+
Nan::Set(sensor,
|
|
290
|
+
GetCachedColumn(isolate, "type"),
|
|
291
|
+
Nan::New(event.sensor.type));
|
|
292
|
+
Nan::Set(
|
|
293
|
+
sensor,
|
|
294
|
+
GetCachedColumn(isolate, "typeStr"),
|
|
295
|
+
Nan::New(gen::sensor_type_itoa[event.sensor.type]).ToLocalChecked());
|
|
296
|
+
Nan::Set(sensor, GetCachedColumn(isolate, "x"), Nan::New(event.sensor.x));
|
|
297
|
+
Nan::Set(sensor, GetCachedColumn(isolate, "y"), Nan::New(event.sensor.x));
|
|
298
|
+
Nan::Set(sensor, GetCachedColumn(isolate, "z"), Nan::New(event.sensor.x));
|
|
299
|
+
Nan::Set(ret, GetCachedColumn(isolate, "sensor"), sensor);
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
229
302
|
|
|
230
303
|
default:
|
|
231
304
|
break;
|
package/src/resizable_buffer.h
CHANGED
package/src/sensor.cc
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#include "sensor.h"
|
|
2
|
+
#include "vector3-inl.h"
|
|
3
|
+
|
|
4
|
+
namespace node_sfml {
|
|
5
|
+
namespace gen {
|
|
6
|
+
extern void InitSensorType();
|
|
7
|
+
} // namespace gen
|
|
8
|
+
|
|
9
|
+
namespace sensor {
|
|
10
|
+
|
|
11
|
+
using std::map;
|
|
12
|
+
using std::string;
|
|
13
|
+
using v8::Local;
|
|
14
|
+
using v8::MaybeLocal;
|
|
15
|
+
using v8::Object;
|
|
16
|
+
using v8::String;
|
|
17
|
+
using v8::Value;
|
|
18
|
+
|
|
19
|
+
NAN_MODULE_INIT(Init) {
|
|
20
|
+
gen::InitSensorType();
|
|
21
|
+
|
|
22
|
+
Nan::SetMethod(target, "sensorIsAvailable", IsAvailable);
|
|
23
|
+
Nan::SetMethod(target, "sensorSetEnabled", SetEnabled);
|
|
24
|
+
Nan::SetMethod(target, "sensorGetValue", GetValue);
|
|
25
|
+
|
|
26
|
+
Local<Object> type = Nan::New<Object>();
|
|
27
|
+
for (auto it = gen::sensor_type_atoi.begin();
|
|
28
|
+
it != gen::sensor_type_atoi.end();
|
|
29
|
+
it++) {
|
|
30
|
+
Nan::Set(type,
|
|
31
|
+
Nan::New<String>(it->first).ToLocalChecked(),
|
|
32
|
+
Nan::New(it->second));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
Nan::Set(target, Nan::New<String>("sensorType").ToLocalChecked(), type);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
NAN_METHOD(IsAvailable) {
|
|
39
|
+
if (info.Length() != 1) {
|
|
40
|
+
Nan::ThrowError("Invalid arguments count.");
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
sf::Sensor::Type sensor_type = static_cast<sf::Sensor::Type>(
|
|
45
|
+
Nan::To<sf::Uint32>(info[0].As<v8::Uint32>()).FromJust());
|
|
46
|
+
info.GetReturnValue().Set(sf::Sensor::isAvailable(sensor_type));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
NAN_METHOD(SetEnabled) {
|
|
50
|
+
if (info.Length() != 2) {
|
|
51
|
+
Nan::ThrowError("Invalid arguments count.");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
sf::Sensor::Type sensor_type = static_cast<sf::Sensor::Type>(
|
|
56
|
+
Nan::To<sf::Uint32>(info[0].As<v8::Uint32>()).FromJust());
|
|
57
|
+
bool enabled = Nan::To<bool>(info[1].As<v8::Boolean>()).FromJust();
|
|
58
|
+
sf::Sensor::setEnabled(sensor_type, enabled);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
NAN_METHOD(GetValue) {
|
|
62
|
+
if (info.Length() != 1) {
|
|
63
|
+
Nan::ThrowError("Invalid arguments count.");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
sf::Sensor::Type sensor_type = static_cast<sf::Sensor::Type>(
|
|
68
|
+
Nan::To<sf::Uint32>(info[0].As<v8::Uint32>()).FromJust());
|
|
69
|
+
sf::Vector3f value = sf::Sensor::getValue(sensor_type);
|
|
70
|
+
|
|
71
|
+
MaybeLocal<Value> maybe_temp;
|
|
72
|
+
Nan::TryCatch try_catch;
|
|
73
|
+
maybe_temp = vector3::Vector3F::NewRealInstance(info.GetIsolate(), value);
|
|
74
|
+
if (maybe_temp.IsEmpty()) {
|
|
75
|
+
try_catch.ReThrow();
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
info.GetReturnValue().Set(maybe_temp.ToLocalChecked());
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
} // namespace sensor
|
|
82
|
+
} // namespace node_sfml
|
package/src/sensor.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#ifndef SRC_SENSOR_H_
|
|
2
|
+
#define SRC_SENSOR_H_
|
|
3
|
+
|
|
4
|
+
#include <nan.h>
|
|
5
|
+
|
|
6
|
+
#include <map>
|
|
7
|
+
#include <string>
|
|
8
|
+
|
|
9
|
+
#include <SFML/Window/Sensor.hpp>
|
|
10
|
+
|
|
11
|
+
namespace node_sfml {
|
|
12
|
+
namespace gen {
|
|
13
|
+
extern std::map<int, std::string> sensor_type_itoa;
|
|
14
|
+
extern std::map<std::string, int> sensor_type_atoi;
|
|
15
|
+
} // namespace gen
|
|
16
|
+
|
|
17
|
+
namespace sensor {
|
|
18
|
+
|
|
19
|
+
NAN_MODULE_INIT(Init);
|
|
20
|
+
|
|
21
|
+
NAN_METHOD(IsAvailable);
|
|
22
|
+
NAN_METHOD(SetEnabled);
|
|
23
|
+
NAN_METHOD(GetValue);
|
|
24
|
+
|
|
25
|
+
} // namespace sensor
|
|
26
|
+
} // namespace node_sfml
|
|
27
|
+
|
|
28
|
+
#endif // SRC_SENSOR_H_
|
package/src/sfml.cc
CHANGED
|
@@ -4,13 +4,17 @@
|
|
|
4
4
|
#include "color.h"
|
|
5
5
|
#include "font.h"
|
|
6
6
|
#include "image.h"
|
|
7
|
+
#include "joystick.h"
|
|
7
8
|
#include "keyboard.h"
|
|
8
9
|
#include "mouse.h"
|
|
9
10
|
#include "rect.h"
|
|
10
11
|
#include "render_window.h"
|
|
12
|
+
#include "sensor.h"
|
|
11
13
|
#include "texture.h"
|
|
12
14
|
#include "time.h"
|
|
15
|
+
#include "touch.h"
|
|
13
16
|
#include "vector2.h"
|
|
17
|
+
#include "vector3.h"
|
|
14
18
|
#include "vertex.h"
|
|
15
19
|
#include "video_mode.h"
|
|
16
20
|
|
|
@@ -31,6 +35,9 @@ namespace node_sfml {
|
|
|
31
35
|
void Init(v8::Local<v8::Object> target) {
|
|
32
36
|
keyboard::Init(target);
|
|
33
37
|
mouse::Init(target);
|
|
38
|
+
joystick::Init(target);
|
|
39
|
+
sensor::Init(target);
|
|
40
|
+
touch::Init(target);
|
|
34
41
|
|
|
35
42
|
clock::Clock::Init(target);
|
|
36
43
|
color::Color::Init(target);
|
|
@@ -64,6 +71,11 @@ void Init(v8::Local<v8::Object> target) {
|
|
|
64
71
|
vector2::Vector2U::Init(target);
|
|
65
72
|
vector2::Vector2F::Init(target);
|
|
66
73
|
|
|
74
|
+
// vector3
|
|
75
|
+
vector3::Vector3I::Init(target);
|
|
76
|
+
vector3::Vector3U::Init(target);
|
|
77
|
+
vector3::Vector3F::Init(target);
|
|
78
|
+
|
|
67
79
|
node::AddEnvironmentCleanupHook(
|
|
68
80
|
target->GetIsolate(), sound::SoundSource::AtExit, nullptr);
|
|
69
81
|
}
|