gosu 1.4.4 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/dependencies/SDL/include/SDL.h +1 -0
  3. data/dependencies/SDL/include/SDL_assert.h +4 -2
  4. data/dependencies/SDL/include/SDL_atomic.h +20 -0
  5. data/dependencies/SDL/include/SDL_audio.h +40 -4
  6. data/dependencies/SDL/include/SDL_blendmode.h +4 -6
  7. data/dependencies/SDL/include/SDL_clipboard.h +47 -0
  8. data/dependencies/SDL/include/SDL_config.h +71 -45
  9. data/dependencies/SDL/include/SDL_cpuinfo.h +39 -4
  10. data/dependencies/SDL/include/SDL_egl.h +59 -9
  11. data/dependencies/SDL/include/SDL_endian.h +34 -3
  12. data/dependencies/SDL/include/SDL_events.h +32 -1
  13. data/dependencies/SDL/include/SDL_filesystem.h +5 -1
  14. data/dependencies/SDL/include/SDL_gamecontroller.h +78 -5
  15. data/dependencies/SDL/include/SDL_guid.h +100 -0
  16. data/dependencies/SDL/include/SDL_hints.h +645 -43
  17. data/dependencies/SDL/include/SDL_joystick.h +127 -7
  18. data/dependencies/SDL/include/SDL_keyboard.h +38 -1
  19. data/dependencies/SDL/include/SDL_keycode.h +6 -1
  20. data/dependencies/SDL/include/SDL_log.h +2 -2
  21. data/dependencies/SDL/include/SDL_main.h +42 -2
  22. data/dependencies/SDL/include/SDL_metal.h +2 -1
  23. data/dependencies/SDL/include/SDL_mouse.h +12 -1
  24. data/dependencies/SDL/include/SDL_opengl.h +0 -51
  25. data/dependencies/SDL/include/SDL_opengl_glext.h +2260 -231
  26. data/dependencies/SDL/include/SDL_opengles2_gl2.h +374 -339
  27. data/dependencies/SDL/include/SDL_opengles2_gl2ext.h +3479 -1496
  28. data/dependencies/SDL/include/SDL_opengles2_gl2platform.h +6 -9
  29. data/dependencies/SDL/include/SDL_opengles2_khrplatform.h +43 -14
  30. data/dependencies/SDL/include/SDL_platform.h +32 -6
  31. data/dependencies/SDL/include/SDL_rect.h +154 -2
  32. data/dependencies/SDL/include/SDL_render.h +46 -17
  33. data/dependencies/SDL/include/SDL_revision.h +6 -1
  34. data/dependencies/SDL/include/SDL_rwops.h +1 -15
  35. data/dependencies/SDL/include/SDL_scancode.h +46 -21
  36. data/dependencies/SDL/include/SDL_sensor.h +24 -3
  37. data/dependencies/SDL/include/SDL_stdinc.h +119 -8
  38. data/dependencies/SDL/include/SDL_surface.h +3 -1
  39. data/dependencies/SDL/include/SDL_system.h +66 -6
  40. data/dependencies/SDL/include/SDL_syswm.h +2 -0
  41. data/dependencies/SDL/include/SDL_test_common.h +1 -0
  42. data/dependencies/SDL/include/SDL_test_font.h +90 -3
  43. data/dependencies/SDL/include/SDL_thread.h +3 -3
  44. data/dependencies/SDL/include/SDL_touch.h +8 -0
  45. data/dependencies/SDL/include/SDL_version.h +19 -3
  46. data/dependencies/SDL/include/SDL_video.h +71 -9
  47. data/dependencies/SDL/include/begin_code.h +4 -4
  48. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  49. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  50. data/dependencies/SDL_sound/SDL_sound.c +210 -71
  51. data/dependencies/SDL_sound/SDL_sound.h +1 -1
  52. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +111 -168
  53. data/dependencies/SDL_sound/SDL_sound_flac.c +0 -6
  54. data/dependencies/SDL_sound/SDL_sound_internal.h +27 -5
  55. data/dependencies/SDL_sound/SDL_sound_modplug.c +20 -8
  56. data/dependencies/SDL_sound/SDL_sound_mp3.c +11 -7
  57. data/dependencies/SDL_sound/SDL_sound_raw.c +1 -1
  58. data/dependencies/SDL_sound/SDL_sound_shn.c +1 -5
  59. data/dependencies/SDL_sound/SDL_sound_voc.c +1 -1
  60. data/dependencies/SDL_sound/SDL_sound_vorbis.c +2 -4
  61. data/dependencies/SDL_sound/SDL_sound_wav.c +44 -20
  62. data/dependencies/SDL_sound/dr_flac.h +237 -95
  63. data/dependencies/SDL_sound/dr_mp3.h +46 -33
  64. data/dependencies/SDL_sound/libmodplug/fastmix.c +53 -39
  65. data/dependencies/SDL_sound/libmodplug/libmodplug.h +0 -12
  66. data/dependencies/SDL_sound/libmodplug/load_669.c +37 -32
  67. data/dependencies/SDL_sound/libmodplug/load_amf.c +57 -44
  68. data/dependencies/SDL_sound/libmodplug/load_ams.c +127 -100
  69. data/dependencies/SDL_sound/libmodplug/load_dbm.c +40 -37
  70. data/dependencies/SDL_sound/libmodplug/load_dmf.c +61 -49
  71. data/dependencies/SDL_sound/libmodplug/load_dsm.c +18 -13
  72. data/dependencies/SDL_sound/libmodplug/load_far.c +31 -24
  73. data/dependencies/SDL_sound/libmodplug/load_gdm.c +27 -21
  74. data/dependencies/SDL_sound/libmodplug/load_it.c +106 -91
  75. data/dependencies/SDL_sound/libmodplug/load_mdl.c +43 -35
  76. data/dependencies/SDL_sound/libmodplug/load_med.c +66 -52
  77. data/dependencies/SDL_sound/libmodplug/load_mod.c +30 -26
  78. data/dependencies/SDL_sound/libmodplug/load_mt2.c +61 -50
  79. data/dependencies/SDL_sound/libmodplug/load_mtm.c +23 -17
  80. data/dependencies/SDL_sound/libmodplug/load_okt.c +18 -16
  81. data/dependencies/SDL_sound/libmodplug/load_psm.c +44 -32
  82. data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -14
  83. data/dependencies/SDL_sound/libmodplug/load_s3m.c +59 -53
  84. data/dependencies/SDL_sound/libmodplug/load_stm.c +23 -18
  85. data/dependencies/SDL_sound/libmodplug/load_ult.c +33 -29
  86. data/dependencies/SDL_sound/libmodplug/load_xm.c +64 -57
  87. data/dependencies/SDL_sound/libmodplug/mmcmp.c +2 -1
  88. data/dependencies/SDL_sound/libmodplug/snd_dsp.c +30 -20
  89. data/dependencies/SDL_sound/libmodplug/snd_flt.c +6 -4
  90. data/dependencies/SDL_sound/libmodplug/snd_fx.c +91 -65
  91. data/dependencies/SDL_sound/libmodplug/sndfile.c +91 -66
  92. data/dependencies/SDL_sound/libmodplug/sndmix.c +58 -35
  93. data/dependencies/SDL_sound/stb_vorbis.h +14 -9
  94. data/dependencies/mojoAL/mojoal.c +41 -24
  95. data/dependencies/utf8proc/utf8proc.c +1 -1
  96. data/dependencies/utf8proc/utf8proc.h +1 -1
  97. data/dependencies/utf8proc/utf8proc_data.h +3366 -3184
  98. data/include/Gosu/Version.hpp +1 -1
  99. data/lib/SDL2.dll +0 -0
  100. data/lib64/SDL2.dll +0 -0
  101. data/src/RubyGosu.cxx +1 -1
  102. data/src/Window.cpp +6 -4
  103. metadata +3 -2
@@ -225,16 +225,16 @@ typedef enum
225
225
  SDL_SCANCODE_F23 = 114,
226
226
  SDL_SCANCODE_F24 = 115,
227
227
  SDL_SCANCODE_EXECUTE = 116,
228
- SDL_SCANCODE_HELP = 117,
229
- SDL_SCANCODE_MENU = 118,
228
+ SDL_SCANCODE_HELP = 117, /**< AL Integrated Help Center */
229
+ SDL_SCANCODE_MENU = 118, /**< Menu (show menu) */
230
230
  SDL_SCANCODE_SELECT = 119,
231
- SDL_SCANCODE_STOP = 120,
232
- SDL_SCANCODE_AGAIN = 121, /**< redo */
233
- SDL_SCANCODE_UNDO = 122,
234
- SDL_SCANCODE_CUT = 123,
235
- SDL_SCANCODE_COPY = 124,
236
- SDL_SCANCODE_PASTE = 125,
237
- SDL_SCANCODE_FIND = 126,
231
+ SDL_SCANCODE_STOP = 120, /**< AC Stop */
232
+ SDL_SCANCODE_AGAIN = 121, /**< AC Redo/Repeat */
233
+ SDL_SCANCODE_UNDO = 122, /**< AC Undo */
234
+ SDL_SCANCODE_CUT = 123, /**< AC Cut */
235
+ SDL_SCANCODE_COPY = 124, /**< AC Copy */
236
+ SDL_SCANCODE_PASTE = 125, /**< AC Paste */
237
+ SDL_SCANCODE_FIND = 126, /**< AC Find */
238
238
  SDL_SCANCODE_MUTE = 127,
239
239
  SDL_SCANCODE_VOLUMEUP = 128,
240
240
  SDL_SCANCODE_VOLUMEDOWN = 129,
@@ -265,9 +265,9 @@ typedef enum
265
265
  SDL_SCANCODE_LANG8 = 151, /**< reserved */
266
266
  SDL_SCANCODE_LANG9 = 152, /**< reserved */
267
267
 
268
- SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */
268
+ SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */
269
269
  SDL_SCANCODE_SYSREQ = 154,
270
- SDL_SCANCODE_CANCEL = 155,
270
+ SDL_SCANCODE_CANCEL = 155, /**< AC Cancel */
271
271
  SDL_SCANCODE_CLEAR = 156,
272
272
  SDL_SCANCODE_PRIOR = 157,
273
273
  SDL_SCANCODE_RETURN2 = 158,
@@ -345,6 +345,11 @@ typedef enum
345
345
  * \name Usage page 0x0C
346
346
  *
347
347
  * These values are mapped from usage page 0x0C (USB consumer page).
348
+ * See https://usb.org/sites/default/files/hut1_2.pdf
349
+ *
350
+ * There are way more keys in the spec than we can represent in the
351
+ * current scancode range, so pick the ones that commonly come up in
352
+ * real world usage.
348
353
  */
349
354
  /* @{ */
350
355
 
@@ -354,17 +359,17 @@ typedef enum
354
359
  SDL_SCANCODE_AUDIOPLAY = 261,
355
360
  SDL_SCANCODE_AUDIOMUTE = 262,
356
361
  SDL_SCANCODE_MEDIASELECT = 263,
357
- SDL_SCANCODE_WWW = 264,
362
+ SDL_SCANCODE_WWW = 264, /**< AL Internet Browser */
358
363
  SDL_SCANCODE_MAIL = 265,
359
- SDL_SCANCODE_CALCULATOR = 266,
364
+ SDL_SCANCODE_CALCULATOR = 266, /**< AL Calculator */
360
365
  SDL_SCANCODE_COMPUTER = 267,
361
- SDL_SCANCODE_AC_SEARCH = 268,
362
- SDL_SCANCODE_AC_HOME = 269,
363
- SDL_SCANCODE_AC_BACK = 270,
364
- SDL_SCANCODE_AC_FORWARD = 271,
365
- SDL_SCANCODE_AC_STOP = 272,
366
- SDL_SCANCODE_AC_REFRESH = 273,
367
- SDL_SCANCODE_AC_BOOKMARKS = 274,
366
+ SDL_SCANCODE_AC_SEARCH = 268, /**< AC Search */
367
+ SDL_SCANCODE_AC_HOME = 269, /**< AC Home */
368
+ SDL_SCANCODE_AC_BACK = 270, /**< AC Back */
369
+ SDL_SCANCODE_AC_FORWARD = 271, /**< AC Forward */
370
+ SDL_SCANCODE_AC_STOP = 272, /**< AC Stop */
371
+ SDL_SCANCODE_AC_REFRESH = 273, /**< AC Refresh */
372
+ SDL_SCANCODE_AC_BOOKMARKS = 274, /**< AC Bookmarks */
368
373
 
369
374
  /* @} *//* Usage page 0x0C */
370
375
 
@@ -383,7 +388,7 @@ typedef enum
383
388
  SDL_SCANCODE_KBDILLUMDOWN = 279,
384
389
  SDL_SCANCODE_KBDILLUMUP = 280,
385
390
  SDL_SCANCODE_EJECT = 281,
386
- SDL_SCANCODE_SLEEP = 282,
391
+ SDL_SCANCODE_SLEEP = 282, /**< SC System Sleep */
387
392
 
388
393
  SDL_SCANCODE_APP1 = 283,
389
394
  SDL_SCANCODE_APP2 = 284,
@@ -402,6 +407,26 @@ typedef enum
402
407
 
403
408
  /* @} *//* Usage page 0x0C (additional media keys) */
404
409
 
410
+ /**
411
+ * \name Mobile keys
412
+ *
413
+ * These are values that are often used on mobile phones.
414
+ */
415
+ /* @{ */
416
+
417
+ SDL_SCANCODE_SOFTLEFT = 287, /**< Usually situated below the display on phones and
418
+ used as a multi-function feature key for selecting
419
+ a software defined function shown on the bottom left
420
+ of the display. */
421
+ SDL_SCANCODE_SOFTRIGHT = 288, /**< Usually situated below the display on phones and
422
+ used as a multi-function feature key for selecting
423
+ a software defined function shown on the bottom right
424
+ of the display. */
425
+ SDL_SCANCODE_CALL = 289, /**< Used for accepting phone calls. */
426
+ SDL_SCANCODE_ENDCALL = 290, /**< Used for rejecting phone calls. */
427
+
428
+ /* @} *//* Mobile keys */
429
+
405
430
  /* Add any other keys here. */
406
431
 
407
432
  SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
@@ -71,7 +71,11 @@ typedef enum
71
71
  SDL_SENSOR_INVALID = -1, /**< Returned for an invalid sensor */
72
72
  SDL_SENSOR_UNKNOWN, /**< Unknown sensor type */
73
73
  SDL_SENSOR_ACCEL, /**< Accelerometer */
74
- SDL_SENSOR_GYRO /**< Gyroscope */
74
+ SDL_SENSOR_GYRO, /**< Gyroscope */
75
+ SDL_SENSOR_ACCEL_L, /**< Accelerometer for left Joy-Con controller and Wii nunchuk */
76
+ SDL_SENSOR_GYRO_L, /**< Gyroscope for left Joy-Con controller */
77
+ SDL_SENSOR_ACCEL_R, /**< Accelerometer for right Joy-Con controller */
78
+ SDL_SENSOR_GYRO_R /**< Gyroscope for right Joy-Con controller */
75
79
  } SDL_SensorType;
76
80
 
77
81
  /**
@@ -263,7 +267,24 @@ extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor)
263
267
  *
264
268
  * \since This function is available since SDL 2.0.9.
265
269
  */
266
- extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data, int num_values);
270
+ extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor *sensor, float *data, int num_values);
271
+
272
+ /**
273
+ * Get the current state of an opened sensor with the timestamp of the last
274
+ * update.
275
+ *
276
+ * The number of values and interpretation of the data is sensor dependent.
277
+ *
278
+ * \param sensor The SDL_Sensor object to query
279
+ * \param timestamp A pointer filled with the timestamp in microseconds of the
280
+ * current sensor reading if available, or 0 if not
281
+ * \param data A pointer filled with the current sensor state
282
+ * \param num_values The number of values to write to data
283
+ * \returns 0 or -1 if an error occurred.
284
+ *
285
+ * \since This function is available since SDL 2.26.0.
286
+ */
287
+ extern DECLSPEC int SDLCALL SDL_SensorGetDataWithTimestamp(SDL_Sensor *sensor, Uint64 *timestamp, float *data, int num_values);
267
288
 
268
289
  /**
269
290
  * Close a sensor previously opened with SDL_SensorOpen().
@@ -272,7 +293,7 @@ extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data,
272
293
  *
273
294
  * \since This function is available since SDL 2.0.9.
274
295
  */
275
- extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor * sensor);
296
+ extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor *sensor);
276
297
 
277
298
  /**
278
299
  * Update the current state of the open sensors.
@@ -80,9 +80,9 @@
80
80
  # include <ctype.h>
81
81
  #endif
82
82
  #ifdef HAVE_MATH_H
83
- # if defined(__WINRT__)
83
+ # if defined(_MSC_VER)
84
84
  /* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on
85
- WinRT. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx
85
+ Visual Studio. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx
86
86
  for more information.
87
87
  */
88
88
  # define _USE_MATH_DEFINES
@@ -115,6 +115,12 @@ char *alloca();
115
115
  # endif
116
116
  #endif
117
117
 
118
+ #ifdef SIZE_MAX
119
+ # define SDL_SIZE_MAX SIZE_MAX
120
+ #else
121
+ # define SDL_SIZE_MAX ((size_t) -1)
122
+ #endif
123
+
118
124
  /**
119
125
  * Check if the compiler supports a given builtin.
120
126
  * Supported by virtually all clang versions and recent gcc. Use this
@@ -234,13 +240,26 @@ typedef uint64_t Uint64;
234
240
 
235
241
  /* @} *//* Basic data types */
236
242
 
243
+ /**
244
+ * \name Floating-point constants
245
+ */
246
+ /* @{ */
247
+
248
+ #ifdef FLT_EPSILON
249
+ #define SDL_FLT_EPSILON FLT_EPSILON
250
+ #else
251
+ #define SDL_FLT_EPSILON 1.1920928955078125e-07F /* 0x0.000002p0 */
252
+ #endif
253
+
254
+ /* @} *//* Floating-point constants */
255
+
237
256
  /* Make sure we have macros for printing width-based integers.
238
257
  * <stdint.h> should define these but this is not true all platforms.
239
258
  * (for example win32) */
240
259
  #ifndef SDL_PRIs64
241
260
  #ifdef PRIs64
242
261
  #define SDL_PRIs64 PRIs64
243
- #elif defined(__WIN32__)
262
+ #elif defined(__WIN32__) || defined(__GDK__)
244
263
  #define SDL_PRIs64 "I64d"
245
264
  #elif defined(__LINUX__) && defined(__LP64__)
246
265
  #define SDL_PRIs64 "ld"
@@ -251,7 +270,7 @@ typedef uint64_t Uint64;
251
270
  #ifndef SDL_PRIu64
252
271
  #ifdef PRIu64
253
272
  #define SDL_PRIu64 PRIu64
254
- #elif defined(__WIN32__)
273
+ #elif defined(__WIN32__) || defined(__GDK__)
255
274
  #define SDL_PRIu64 "I64u"
256
275
  #elif defined(__LINUX__) && defined(__LP64__)
257
276
  #define SDL_PRIu64 "lu"
@@ -262,7 +281,7 @@ typedef uint64_t Uint64;
262
281
  #ifndef SDL_PRIx64
263
282
  #ifdef PRIx64
264
283
  #define SDL_PRIx64 PRIx64
265
- #elif defined(__WIN32__)
284
+ #elif defined(__WIN32__) || defined(__GDK__)
266
285
  #define SDL_PRIx64 "I64x"
267
286
  #elif defined(__LINUX__) && defined(__LP64__)
268
287
  #define SDL_PRIx64 "lx"
@@ -273,7 +292,7 @@ typedef uint64_t Uint64;
273
292
  #ifndef SDL_PRIX64
274
293
  #ifdef PRIX64
275
294
  #define SDL_PRIX64 PRIX64
276
- #elif defined(__WIN32__)
295
+ #elif defined(__WIN32__) || defined(__GDK__)
277
296
  #define SDL_PRIX64 "I64X"
278
297
  #elif defined(__LINUX__) && defined(__LP64__)
279
298
  #define SDL_PRIX64 "lX"
@@ -354,8 +373,22 @@ typedef uint64_t Uint64;
354
373
  #endif
355
374
  #endif /* SDL_DISABLE_ANALYZE_MACROS */
356
375
 
376
+ #ifndef SDL_COMPILE_TIME_ASSERT
377
+ #if defined(__cplusplus)
378
+ #if (__cplusplus >= 201103L)
379
+ #define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x)
380
+ #endif
381
+ #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
382
+ #define SDL_COMPILE_TIME_ASSERT(name, x) _Static_assert(x, #x)
383
+ #endif
384
+ #endif /* !SDL_COMPILE_TIME_ASSERT */
385
+
386
+ #ifndef SDL_COMPILE_TIME_ASSERT
387
+ /* universal, but may trigger -Wunused-local-typedefs */
357
388
  #define SDL_COMPILE_TIME_ASSERT(name, x) \
358
389
  typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1]
390
+ #endif
391
+
359
392
  /** \cond */
360
393
  #ifndef DOXYGEN_SHOULD_IGNORE_THIS
361
394
  SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
@@ -377,7 +410,7 @@ SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
377
410
 
378
411
  /** \cond */
379
412
  #ifndef DOXYGEN_SHOULD_IGNORE_THIS
380
- #if !defined(__ANDROID__) && !defined(__VITA__)
413
+ #if !defined(__ANDROID__) && !defined(__VITA__) && !defined(__3DS__)
381
414
  /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
382
415
  typedef enum
383
416
  {
@@ -413,6 +446,16 @@ typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size);
413
446
  typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size);
414
447
  typedef void (SDLCALL *SDL_free_func)(void *mem);
415
448
 
449
+ /**
450
+ * Get the original set of SDL memory functions
451
+ *
452
+ * \since This function is available since SDL 2.24.0.
453
+ */
454
+ extern DECLSPEC void SDLCALL SDL_GetOriginalMemoryFunctions(SDL_malloc_func *malloc_func,
455
+ SDL_calloc_func *calloc_func,
456
+ SDL_realloc_func *realloc_func,
457
+ SDL_free_func *free_func);
458
+
416
459
  /**
417
460
  * Get the current set of SDL memory functions
418
461
  *
@@ -443,7 +486,8 @@ extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
443
486
  extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
444
487
  extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
445
488
 
446
- extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));
489
+ extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (SDLCALL *compare) (const void *, const void *));
490
+ extern DECLSPEC void * SDLCALL SDL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (SDLCALL *compare) (const void *, const void *));
447
491
 
448
492
  extern DECLSPEC int SDLCALL SDL_abs(int x);
449
493
 
@@ -467,6 +511,7 @@ extern DECLSPEC int SDLCALL SDL_isgraph(int x);
467
511
  extern DECLSPEC int SDLCALL SDL_toupper(int x);
468
512
  extern DECLSPEC int SDLCALL SDL_tolower(int x);
469
513
 
514
+ extern DECLSPEC Uint16 SDLCALL SDL_crc16(Uint16 crc, const void *data, size_t len);
470
515
  extern DECLSPEC Uint32 SDLCALL SDL_crc32(Uint32 crc, const void *data, size_t len);
471
516
 
472
517
  extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len);
@@ -475,6 +520,11 @@ extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c,
475
520
  #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
476
521
  #define SDL_zeroa(x) SDL_memset((x), 0, sizeof((x)))
477
522
 
523
+ #define SDL_copyp(dst, src) \
524
+ { SDL_COMPILE_TIME_ASSERT(SDL_copyp, sizeof (*(dst)) == sizeof (*(src))); } \
525
+ SDL_memcpy((dst), (src), sizeof (*(src)))
526
+
527
+
478
528
  /* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
479
529
  SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
480
530
  {
@@ -533,8 +583,10 @@ extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
533
583
  extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
534
584
  extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
535
585
  extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
586
+ extern DECLSPEC char *SDLCALL SDL_strcasestr(const char *haystack, const char *needle);
536
587
  extern DECLSPEC char *SDLCALL SDL_strtokr(char *s1, const char *s2, char **saveptr);
537
588
  extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
589
+ extern DECLSPEC size_t SDLCALL SDL_utf8strnlen(const char *str, size_t bytes);
538
590
 
539
591
  extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
540
592
  extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
@@ -708,6 +760,65 @@ SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_B
708
760
  return SDL_memcpy(dst, src, dwords * 4);
709
761
  }
710
762
 
763
+ /**
764
+ * If a * b would overflow, return -1. Otherwise store a * b via ret
765
+ * and return 0.
766
+ *
767
+ * \since This function is available since SDL 2.24.0.
768
+ */
769
+ SDL_FORCE_INLINE int SDL_size_mul_overflow (size_t a,
770
+ size_t b,
771
+ size_t *ret)
772
+ {
773
+ if (a != 0 && b > SDL_SIZE_MAX / a) {
774
+ return -1;
775
+ }
776
+ *ret = a * b;
777
+ return 0;
778
+ }
779
+
780
+ #if _SDL_HAS_BUILTIN(__builtin_mul_overflow)
781
+ /* This needs to be wrapped in an inline rather than being a direct #define,
782
+ * because __builtin_mul_overflow() is type-generic, but we want to be
783
+ * consistent about interpreting a and b as size_t. */
784
+ SDL_FORCE_INLINE int _SDL_size_mul_overflow_builtin (size_t a,
785
+ size_t b,
786
+ size_t *ret)
787
+ {
788
+ return __builtin_mul_overflow(a, b, ret) == 0 ? 0 : -1;
789
+ }
790
+ #define SDL_size_mul_overflow(a, b, ret) (_SDL_size_mul_overflow_builtin(a, b, ret))
791
+ #endif
792
+
793
+ /**
794
+ * If a + b would overflow, return -1. Otherwise store a + b via ret
795
+ * and return 0.
796
+ *
797
+ * \since This function is available since SDL 2.24.0.
798
+ */
799
+ SDL_FORCE_INLINE int SDL_size_add_overflow (size_t a,
800
+ size_t b,
801
+ size_t *ret)
802
+ {
803
+ if (b > SDL_SIZE_MAX - a) {
804
+ return -1;
805
+ }
806
+ *ret = a + b;
807
+ return 0;
808
+ }
809
+
810
+ #if _SDL_HAS_BUILTIN(__builtin_add_overflow)
811
+ /* This needs to be wrapped in an inline rather than being a direct #define,
812
+ * the same as the call to __builtin_mul_overflow() above. */
813
+ SDL_FORCE_INLINE int _SDL_size_add_overflow_builtin (size_t a,
814
+ size_t b,
815
+ size_t *ret)
816
+ {
817
+ return __builtin_add_overflow(a, b, ret) == 0 ? 0 : -1;
818
+ }
819
+ #define SDL_size_add_overflow(a, b, ret) (_SDL_size_add_overflow_builtin(a, b, ret))
820
+ #endif
821
+
711
822
  /* Ends C function definitions when using C++ */
712
823
  #ifdef __cplusplus
713
824
  }
@@ -61,6 +61,8 @@ extern "C" {
61
61
  */
62
62
  #define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
63
63
 
64
+ typedef struct SDL_BlitMap SDL_BlitMap; /* this is an opaque type. */
65
+
64
66
  /**
65
67
  * \brief A collection of pixels used in software blitting.
66
68
  *
@@ -88,7 +90,7 @@ typedef struct SDL_Surface
88
90
  SDL_Rect clip_rect; /**< Read-only */
89
91
 
90
92
  /** info for fast blit mapping to other surfaces */
91
- struct SDL_BlitMap *map; /**< Private */
93
+ SDL_BlitMap *map; /**< Private */
92
94
 
93
95
  /** Reference count -- used when freeing surface */
94
96
  int refcount; /**< Read-mostly */
@@ -41,7 +41,7 @@ extern "C" {
41
41
 
42
42
 
43
43
  /* Platform specific functions for Windows */
44
- #ifdef __WIN32__
44
+ #if defined(__WIN32__) || defined(__GDK__)
45
45
 
46
46
  typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsigned int message, Uint64 wParam, Sint64 lParam);
47
47
 
@@ -55,6 +55,10 @@ typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsi
55
55
  */
56
56
  extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata);
57
57
 
58
+ #endif /* defined(__WIN32__) || defined(__GDK__) */
59
+
60
+ #if defined(__WIN32__) || defined(__WINGDK__)
61
+
58
62
  /**
59
63
  * Get the D3D9 adapter index that matches the specified display index.
60
64
  *
@@ -102,6 +106,30 @@ typedef struct ID3D11Device ID3D11Device;
102
106
  */
103
107
  extern DECLSPEC ID3D11Device* SDLCALL SDL_RenderGetD3D11Device(SDL_Renderer * renderer);
104
108
 
109
+ #endif /* defined(__WIN32__) || defined(__WINGDK__) */
110
+
111
+ #if defined(__WIN32__) || defined(__GDK__)
112
+
113
+ typedef struct ID3D12Device ID3D12Device;
114
+
115
+ /**
116
+ * Get the D3D12 device associated with a renderer.
117
+ *
118
+ * Once you are done using the device, you should release it to avoid a
119
+ * resource leak.
120
+ *
121
+ * \param renderer the renderer from which to get the associated D3D12 device
122
+ * \returns the D3D12 device associated with given renderer or NULL if it is
123
+ * not a D3D12 renderer; call SDL_GetError() for more information.
124
+ *
125
+ * \since This function is available since SDL 2.24.0.
126
+ */
127
+ extern DECLSPEC ID3D12Device* SDLCALL SDL_RenderGetD3D12Device(SDL_Renderer* renderer);
128
+
129
+ #endif /* defined(__WIN32__) || defined(__GDK__) */
130
+
131
+ #if defined(__WIN32__) || defined(__WINGDK__)
132
+
105
133
  /**
106
134
  * Get the DXGI Adapter and Output indices for the specified display index.
107
135
  *
@@ -122,8 +150,7 @@ extern DECLSPEC ID3D11Device* SDLCALL SDL_RenderGetD3D11Device(SDL_Renderer * re
122
150
  */
123
151
  extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *adapterIndex, int *outputIndex );
124
152
 
125
- #endif /* __WIN32__ */
126
-
153
+ #endif /* defined(__WIN32__) || defined(__WINGDK__) */
127
154
 
128
155
  /* Platform specific functions for Linux */
129
156
  #ifdef __LINUX__
@@ -178,7 +205,7 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID,
178
205
  * This function is only available on Apple iOS.
179
206
  *
180
207
  * For more information see:
181
- * [README-ios.md](https://hg.libsdl.org/SDL/file/default/docs/README-ios.md)
208
+ * https://github.com/libsdl-org/SDL/blob/main/docs/README-ios.md
182
209
  *
183
210
  * This functions is also accessible using the macro
184
211
  * SDL_iOSSetAnimationCallback() since SDL 2.0.4.
@@ -195,7 +222,7 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID,
195
222
  *
196
223
  * \sa SDL_iPhoneSetEventPump
197
224
  */
198
- extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
225
+ extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (SDLCALL *callback)(void*), void *callbackParam);
199
226
 
200
227
  #define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
201
228
 
@@ -425,6 +452,18 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permis
425
452
  */
426
453
  extern DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int duration, int gravity, int xoffset, int yoffset);
427
454
 
455
+ /**
456
+ * Send a user command to SDLActivity.
457
+ *
458
+ * Override "boolean onUnhandledMessage(Message msg)" to handle the message.
459
+ *
460
+ * \param command user command that must be greater or equal to 0x8000
461
+ * \param param user parameter
462
+ *
463
+ * \since This function is available since SDL 2.0.22.
464
+ */
465
+ extern DECLSPEC int SDLCALL SDL_AndroidSendMessage(Uint32 command, int param);
466
+
428
467
  #endif /* __ANDROID__ */
429
468
 
430
469
  /* Platform specific functions for WinRT */
@@ -520,7 +559,7 @@ extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path
520
559
  extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
521
560
 
522
561
  /**
523
- * Detects the device family of WinRT plattform at runtime.
562
+ * Detects the device family of WinRT platform at runtime.
524
563
  *
525
564
  * \returns a value from the SDL_WinRT_DeviceFamily enum.
526
565
  *
@@ -552,6 +591,27 @@ extern DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void);
552
591
  extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void);
553
592
  #endif
554
593
 
594
+ /* Functions used only by GDK */
595
+ #if defined(__GDK__)
596
+ typedef struct XTaskQueueObject * XTaskQueueHandle;
597
+
598
+ /**
599
+ * Gets a reference to the global async task queue handle for GDK,
600
+ * initializing if needed.
601
+ *
602
+ * Once you are done with the task queue, you should call
603
+ * XTaskQueueCloseHandle to reduce the reference count to avoid a resource
604
+ * leak.
605
+ *
606
+ * \param outTaskQueue a pointer to be filled in with task queue handle.
607
+ * \returns 0 if success, -1 if any error occurs.
608
+ *
609
+ * \since This function is available since SDL 2.24.0.
610
+ */
611
+ extern DECLSPEC int SDLCALL SDL_GDKGetTaskQueue(XTaskQueueHandle * outTaskQueue);
612
+
613
+ #endif
614
+
555
615
  /* Ends C function definitions when using C++ */
556
616
  #ifdef __cplusplus
557
617
  }
@@ -298,6 +298,8 @@ struct SDL_SysWMinfo
298
298
  struct wl_egl_window *egl_window; /**< Wayland EGL window (native window) */
299
299
  struct xdg_surface *xdg_surface; /**< Wayland xdg surface (window manager handle) */
300
300
  struct xdg_toplevel *xdg_toplevel; /**< Wayland xdg toplevel role */
301
+ struct xdg_popup *xdg_popup; /**< Wayland xdg popup role */
302
+ struct xdg_positioner *xdg_positioner; /**< Wayland xdg positioner, for popup */
301
303
  } wl;
302
304
  #endif
303
305
  #if defined(SDL_VIDEO_DRIVER_MIR) /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
@@ -50,6 +50,7 @@
50
50
  #define VERBOSE_RENDER 0x00000004
51
51
  #define VERBOSE_EVENT 0x00000008
52
52
  #define VERBOSE_AUDIO 0x00000010
53
+ #define VERBOSE_MOTION 0x00000020
53
54
 
54
55
  typedef struct
55
56
  {
@@ -38,7 +38,8 @@ extern "C" {
38
38
 
39
39
  /* Function prototypes */
40
40
 
41
- #define FONT_CHARACTER_SIZE 8
41
+ #define FONT_CHARACTER_SIZE 8
42
+ #define FONT_LINE_HEIGHT (FONT_CHARACTER_SIZE + 2)
42
43
 
43
44
  /**
44
45
  * \brief Draw a string in the currently set font.
@@ -50,10 +51,12 @@ extern "C" {
50
51
  *
51
52
  * \returns 0 on success, -1 on failure.
52
53
  */
53
- int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c);
54
+ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c);
54
55
 
55
56
  /**
56
- * \brief Draw a string in the currently set font.
57
+ * \brief Draw a UTF-8 string in the currently set font.
58
+ *
59
+ * The font currently only supports characters in the Basic Latin and Latin-1 Supplement sets.
57
60
  *
58
61
  * \param renderer The renderer to draw on.
59
62
  * \param x The X coordinate of the upper left corner of the string.
@@ -64,6 +67,90 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c);
64
67
  */
65
68
  int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s);
66
69
 
70
+ /**
71
+ * \brief Data used for multi-line text output
72
+ */
73
+ typedef struct SDLTest_TextWindow
74
+ {
75
+ SDL_Rect rect;
76
+ int current;
77
+ int numlines;
78
+ char **lines;
79
+ } SDLTest_TextWindow;
80
+
81
+ /**
82
+ * \brief Create a multi-line text output window
83
+ *
84
+ * \param x The X coordinate of the upper left corner of the window.
85
+ * \param y The Y coordinate of the upper left corner of the window.
86
+ * \param w The width of the window (currently ignored)
87
+ * \param h The height of the window (currently ignored)
88
+ *
89
+ * \returns the new window, or NULL on failure.
90
+ *
91
+ * \since This function is available since SDL 2.24.0
92
+ */
93
+ SDLTest_TextWindow *SDLTest_TextWindowCreate(int x, int y, int w, int h);
94
+
95
+ /**
96
+ * \brief Display a multi-line text output window
97
+ *
98
+ * This function should be called every frame to display the text
99
+ *
100
+ * \param textwin The text output window
101
+ * \param renderer The renderer to use for display
102
+ *
103
+ * \since This function is available since SDL 2.24.0
104
+ */
105
+ void SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *renderer);
106
+
107
+ /**
108
+ * \brief Add text to a multi-line text output window
109
+ *
110
+ * Adds UTF-8 text to the end of the current text. The newline character starts a
111
+ * new line of text. The backspace character deletes the last character or, if the
112
+ * line is empty, deletes the line and goes to the end of the previous line.
113
+ *
114
+ * \param textwin The text output window
115
+ * \param fmt A printf() style format string
116
+ * \param ... additional parameters matching % tokens in the `fmt` string, if any
117
+ *
118
+ * \since This function is available since SDL 2.24.0
119
+ */
120
+ void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
121
+
122
+ /**
123
+ * \brief Add text to a multi-line text output window
124
+ *
125
+ * Adds UTF-8 text to the end of the current text. The newline character starts a
126
+ * new line of text. The backspace character deletes the last character or, if the
127
+ * line is empty, deletes the line and goes to the end of the previous line.
128
+ *
129
+ * \param textwin The text output window
130
+ * \param text The text to add to the window
131
+ * \param len The length, in bytes, of the text to add to the window
132
+ *
133
+ * \since This function is available since SDL 2.24.0
134
+ */
135
+ void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char *text, size_t len);
136
+
137
+ /**
138
+ * \brief Clear the text in a multi-line text output window
139
+ *
140
+ * \param textwin The text output window
141
+ *
142
+ * \since This function is available since SDL 2.24.0
143
+ */
144
+ void SDLTest_TextWindowClear(SDLTest_TextWindow *textwin);
145
+
146
+ /**
147
+ * \brief Free the storage associated with a multi-line text output window
148
+ *
149
+ * \param textwin The text output window
150
+ *
151
+ * \since This function is available since SDL 2.24.0
152
+ */
153
+ void SDLTest_TextWindowDestroy(SDLTest_TextWindow *textwin);
67
154
 
68
155
  /**
69
156
  * \brief Cleanup textures used by font drawing functions.