ruby2d 0.9.5 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/assets/include/SDL2/SDL.h +4 -1
  3. data/assets/include/SDL2/SDL_assert.h +3 -1
  4. data/assets/include/SDL2/SDL_atomic.h +1 -1
  5. data/assets/include/SDL2/SDL_audio.h +1 -1
  6. data/assets/include/SDL2/SDL_bits.h +1 -1
  7. data/assets/include/SDL2/SDL_blendmode.h +4 -1
  8. data/assets/include/SDL2/SDL_clipboard.h +1 -1
  9. data/assets/include/SDL2/SDL_config.h +1 -1
  10. data/assets/include/SDL2/SDL_config_android.h +7 -3
  11. data/assets/include/SDL2/SDL_config_iphoneos.h +16 -10
  12. data/assets/include/SDL2/SDL_config_macosx.h +40 -14
  13. data/assets/include/SDL2/SDL_config_minimal.h +1 -1
  14. data/assets/include/SDL2/SDL_config_os2.h +26 -8
  15. data/assets/include/SDL2/SDL_config_pandora.h +4 -2
  16. data/assets/include/SDL2/SDL_config_psp.h +2 -1
  17. data/assets/include/SDL2/SDL_config_windows.h +40 -9
  18. data/assets/include/SDL2/SDL_config_winrt.h +5 -2
  19. data/assets/include/SDL2/SDL_config_wiz.h +5 -2
  20. data/assets/include/SDL2/SDL_copying.h +1 -1
  21. data/assets/include/SDL2/SDL_cpuinfo.h +32 -3
  22. data/assets/include/SDL2/SDL_egl.h +4 -1
  23. data/assets/include/SDL2/SDL_endian.h +6 -3
  24. data/assets/include/SDL2/SDL_error.h +38 -2
  25. data/assets/include/SDL2/SDL_events.h +64 -28
  26. data/assets/include/SDL2/SDL_filesystem.h +1 -1
  27. data/assets/include/SDL2/SDL_gamecontroller.h +160 -9
  28. data/assets/include/SDL2/SDL_gesture.h +1 -1
  29. data/assets/include/SDL2/SDL_haptic.h +10 -1
  30. data/assets/include/SDL2/SDL_hints.h +316 -4
  31. data/assets/include/SDL2/SDL_joystick.h +115 -24
  32. data/assets/include/SDL2/SDL_keyboard.h +1 -1
  33. data/assets/include/SDL2/SDL_keycode.h +11 -9
  34. data/assets/include/SDL2/SDL_loadso.h +1 -1
  35. data/assets/include/SDL2/SDL_locale.h +101 -0
  36. data/assets/include/SDL2/SDL_log.h +3 -3
  37. data/assets/include/SDL2/SDL_main.h +1 -1
  38. data/assets/include/SDL2/SDL_messagebox.h +6 -4
  39. data/assets/include/SDL2/SDL_metal.h +117 -0
  40. data/assets/include/SDL2/SDL_misc.h +75 -0
  41. data/assets/include/SDL2/SDL_mouse.h +1 -1
  42. data/assets/include/SDL2/SDL_mutex.h +1 -1
  43. data/assets/include/SDL2/SDL_name.h +1 -1
  44. data/assets/include/SDL2/SDL_opengl.h +1 -1
  45. data/assets/include/SDL2/SDL_opengl_glext.h +3 -0
  46. data/assets/include/SDL2/SDL_opengles.h +1 -1
  47. data/assets/include/SDL2/SDL_opengles2.h +1 -1
  48. data/assets/include/SDL2/SDL_pixels.h +25 -16
  49. data/assets/include/SDL2/SDL_platform.h +1 -1
  50. data/assets/include/SDL2/SDL_power.h +1 -1
  51. data/assets/include/SDL2/SDL_quit.h +1 -1
  52. data/assets/include/SDL2/SDL_rect.h +1 -1
  53. data/assets/include/SDL2/SDL_render.h +63 -3
  54. data/assets/include/SDL2/SDL_revision.h +2 -2
  55. data/assets/include/SDL2/SDL_rwops.h +2 -10
  56. data/assets/include/SDL2/SDL_scancode.h +1 -1
  57. data/assets/include/SDL2/SDL_sensor.h +25 -9
  58. data/assets/include/SDL2/SDL_shape.h +1 -1
  59. data/assets/include/SDL2/SDL_stdinc.h +44 -4
  60. data/assets/include/SDL2/SDL_surface.h +11 -2
  61. data/assets/include/SDL2/SDL_system.h +50 -4
  62. data/assets/include/SDL2/SDL_syswm.h +29 -2
  63. data/assets/include/SDL2/SDL_test.h +1 -1
  64. data/assets/include/SDL2/SDL_test_assert.h +1 -1
  65. data/assets/include/SDL2/SDL_test_common.h +14 -1
  66. data/assets/include/SDL2/SDL_test_compare.h +1 -1
  67. data/assets/include/SDL2/SDL_test_crc32.h +1 -1
  68. data/assets/include/SDL2/SDL_test_font.h +1 -1
  69. data/assets/include/SDL2/SDL_test_fuzzer.h +1 -1
  70. data/assets/include/SDL2/SDL_test_harness.h +1 -1
  71. data/assets/include/SDL2/SDL_test_images.h +1 -1
  72. data/assets/include/SDL2/SDL_test_log.h +1 -1
  73. data/assets/include/SDL2/SDL_test_md5.h +1 -1
  74. data/assets/include/SDL2/SDL_test_memory.h +1 -1
  75. data/assets/include/SDL2/SDL_test_random.h +1 -1
  76. data/assets/include/SDL2/SDL_thread.h +34 -11
  77. data/assets/include/SDL2/SDL_timer.h +1 -1
  78. data/assets/include/SDL2/SDL_touch.h +1 -1
  79. data/assets/include/SDL2/SDL_types.h +1 -1
  80. data/assets/include/SDL2/SDL_version.h +2 -2
  81. data/assets/include/SDL2/SDL_video.h +11 -5
  82. data/assets/include/SDL2/SDL_vulkan.h +6 -8
  83. data/assets/include/SDL2/begin_code.h +5 -9
  84. data/assets/include/SDL2/close_code.h +1 -1
  85. data/assets/macos/lib/libFLAC.a +0 -0
  86. data/assets/macos/lib/libSDL2.a +0 -0
  87. data/assets/macos/lib/libSDL2_image.a +0 -0
  88. data/assets/macos/lib/libSDL2_mixer.a +0 -0
  89. data/assets/macos/lib/libSDL2_ttf.a +0 -0
  90. data/assets/macos/lib/libfreetype.a +0 -0
  91. data/assets/macos/lib/libjpeg.a +0 -0
  92. data/assets/macos/lib/libmpg123.a +0 -0
  93. data/assets/macos/lib/libogg.a +0 -0
  94. data/assets/macos/lib/libpng16.a +0 -0
  95. data/assets/macos/lib/libtiff.a +0 -0
  96. data/assets/macos/lib/libvorbis.a +0 -0
  97. data/assets/macos/lib/libvorbisfile.a +0 -0
  98. data/assets/macos/lib/libwebp.a +0 -0
  99. data/assets/mingw/bin/SDL2.dll +0 -0
  100. data/assets/mingw/lib/libSDL2.a +0 -0
  101. data/assets/mingw/lib/libSDL2.dll.a +0 -0
  102. data/assets/mingw/lib/libSDL2_test.a +0 -0
  103. data/assets/mingw/lib/libSDL2main.a +0 -0
  104. data/ext/ruby2d/extconf.rb +1 -1
  105. data/ext/ruby2d/gl.c +17 -0
  106. data/ext/ruby2d/gl2.c +15 -0
  107. data/ext/ruby2d/gl3.c +15 -0
  108. data/ext/ruby2d/gles.c +15 -0
  109. data/ext/ruby2d/music.c +13 -0
  110. data/ext/ruby2d/ruby2d.c +306 -168
  111. data/ext/ruby2d/ruby2d.h +32 -0
  112. data/ext/ruby2d/sound.c +25 -0
  113. data/ext/ruby2d/tileset.c +30 -0
  114. data/lib/ruby2d.rb +4 -1
  115. data/lib/ruby2d/circle.rb +18 -2
  116. data/lib/ruby2d/dsl.rb +16 -9
  117. data/lib/ruby2d/entity.rb +17 -0
  118. data/lib/ruby2d/font.rb +4 -3
  119. data/lib/ruby2d/image.rb +24 -1
  120. data/lib/ruby2d/line.rb +20 -0
  121. data/lib/ruby2d/music.rb +5 -0
  122. data/lib/ruby2d/pixel.rb +17 -0
  123. data/lib/ruby2d/quad.rb +18 -0
  124. data/lib/ruby2d/rectangle.rb +11 -2
  125. data/lib/ruby2d/renderable.rb +4 -8
  126. data/lib/ruby2d/sound.rb +5 -0
  127. data/lib/ruby2d/sprite.rb +35 -3
  128. data/lib/ruby2d/square.rb +9 -0
  129. data/lib/ruby2d/text.rb +22 -1
  130. data/lib/ruby2d/tileset.rb +69 -0
  131. data/lib/ruby2d/triangle.rb +16 -0
  132. data/lib/ruby2d/version.rb +1 -1
  133. data/lib/ruby2d/window.rb +249 -22
  134. metadata +10 -3
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -31,6 +31,7 @@
31
31
  #include "SDL_stdinc.h"
32
32
  #include "SDL_error.h"
33
33
  #include "SDL_rwops.h"
34
+ #include "SDL_sensor.h"
34
35
  #include "SDL_joystick.h"
35
36
 
36
37
  #include "begin_code.h"
@@ -57,6 +58,17 @@ extern "C" {
57
58
  struct _SDL_GameController;
58
59
  typedef struct _SDL_GameController SDL_GameController;
59
60
 
61
+ typedef enum
62
+ {
63
+ SDL_CONTROLLER_TYPE_UNKNOWN = 0,
64
+ SDL_CONTROLLER_TYPE_XBOX360,
65
+ SDL_CONTROLLER_TYPE_XBOXONE,
66
+ SDL_CONTROLLER_TYPE_PS3,
67
+ SDL_CONTROLLER_TYPE_PS4,
68
+ SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO,
69
+ SDL_CONTROLLER_TYPE_VIRTUAL,
70
+ SDL_CONTROLLER_TYPE_PS5
71
+ } SDL_GameControllerType;
60
72
 
61
73
  typedef enum
62
74
  {
@@ -161,7 +173,7 @@ extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID
161
173
  *
162
174
  * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available
163
175
  */
164
- extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController * gamecontroller);
176
+ extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController *gamecontroller);
165
177
 
166
178
  /**
167
179
  * Is the joystick on this index supported by the game controller interface?
@@ -175,6 +187,12 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
175
187
  */
176
188
  extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
177
189
 
190
+ /**
191
+ * Get the type of a game controller.
192
+ * This can be called before any controllers are opened.
193
+ */
194
+ extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(int joystick_index);
195
+
178
196
  /**
179
197
  * Get the mapping of a game controller.
180
198
  * This can be called before any controllers are opened.
@@ -199,11 +217,21 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_
199
217
  */
200
218
  extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid);
201
219
 
220
+ /**
221
+ * Return the SDL_GameController associated with a player index.
222
+ */
223
+ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromPlayerIndex(int player_index);
224
+
202
225
  /**
203
226
  * Return the name for this currently opened controller
204
227
  */
205
228
  extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
206
229
 
230
+ /**
231
+ * Return the type of this currently opened controller
232
+ */
233
+ extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_GameController *gamecontroller);
234
+
207
235
  /**
208
236
  * Get the player index of an opened game controller, or -1 if it's not available
209
237
  *
@@ -211,23 +239,35 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *g
211
239
  */
212
240
  extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller);
213
241
 
242
+ /**
243
+ * Set the player index of an opened game controller
244
+ */
245
+ extern DECLSPEC void SDLCALL SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index);
246
+
214
247
  /**
215
248
  * Get the USB vendor ID of an opened controller, if available.
216
249
  * If the vendor ID isn't available this function returns 0.
217
250
  */
218
- extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController * gamecontroller);
251
+ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController *gamecontroller);
219
252
 
220
253
  /**
221
254
  * Get the USB product ID of an opened controller, if available.
222
255
  * If the product ID isn't available this function returns 0.
223
256
  */
224
- extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * gamecontroller);
257
+ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController *gamecontroller);
225
258
 
226
259
  /**
227
260
  * Get the product version of an opened controller, if available.
228
261
  * If the product version isn't available this function returns 0.
229
262
  */
230
- extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller);
263
+ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller);
264
+
265
+ /**
266
+ * Get the serial number of an opened controller, if available.
267
+ *
268
+ * Returns the serial number of the controller, or NULL if it is not available.
269
+ */
270
+ extern DECLSPEC const char * SDLCALL SDL_GameControllerGetSerial(SDL_GameController *gamecontroller);
231
271
 
232
272
  /**
233
273
  * Returns SDL_TRUE if the controller has been opened and currently connected,
@@ -298,6 +338,12 @@ extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
298
338
  SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
299
339
  SDL_GameControllerAxis axis);
300
340
 
341
+ /**
342
+ * Return whether a game controller has a given axis
343
+ */
344
+ extern DECLSPEC SDL_bool SDLCALL
345
+ SDL_GameControllerHasAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis);
346
+
301
347
  /**
302
348
  * Get the current state of an axis control on a game controller.
303
349
  *
@@ -307,8 +353,7 @@ SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
307
353
  * The axis indices start at index 0.
308
354
  */
309
355
  extern DECLSPEC Sint16 SDLCALL
310
- SDL_GameControllerGetAxis(SDL_GameController *gamecontroller,
311
- SDL_GameControllerAxis axis);
356
+ SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis);
312
357
 
313
358
  /**
314
359
  * The list of buttons available from a controller
@@ -331,6 +376,12 @@ typedef enum
331
376
  SDL_CONTROLLER_BUTTON_DPAD_DOWN,
332
377
  SDL_CONTROLLER_BUTTON_DPAD_LEFT,
333
378
  SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
379
+ SDL_CONTROLLER_BUTTON_MISC1, /* Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button */
380
+ SDL_CONTROLLER_BUTTON_PADDLE1, /* Xbox Elite paddle P1 */
381
+ SDL_CONTROLLER_BUTTON_PADDLE2, /* Xbox Elite paddle P3 */
382
+ SDL_CONTROLLER_BUTTON_PADDLE3, /* Xbox Elite paddle P2 */
383
+ SDL_CONTROLLER_BUTTON_PADDLE4, /* Xbox Elite paddle P4 */
384
+ SDL_CONTROLLER_BUTTON_TOUCHPAD, /* PS4/PS5 touchpad button */
334
385
  SDL_CONTROLLER_BUTTON_MAX
335
386
  } SDL_GameControllerButton;
336
387
 
@@ -351,6 +402,11 @@ extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
351
402
  SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
352
403
  SDL_GameControllerButton button);
353
404
 
405
+ /**
406
+ * Return whether a game controller has a given button
407
+ */
408
+ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasButton(SDL_GameController *gamecontroller,
409
+ SDL_GameControllerButton button);
354
410
 
355
411
  /**
356
412
  * Get the current state of a button on a game controller.
@@ -361,7 +417,68 @@ extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *ga
361
417
  SDL_GameControllerButton button);
362
418
 
363
419
  /**
364
- * Trigger a rumble effect
420
+ * Get the number of touchpads on a game controller.
421
+ */
422
+ extern DECLSPEC int SDLCALL SDL_GameControllerGetNumTouchpads(SDL_GameController *gamecontroller);
423
+
424
+ /**
425
+ * Get the number of supported simultaneous fingers on a touchpad on a game controller.
426
+ */
427
+ extern DECLSPEC int SDLCALL SDL_GameControllerGetNumTouchpadFingers(SDL_GameController *gamecontroller, int touchpad);
428
+
429
+ /**
430
+ * Get the current state of a finger on a touchpad on a game controller.
431
+ */
432
+ extern DECLSPEC int SDLCALL SDL_GameControllerGetTouchpadFinger(SDL_GameController *gamecontroller, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure);
433
+
434
+ /**
435
+ * Return whether a game controller has a particular sensor.
436
+ *
437
+ * \param gamecontroller The controller to query
438
+ * \param type The type of sensor to query
439
+ *
440
+ * \return SDL_TRUE if the sensor exists, SDL_FALSE otherwise.
441
+ */
442
+ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasSensor(SDL_GameController *gamecontroller, SDL_SensorType type);
443
+
444
+ /**
445
+ * Set whether data reporting for a game controller sensor is enabled
446
+ *
447
+ * \param gamecontroller The controller to update
448
+ * \param type The type of sensor to enable/disable
449
+ * \param enabled Whether data reporting should be enabled
450
+ *
451
+ * \return 0 or -1 if an error occurred.
452
+ */
453
+ extern DECLSPEC int SDLCALL SDL_GameControllerSetSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type, SDL_bool enabled);
454
+
455
+ /**
456
+ * Query whether sensor data reporting is enabled for a game controller
457
+ *
458
+ * \param gamecontroller The controller to query
459
+ * \param type The type of sensor to query
460
+ *
461
+ * \return SDL_TRUE if the sensor is enabled, SDL_FALSE otherwise.
462
+ */
463
+ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerIsSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type);
464
+
465
+ /**
466
+ * Get the current state of a game controller sensor.
467
+ *
468
+ * The number of values and interpretation of the data is sensor dependent.
469
+ * See SDL_sensor.h for the details for each type of sensor.
470
+ *
471
+ * \param gamecontroller The controller to query
472
+ * \param type The type of sensor to query
473
+ * \param data A pointer filled with the current sensor state
474
+ * \param num_values The number of values to write to data
475
+ *
476
+ * \return 0 or -1 if an error occurred.
477
+ */
478
+ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController *gamecontroller, SDL_SensorType type, float *data, int num_values);
479
+
480
+ /**
481
+ * Start a rumble effect
365
482
  * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.
366
483
  *
367
484
  * \param gamecontroller The controller to vibrate
@@ -369,10 +486,44 @@ extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *ga
369
486
  * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF
370
487
  * \param duration_ms The duration of the rumble effect, in milliseconds
371
488
  *
372
- * \return 0, or -1 if rumble isn't supported on this joystick
489
+ * \return 0, or -1 if rumble isn't supported on this controller
373
490
  */
374
491
  extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
375
492
 
493
+ /**
494
+ * Start a rumble effect in the game controller's triggers
495
+ * Each call to this function cancels any previous trigger rumble effect, and calling it with 0 intensity stops any rumbling.
496
+ *
497
+ * \param gamecontroller The controller to vibrate
498
+ * \param left_rumble The intensity of the left trigger rumble motor, from 0 to 0xFFFF
499
+ * \param right_rumble The intensity of the right trigger rumble motor, from 0 to 0xFFFF
500
+ * \param duration_ms The duration of the rumble effect, in milliseconds
501
+ *
502
+ * \return 0, or -1 if rumble isn't supported on this controller
503
+ */
504
+ extern DECLSPEC int SDLCALL SDL_GameControllerRumbleTriggers(SDL_GameController *gamecontroller, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
505
+
506
+ /**
507
+ * Return whether a controller has an LED
508
+ *
509
+ * \param gamecontroller The controller to query
510
+ *
511
+ * \return SDL_TRUE, or SDL_FALSE if this controller does not have a modifiable LED
512
+ */
513
+ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasLED(SDL_GameController *gamecontroller);
514
+
515
+ /**
516
+ * Update a controller's LED color.
517
+ *
518
+ * \param gamecontroller The controller to update
519
+ * \param red The intensity of the red LED
520
+ * \param green The intensity of the green LED
521
+ * \param blue The intensity of the blue LED
522
+ *
523
+ * \return 0, or -1 if this controller does not have a modifiable LED
524
+ */
525
+ extern DECLSPEC int SDLCALL SDL_GameControllerSetLED(SDL_GameController *gamecontroller, Uint8 red, Uint8 green, Uint8 blue);
526
+
376
527
  /**
377
528
  * Close a controller previously opened with SDL_GameControllerOpen().
378
529
  */
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -336,6 +336,14 @@ typedef struct _SDL_Haptic SDL_Haptic;
336
336
  */
337
337
  #define SDL_HAPTIC_SPHERICAL 2
338
338
 
339
+ /**
340
+ * \brief Use this value to play an effect on the steering wheel axis. This
341
+ * provides better compatibility across platforms and devices as SDL will guess
342
+ * the correct axis.
343
+ * \sa SDL_HapticDirection
344
+ */
345
+ #define SDL_HAPTIC_STEERING_AXIS 3
346
+
339
347
  /* @} *//* Direction encodings */
340
348
 
341
349
  /* @} *//* Haptic features */
@@ -444,6 +452,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
444
452
  * \sa SDL_HAPTIC_POLAR
445
453
  * \sa SDL_HAPTIC_CARTESIAN
446
454
  * \sa SDL_HAPTIC_SPHERICAL
455
+ * \sa SDL_HAPTIC_STEERING_AXIS
447
456
  * \sa SDL_HapticEffect
448
457
  * \sa SDL_HapticNumAxes
449
458
  */
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -164,6 +164,21 @@ extern "C" {
164
164
  */
165
165
  #define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER"
166
166
 
167
+ /**
168
+ * \brief A variable controlling whether the graphics context is externally managed.
169
+ *
170
+ * This variable can be set to the following values:
171
+ * "0" - SDL will manage graphics contexts that are attached to windows.
172
+ * "1" - Disable graphics context management on windows.
173
+ *
174
+ * By default SDL will manage OpenGL contexts in certain situations. For example, on Android the
175
+ * context will be automatically saved and restored when pausing the application. Additionally, some
176
+ * platforms will assume usage of OpenGL if Vulkan isn't used. Setting this to "1" will prevent this
177
+ * behavior, which is desireable when the application manages the graphics context, such as
178
+ * an externally managed OpenGL context or attaching a Vulkan surface to the window.
179
+ */
180
+ #define SDL_HINT_VIDEO_EXTERNAL_CONTEXT "SDL_VIDEO_EXTERNAL_CONTEXT"
181
+
167
182
  /**
168
183
  * \brief A variable controlling whether the X11 VidMode extension should be used.
169
184
  *
@@ -197,6 +212,12 @@ extern "C" {
197
212
  */
198
213
  #define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR"
199
214
 
215
+ /**
216
+ * \brief A variable forcing the visual ID chosen for new X11 windows
217
+ *
218
+ */
219
+ #define SDL_HINT_VIDEO_X11_WINDOW_VISUALID "SDL_VIDEO_X11_WINDOW_VISUALID"
220
+
200
221
  /**
201
222
  * \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported.
202
223
  *
@@ -223,6 +244,17 @@ extern "C" {
223
244
  */
224
245
  #define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"
225
246
 
247
+ /**
248
+ * \brief A variable controlling whether X11 should use GLX or EGL by default
249
+ *
250
+ * This variable can be set to the following values:
251
+ * "0" - Use GLX
252
+ * "1" - Use EGL
253
+ *
254
+ * By default SDL will use GLX when both are present.
255
+ */
256
+ #define SDL_HINT_VIDEO_X11_FORCE_EGL "SDL_VIDEO_X11_FORCE_EGL"
257
+
226
258
  /**
227
259
  * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
228
260
  *
@@ -282,6 +314,17 @@ extern "C" {
282
314
  */
283
315
  #define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE"
284
316
 
317
+ /**
318
+ * \brief A variable controlling whether relative mouse motion is affected by renderer scaling
319
+ *
320
+ * This variable can be set to the following values:
321
+ * "0" - Relative motion is unaffected by DPI or renderer's logical size
322
+ * "1" - Relative motion is scaled according to DPI scaling and logical size
323
+ *
324
+ * By default relative mouse deltas are affected by DPI and renderer scaling
325
+ */
326
+ #define SDL_HINT_MOUSE_RELATIVE_SCALING "SDL_MOUSE_RELATIVE_SCALING"
327
+
285
328
  /**
286
329
  * \brief A variable controlling whether relative mouse mode is implemented using mouse warping
287
330
  *
@@ -326,7 +369,9 @@ extern "C" {
326
369
  #define SDL_HINT_MOUSE_TOUCH_EVENTS "SDL_MOUSE_TOUCH_EVENTS"
327
370
 
328
371
  /**
329
- * \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
372
+ * \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to false.
373
+ * \warning Before SDL 2.0.14, this defaulted to true! In 2.0.14, we're
374
+ * seeing if "true" causes more problems than it solves in modern times.
330
375
  *
331
376
  */
332
377
  #define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"
@@ -436,6 +481,25 @@ extern "C" {
436
481
  */
437
482
  #define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
438
483
 
484
+ /**
485
+ * \brief A variable that overrides the automatic controller type detection
486
+ *
487
+ * The variable should be comma separated entries, in the form: VID/PID=type
488
+ *
489
+ * The VID and PID should be hexadecimal with exactly 4 digits, e.g. 0x00fd
490
+ *
491
+ * The type should be one of:
492
+ * Xbox360
493
+ * XboxOne
494
+ * PS3
495
+ * PS4
496
+ * PS5
497
+ * SwitchPro
498
+ *
499
+ * This hint affects what driver is used, and must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
500
+ */
501
+ #define SDL_HINT_GAMECONTROLLERTYPE "SDL_GAMECONTROLLERTYPE"
502
+
439
503
  /**
440
504
  * \brief A variable that lets you manually hint extra gamecontroller db entries.
441
505
  *
@@ -482,6 +546,29 @@ extern "C" {
482
546
  */
483
547
  #define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"
484
548
 
549
+ /**
550
+ * \brief If set, game controller face buttons report their values according to their labels instead of their positional layout.
551
+ *
552
+ * For example, on Nintendo Switch controllers, normally you'd get:
553
+ *
554
+ * (Y)
555
+ * (X) (B)
556
+ * (A)
557
+ *
558
+ * but if this hint is set, you'll get:
559
+ *
560
+ * (X)
561
+ * (Y) (A)
562
+ * (B)
563
+ *
564
+ * The variable can be set to the following values:
565
+ * "0" - Report the face buttons by position, as though they were on an Xbox controller.
566
+ * "1" - Report the face buttons by label instead of position
567
+ *
568
+ * The default value is "1". This hint may be set at any time.
569
+ */
570
+ #define SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS "SDL_GAMECONTROLLER_USE_BUTTON_LABELS"
571
+
485
572
  /**
486
573
  * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
487
574
  *
@@ -517,6 +604,17 @@ extern "C" {
517
604
  */
518
605
  #define SDL_HINT_JOYSTICK_HIDAPI_PS4 "SDL_JOYSTICK_HIDAPI_PS4"
519
606
 
607
+ /**
608
+ * \brief A variable controlling whether the HIDAPI driver for PS5 controllers should be used.
609
+ *
610
+ * This variable can be set to the following values:
611
+ * "0" - HIDAPI driver is not used
612
+ * "1" - HIDAPI driver is used
613
+ *
614
+ * The default is the value of SDL_HINT_JOYSTICK_HIDAPI
615
+ */
616
+ #define SDL_HINT_JOYSTICK_HIDAPI_PS5 "SDL_JOYSTICK_HIDAPI_PS5"
617
+
520
618
  /**
521
619
  * \brief A variable controlling whether extended input reports should be used for PS4 controllers when using the HIDAPI driver.
522
620
  *
@@ -561,10 +659,34 @@ extern "C" {
561
659
  * "0" - HIDAPI driver is not used
562
660
  * "1" - HIDAPI driver is used
563
661
  *
564
- * The default is the value of SDL_HINT_JOYSTICK_HIDAPI
662
+ * The default is "0" on Windows, otherwise the value of SDL_HINT_JOYSTICK_HIDAPI
565
663
  */
566
664
  #define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX"
567
665
 
666
+ /**
667
+ * \brief A variable controlling whether the HIDAPI driver for XBox controllers on Windows should pull correlated
668
+ * data from XInput.
669
+ *
670
+ * This variable can be set to the following values:
671
+ * "0" - HIDAPI Xbox driver will only use HIDAPI data
672
+ * "1" - HIDAPI Xbox driver will also pull data from XInput, providing better trigger axes, guide button
673
+ * presses, and rumble support
674
+ *
675
+ * The default is "1". This hint applies to any joysticks opened after setting the hint.
676
+ */
677
+ #define SDL_HINT_JOYSTICK_HIDAPI_CORRELATE_XINPUT "SDL_JOYSTICK_HIDAPI_CORRELATE_XINPUT"
678
+
679
+ /**
680
+ * \brief A variable controlling whether the HIDAPI driver for Nintendo GameCube controllers should be used.
681
+ *
682
+ * This variable can be set to the following values:
683
+ * "0" - HIDAPI driver is not used
684
+ * "1" - HIDAPI driver is used
685
+ *
686
+ * The default is the value of SDL_HINT_JOYSTICK_HIDAPI
687
+ */
688
+ #define SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE "SDL_JOYSTICK_HIDAPI_GAMECUBE"
689
+
568
690
  /**
569
691
  * \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs
570
692
  *
@@ -576,6 +698,35 @@ extern "C" {
576
698
  */
577
699
  #define SDL_HINT_ENABLE_STEAM_CONTROLLERS "SDL_ENABLE_STEAM_CONTROLLERS"
578
700
 
701
+ /**
702
+ * \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices.
703
+ *
704
+ * This variable can be set to the following values:
705
+ * "0" - RAWINPUT drivers are not used
706
+ * "1" - RAWINPUT drivers are used (the default)
707
+ *
708
+ */
709
+ #define SDL_HINT_JOYSTICK_RAWINPUT "SDL_JOYSTICK_RAWINPUT"
710
+
711
+ /**
712
+ * \brief A variable controlling whether a separate thread should be used
713
+ * for handling joystick detection and raw input messages on Windows
714
+ *
715
+ * This variable can be set to the following values:
716
+ * "0" - A separate thread is not used (the default)
717
+ * "1" - A separate thread is used for handling raw input messages
718
+ *
719
+ */
720
+ #define SDL_HINT_JOYSTICK_THREAD "SDL_JOYSTICK_THREAD"
721
+
722
+ /**
723
+ * \brief A variable controlling whether joysticks on Linux adhere to their HID-defined deadzones or return unfiltered values.
724
+ *
725
+ * This variable can be set to the following values:
726
+ * "0" - Return unfiltered joystick axis values (the default)
727
+ * "1" - Return axis values with deadzones taken into account
728
+ */
729
+ #define SDL_HINT_LINUX_JOYSTICK_DEADZONES "SDL_LINUX_JOYSTICK_DEADZONES"
579
730
 
580
731
  /**
581
732
  * \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it.
@@ -646,6 +797,42 @@ extern "C" {
646
797
  */
647
798
  #define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE"
648
799
 
800
+ /**
801
+ * \brief A string specifying additional information to use with SDL_SetThreadPriority.
802
+ *
803
+ * By default SDL_SetThreadPriority will make appropriate system changes in order to
804
+ * apply a thread priority. For example on systems using pthreads the scheduler policy
805
+ * is changed automatically to a policy that works well with a given priority.
806
+ * Code which has specific requirements can override SDL's default behavior with this hint.
807
+ *
808
+ * pthread hint values are "current", "other", "fifo" and "rr".
809
+ * Currently no other platform hint values are defined but may be in the future.
810
+ *
811
+ * \note On Linux, the kernel may send SIGKILL to realtime tasks which exceed the distro
812
+ * configured execution budget for rtkit. This budget can be queried through RLIMIT_RTTIME
813
+ * after calling SDL_SetThreadPriority().
814
+ */
815
+ #define SDL_HINT_THREAD_PRIORITY_POLICY "SDL_THREAD_PRIORITY_POLICY"
816
+
817
+ /**
818
+ * \brief Specifies whether SDL_THREAD_PRIORITY_TIME_CRITICAL should be treated as realtime.
819
+ *
820
+ * On some platforms, like Linux, a realtime priority thread may be subject to restrictions
821
+ * that require special handling by the application. This hint exists to let SDL know that
822
+ * the app is prepared to handle said restrictions.
823
+ *
824
+ * On Linux, SDL will apply the following configuration to any thread that becomes realtime:
825
+ * * The SCHED_RESET_ON_FORK bit will be set on the scheduling policy,
826
+ * * An RLIMIT_RTTIME budget will be configured to the rtkit specified limit.
827
+ * * Exceeding this limit will result in the kernel sending SIGKILL to the app,
828
+ * * Refer to the man pages for more information.
829
+ *
830
+ * This variable can be set to the following values:
831
+ * "0" - default platform specific behaviour
832
+ * "1" - Force SDL_THREAD_PRIORITY_TIME_CRITICAL to a realtime scheduling policy
833
+ */
834
+ #define SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL "SDL_THREAD_FORCE_REALTIME_TIME_CRITICAL"
835
+
649
836
  /**
650
837
  * \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS)
651
838
  */
@@ -884,6 +1071,18 @@ extern "C" {
884
1071
  */
885
1072
  #define SDL_HINT_ANDROID_BLOCK_ON_PAUSE "SDL_ANDROID_BLOCK_ON_PAUSE"
886
1073
 
1074
+ /**
1075
+ * \brief A variable to control whether SDL will pause audio in background
1076
+ * (Requires SDL_ANDROID_BLOCK_ON_PAUSE as "Non blocking")
1077
+ *
1078
+ * The variable can be set to the following values:
1079
+ * "0" - Non paused.
1080
+ * "1" - Paused. (default)
1081
+ *
1082
+ * The value should be set before SDL is initialized.
1083
+ */
1084
+ #define SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO "SDL_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO"
1085
+
887
1086
  /**
888
1087
  * \brief A variable to control whether the return key on the soft keyboard
889
1088
  * should hide the soft keyboard on Android and iOS.
@@ -910,10 +1109,26 @@ extern "C" {
910
1109
  */
911
1110
  #define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT"
912
1111
 
1112
+ /**
1113
+ * \brief Disable giving back control to the browser automatically
1114
+ * when running with asyncify
1115
+ *
1116
+ * With -s ASYNCIFY, SDL2 calls emscripten_sleep during operations
1117
+ * such as refreshing the screen or polling events.
1118
+ *
1119
+ * This hint only applies to the emscripten platform
1120
+ *
1121
+ * The variable can be set to the following values:
1122
+ * "0" - Disable emscripten_sleep calls (if you give back browser control manually or use asyncify for other purposes)
1123
+ * "1" - Enable emscripten_sleep calls (the default)
1124
+ */
1125
+ #define SDL_HINT_EMSCRIPTEN_ASYNCIFY "SDL_EMSCRIPTEN_ASYNCIFY"
1126
+
913
1127
  /**
914
1128
  * \brief Tell SDL not to catch the SIGINT or SIGTERM signals.
915
1129
  *
916
- * This hint only applies to Unix-like platforms.
1130
+ * This hint only applies to Unix-like platforms, and should set before
1131
+ * any calls to SDL_Init()
917
1132
  *
918
1133
  * The variable can be set to the following values:
919
1134
  * "0" - SDL will install a SIGINT and SIGTERM handler, and when it
@@ -1087,6 +1302,32 @@ extern "C" {
1087
1302
  #define SDL_HINT_RENDER_BATCHING "SDL_RENDER_BATCHING"
1088
1303
 
1089
1304
 
1305
+ /**
1306
+ * \brief A variable controlling whether SDL updates joystick state when getting input events
1307
+ *
1308
+ * This variable can be set to the following values:
1309
+ *
1310
+ * "0" - You'll call SDL_JoystickUpdate() manually
1311
+ * "1" - SDL will automatically call SDL_JoystickUpdate() (default)
1312
+ *
1313
+ * This hint can be toggled on and off at runtime.
1314
+ */
1315
+ #define SDL_HINT_AUTO_UPDATE_JOYSTICKS "SDL_AUTO_UPDATE_JOYSTICKS"
1316
+
1317
+
1318
+ /**
1319
+ * \brief A variable controlling whether SDL updates sensor state when getting input events
1320
+ *
1321
+ * This variable can be set to the following values:
1322
+ *
1323
+ * "0" - You'll call SDL_SensorUpdate() manually
1324
+ * "1" - SDL will automatically call SDL_SensorUpdate() (default)
1325
+ *
1326
+ * This hint can be toggled on and off at runtime.
1327
+ */
1328
+ #define SDL_HINT_AUTO_UPDATE_SENSORS "SDL_AUTO_UPDATE_SENSORS"
1329
+
1330
+
1090
1331
  /**
1091
1332
  * \brief A variable controlling whether SDL logs all events pushed onto its internal queue.
1092
1333
  *
@@ -1174,6 +1415,77 @@ extern "C" {
1174
1415
  */
1175
1416
  #define SDL_HINT_WAVE_FACT_CHUNK "SDL_WAVE_FACT_CHUNK"
1176
1417
 
1418
+ /**
1419
+ * \brief Override for SDL_GetDisplayUsableBounds()
1420
+ *
1421
+ * If set, this hint will override the expected results for
1422
+ * SDL_GetDisplayUsableBounds() for display index 0. Generally you don't want
1423
+ * to do this, but this allows an embedded system to request that some of the
1424
+ * screen be reserved for other uses when paired with a well-behaved
1425
+ * application.
1426
+ *
1427
+ * The contents of this hint must be 4 comma-separated integers, the first
1428
+ * is the bounds x, then y, width and height, in that order.
1429
+ */
1430
+ #define SDL_HINT_DISPLAY_USABLE_BOUNDS "SDL_DISPLAY_USABLE_BOUNDS"
1431
+
1432
+ /**
1433
+ * \brief Specify an application name for an audio device.
1434
+ *
1435
+ * Some audio backends (such as PulseAudio) allow you to describe your audio
1436
+ * stream. Among other things, this description might show up in a system
1437
+ * control panel that lets the user adjust the volume on specific audio
1438
+ * streams instead of using one giant master volume slider.
1439
+ *
1440
+ * This hints lets you transmit that information to the OS. The contents of
1441
+ * this hint are used while opening an audio device. You should use a string
1442
+ * that describes your program ("My Game 2: The Revenge")
1443
+ *
1444
+ * Setting this to "" or leaving it unset will have SDL use a reasonable
1445
+ * default: probably the application's name or "SDL Application" if SDL
1446
+ * doesn't have any better information.
1447
+ *
1448
+ * On targets where this is not supported, this hint does nothing.
1449
+ */
1450
+ #define SDL_HINT_AUDIO_DEVICE_APP_NAME "SDL_AUDIO_DEVICE_APP_NAME"
1451
+
1452
+ /**
1453
+ * \brief Specify an application name for an audio device.
1454
+ *
1455
+ * Some audio backends (such as PulseAudio) allow you to describe your audio
1456
+ * stream. Among other things, this description might show up in a system
1457
+ * control panel that lets the user adjust the volume on specific audio
1458
+ * streams instead of using one giant master volume slider.
1459
+ *
1460
+ * This hints lets you transmit that information to the OS. The contents of
1461
+ * this hint are used while opening an audio device. You should use a string
1462
+ * that describes your what your program is playing ("audio stream" is
1463
+ * probably sufficient in many cases, but this could be useful for something
1464
+ * like "team chat" if you have a headset playing VoIP audio separately).
1465
+ *
1466
+ * Setting this to "" or leaving it unset will have SDL use a reasonable
1467
+ * default: "audio stream" or something similar.
1468
+ *
1469
+ * On targets where this is not supported, this hint does nothing.
1470
+ */
1471
+ #define SDL_HINT_AUDIO_DEVICE_STREAM_NAME "SDL_AUDIO_DEVICE_STREAM_NAME"
1472
+
1473
+
1474
+ /**
1475
+ * \brief Override for SDL_GetPreferredLocales()
1476
+ *
1477
+ * If set, this will be favored over anything the OS might report for the
1478
+ * user's preferred locales. Changing this hint at runtime will not generate
1479
+ * a SDL_LOCALECHANGED event (but if you can change the hint, you can push
1480
+ * your own event, if you want).
1481
+ *
1482
+ * The format of this hint is a comma-separated list of language and locale,
1483
+ * combined with an underscore, as is a common format: "en_GB". Locale is
1484
+ * optional: "en". So you might have a list like this: "en_GB,jp,es_PT"
1485
+ */
1486
+ #define SDL_HINT_PREFERRED_LOCALES "SDL_PREFERRED_LOCALES"
1487
+
1488
+
1177
1489
  /**
1178
1490
  * \brief An enumeration of hint priorities
1179
1491
  */