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.
Files changed (213) hide show
  1. package/README.md +57 -7
  2. package/binding.gyp +71 -19
  3. package/lib/joystick.d.ts +21 -0
  4. package/lib/joystick.js +72 -0
  5. package/lib/keyboard.d.ts +1 -0
  6. package/lib/mouse.d.ts +1 -1
  7. package/lib/poll_event.d.ts +73 -9
  8. package/lib/rect.d.ts +1 -1
  9. package/lib/render_window.d.ts +36 -10
  10. package/lib/render_window.js +76 -0
  11. package/lib/sensor.d.ts +12 -0
  12. package/lib/sensor.js +34 -0
  13. package/lib/sfml.d.ts +4 -0
  14. package/lib/sfml.js +4 -0
  15. package/lib/touch.d.ts +7 -0
  16. package/lib/touch.js +34 -0
  17. package/lib/vector3.d.ts +47 -0
  18. package/lib/vector3.js +154 -0
  19. package/package.json +12 -18
  20. package/src/gen/joystick_axis.cc +30 -0
  21. package/src/gen/sensor_type.cc +26 -0
  22. package/src/joystick.cc +132 -0
  23. package/src/joystick.h +32 -0
  24. package/src/poll_event.cc +74 -1
  25. package/src/render_window.cc +177 -0
  26. package/src/render_window.h +45 -0
  27. package/src/render_window_async_display.cc +49 -0
  28. package/src/render_window_async_draw.cc +56 -0
  29. package/src/sensor.cc +82 -0
  30. package/src/sensor.h +28 -0
  31. package/src/sfml.cc +12 -0
  32. package/src/touch.cc +54 -0
  33. package/src/touch.h +23 -0
  34. package/src/vector3-inl.h +200 -0
  35. package/src/vector3.cc +36 -0
  36. package/src/vector3.h +134 -0
  37. package/tools/copier/linux.js +21 -0
  38. package/tools/copier/macos.js +34 -0
  39. package/tools/copier/windows.js +33 -0
  40. package/tools/joystick_axis.js +62 -0
  41. package/tools/keycode.js +5 -3
  42. package/tools/lib_downloader.js +102 -0
  43. package/tools/lib_downloader_urls.js +58 -0
  44. package/tools/mouse_button.js +9 -5
  45. package/tools/sensor_type.js +62 -0
  46. package/third_party/sfml/platform/linux/lib/libsfml-audio.so.2.5.1 +0 -0
  47. package/third_party/sfml/platform/linux/lib/libsfml-graphics.so.2.5.1 +0 -0
  48. package/third_party/sfml/platform/linux/lib/libsfml-network.so.2.5.1 +0 -0
  49. package/third_party/sfml/platform/linux/lib/libsfml-system.so.2.5.1 +0 -0
  50. package/third_party/sfml/platform/linux/lib/libsfml-window.so.2.5.1 +0 -0
  51. package/third_party/sfml/platform/macOS/Frameworks/FLAC.framework/Versions/A/FLAC +0 -0
  52. package/third_party/sfml/platform/macOS/Frameworks/FLAC.framework/Versions/A/Resources/Info.plist +0 -22
  53. package/third_party/sfml/platform/macOS/Frameworks/OpenAL.framework/Versions/A/OpenAL +0 -0
  54. package/third_party/sfml/platform/macOS/Frameworks/OpenAL.framework/Versions/A/Resources/Info.plist +0 -22
  55. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/AlResource.hpp +0 -70
  56. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/Export.hpp +0 -48
  57. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/InputSoundFile.hpp +0 -263
  58. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/Listener.hpp +0 -234
  59. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/Music.hpp +0 -337
  60. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/OutputSoundFile.hpp +0 -133
  61. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/Sound.hpp +0 -264
  62. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundBuffer.hpp +0 -352
  63. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundBufferRecorder.hpp +0 -144
  64. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundFileFactory.hpp +0 -197
  65. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundFileFactory.inl +0 -100
  66. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundFileReader.hpp +0 -165
  67. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundFileWriter.hpp +0 -125
  68. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundRecorder.hpp +0 -408
  69. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundSource.hpp +0 -332
  70. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio/SoundStream.hpp +0 -405
  71. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Audio.hpp +0 -56
  72. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Config.hpp +0 -236
  73. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/GpuPreference.hpp +0 -74
  74. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/BlendMode.hpp +0 -215
  75. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/CircleShape.hpp +0 -154
  76. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Color.hpp +0 -275
  77. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/ConvexShape.hpp +0 -153
  78. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Drawable.hpp +0 -126
  79. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Export.hpp +0 -48
  80. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Font.hpp +0 -439
  81. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Glsl.hpp +0 -227
  82. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Glsl.inl +0 -155
  83. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Glyph.hpp +0 -79
  84. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Image.hpp +0 -324
  85. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/PrimitiveType.hpp +0 -58
  86. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Rect.hpp +0 -254
  87. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Rect.inl +0 -159
  88. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/RectangleShape.hpp +0 -132
  89. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/RenderStates.hpp +0 -174
  90. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/RenderTarget.hpp +0 -510
  91. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/RenderTexture.hpp +0 -314
  92. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/RenderWindow.hpp +0 -284
  93. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Shader.hpp +0 -875
  94. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Shape.hpp +0 -355
  95. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Sprite.hpp +0 -279
  96. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Text.hpp +0 -513
  97. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Texture.hpp +0 -733
  98. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Transform.hpp +0 -479
  99. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Transformable.hpp +0 -429
  100. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/Vertex.hpp +0 -148
  101. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/VertexArray.hpp +0 -223
  102. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/VertexBuffer.hpp +0 -408
  103. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics/View.hpp +0 -343
  104. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Graphics.hpp +0 -68
  105. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Main.hpp +0 -43
  106. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/Export.hpp +0 -48
  107. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/Ftp.hpp +0 -616
  108. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/Http.hpp +0 -482
  109. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/IpAddress.hpp +0 -328
  110. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/Packet.hpp +0 -532
  111. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/Socket.hpp +0 -219
  112. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/SocketHandle.hpp +0 -57
  113. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/SocketSelector.hpp +0 -263
  114. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/TcpListener.hpp +0 -166
  115. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/TcpSocket.hpp +0 -316
  116. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network/UdpSocket.hpp +0 -291
  117. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Network.hpp +0 -53
  118. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/OpenGL.hpp +0 -78
  119. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Clock.hpp +0 -117
  120. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Err.hpp +0 -80
  121. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Export.hpp +0 -48
  122. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/FileInputStream.hpp +0 -169
  123. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/InputStream.hpp +0 -152
  124. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Lock.hpp +0 -139
  125. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/MemoryInputStream.hpp +0 -148
  126. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Mutex.hpp +0 -148
  127. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/NativeActivity.hpp +0 -62
  128. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/NonCopyable.hpp +0 -129
  129. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Sleep.hpp +0 -52
  130. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/String.hpp +0 -669
  131. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/String.inl +0 -53
  132. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Thread.hpp +0 -282
  133. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Thread.inl +0 -90
  134. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/ThreadLocal.hpp +0 -103
  135. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/ThreadLocalPtr.hpp +0 -158
  136. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/ThreadLocalPtr.inl +0 -77
  137. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Time.hpp +0 -488
  138. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Utf.hpp +0 -763
  139. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Utf.inl +0 -752
  140. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Vector2.hpp +0 -301
  141. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Vector2.inl +0 -161
  142. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Vector3.hpp +0 -302
  143. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System/Vector3.inl +0 -168
  144. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/System.hpp +0 -60
  145. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Clipboard.hpp +0 -119
  146. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Context.hpp +0 -195
  147. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/ContextSettings.hpp +0 -149
  148. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Cursor.hpp +0 -222
  149. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Event.hpp +0 -284
  150. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Export.hpp +0 -48
  151. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/GlResource.hpp +0 -109
  152. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Joystick.hpp +0 -227
  153. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Keyboard.hpp +0 -232
  154. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Mouse.hpp +0 -177
  155. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Sensor.hpp +0 -150
  156. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Touch.hpp +0 -137
  157. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/VideoMode.hpp +0 -228
  158. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/Window.hpp +0 -622
  159. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/WindowHandle.hpp +0 -101
  160. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window/WindowStyle.hpp +0 -53
  161. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Headers/Window.hpp +0 -58
  162. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Resources/CMake/SFMLConfig.cmake +0 -148
  163. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Resources/CMake/SFMLConfigDependencies.cmake +0 -86
  164. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Resources/CMake/SFMLConfigVersion.cmake +0 -46
  165. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Resources/CMake/SFMLSharedTargets-release.cmake +0 -59
  166. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Resources/CMake/SFMLSharedTargets.cmake +0 -158
  167. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/Resources/Info.plist +0 -26
  168. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/2.5.1/SFML +0 -0
  169. package/third_party/sfml/platform/macOS/Frameworks/freetype.framework/Versions/A/Resources/Info.plist +0 -22
  170. package/third_party/sfml/platform/macOS/Frameworks/freetype.framework/Versions/A/freetype +0 -0
  171. package/third_party/sfml/platform/macOS/Frameworks/ogg.framework/Versions/A/Resources/Info.plist +0 -22
  172. package/third_party/sfml/platform/macOS/Frameworks/ogg.framework/Versions/A/ogg +0 -0
  173. package/third_party/sfml/platform/macOS/Frameworks/sfml-audio.framework/Versions/2.5.1/Resources/Info.plist +0 -26
  174. package/third_party/sfml/platform/macOS/Frameworks/sfml-audio.framework/Versions/2.5.1/sfml-audio +0 -0
  175. package/third_party/sfml/platform/macOS/Frameworks/sfml-graphics.framework/Versions/2.5.1/Resources/Info.plist +0 -26
  176. package/third_party/sfml/platform/macOS/Frameworks/sfml-graphics.framework/Versions/2.5.1/sfml-graphics +0 -0
  177. package/third_party/sfml/platform/macOS/Frameworks/sfml-network.framework/Versions/2.5.1/Resources/Info.plist +0 -26
  178. package/third_party/sfml/platform/macOS/Frameworks/sfml-network.framework/Versions/2.5.1/sfml-network +0 -0
  179. package/third_party/sfml/platform/macOS/Frameworks/sfml-system.framework/Versions/2.5.1/Resources/Info.plist +0 -26
  180. package/third_party/sfml/platform/macOS/Frameworks/sfml-system.framework/Versions/2.5.1/sfml-system +0 -0
  181. package/third_party/sfml/platform/macOS/Frameworks/sfml-window.framework/Versions/2.5.1/Resources/Info.plist +0 -26
  182. package/third_party/sfml/platform/macOS/Frameworks/sfml-window.framework/Versions/2.5.1/sfml-window +0 -0
  183. package/third_party/sfml/platform/macOS/Frameworks/vorbis.framework/Versions/A/Resources/Info.plist +0 -22
  184. package/third_party/sfml/platform/macOS/Frameworks/vorbis.framework/Versions/A/vorbis +0 -0
  185. package/third_party/sfml/platform/macOS/Frameworks/vorbisenc.framework/Versions/A/Resources/Info.plist +0 -22
  186. package/third_party/sfml/platform/macOS/Frameworks/vorbisenc.framework/Versions/A/vorbisenc +0 -0
  187. package/third_party/sfml/platform/macOS/Frameworks/vorbisfile.framework/Versions/A/Resources/Info.plist +0 -22
  188. package/third_party/sfml/platform/macOS/Frameworks/vorbisfile.framework/Versions/A/vorbisfile +0 -0
  189. package/third_party/sfml/platform/macOS/lib/libsfml-audio.2.5.1.dylib +0 -0
  190. package/third_party/sfml/platform/macOS/lib/libsfml-graphics.2.5.1.dylib +0 -0
  191. package/third_party/sfml/platform/macOS/lib/libsfml-network.2.5.1.dylib +0 -0
  192. package/third_party/sfml/platform/macOS/lib/libsfml-system.2.5.1.dylib +0 -0
  193. package/third_party/sfml/platform/macOS/lib/libsfml-window.2.5.1.dylib +0 -0
  194. package/third_party/sfml/platform/win64/bin/openal32.dll +0 -0
  195. package/third_party/sfml/platform/win64/bin/sfml-audio-2.dll +0 -0
  196. package/third_party/sfml/platform/win64/bin/sfml-graphics-2.dll +0 -0
  197. package/third_party/sfml/platform/win64/bin/sfml-network-2.dll +0 -0
  198. package/third_party/sfml/platform/win64/bin/sfml-system-2.dll +0 -0
  199. package/third_party/sfml/platform/win64/bin/sfml-window-2.dll +0 -0
  200. package/third_party/sfml/platform/win64/lib/flac.lib +0 -0
  201. package/third_party/sfml/platform/win64/lib/freetype.lib +0 -0
  202. package/third_party/sfml/platform/win64/lib/ogg.lib +0 -0
  203. package/third_party/sfml/platform/win64/lib/openal32.lib +0 -0
  204. package/third_party/sfml/platform/win64/lib/sfml-audio.lib +0 -0
  205. package/third_party/sfml/platform/win64/lib/sfml-graphics.lib +0 -0
  206. package/third_party/sfml/platform/win64/lib/sfml-main.lib +0 -0
  207. package/third_party/sfml/platform/win64/lib/sfml-network.lib +0 -0
  208. package/third_party/sfml/platform/win64/lib/sfml-system.lib +0 -0
  209. package/third_party/sfml/platform/win64/lib/sfml-window.lib +0 -0
  210. package/third_party/sfml/platform/win64/lib/vorbis.lib +0 -0
  211. package/third_party/sfml/platform/win64/lib/vorbisenc.lib +0 -0
  212. package/third_party/sfml/platform/win64/lib/vorbisfile.lib +0 -0
  213. package/tools/symlinks.js +0 -122
package/lib/sfml.js CHANGED
@@ -7,6 +7,9 @@ module.exports = {
7
7
  ...require('./image'),
8
8
  Keyboard: require('./keyboard'),
9
9
  Mouse: require('./mouse'),
10
+ Joystick: require('./joystick'),
11
+ Sensor: require('./sensor'),
12
+ Touch: require('./touch'),
10
13
  ...require('./render_window'),
11
14
  ...require('./texture'),
12
15
  ...require('./vertex'),
@@ -16,6 +19,7 @@ module.exports = {
16
19
 
17
20
  ...require('./rect'),
18
21
  ...require('./vector2'),
22
+ ...require('./vector3'),
19
23
 
20
24
  // drawable
21
25
  ...require('./drawable/circle_shape'),
package/lib/touch.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { Vector2I } from './vector2';
2
+ import { RenderWindow } from './render_window';
3
+
4
+ type UnsignedInteger = number;
5
+
6
+ export function isDown(finger: UnsignedInteger): boolean;
7
+ export function getPosition(finger: UnsignedInteger, window?: RenderWindow): Vector2I;
package/lib/touch.js ADDED
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ const {
4
+ touchGetPosition: _getPosition,
5
+ touchIsDown: _isDown,
6
+ } = require('../build/Release/binding.node');
7
+ const { RenderWindow } = require('./render_window');
8
+
9
+ const validateFinger = finger => {
10
+ if (!Number.isInteger(finger) || Math.sign(finger) < 0) {
11
+ throw new TypeError(
12
+ `Unexpected value ${finger} for finger, expected usigned integer.`
13
+ );
14
+ }
15
+ };
16
+
17
+ exports.isDown = finger => {
18
+ validateFinger(finger);
19
+ return _isDown(finger);
20
+ };
21
+
22
+ exports.getPosition = function getPosition(finger, window) {
23
+ validateFinger(finger);
24
+
25
+ if (arguments.length === 1) {
26
+ return _getPosition(finger);
27
+ }
28
+
29
+ if (!(window instanceof RenderWindow)) {
30
+ throw new TypeError('Parameter is not a RenderWindow instance.');
31
+ }
32
+
33
+ return _getPosition(finger, window[RenderWindow.RAW_RENDER_WINDOW]);
34
+ };
@@ -0,0 +1,47 @@
1
+ export class Vector3I {
2
+ constructor(x: number, y: number, z: number);
3
+ constructor(vec: Vector3I);
4
+
5
+ x: number;
6
+ y: number;
7
+
8
+ static add(a: Vector3I, b: Vector3I): Vector3I;
9
+ static subtract(a: Vector3I, b: Vector3I): Vector3I;
10
+ static multiply(a: Vector3I, b: number): Vector3I;
11
+ static div(a: Vector3I, b: number): Vector3I;
12
+
13
+ static equals(a: Vector3I, b: Vector3I): boolean;
14
+ static notEequals(a: Vector3I, b: Vector3I): boolean;
15
+ }
16
+
17
+ export class Vector3U {
18
+ constructor(x: number, y: number, z: number);
19
+ constructor(vec: Vector3U);
20
+
21
+ x: number;
22
+ y: number;
23
+
24
+ static add(a: Vector3U, b: Vector3U): Vector3U;
25
+ static subtract(a: Vector3U, b: Vector3U): Vector3U;
26
+ static multiply(a: Vector3U, b: number): Vector3U;
27
+ static div(a: Vector3U, b: number): Vector3U;
28
+
29
+ static equals(a: Vector3U, b: Vector3U): boolean;
30
+ static notEequals(a: Vector3U, b: Vector3U): boolean;
31
+ }
32
+
33
+ export class Vector3F {
34
+ constructor(x: number, y: number, z: number);
35
+ constructor(vec: Vector3F);
36
+
37
+ x: number;
38
+ y: number;
39
+
40
+ static add(a: Vector3F, b: Vector3F): Vector3F;
41
+ static subtract(a: Vector3F, b: Vector3F): Vector3F;
42
+ static multiply(a: Vector3F, b: number): Vector3F;
43
+ static div(a: Vector3F, b: number): Vector3F;
44
+
45
+ static equals(a: Vector3F, b: Vector3F): boolean;
46
+ static notEequals(a: Vector3F, b: Vector3F): boolean;
47
+ }
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,16 +1,16 @@
1
1
  {
2
2
  "name": "sfml.js",
3
- "version": "0.0.1-preview.41",
3
+ "version": "0.0.1-preview.44",
4
4
  "description": "SFML's Node.js binding.",
5
5
  "main": "lib/sfml.js",
6
6
  "scripts": {
7
7
  "build-dummy-debug": "node-gyp rebuild --debug && mv build/Debug build/Release",
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
- "preinstall": "node tools/symlinks.js",
11
- "cpplint": "./third_party/cpplint/cpplint.py src/**/*",
10
+ "postinstall": "rm -f package-lock.json",
11
+ "cpplint": "./third_party/cpplint/cpplint.py src/*.* src/**/*",
12
12
  "jslint": "./node_modules/.bin/eslint ./**/*.js",
13
- "install": "node-gyp rebuild"
13
+ "install": "node tools/lib_downloader.js && node-gyp rebuild"
14
14
  },
15
15
  "repository": {
16
16
  "type": "git",
@@ -24,17 +24,23 @@
24
24
  "homepage": "https://github.com/XadillaX/node-sfml#readme",
25
25
  "dependencies": {
26
26
  "clang-format": "^1.4.0",
27
+ "download": "^8.0.0",
27
28
  "nan": "^2.15.0",
28
- "node-gyp": "^8.2.0"
29
+ "node-gyp": "^8.2.0",
30
+ "spidex": "^2.2.1",
31
+ "tiny-spinner": "^1.1.0"
29
32
  },
30
33
  "devDependencies": {
31
34
  "@types/node": "^16.11.6",
32
35
  "@typescript-eslint/eslint-plugin": "^5.4.0",
36
+ "all-contributors-cli": "^6.20.0",
33
37
  "eslint": "^7.0.0",
34
38
  "eslint-config-egg": "^9.0.0",
35
39
  "eslint-plugin-import": "^2.25.2",
36
40
  "eslint-plugin-jsdoc": "^37.0.3",
37
41
  "eslint-plugin-node": "^11.1.0",
42
+ "typedoc": "^0.20.14",
43
+ "typedoc-deno-theme": "^1.3.3",
38
44
  "typescript": "~4.0.0"
39
45
  },
40
46
  "files": [
@@ -43,19 +49,7 @@
43
49
  "lib/**/*",
44
50
  "src/**/*",
45
51
  "third_party/sfml/include/**/*",
46
- "third_party/sfml/platform/linux/lib/libsfml-audio.so.2.5.1",
47
- "third_party/sfml/platform/linux/lib/libsfml-system.so.2.5.1",
48
- "third_party/sfml/platform/linux/lib/libsfml-window.so.2.5.1",
49
- "third_party/sfml/platform/linux/lib/libsfml-network.so.2.5.1",
50
- "third_party/sfml/platform/linux/lib/libsfml-graphics.so.2.5.1",
51
- "third_party/sfml/platform/macOS/lib/libsfml-audio.2.5.1.dylib",
52
- "third_party/sfml/platform/macOS/lib/libsfml-system.2.5.1.dylib",
53
- "third_party/sfml/platform/macOS/lib/libsfml-window.2.5.1.dylib",
54
- "third_party/sfml/platform/macOS/lib/libsfml-network.2.5.1.dylib",
55
- "third_party/sfml/platform/macOS/lib/libsfml-graphics.2.5.1.dylib",
56
- "third_party/sfml/platform/macOS/Frameworks/**/*",
57
- "third_party/sfml/platform/win64/lib/*.lib",
58
- "third_party/sfml/platform/win64/bin/*.dll",
52
+ "third_party/sfm/platform/.gitkeep",
59
53
  "tools/*",
60
54
  "tsconfig.json"
61
55
  ]
@@ -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
@@ -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
- // TODO(XadillaX): Joystick / Touch / Sensor events.
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;