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.
Files changed (299) hide show
  1. package/README.md +43 -6
  2. package/binding.gyp +53 -0
  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/sensor.d.ts +12 -0
  10. package/lib/sensor.js +34 -0
  11. package/lib/sfml.d.ts +4 -0
  12. package/lib/sfml.js +4 -0
  13. package/lib/touch.d.ts +7 -0
  14. package/lib/touch.js +34 -0
  15. package/lib/vector3.d.ts +47 -0
  16. package/lib/vector3.js +154 -0
  17. package/package.json +3 -2
  18. package/src/gen/joystick_axis.cc +30 -0
  19. package/src/gen/sensor_type.cc +26 -0
  20. package/src/joystick.cc +132 -0
  21. package/src/joystick.h +32 -0
  22. package/src/poll_event.cc +74 -1
  23. package/src/resizable_buffer.h +1 -0
  24. package/src/sensor.cc +82 -0
  25. package/src/sensor.h +28 -0
  26. package/src/sfml.cc +12 -0
  27. package/src/touch.cc +54 -0
  28. package/src/touch.h +23 -0
  29. package/src/utils-inl.h +2 -2
  30. package/src/vector3-inl.h +200 -0
  31. package/src/vector3.cc +36 -0
  32. package/src/vector3.h +134 -0
  33. package/tools/joystick_axis.js +62 -0
  34. package/tools/keycode.js +5 -3
  35. package/tools/mouse_button.js +9 -5
  36. package/tools/sensor_type.js +62 -0
  37. package/third_party/sfml/platform/macOS/Frameworks/FLAC.framework/Resources/Info.plist +0 -22
  38. package/third_party/sfml/platform/macOS/Frameworks/FLAC.framework/Versions/Current/FLAC +0 -0
  39. package/third_party/sfml/platform/macOS/Frameworks/FLAC.framework/Versions/Current/Resources/Info.plist +0 -22
  40. package/third_party/sfml/platform/macOS/Frameworks/OpenAL.framework/Resources/Info.plist +0 -22
  41. package/third_party/sfml/platform/macOS/Frameworks/OpenAL.framework/Versions/Current/OpenAL +0 -0
  42. package/third_party/sfml/platform/macOS/Frameworks/OpenAL.framework/Versions/Current/Resources/Info.plist +0 -22
  43. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/AlResource.hpp +0 -70
  44. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/Export.hpp +0 -48
  45. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/InputSoundFile.hpp +0 -263
  46. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/Listener.hpp +0 -234
  47. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/Music.hpp +0 -337
  48. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/OutputSoundFile.hpp +0 -133
  49. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/Sound.hpp +0 -264
  50. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundBuffer.hpp +0 -352
  51. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundBufferRecorder.hpp +0 -144
  52. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundFileFactory.hpp +0 -197
  53. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundFileFactory.inl +0 -100
  54. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundFileReader.hpp +0 -165
  55. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundFileWriter.hpp +0 -125
  56. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundRecorder.hpp +0 -408
  57. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundSource.hpp +0 -332
  58. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio/SoundStream.hpp +0 -405
  59. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Audio.hpp +0 -56
  60. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Config.hpp +0 -236
  61. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/GpuPreference.hpp +0 -74
  62. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/BlendMode.hpp +0 -215
  63. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/CircleShape.hpp +0 -154
  64. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Color.hpp +0 -275
  65. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/ConvexShape.hpp +0 -153
  66. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Drawable.hpp +0 -126
  67. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Export.hpp +0 -48
  68. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Font.hpp +0 -439
  69. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Glsl.hpp +0 -227
  70. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Glsl.inl +0 -155
  71. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Glyph.hpp +0 -79
  72. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Image.hpp +0 -324
  73. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/PrimitiveType.hpp +0 -58
  74. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Rect.hpp +0 -254
  75. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Rect.inl +0 -159
  76. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/RectangleShape.hpp +0 -132
  77. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/RenderStates.hpp +0 -174
  78. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/RenderTarget.hpp +0 -510
  79. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/RenderTexture.hpp +0 -314
  80. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/RenderWindow.hpp +0 -284
  81. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Shader.hpp +0 -875
  82. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Shape.hpp +0 -355
  83. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Sprite.hpp +0 -279
  84. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Text.hpp +0 -513
  85. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Texture.hpp +0 -733
  86. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Transform.hpp +0 -479
  87. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Transformable.hpp +0 -429
  88. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/Vertex.hpp +0 -148
  89. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/VertexArray.hpp +0 -223
  90. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/VertexBuffer.hpp +0 -408
  91. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics/View.hpp +0 -343
  92. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Graphics.hpp +0 -68
  93. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Main.hpp +0 -43
  94. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/Export.hpp +0 -48
  95. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/Ftp.hpp +0 -616
  96. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/Http.hpp +0 -482
  97. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/IpAddress.hpp +0 -328
  98. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/Packet.hpp +0 -532
  99. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/Socket.hpp +0 -219
  100. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/SocketHandle.hpp +0 -57
  101. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/SocketSelector.hpp +0 -263
  102. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/TcpListener.hpp +0 -166
  103. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/TcpSocket.hpp +0 -316
  104. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network/UdpSocket.hpp +0 -291
  105. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Network.hpp +0 -53
  106. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/OpenGL.hpp +0 -78
  107. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Clock.hpp +0 -117
  108. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Err.hpp +0 -80
  109. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Export.hpp +0 -48
  110. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/FileInputStream.hpp +0 -169
  111. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/InputStream.hpp +0 -152
  112. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Lock.hpp +0 -139
  113. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/MemoryInputStream.hpp +0 -148
  114. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Mutex.hpp +0 -148
  115. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/NativeActivity.hpp +0 -62
  116. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/NonCopyable.hpp +0 -129
  117. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Sleep.hpp +0 -52
  118. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/String.hpp +0 -669
  119. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/String.inl +0 -53
  120. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Thread.hpp +0 -282
  121. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Thread.inl +0 -90
  122. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/ThreadLocal.hpp +0 -103
  123. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/ThreadLocalPtr.hpp +0 -158
  124. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/ThreadLocalPtr.inl +0 -77
  125. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Time.hpp +0 -488
  126. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Utf.hpp +0 -763
  127. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Utf.inl +0 -752
  128. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Vector2.hpp +0 -301
  129. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Vector2.inl +0 -161
  130. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Vector3.hpp +0 -302
  131. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System/Vector3.inl +0 -168
  132. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/System.hpp +0 -60
  133. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Clipboard.hpp +0 -119
  134. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Context.hpp +0 -195
  135. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/ContextSettings.hpp +0 -149
  136. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Cursor.hpp +0 -222
  137. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Event.hpp +0 -284
  138. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Export.hpp +0 -48
  139. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/GlResource.hpp +0 -109
  140. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Joystick.hpp +0 -227
  141. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Keyboard.hpp +0 -232
  142. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Mouse.hpp +0 -177
  143. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Sensor.hpp +0 -150
  144. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Touch.hpp +0 -137
  145. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/VideoMode.hpp +0 -228
  146. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/Window.hpp +0 -622
  147. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/WindowHandle.hpp +0 -101
  148. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window/WindowStyle.hpp +0 -53
  149. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Headers/Window.hpp +0 -58
  150. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Resources/CMake/SFMLConfig.cmake +0 -148
  151. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Resources/CMake/SFMLConfigDependencies.cmake +0 -86
  152. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Resources/CMake/SFMLConfigVersion.cmake +0 -46
  153. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Resources/CMake/SFMLSharedTargets-release.cmake +0 -59
  154. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Resources/CMake/SFMLSharedTargets.cmake +0 -158
  155. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Resources/Info.plist +0 -26
  156. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/AlResource.hpp +0 -70
  157. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/Export.hpp +0 -48
  158. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/InputSoundFile.hpp +0 -263
  159. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/Listener.hpp +0 -234
  160. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/Music.hpp +0 -337
  161. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/OutputSoundFile.hpp +0 -133
  162. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/Sound.hpp +0 -264
  163. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundBuffer.hpp +0 -352
  164. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundBufferRecorder.hpp +0 -144
  165. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundFileFactory.hpp +0 -197
  166. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundFileFactory.inl +0 -100
  167. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundFileReader.hpp +0 -165
  168. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundFileWriter.hpp +0 -125
  169. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundRecorder.hpp +0 -408
  170. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundSource.hpp +0 -332
  171. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio/SoundStream.hpp +0 -405
  172. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Audio.hpp +0 -56
  173. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Config.hpp +0 -236
  174. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/GpuPreference.hpp +0 -74
  175. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/BlendMode.hpp +0 -215
  176. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/CircleShape.hpp +0 -154
  177. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Color.hpp +0 -275
  178. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/ConvexShape.hpp +0 -153
  179. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Drawable.hpp +0 -126
  180. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Export.hpp +0 -48
  181. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Font.hpp +0 -439
  182. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Glsl.hpp +0 -227
  183. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Glsl.inl +0 -155
  184. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Glyph.hpp +0 -79
  185. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Image.hpp +0 -324
  186. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/PrimitiveType.hpp +0 -58
  187. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Rect.hpp +0 -254
  188. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Rect.inl +0 -159
  189. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/RectangleShape.hpp +0 -132
  190. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/RenderStates.hpp +0 -174
  191. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/RenderTarget.hpp +0 -510
  192. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/RenderTexture.hpp +0 -314
  193. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/RenderWindow.hpp +0 -284
  194. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Shader.hpp +0 -875
  195. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Shape.hpp +0 -355
  196. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Sprite.hpp +0 -279
  197. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Text.hpp +0 -513
  198. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Texture.hpp +0 -733
  199. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Transform.hpp +0 -479
  200. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Transformable.hpp +0 -429
  201. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/Vertex.hpp +0 -148
  202. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/VertexArray.hpp +0 -223
  203. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/VertexBuffer.hpp +0 -408
  204. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics/View.hpp +0 -343
  205. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Graphics.hpp +0 -68
  206. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Main.hpp +0 -43
  207. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/Export.hpp +0 -48
  208. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/Ftp.hpp +0 -616
  209. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/Http.hpp +0 -482
  210. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/IpAddress.hpp +0 -328
  211. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/Packet.hpp +0 -532
  212. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/Socket.hpp +0 -219
  213. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/SocketHandle.hpp +0 -57
  214. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/SocketSelector.hpp +0 -263
  215. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/TcpListener.hpp +0 -166
  216. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/TcpSocket.hpp +0 -316
  217. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network/UdpSocket.hpp +0 -291
  218. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Network.hpp +0 -53
  219. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/OpenGL.hpp +0 -78
  220. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Clock.hpp +0 -117
  221. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Err.hpp +0 -80
  222. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Export.hpp +0 -48
  223. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/FileInputStream.hpp +0 -169
  224. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/InputStream.hpp +0 -152
  225. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Lock.hpp +0 -139
  226. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/MemoryInputStream.hpp +0 -148
  227. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Mutex.hpp +0 -148
  228. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/NativeActivity.hpp +0 -62
  229. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/NonCopyable.hpp +0 -129
  230. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Sleep.hpp +0 -52
  231. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/String.hpp +0 -669
  232. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/String.inl +0 -53
  233. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Thread.hpp +0 -282
  234. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Thread.inl +0 -90
  235. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/ThreadLocal.hpp +0 -103
  236. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/ThreadLocalPtr.hpp +0 -158
  237. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/ThreadLocalPtr.inl +0 -77
  238. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Time.hpp +0 -488
  239. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Utf.hpp +0 -763
  240. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Utf.inl +0 -752
  241. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Vector2.hpp +0 -301
  242. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Vector2.inl +0 -161
  243. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Vector3.hpp +0 -302
  244. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System/Vector3.inl +0 -168
  245. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/System.hpp +0 -60
  246. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Clipboard.hpp +0 -119
  247. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Context.hpp +0 -195
  248. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/ContextSettings.hpp +0 -149
  249. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Cursor.hpp +0 -222
  250. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Event.hpp +0 -284
  251. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Export.hpp +0 -48
  252. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/GlResource.hpp +0 -109
  253. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Joystick.hpp +0 -227
  254. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Keyboard.hpp +0 -232
  255. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Mouse.hpp +0 -177
  256. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Sensor.hpp +0 -150
  257. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Touch.hpp +0 -137
  258. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/VideoMode.hpp +0 -228
  259. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/Window.hpp +0 -622
  260. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/WindowHandle.hpp +0 -101
  261. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window/WindowStyle.hpp +0 -53
  262. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Headers/Window.hpp +0 -58
  263. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Resources/CMake/SFMLConfig.cmake +0 -148
  264. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Resources/CMake/SFMLConfigDependencies.cmake +0 -86
  265. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Resources/CMake/SFMLConfigVersion.cmake +0 -46
  266. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Resources/CMake/SFMLSharedTargets-release.cmake +0 -59
  267. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Resources/CMake/SFMLSharedTargets.cmake +0 -158
  268. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/Resources/Info.plist +0 -26
  269. package/third_party/sfml/platform/macOS/Frameworks/SFML.framework/Versions/Current/SFML +0 -0
  270. package/third_party/sfml/platform/macOS/Frameworks/freetype.framework/Resources/Info.plist +0 -22
  271. package/third_party/sfml/platform/macOS/Frameworks/freetype.framework/Versions/Current/Resources/Info.plist +0 -22
  272. package/third_party/sfml/platform/macOS/Frameworks/freetype.framework/Versions/Current/freetype +0 -0
  273. package/third_party/sfml/platform/macOS/Frameworks/ogg.framework/Resources/Info.plist +0 -22
  274. package/third_party/sfml/platform/macOS/Frameworks/ogg.framework/Versions/Current/Resources/Info.plist +0 -22
  275. package/third_party/sfml/platform/macOS/Frameworks/ogg.framework/Versions/Current/ogg +0 -0
  276. package/third_party/sfml/platform/macOS/Frameworks/sfml-audio.framework/Resources/Info.plist +0 -26
  277. package/third_party/sfml/platform/macOS/Frameworks/sfml-audio.framework/Versions/Current/Resources/Info.plist +0 -26
  278. package/third_party/sfml/platform/macOS/Frameworks/sfml-audio.framework/Versions/Current/sfml-audio +0 -0
  279. package/third_party/sfml/platform/macOS/Frameworks/sfml-graphics.framework/Resources/Info.plist +0 -26
  280. package/third_party/sfml/platform/macOS/Frameworks/sfml-graphics.framework/Versions/Current/Resources/Info.plist +0 -26
  281. package/third_party/sfml/platform/macOS/Frameworks/sfml-graphics.framework/Versions/Current/sfml-graphics +0 -0
  282. package/third_party/sfml/platform/macOS/Frameworks/sfml-network.framework/Resources/Info.plist +0 -26
  283. package/third_party/sfml/platform/macOS/Frameworks/sfml-network.framework/Versions/Current/Resources/Info.plist +0 -26
  284. package/third_party/sfml/platform/macOS/Frameworks/sfml-network.framework/Versions/Current/sfml-network +0 -0
  285. package/third_party/sfml/platform/macOS/Frameworks/sfml-system.framework/Resources/Info.plist +0 -26
  286. package/third_party/sfml/platform/macOS/Frameworks/sfml-system.framework/Versions/Current/Resources/Info.plist +0 -26
  287. package/third_party/sfml/platform/macOS/Frameworks/sfml-system.framework/Versions/Current/sfml-system +0 -0
  288. package/third_party/sfml/platform/macOS/Frameworks/sfml-window.framework/Resources/Info.plist +0 -26
  289. package/third_party/sfml/platform/macOS/Frameworks/sfml-window.framework/Versions/Current/Resources/Info.plist +0 -26
  290. package/third_party/sfml/platform/macOS/Frameworks/sfml-window.framework/Versions/Current/sfml-window +0 -0
  291. package/third_party/sfml/platform/macOS/Frameworks/vorbis.framework/Resources/Info.plist +0 -22
  292. package/third_party/sfml/platform/macOS/Frameworks/vorbis.framework/Versions/Current/Resources/Info.plist +0 -22
  293. package/third_party/sfml/platform/macOS/Frameworks/vorbis.framework/Versions/Current/vorbis +0 -0
  294. package/third_party/sfml/platform/macOS/Frameworks/vorbisenc.framework/Resources/Info.plist +0 -22
  295. package/third_party/sfml/platform/macOS/Frameworks/vorbisenc.framework/Versions/Current/Resources/Info.plist +0 -22
  296. package/third_party/sfml/platform/macOS/Frameworks/vorbisenc.framework/Versions/Current/vorbisenc +0 -0
  297. package/third_party/sfml/platform/macOS/Frameworks/vorbisfile.framework/Resources/Info.plist +0 -22
  298. package/third_party/sfml/platform/macOS/Frameworks/vorbisfile.framework/Versions/Current/Resources/Info.plist +0 -22
  299. package/third_party/sfml/platform/macOS/Frameworks/vorbisfile.framework/Versions/Current/vorbisfile +0 -0
package/README.md CHANGED
@@ -1,15 +1,52 @@
1
- # Node SFML
1
+ # sfml.js
2
+ <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
3
+ [![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg)](#contributors-)
4
+ <!-- ALL-CONTRIBUTORS-BADGE:END -->
5
+ [![sfml.js](http://img.shields.io/npm/v/sfml.js.svg)](https://www.npmjs.org/package/sfml.js)
6
+ [![sfml.js](http://img.shields.io/npm/dm/sfml.js.svg)](https://www.npmjs.org/package/sfml.js)
7
+ [![License](https://img.shields.io/npm/l/sfml.js.svg?style=flat)](https://www.npmjs.org/package/sfml.js)
8
+ [![Star at GitHub](https://img.shields.io/github/stars/XadillaX/node-sfml.svg?style=social&label=Star)](https://github.com/XadillaX/node-sfml)
2
9
 
3
10
  ![](https://www.sfml-dev.org/images/logo.png)
4
11
 
5
- SFML's Node.js binding.
6
-
7
- > Under developing.
12
+ A cross-platform SFML's Node.js binding.
8
13
 
9
14
  ## Installation
10
15
 
11
16
  ```bash
12
- $ node-gyp rebuild
17
+ $ npm install --save sfml.js
13
18
  ```
14
19
 
15
- > Current only support Linux and macOS.
20
+ ## Usage
21
+
22
+ Refer to Typing Definitions: [https://github.com/XadillaX/node-sfml/blob/main/index.d.ts](https://github.com/XadillaX/node-sfml/blob/main/index.d.ts).
23
+
24
+ And SFML's official documentation: [https://www.sfml-dev.org/documentation/2.5.1/](https://www.sfml-dev.org/documentation/2.5.1/).
25
+
26
+ ## Examples
27
+
28
+ + [node-sfml-demos](https://github.com/XadillaX/node-sfml-demos): Several small example games;
29
+ + [play-nes](https://github.com/XadillaX/play-nes): A cross-platform desktop NES emulator powered by OpenGL in Node.js.
30
+
31
+ > PR is welcomed. You can add your own sfml.js example.
32
+
33
+ ## Contributors ✨
34
+
35
+ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
36
+
37
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
38
+ <!-- prettier-ignore-start -->
39
+ <!-- markdownlint-disable -->
40
+ <table>
41
+ <tr>
42
+ <td align="center"><a href="https://xcoder.in/"><img src="https://avatars.githubusercontent.com/u/2842176?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Khaidi Chu</b></sub></a><br /><a href="#maintenance-XadillaX" title="Maintenance">🚧</a> <a href="https://github.com/XadillaX/node-sfml/commits?author=XadillaX" title="Code">💻</a></td>
43
+ <td align="center"><a href="https://pokemonworkshop.com/forum"><img src="https://avatars.githubusercontent.com/u/7335788?v=4?s=100" width="100px;" alt=""/><br /><sub><b>NuriYuri</b></sub></a><br /><a href="https://github.com/XadillaX/node-sfml/commits?author=NuriYuri" title="Code">💻</a></td>
44
+ </tr>
45
+ </table>
46
+
47
+ <!-- markdownlint-restore -->
48
+ <!-- prettier-ignore-end -->
49
+
50
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
51
+
52
+ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
package/binding.gyp CHANGED
@@ -41,6 +41,48 @@
41
41
  "./tools/keycode.js"
42
42
  ]
43
43
  }]
44
+ }, {
45
+ "target_name": "joystick_axis.cc",
46
+ "type": "none",
47
+ "sources": [
48
+ "./third_party/sfml/include/SFML/Window/Joystick.hpp",
49
+ "./tools/joystick_axis.js"
50
+ ],
51
+ "actions": [{
52
+ "action_name": "gen_joystick_axis",
53
+ "inputs": [
54
+ "./third_party/sfml/include/SFML/Window/Joystick.hpp",
55
+ "./tools/joystick_axis.js"
56
+ ],
57
+ "outputs": [
58
+ "./src/gen/joystick_axis.cc"
59
+ ],
60
+ "action": [
61
+ "node",
62
+ "./tools/joystick_axis.js"
63
+ ]
64
+ }]
65
+ }, {
66
+ "target_name": "sensor_type.cc",
67
+ "type": "none",
68
+ "sources": [
69
+ "./third_party/sfml/include/SFML/Window/Sensor.hpp",
70
+ "./tools/sensor_type.js"
71
+ ],
72
+ "actions": [{
73
+ "action_name": "gen_sensor_type",
74
+ "inputs": [
75
+ "./third_party/sfml/include/SFML/Window/Sensor.hpp",
76
+ "./tools/sensor_type.js"
77
+ ],
78
+ "outputs": [
79
+ "./src/gen/sensor_type.cc"
80
+ ],
81
+ "action": [
82
+ "node",
83
+ "./tools/sensor_type.js"
84
+ ]
85
+ }]
44
86
  }, {
45
87
  "target_name": "binding",
46
88
  "include_dirs": [
@@ -55,6 +97,9 @@
55
97
  "../third_party/sfml/platform/linux/lib/libsfml-window.so",
56
98
  "../third_party/sfml/platform/linux/lib/libsfml-network.so",
57
99
  "../third_party/sfml/platform/linux/lib/libsfml-graphics.so"
100
+ ],
101
+ "ldflags": [
102
+ "-Wl,-rpath='$$ORIGIN/../../third_party/sfml/platform/linux/lib'"
58
103
  ]
59
104
  }],
60
105
  ["OS==\"win\"", {
@@ -112,14 +157,18 @@
112
157
  "./src/color.cc",
113
158
  "./src/font.cc",
114
159
  "./src/image.cc",
160
+ "./src/joystick.cc",
115
161
  "./src/keyboard.cc",
116
162
  "./src/mouse.cc",
117
163
  "./src/poll_event.cc",
118
164
  "./src/rect.cc",
119
165
  "./src/render_window.cc",
166
+ "./src/sensor.cc",
167
+ "./src/touch.cc",
120
168
  "./src/texture.cc",
121
169
  "./src/time.cc",
122
170
  "./src/vector2.cc",
171
+ "./src/vector3.cc",
123
172
  "./src/vertex.cc",
124
173
  "./src/video_mode.cc",
125
174
 
@@ -132,8 +181,10 @@
132
181
  "./src/drawable/text.cc",
133
182
  "./src/drawable/vertex_array.cc",
134
183
 
184
+ "./src/gen/joystick_axis.cc",
135
185
  "./src/gen/keycode.cc",
136
186
  "./src/gen/mouse_button.cc",
187
+ "./src/gen/sensor_type.cc",
137
188
 
138
189
  "./src/sound/music.cc",
139
190
  "./src/sound/sound.cc",
@@ -142,6 +193,8 @@
142
193
  ],
143
194
  "dependencies": [
144
195
  "keycode.cc",
196
+ "joystick_axis.cc",
197
+ "sensor_type.cc",
145
198
  "mouse_button.cc"
146
199
  ]
147
200
  }]
@@ -0,0 +1,21 @@
1
+ export enum Axis {
2
+ X = 0, Y = 1, Z = 2, R = 3,
3
+ U = 4, V = 5, PovX = 6, PovY = 7
4
+ }
5
+
6
+ export type AxisStr = keyof typeof Axis;
7
+ type UnsignedInteger = number;
8
+
9
+ type Identification = {
10
+ name: string;
11
+ vendorId: number;
12
+ productId: number;
13
+ };
14
+
15
+ export function isConnected(joystickId: UnsignedInteger): boolean;
16
+ export function getButtonCount(joystickId: UnsignedInteger): number;
17
+ export function hasAxis(joystickId: UnsignedInteger, axis: Axis): boolean;
18
+ export function isButtonPressed(joystickId: UnsignedInteger, button: UnsignedInteger): boolean;
19
+ export function getAxisPosition(joystickId: UnsignedInteger, axis: Axis): number;
20
+ export function getIdentification(joystickId: UnsignedInteger): Identification;
21
+ export function update(): void;
@@ -0,0 +1,72 @@
1
+ 'use strict';
2
+
3
+ const {
4
+ joystickIsConnected: _isConnected,
5
+ joystickGetButtonCount: _getButtonCount,
6
+ joystickHasAxis: _hasAxis,
7
+ joystickIsJoystickButtonPressed: _isButtonPressed,
8
+ joystickGetAxisPosition: _getAxisPosition,
9
+ joystickGetIdentification: _getIdentification,
10
+ joystickUpdate: update,
11
+ joystickAxis: Axis,
12
+ } = require('../build/Release/binding.node');
13
+
14
+ const AxisValues = Object.values(Axis);
15
+
16
+ const validateJoystickId = joystickId => {
17
+ if (!Number.isInteger(joystickId) || Math.sign(joystickId) < 0) {
18
+ throw new TypeError(
19
+ `Unexpected value ${joystickId} for joystickId, expected usigned integer.`
20
+ );
21
+ }
22
+ };
23
+
24
+ const validateButton = button => {
25
+ if (!Number.isInteger(button) || Math.sign(button) < 0) {
26
+ throw new TypeError(
27
+ `Unexpected value ${button} for button, expected usigned integer.`
28
+ );
29
+ }
30
+ };
31
+
32
+ const validateAxis = axis => {
33
+ if (!AxisValues.includes(axis)) {
34
+ throw new TypeError('Invalid Axis value.');
35
+ }
36
+ };
37
+
38
+ module.exports.isConnected = joystickId => {
39
+ validateJoystickId(joystickId);
40
+ return _isConnected(joystickId);
41
+ };
42
+
43
+ module.exports.getButtonCount = joystickId => {
44
+ validateJoystickId(joystickId);
45
+ return _getButtonCount(joystickId);
46
+ };
47
+
48
+ module.exports.hasAxis = (joystickId, axis) => {
49
+ validateJoystickId(joystickId);
50
+ validateAxis(axis);
51
+ return _hasAxis(joystickId, axis);
52
+ };
53
+
54
+ module.exports.isButtonPressed = (joystickId, button) => {
55
+ validateJoystickId(joystickId);
56
+ validateButton(button);
57
+ return _isButtonPressed(joystickId, button);
58
+ };
59
+
60
+ module.exports.getAxisPosition = (joystickId, axis) => {
61
+ validateJoystickId(joystickId);
62
+ validateAxis(axis);
63
+ return _getAxisPosition(joystickId, axis);
64
+ };
65
+
66
+ module.exports.getIdentification = joystickId => {
67
+ validateJoystickId(joystickId);
68
+ return _getIdentification(joystickId);
69
+ };
70
+
71
+ module.exports.update = update;
72
+ module.exports.Axis = Axis;
package/lib/keyboard.d.ts CHANGED
@@ -104,3 +104,4 @@ export enum Keys {
104
104
  Y = 24,
105
105
  Z = 25,
106
106
  }
107
+ export type KeysStr = keyof typeof Keys;
package/lib/mouse.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PointType, Vector2I } from './vector2';
2
- import * as RenderWindow from './render_window';
2
+ import { RenderWindow } from './render_window';
3
3
 
4
4
  export function isButtonPressed(button: number | string): boolean;
5
5
  export function getPosition(window?: RenderWindow): Vector2I;
@@ -1,7 +1,14 @@
1
+ import { Sensor } from './sensor';
2
+ import { Joystick } from './joystick';
3
+ import { Keys, KeysStr } from './keyboard';
4
+
1
5
  interface OtherEvent {
2
- type: 'Closed' | 'LostFocus' | 'GainedFocus' | 'MouseLeft' | 'JoystickButtonPressed' | 'JoystickButtonReleased' |
3
- 'JoystickMoved' | 'JoystickConnected' | 'JoystickDisconnected' | 'TouchBegan' | 'TouchMoved' | 'TouchEnded' |
4
- 'SensorChanged';
6
+ type:
7
+ | 'Closed'
8
+ | 'LostFocus'
9
+ | 'GainedFocus'
10
+ | 'MouseLeft'
11
+ | 'MouseEntered';
5
12
  }
6
13
 
7
14
  interface SizeEvent {
@@ -15,8 +22,8 @@ interface SizeEvent {
15
22
  interface KeyEvent {
16
23
  type: 'KeyPressed' | 'KeyReleased';
17
24
  key: {
18
- code: number;
19
- codeStr: string;
25
+ code: Keys;
26
+ codeStr: KeysStr;
20
27
  alt: boolean;
21
28
  shift: boolean;
22
29
  control: boolean;
@@ -46,7 +53,7 @@ interface MouseButtonEvent {
46
53
  x: number;
47
54
  y: number;
48
55
  button: number;
49
- buttonStr: string;
56
+ buttonStr: 'Left' | 'Right' | 'Middle' | 'XButton1' | 'XButton2';
50
57
  };
51
58
  }
52
59
 
@@ -66,9 +73,66 @@ interface MouseWheelScrollEvent {
66
73
  y: number;
67
74
  delta: number;
68
75
  wheel: number;
69
- wheelStr: string;
76
+ wheelStr: 'VerticalWheel' | 'HorizontalWheel';
70
77
  };
71
78
  }
72
79
 
73
- export type Event = OtherEvent | SizeEvent | KeyEvent | TextEvent | MouseMoveEvent | MouseButtonEvent |
74
- MouseWheelEvent | MouseWheelScrollEvent;
80
+ interface JoystickButtonEvent {
81
+ type: 'JoystickButtonPressed' | 'JoystickButtonReleased';
82
+ joystickButton: {
83
+ joystickId: number;
84
+ button: number;
85
+ }
86
+ }
87
+
88
+ interface JoystickConnectEvent {
89
+ type: 'JoystickConnected' | 'JoystickDisconnected';
90
+ joystickConnect: {
91
+ joystickId: number;
92
+ }
93
+ }
94
+
95
+ interface JoystickMoveEvent {
96
+ type: 'JoystickMoved',
97
+ joystickMove: {
98
+ joystickId: number;
99
+ axis: Joystick.Axis;
100
+ axisStr: Joystick.AxisStr;
101
+ position: number;
102
+ }
103
+ }
104
+
105
+ interface TouchEvent {
106
+ type: 'TouchBegan' | 'TouchMoved' | 'TouchEnded';
107
+ touch: {
108
+ finger: number;
109
+ x: number;
110
+ y: number;
111
+ }
112
+ }
113
+
114
+ interface SensorEvent {
115
+ type: 'SensorChanged',
116
+ sensor: {
117
+ type: Sensor.Type;
118
+ typeStr: Sensor.TypeStr;
119
+ x: number;
120
+ y: number;
121
+ z: number;
122
+ }
123
+ }
124
+
125
+ export type Event =
126
+ | OtherEvent
127
+ | SizeEvent
128
+ | KeyEvent
129
+ | TextEvent
130
+ | MouseMoveEvent
131
+ | MouseButtonEvent
132
+ | MouseWheelEvent
133
+ | MouseWheelScrollEvent
134
+ | JoystickButtonEvent
135
+ | JoystickConnectEvent
136
+ | JoystickMoveEvent
137
+ | TouchEvent
138
+ | SensorEvent;
package/lib/rect.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { PointType, Vector2F, Vector2I } from './vector2';
2
2
 
3
- class Rect<Vector_T> {
3
+ declare class Rect<Vector_T> {
4
4
  constructor(left: number, top: number, width: number, height: number);
5
5
  constructor(position: PointType<Vector2I>, size: PointType<Vector2I>);
6
6
 
@@ -0,0 +1,12 @@
1
+ import { Vector3F } from './vector3';
2
+
3
+ export enum Type {
4
+ Accelerometer = 0, Gyroscope = 1, Magnetometer = 2, Gravity = 3,
5
+ UserAcceleration = 4, Orientation = 5
6
+ }
7
+
8
+ export type TypeStr = keyof typeof Type;
9
+
10
+ export function isAvailable(sensor: Type): boolean;
11
+ export function setEnabled(sensor: Type, enabled: boolean): void;
12
+ export function getValue(sensor: Type): Vector3F;
package/lib/sensor.js ADDED
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ const {
4
+ sensorIsAvailable: _isAvailable,
5
+ sensorSetEnabled: _setEnabled,
6
+ sensorGetValue: _getValue,
7
+ sensorType: Type,
8
+ } = require('../build/Release/binding.node');
9
+
10
+ const SensorTypeValues = Object.values(Type);
11
+
12
+ const validateSensorType = sensor => {
13
+ if (!SensorTypeValues.includes(sensor)) {
14
+ throw new TypeError('Invalid Sensor::Type value.');
15
+ }
16
+ };
17
+
18
+ module.exports.isAvailable = sensor => {
19
+ validateSensorType(sensor);
20
+ return _isAvailable(sensor);
21
+ };
22
+
23
+ module.exports.setEnabled = (sensor, enabled) => {
24
+ validateSensorType(sensor);
25
+ _setEnabled(sensor, !!enabled);
26
+
27
+ };
28
+
29
+ module.exports.getValue = sensor => {
30
+ validateSensorType(sensor);
31
+ return _getValue(sensor);
32
+ };
33
+
34
+ module.exports.Type = Type;
package/lib/sfml.d.ts CHANGED
@@ -4,6 +4,9 @@ export * from './font';
4
4
  export * from './image';
5
5
  export * as Keyboard from './keyboard';
6
6
  export * as Mouse from './mouse';
7
+ export * as Joystick from './joystick';
8
+ export * as Sensor from './sensor';
9
+ export * as Touch from './touch';
7
10
  export * from './rect';
8
11
  export * from './render_window';
9
12
  export * from './texture';
@@ -11,6 +14,7 @@ export * from './texture';
11
14
  export * as Time from './time';
12
15
 
13
16
  export * from './vector2';
17
+ export * from './vector3';
14
18
  export * from './vertex';
15
19
  export * from './video_mode';
16
20
 
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
+ }