@kmamal/sdl 0.6.2 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -289,15 +289,18 @@ This event will be followed by a call to `process.exit()`.
289
289
  * `drivers: <object>`
290
290
  * `video: <object>`
291
291
  * `all: <string>[]` A list of all video drivers.
292
- * `current: <string>` The video driver that is currently selected.
292
+ * `current: <string>|<null>` The video driver that is currently selected.
293
293
  * `audio: <object>`
294
294
  * `all: <string>[]` A list of all audio drivers.
295
- * `current: <string>` The audio driver that is currently selected.
295
+ * `current: <string>|<null>` The audio driver that is currently selected.
296
296
 
297
297
  This object is filled with the information produced during the initialization of SDL.
298
298
  All the values will remain constant throughout the execution of the program.
299
299
  If you want to initialize SDL with drivers other than the default ones, you can do so via its [environment variables](https://wiki.libsdl.org/FAQUsingSDL).
300
300
 
301
+ Note that the `current` video or audio driver can be `null`.
302
+ This can happen on systems that don't have any compatible devices, such as on a CI pipeline.
303
+
301
304
  Sample data for Ubuntu:
302
305
 
303
306
  ```js
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.6.2",
2
+ "version": "0.6.4",
3
3
  "name": "@kmamal/sdl",
4
4
  "description": "SDL bindings for Node.js",
5
5
  "keywords": [
@@ -4,3 +4,5 @@ class CALayer;
4
4
  #endif
5
5
 
6
6
  extern "C" CALayer * getView(NSWindow *);
7
+
8
+ extern "C" void reenableInertialScrolling();
@@ -7,3 +7,7 @@ extern "C" CALayer * getView(NSWindow * window) {
7
7
  [view setWantsLayer:YES];
8
8
  return view.layer;
9
9
  }
10
+
11
+ extern "C" void reenableInertialScrolling() {
12
+ [[NSUserDefaults standardUserDefaults] setBool: YES forKey: @"AppleMomentumScrollSupported"];
13
+ }
@@ -698,13 +698,11 @@ initialize (Variant & object)
698
698
  {
699
699
  int subsystems = 0
700
700
  | SDL_INIT_EVENTS
701
- | SDL_INIT_VIDEO
702
701
  | SDL_INIT_JOYSTICK
703
702
  | SDL_INIT_GAMECONTROLLER
704
- | SDL_INIT_HAPTIC
705
- | SDL_INIT_AUDIO;
703
+ | SDL_INIT_HAPTIC;
706
704
  if (SDL_Init(subsystems) != 0) {
707
- RETURN_ERROR("SDL_Init(0) error: %s\n", SDL_GetError());
705
+ RETURN_ERROR("SDL_Init() error: %s\n", SDL_GetError());
708
706
  }
709
707
  }
710
708
 
@@ -774,12 +772,16 @@ initialize (Variant & object)
774
772
 
775
773
  // Selected Video Driver
776
774
  {
777
- const char * driver_name = SDL_GetCurrentVideoDriver();
778
- if(driver_name == nullptr) {
779
- RETURN_ERROR("SDL_GetCurrentVideoDriver() error: %s\n", SDL_GetError());
780
- }
775
+ if (SDL_InitSubSystem(SDL_INIT_VIDEO) == 0) {
776
+ const char * driver_name = SDL_GetCurrentVideoDriver();
777
+ if(driver_name == nullptr) {
778
+ RETURN_ERROR("SDL_GetCurrentVideoDriver() error: %s\n", SDL_GetError());
779
+ }
781
780
 
782
- SET_STRING(video, "current", driver_name);
781
+ SET_STRING(video, "current", driver_name);
782
+ } else {
783
+ SET_NULL(video, "current");
784
+ }
783
785
  }
784
786
 
785
787
  // Available Audio Drivers
@@ -809,13 +811,15 @@ initialize (Variant & object)
809
811
  }
810
812
 
811
813
  // Selected Audio Driver
812
- {
814
+ if (SDL_InitSubSystem(SDL_INIT_AUDIO) == 0) {
813
815
  const char * driver_name = SDL_GetCurrentAudioDriver();
814
816
  if(driver_name == nullptr) {
815
817
  RETURN_ERROR("SDL_GetCurrentAudioDriver() error: %s\n", SDL_GetError());
816
818
  }
817
819
 
818
820
  SET_STRING(audio, "current", driver_name);
821
+ } else {
822
+ SET_NULL(audio, "current");
819
823
  }
820
824
 
821
825
  SET_MAP(drivers, "video", video);
@@ -828,6 +832,11 @@ initialize (Variant & object)
828
832
  keys = SDL_GetKeyboardState(&num_keys);
829
833
  SDL_StartTextInput();
830
834
 
835
+
836
+ #if defined(__MACOSX__)
837
+ reenableInertialScrolling();
838
+ #endif
839
+
831
840
  return nullptr;
832
841
  }
833
842