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/src/touch.cc ADDED
@@ -0,0 +1,54 @@
1
+ #include "touch.h"
2
+ #include "render_window.h"
3
+ #include "vector2-inl.h"
4
+
5
+ namespace node_sfml {
6
+ namespace touch {
7
+
8
+ using std::map;
9
+ using std::string;
10
+ using v8::Local;
11
+ using v8::MaybeLocal;
12
+ using v8::Object;
13
+ using v8::String;
14
+ using v8::Value;
15
+
16
+ NAN_MODULE_INIT(Init) {
17
+ Nan::SetMethod(target, "touchIsDown", IsDown);
18
+ Nan::SetMethod(target, "touchGetPosition", GetPosition);
19
+ }
20
+
21
+ NAN_METHOD(IsDown) {
22
+ sf::Uint32 finger = Nan::To<sf::Uint32>(info[0]).FromJust();
23
+
24
+ info.GetReturnValue().Set(sf::Touch::isDown(finger));
25
+ return;
26
+ }
27
+
28
+ NAN_METHOD(GetPosition) {
29
+ sf::Uint32 finger = Nan::To<sf::Uint32>(info[0]).FromJust();
30
+ sf::Vector2i pos;
31
+ if (info.Length() == 1) {
32
+ pos = sf::Touch::getPosition(finger);
33
+ } else {
34
+ Local<Object> window_object = info[1].As<Object>();
35
+ render_window::RenderWindow* render_window =
36
+ Nan::ObjectWrap::Unwrap<render_window::RenderWindow>(window_object);
37
+ sf::RenderWindow* window = render_window->window();
38
+
39
+ pos = sf::Touch::getPosition(finger, *window);
40
+ }
41
+
42
+ Nan::TryCatch try_catch;
43
+ MaybeLocal<Value> ret =
44
+ vector2::Vector2I::NewRealInstance(info.GetIsolate(), pos);
45
+ if (ret.IsEmpty()) {
46
+ try_catch.ReThrow();
47
+ return;
48
+ }
49
+
50
+ info.GetReturnValue().Set(ret.ToLocalChecked());
51
+ }
52
+
53
+ } // namespace touch
54
+ } // namespace node_sfml
package/src/touch.h ADDED
@@ -0,0 +1,23 @@
1
+ #ifndef SRC_TOUCH_H_
2
+ #define SRC_TOUCH_H_
3
+
4
+ #include <nan.h>
5
+
6
+ #include <map>
7
+ #include <string>
8
+
9
+ #include <SFML/Window/Touch.hpp>
10
+
11
+ namespace node_sfml {
12
+
13
+ namespace touch {
14
+
15
+ NAN_MODULE_INIT(Init);
16
+
17
+ NAN_METHOD(IsDown);
18
+ NAN_METHOD(GetPosition);
19
+
20
+ } // namespace touch
21
+ } // namespace node_sfml
22
+
23
+ #endif // SRC_TOUCH_H_
package/src/utils-inl.h CHANGED
@@ -34,11 +34,11 @@ inline void V8StringToSFString(v8::Isolate* isolate,
34
34
  return;
35
35
  }
36
36
 
37
- ResizableBuffer<char> utf8_string(string_utf8_length);
37
+ ResizableBuffer<char> utf8_string(string_utf8_length + 1);
38
38
  int wrote = v8_string->WriteUtf8(isolate, *utf8_string);
39
39
 
40
40
  // TODO(XadillaX): Real length?
41
- ResizableBuffer<wchar_t> wstr(wrote << 1);
41
+ ResizableBuffer<wchar_t> wstr((wrote << 1) + 1);
42
42
  sf::Utf<8>::toWide(*utf8_string, *utf8_string + wrote, *wstr);
43
43
  sf_string = sf::String(*wstr);
44
44
  }
@@ -0,0 +1,200 @@
1
+ #ifndef SRC_VECTOR3_INL_H_
2
+ #define SRC_VECTOR3_INL_H_
3
+
4
+ #include "utils-inl.h"
5
+ #include "vector3.h"
6
+
7
+ namespace node_sfml {
8
+ namespace vector3 {
9
+
10
+ template <class T>
11
+ NAN_METHOD(Subtract) {
12
+ T* left = Nan::ObjectWrap::Unwrap<T>(info[0].As<v8::Object>());
13
+ T* right = Nan::ObjectWrap::Unwrap<T>(info[1].As<v8::Object>());
14
+
15
+ Nan::TryCatch try_catch;
16
+ v8::MaybeLocal<v8::Value> ret =
17
+ T::NewRealInstance(info.GetIsolate(), left->vector3() - right->vector3());
18
+ if (ret.IsEmpty()) {
19
+ try_catch.ReThrow();
20
+ return;
21
+ }
22
+
23
+ info.GetReturnValue().Set(ret.ToLocalChecked());
24
+ }
25
+
26
+ template <class T>
27
+ NAN_METHOD(Add) {
28
+ T* left = Nan::ObjectWrap::Unwrap<T>(info[0].As<v8::Object>());
29
+ T* right = Nan::ObjectWrap::Unwrap<T>(info[1].As<v8::Object>());
30
+
31
+ Nan::TryCatch try_catch;
32
+ v8::MaybeLocal<v8::Value> ret =
33
+ T::NewRealInstance(info.GetIsolate(), left->vector3() + right->vector3());
34
+ if (ret.IsEmpty()) {
35
+ try_catch.ReThrow();
36
+ return;
37
+ }
38
+
39
+ info.GetReturnValue().Set(ret.ToLocalChecked());
40
+ }
41
+
42
+ template <class Self, typename T, typename NAN_T>
43
+ NAN_METHOD(Multiply) {
44
+ Self* left = Nan::ObjectWrap::Unwrap<Self>(info[0].As<v8::Object>());
45
+ T right = static_cast<T>(Nan::To<NAN_T>(info[1]).FromJust());
46
+
47
+ Nan::TryCatch try_catch;
48
+ v8::MaybeLocal<v8::Value> ret =
49
+ Self::NewRealInstance(info.GetIsolate(), left->vector3() * right);
50
+ if (ret.IsEmpty()) {
51
+ try_catch.ReThrow();
52
+ return;
53
+ }
54
+
55
+ info.GetReturnValue().Set(ret.ToLocalChecked());
56
+ }
57
+
58
+ template <class Self, typename T, typename NAN_T>
59
+ NAN_METHOD(Div) {
60
+ Self* left = Nan::ObjectWrap::Unwrap<Self>(info[0].As<v8::Object>());
61
+ T right = static_cast<T>(Nan::To<NAN_T>(info[1]).FromJust());
62
+
63
+ Nan::TryCatch try_catch;
64
+ v8::MaybeLocal<v8::Value> ret =
65
+ Self::NewRealInstance(info.GetIsolate(), left->vector3() / right);
66
+ if (ret.IsEmpty()) {
67
+ try_catch.ReThrow();
68
+ return;
69
+ }
70
+
71
+ info.GetReturnValue().Set(ret.ToLocalChecked());
72
+ }
73
+
74
+ template <class T>
75
+ NAN_METHOD(Equals) {
76
+ T* left = Nan::ObjectWrap::Unwrap<T>(info[0].As<v8::Object>());
77
+ T* right = Nan::ObjectWrap::Unwrap<T>(info[1].As<v8::Object>());
78
+ info.GetReturnValue().Set(left->vector3() == right->vector3());
79
+ }
80
+
81
+ template <class T>
82
+ NAN_METHOD(NotEquals) {
83
+ T* left = Nan::ObjectWrap::Unwrap<T>(info[0].As<v8::Object>());
84
+ T* right = Nan::ObjectWrap::Unwrap<T>(info[1].As<v8::Object>());
85
+ info.GetReturnValue().Set(left->vector3() != right->vector3());
86
+ }
87
+
88
+ #define TEMPLATE_INNER T, NAN_T, V8_T
89
+
90
+ template <typename T, typename NAN_T, class V8_T>
91
+ v8::MaybeLocal<v8::Value> Vector3<TEMPLATE_INNER>::NewRealInstance(
92
+ v8::Isolate* isolate, size_t argc, v8::Local<v8::Value>* argv) {
93
+ v8::Local<v8::Function> cons = real_constructor.Get(isolate);
94
+ if (cons.IsEmpty()) {
95
+ Nan::ThrowError("`real_constructor` is not set.");
96
+ return v8::MaybeLocal<v8::Value>();
97
+ }
98
+
99
+ v8::MaybeLocal<v8::Value> maybe_ret = Nan::Call(cons, cons, argc, argv);
100
+ cons->NewInstance(isolate->GetCurrentContext(), argc, argv);
101
+ return maybe_ret;
102
+ }
103
+
104
+ template <typename T, typename NAN_T, class V8_T>
105
+ v8::MaybeLocal<v8::Value> Vector3<TEMPLATE_INNER>::NewRealInstance(
106
+ v8::Isolate* isolate, const sf::Vector3<T>& src) {
107
+ v8::MaybeLocal<v8::Value> maybe =
108
+ Vector3<TEMPLATE_INNER>::NewRealInstance(isolate);
109
+ if (maybe.IsEmpty()) return maybe;
110
+
111
+ v8::Local<v8::Object> vec = maybe.ToLocalChecked().As<v8::Object>();
112
+ Vector3<TEMPLATE_INNER>* vec_wrapper =
113
+ Nan::ObjectWrap::Unwrap<Vector3<TEMPLATE_INNER>>(vec);
114
+ sf::Vector3<T>& v = vec_wrapper->vector3();
115
+ v.x = src.x;
116
+ v.y = src.y;
117
+ v.z = src.z;
118
+
119
+ return vec;
120
+ }
121
+
122
+ template <typename T, typename NAN_T, class V8_T>
123
+ NAN_METHOD(Vector3<TEMPLATE_INNER>::New) {
124
+ Vector3<T, NAN_T, V8_T>* rect = nullptr;
125
+ if (info.Length() == 0) {
126
+ rect = new Vector3<T, NAN_T, V8_T>();
127
+ rect->Wrap(info.This());
128
+ info.GetReturnValue().Set(info.This());
129
+ return;
130
+ }
131
+
132
+ if (info.Length() == 1) {
133
+ Vector3<T, NAN_T, V8_T>* another =
134
+ Nan::ObjectWrap::Unwrap<Vector3<T, NAN_T, V8_T>>(
135
+ info[0].As<v8::Object>());
136
+ rect = new Vector3(*another);
137
+ rect->Wrap(info.This());
138
+ info.GetReturnValue().Set(info.This());
139
+ return;
140
+ }
141
+
142
+ T val[3];
143
+ if (!ParseParameters<T, NAN_T, V8_T>(info, 3, val)) return;
144
+ rect = new Vector3<T, NAN_T, V8_T>(val[0], val[1], val[2]);
145
+
146
+ rect->Wrap(info.This());
147
+ info.GetReturnValue().Set(info.This());
148
+ }
149
+
150
+ #define V(name, lowercase) \
151
+ template <typename T, typename NAN_T, class V8_T> \
152
+ NAN_METHOD(Vector3<TEMPLATE_INNER>::name##Getter) { \
153
+ Vector3<T, NAN_T, V8_T>* vec = \
154
+ Nan::ObjectWrap::Unwrap<Vector3<T, NAN_T, V8_T>>(info.This()); \
155
+ v8::Local<V8_T> ret = \
156
+ Nan::New<V8_T>(static_cast<NAN_T>(vec->vector3().lowercase)); \
157
+ info.GetReturnValue().Set(ret); \
158
+ } \
159
+ \
160
+ template <typename T, typename NAN_T, class V8_T> \
161
+ NAN_METHOD(Vector3<TEMPLATE_INNER>::name##Setter) { \
162
+ v8::MaybeLocal<V8_T> maybe_value = info[0].As<V8_T>(); \
163
+ if (maybe_value.IsEmpty()) { \
164
+ Nan::ThrowTypeError("Invalid type for `" #lowercase "`."); \
165
+ } \
166
+ \
167
+ NAN_T val = maybe_value.ToLocalChecked()->Value(); \
168
+ Vector3<T, NAN_T, V8_T>* vec = \
169
+ Nan::ObjectWrap::Unwrap<Vector3<T, NAN_T, V8_T>>(info.This()); \
170
+ vec->vector3().lowercase = static_cast<T>(val); \
171
+ }
172
+
173
+ VECTOR3_PROPERTIES(V);
174
+ #undef V
175
+
176
+ template <typename T, typename NAN_T, class V8_T>
177
+ NAN_METHOD(Vector3<TEMPLATE_INNER>::SetRealConstructor) {
178
+ real_constructor.Reset(info[0].As<v8::Function>());
179
+ }
180
+
181
+ template <typename T, typename NAN_T, class V8_T>
182
+ Vector3<T, NAN_T, V8_T>::Vector3() : Nan::ObjectWrap(), _vec() {}
183
+
184
+ template <typename T, typename NAN_T, class V8_T>
185
+ Vector3<T, NAN_T, V8_T>::Vector3(T x, T y, T z)
186
+ : Nan::ObjectWrap(), _vec(x, y, z) {}
187
+
188
+ template <typename T, typename NAN_T, class V8_T>
189
+ Vector3<T, NAN_T, V8_T>::Vector3(const Vector3<T, NAN_T, V8_T>& vec)
190
+ : Nan::ObjectWrap(), _vec(vec.vector3()) {}
191
+
192
+ template <typename T, typename NAN_T, class V8_T>
193
+ Vector3<T, NAN_T, V8_T>::~Vector3() {}
194
+
195
+ #undef TEMPLATE_INNER
196
+
197
+ } // namespace vector3
198
+ } // namespace node_sfml
199
+
200
+ #endif // SRC_VECTOR3_INL_H_
package/src/vector3.cc ADDED
@@ -0,0 +1,36 @@
1
+ #include "vector3.h"
2
+ #include "vector3-inl.h"
3
+
4
+ namespace node_sfml {
5
+ namespace vector3 {
6
+
7
+ template <typename T, typename NAN_T, class V8_T>
8
+ Nan::Persistent<v8::Function> Vector3<T, NAN_T, V8_T>::constructor;
9
+
10
+ template <typename T, typename NAN_T, class V8_T>
11
+ Nan::Persistent<v8::Function> Vector3<T, NAN_T, V8_T>::real_constructor;
12
+
13
+ const char int_name[] = "Vector3I";
14
+ NAN_MODULE_INIT(Vector3I::Init) {
15
+ Vector3<int, int, v8::Int32>::Init<Vector3I, int_name>(target);
16
+ }
17
+
18
+ Vector3I::~Vector3I() {}
19
+
20
+ const char uint_name[] = "Vector3U";
21
+ NAN_MODULE_INIT(Vector3U::Init) {
22
+ Vector3<sf::Uint32, sf::Uint32, v8::Uint32>::Init<Vector3U, uint_name>(
23
+ target);
24
+ }
25
+
26
+ Vector3U::~Vector3U() {}
27
+
28
+ const char float_name[] = "Vector3F";
29
+ NAN_MODULE_INIT(Vector3F::Init) {
30
+ Vector3<float, double, v8::Number>::Init<Vector3F, float_name>(target);
31
+ }
32
+
33
+ Vector3F::~Vector3F() {}
34
+
35
+ } // namespace vector3
36
+ } // namespace node_sfml
package/src/vector3.h ADDED
@@ -0,0 +1,134 @@
1
+ #ifndef SRC_VECTOR3_H_
2
+ #define SRC_VECTOR3_H_
3
+
4
+ #include <nan.h>
5
+
6
+ #include <SFML/Config.hpp>
7
+ #include <SFML/System/Vector3.hpp>
8
+
9
+ namespace node_sfml {
10
+ namespace vector3 {
11
+
12
+ #define VECTOR3_PROPERTIES(V) \
13
+ V(X, x) \
14
+ V(Y, y) \
15
+ V(Z, z)
16
+
17
+ template <class T>
18
+ NAN_METHOD(Subtract);
19
+
20
+ template <class T>
21
+ NAN_METHOD(Add);
22
+
23
+ template <class Self, typename T, typename NAN_T>
24
+ NAN_METHOD(Multiply);
25
+
26
+ template <class Self, typename T, typename NAN_T>
27
+ NAN_METHOD(Div);
28
+
29
+ template <class T>
30
+ NAN_METHOD(Equals);
31
+
32
+ template <class T>
33
+ NAN_METHOD(NotEquals);
34
+
35
+ // TODO(XadillaX): Pure JavaScript vertion for performance.
36
+ template <typename T, typename NAN_T, class V8_T>
37
+ class Vector3 : public Nan::ObjectWrap {
38
+ public:
39
+ inline const sf::Vector3<T>& vector3() const { return _vec; }
40
+ inline sf::Vector3<T>& vector3() { return _vec; }
41
+
42
+ static Nan::Persistent<v8::Function> constructor;
43
+ static Nan::Persistent<v8::Function> real_constructor;
44
+
45
+ template <class Self, const char* class_name>
46
+ static NAN_MODULE_INIT(Init) {
47
+ v8::Local<v8::String> name = Nan::New(class_name).ToLocalChecked();
48
+ v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
49
+
50
+ #define V(name, lowercase) \
51
+ tpl->PrototypeTemplate()->SetAccessorProperty( \
52
+ Nan::New(#lowercase).ToLocalChecked(), \
53
+ Nan::New<v8::FunctionTemplate>(name##Getter), \
54
+ Nan::New<v8::FunctionTemplate>(name##Setter), \
55
+ v8::PropertyAttribute::DontDelete);
56
+
57
+ VECTOR3_PROPERTIES(V);
58
+ #undef V
59
+
60
+ tpl->SetClassName(name);
61
+ tpl->InstanceTemplate()->SetInternalFieldCount(1);
62
+
63
+ v8::Local<v8::Function> func = Nan::GetFunction(tpl).ToLocalChecked();
64
+ constructor.Reset(func);
65
+
66
+ Nan::Set(target, name, func);
67
+
68
+ Nan::SetMethod(func, "setRealConstructor", SetRealConstructor);
69
+ Nan::SetMethod(func, "subtract", Subtract<Self>);
70
+ Nan::SetMethod(func, "add", Add<Self>);
71
+ Nan::SetMethod(func, "multiply", Multiply<Self, T, NAN_T>);
72
+ Nan::SetMethod(func, "div", Div<Self, T, NAN_T>);
73
+
74
+ Nan::SetMethod(func, "equals", Equals<Self>);
75
+ Nan::SetMethod(func, "notEquals", NotEquals<Self>);
76
+ }
77
+
78
+ static v8::MaybeLocal<v8::Value> NewRealInstance(
79
+ v8::Isolate* isolate,
80
+ size_t argc = 0,
81
+ v8::Local<v8::Value>* argv = nullptr);
82
+ static v8::MaybeLocal<v8::Value> NewRealInstance(v8::Isolate* isolate,
83
+ const sf::Vector3<T>& src);
84
+
85
+ protected:
86
+ static NAN_METHOD(New);
87
+
88
+ #define V(name, lowercase) \
89
+ static NAN_METHOD(name##Getter); \
90
+ static NAN_METHOD(name##Setter);
91
+
92
+ VECTOR3_PROPERTIES(V);
93
+ #undef V
94
+
95
+ static NAN_METHOD(SetRealConstructor);
96
+
97
+ protected:
98
+ Vector3();
99
+ Vector3(T x, T y, T z);
100
+ explicit Vector3(const Vector3<T, NAN_T, V8_T>& vec);
101
+ virtual ~Vector3();
102
+
103
+ protected:
104
+ sf::Vector3<T> _vec;
105
+ };
106
+
107
+ class Vector3I : public Vector3<int, int, v8::Int32> {
108
+ public:
109
+ static NAN_MODULE_INIT(Init);
110
+
111
+ private:
112
+ ~Vector3I();
113
+ };
114
+
115
+ class Vector3U : public Vector3<sf::Uint32, sf::Uint32, v8::Uint32> {
116
+ public:
117
+ static NAN_MODULE_INIT(Init);
118
+
119
+ private:
120
+ ~Vector3U();
121
+ };
122
+
123
+ class Vector3F : public Vector3<float, double, v8::Number> {
124
+ public:
125
+ static NAN_MODULE_INIT(Init);
126
+
127
+ private:
128
+ ~Vector3F();
129
+ };
130
+
131
+ } // namespace vector3
132
+ } // namespace node_sfml
133
+
134
+ #endif // SRC_VECTOR3_H_
@@ -0,0 +1,62 @@
1
+ 'use strict';
2
+
3
+ const cp = require('child_process');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+
7
+ const joystickHpp = fs.readFileSync(
8
+ path.join(__dirname, '../third_party/sfml/include/SFML/Window/Joystick.hpp'));
9
+
10
+ let current = -1;
11
+ const extracted = /enum Axis\W+{([^}]*)\};/
12
+ .exec(joystickHpp)[1]
13
+ .trim()
14
+ .split('\n')
15
+ .map(line => {
16
+ line = line.trim().replace(/(,|)\W*\/\/\/.+/, '');
17
+
18
+ const arr = line.split('=').map(c => c.trim());
19
+ if (arr.length >= 2) {
20
+ current = parseInt(arr[1]);
21
+ } else {
22
+ current++;
23
+ }
24
+
25
+ return [ arr[0], current ];
26
+ });
27
+
28
+ const str = `#include <map>
29
+ #include <string>
30
+
31
+ namespace node_sfml {
32
+ namespace gen {
33
+
34
+ std::map<int, std::string> joystick_axis_itoa;
35
+ std::map<std::string, int> joystick_axis_atoi;
36
+
37
+ void InitJoystickAxis() {
38
+ ${extracted
39
+ .map(([ key, code ]) => {
40
+ return `joystick_axis_itoa[${code}] = "${key}";
41
+ joystick_axis_atoi["${key}"] = ${code};
42
+ `;
43
+ })
44
+ .join(' ')
45
+ .trim()}
46
+ }
47
+
48
+ } // namespace gen
49
+ } // namespace node_sfml
50
+ `;
51
+
52
+ fs.writeFileSync(path.join(__dirname, '../src/gen/joystick_axis.cc'), str);
53
+
54
+ if (process.platform !== 'win32') {
55
+ cp.execFileSync(path.join(__dirname, 'clang_format.js'), [
56
+ '-style=file',
57
+ '-i',
58
+ path.join(__dirname, '../src/gen/joystick_axis.cc'),
59
+ ]);
60
+ }
61
+
62
+ console.log('./src/gen/joystick_axis.cc generated.');
package/tools/keycode.js CHANGED
@@ -38,13 +38,15 @@ void InitKeyCode() {
38
38
  ${extracted
39
39
  .map(([ key, code ]) => {
40
40
  return `keycode_itoa[${code}] = "${key}";
41
- keycode_atoi["${key}"] = ${code};`;
41
+ keycode_atoi["${key}"] = ${code};
42
+ `;
42
43
  })
43
- .join('')}
44
+ .join(' ')
45
+ .trim()}
44
46
  }
45
47
 
46
- } // namespace node_sfml
47
48
  } // namespace gen
49
+ } // namespace node_sfml
48
50
  `;
49
51
 
50
52
  fs.writeFileSync(path.join(__dirname, '../src/gen/keycode.cc'), str);
@@ -58,19 +58,23 @@ void InitMouseButton() {
58
58
  ${extracted
59
59
  .map(([ key, code ]) => {
60
60
  return `mouse_button_itoa[${code}] = "${key}";
61
- mouse_button_atoi["${key}"] = ${code};`;
61
+ mouse_button_atoi["${key}"] = ${code};
62
+ `;
62
63
  })
63
- .join('')}
64
+ .join(' ')
65
+ .trim()}
64
66
  ${extracted2
65
67
  .map(([ key, code ]) => {
66
68
  return `mouse_wheel_itoa[${code}] = "${key}";
67
- mouse_wheel_atoi["${key}"] = ${code};`;
69
+ mouse_wheel_atoi["${key}"] = ${code};
70
+ `;
68
71
  })
69
- .join('')}
72
+ .join(' ')
73
+ .trim()}
70
74
  }
71
75
 
72
- } // namespace node_sfml
73
76
  } // namespace gen
77
+ } // namespace node_sfml
74
78
  `;
75
79
 
76
80
  fs.writeFileSync(path.join(__dirname, '../src/gen/mouse_button.cc'), str);
@@ -0,0 +1,62 @@
1
+ 'use strict';
2
+
3
+ const cp = require('child_process');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+
7
+ const sensorHpp = fs.readFileSync(
8
+ path.join(__dirname, '../third_party/sfml/include/SFML/Window/Sensor.hpp'));
9
+
10
+ let current = -1;
11
+ const extracted = /enum Type\W+{([\w\W]*)Count/
12
+ .exec(sensorHpp)[1]
13
+ .trim()
14
+ .split('\n')
15
+ .map(line => {
16
+ line = line.trim().replace(/,\W*\/\/\/.+/, '');
17
+
18
+ const arr = line.split('=').map(c => c.trim());
19
+ if (arr.length >= 2) {
20
+ current = parseInt(arr[1]);
21
+ } else {
22
+ current++;
23
+ }
24
+
25
+ return [ arr[0], current ];
26
+ });
27
+
28
+ const str = `#include <map>
29
+ #include <string>
30
+
31
+ namespace node_sfml {
32
+ namespace gen {
33
+
34
+ std::map<int, std::string> sensor_type_itoa;
35
+ std::map<std::string, int> sensor_type_atoi;
36
+
37
+ void InitSensorType() {
38
+ ${extracted
39
+ .map(([ key, code ]) => {
40
+ return `sensor_type_itoa[${code}] = "${key}";
41
+ sensor_type_atoi["${key}"] = ${code};
42
+ `;
43
+ })
44
+ .join(' ')
45
+ .trim()}
46
+ }
47
+
48
+ } // namespace gen
49
+ } // namespace node_sfml
50
+ `;
51
+
52
+ fs.writeFileSync(path.join(__dirname, '../src/gen/sensor_type.cc'), str);
53
+
54
+ if (process.platform !== 'win32') {
55
+ cp.execFileSync(path.join(__dirname, 'clang_format.js'), [
56
+ '-style=file',
57
+ '-i',
58
+ path.join(__dirname, '../src/gen/sensor_type.cc'),
59
+ ]);
60
+ }
61
+
62
+ console.log('./src/gen/sensor_type.cc generated.');
@@ -1,22 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>CFBundleDevelopmentRegion</key>
6
- <string>English</string>
7
- <key>CFBundleExecutable</key>
8
- <string>FLAC</string>
9
- <key>CFBundleIdentifier</key>
10
- <string>org.sfml-dev.FLAC</string>
11
- <key>CFBundleInfoDictionaryVersion</key>
12
- <string>6.0</string>
13
- <key>CFBundlePackageType</key>
14
- <string>FMWK</string>
15
- <key>CFBundleSignature</key>
16
- <string>????</string>
17
- <key>CFBundleVersion</key>
18
- <string>1.0</string>
19
- <key>CFBundleSupportedPlatforms</key>
20
- <array><string>MacOSX</string></array>
21
- </dict>
22
- </plist>
@@ -1,22 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>CFBundleDevelopmentRegion</key>
6
- <string>English</string>
7
- <key>CFBundleExecutable</key>
8
- <string>FLAC</string>
9
- <key>CFBundleIdentifier</key>
10
- <string>org.sfml-dev.FLAC</string>
11
- <key>CFBundleInfoDictionaryVersion</key>
12
- <string>6.0</string>
13
- <key>CFBundlePackageType</key>
14
- <string>FMWK</string>
15
- <key>CFBundleSignature</key>
16
- <string>????</string>
17
- <key>CFBundleVersion</key>
18
- <string>1.0</string>
19
- <key>CFBundleSupportedPlatforms</key>
20
- <array><string>MacOSX</string></array>
21
- </dict>
22
- </plist>