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
@@ -85,6 +85,16 @@ typedef struct SDL_RendererInfo
85
85
  int max_texture_height; /**< The maximum texture height */
86
86
  } SDL_RendererInfo;
87
87
 
88
+ /**
89
+ * \brief The scaling mode for a texture.
90
+ */
91
+ typedef enum
92
+ {
93
+ SDL_ScaleModeNearest, /**< nearest pixel sampling */
94
+ SDL_ScaleModeLinear, /**< linear filtering */
95
+ SDL_ScaleModeBest /**< anisotropic filtering */
96
+ } SDL_ScaleMode;
97
+
88
98
  /**
89
99
  * \brief The access pattern allowed for a texture.
90
100
  */
@@ -366,6 +376,35 @@ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
366
376
  extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
367
377
  SDL_BlendMode *blendMode);
368
378
 
379
+ /**
380
+ * \brief Set the scale mode used for texture scale operations.
381
+ *
382
+ * \param texture The texture to update.
383
+ * \param scaleMode ::SDL_ScaleMode to use for texture scaling.
384
+ *
385
+ * \return 0 on success, or -1 if the texture is not valid.
386
+ *
387
+ * \note If the scale mode is not supported, the closest supported mode is
388
+ * chosen.
389
+ *
390
+ * \sa SDL_GetTextureScaleMode()
391
+ */
392
+ extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture,
393
+ SDL_ScaleMode scaleMode);
394
+
395
+ /**
396
+ * \brief Get the scale mode used for texture scale operations.
397
+ *
398
+ * \param texture The texture to query.
399
+ * \param scaleMode A pointer filled in with the current scale mode.
400
+ *
401
+ * \return 0 on success, or -1 if the texture is not valid.
402
+ *
403
+ * \sa SDL_SetTextureScaleMode()
404
+ */
405
+ extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture,
406
+ SDL_ScaleMode *scaleMode);
407
+
369
408
  /**
370
409
  * \brief Update the given texture rectangle with new pixel data.
371
410
  *
@@ -430,10 +469,31 @@ extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
430
469
  const SDL_Rect * rect,
431
470
  void **pixels, int *pitch);
432
471
 
472
+ /**
473
+ * \brief Lock a portion of the texture for write-only pixel access.
474
+ * Expose it as a SDL surface.
475
+ *
476
+ * \param texture The texture to lock for access, which was created with
477
+ * ::SDL_TEXTUREACCESS_STREAMING.
478
+ * \param rect A pointer to the rectangle to lock for access. If the rect
479
+ * is NULL, the entire texture will be locked.
480
+ * \param surface This is filled in with a SDL surface representing the locked area
481
+ * Surface is freed internally after calling SDL_UnlockTexture or SDL_DestroyTexture.
482
+ *
483
+ * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
484
+ *
485
+ * \sa SDL_UnlockTexture()
486
+ */
487
+ extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture,
488
+ const SDL_Rect *rect,
489
+ SDL_Surface **surface);
490
+
433
491
  /**
434
492
  * \brief Unlock a texture, uploading the changes to video memory, if needed.
493
+ * If SDL_LockTextureToSurface() was called for locking, the SDL surface is freed.
435
494
  *
436
495
  * \sa SDL_LockTexture()
496
+ * \sa SDL_LockTextureToSurface()
437
497
  */
438
498
  extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
439
499
 
@@ -558,8 +618,8 @@ extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
558
618
  * \brief Set the clip rectangle for the current target.
559
619
  *
560
620
  * \param renderer The renderer for which clip rectangle should be set.
561
- * \param rect A pointer to the rectangle to set as the clip rectangle, or
562
- * NULL to disable clipping.
621
+ * \param rect A pointer to the rectangle to set as the clip rectangle,
622
+ * relative to the viewport, or NULL to disable clipping.
563
623
  *
564
624
  * \return 0 on success, or -1 on error
565
625
  *
@@ -1,2 +1,2 @@
1
- #define SDL_REVISION "hg-12952:bc90ce38f1e2"
2
- #define SDL_REVISION_NUMBER 12952
1
+ #define SDL_REVISION "hg-14525:e52d96ea04fc"
2
+ #define SDL_REVISION_NUMBER 14525
@@ -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
@@ -96,15 +96,7 @@ typedef struct SDL_RWops
96
96
  #if defined(__ANDROID__)
97
97
  struct
98
98
  {
99
- void *fileNameRef;
100
- void *inputStreamRef;
101
- void *readableByteChannelRef;
102
- void *readMethod;
103
- void *assetFileDescriptorRef;
104
- long position;
105
- long size;
106
- long offset;
107
- int fd;
99
+ void *asset;
108
100
  } androidio;
109
101
  #elif defined(__WIN32__)
110
102
  struct
@@ -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
@@ -78,14 +78,16 @@ typedef enum
78
78
  * Accelerometer sensor
79
79
  *
80
80
  * The accelerometer returns the current acceleration in SI meters per
81
- * second squared. This includes gravity, so a device at rest will have
82
- * an acceleration of SDL_STANDARD_GRAVITY straight down.
81
+ * second squared. This measurement includes the force of gravity, so
82
+ * a device at rest will have an value of SDL_STANDARD_GRAVITY away
83
+ * from the center of the earth.
83
84
  *
84
85
  * values[0]: Acceleration on the x axis
85
86
  * values[1]: Acceleration on the y axis
86
87
  * values[2]: Acceleration on the z axis
87
88
  *
88
- * For phones held in portrait mode, the axes are defined as follows:
89
+ * For phones held in portrait mode and game controllers held in front of you,
90
+ * the axes are defined as follows:
89
91
  * -X ... +X : left ... right
90
92
  * -Y ... +Y : bottom ... top
91
93
  * -Z ... +Z : farther ... closer
@@ -105,22 +107,36 @@ typedef enum
105
107
  * see positive rotation on that axis when it appeared to be rotating
106
108
  * counter-clockwise.
107
109
  *
108
- * values[0]: Angular speed around the x axis
109
- * values[1]: Angular speed around the y axis
110
- * values[2]: Angular speed around the z axis
110
+ * values[0]: Angular speed around the x axis (pitch)
111
+ * values[1]: Angular speed around the y axis (yaw)
112
+ * values[2]: Angular speed around the z axis (roll)
111
113
  *
112
- * For phones held in portrait mode, the axes are defined as follows:
114
+ * For phones held in portrait mode and game controllers held in front of you,
115
+ * the axes are defined as follows:
113
116
  * -X ... +X : left ... right
114
117
  * -Y ... +Y : bottom ... top
115
118
  * -Z ... +Z : farther ... closer
116
119
  *
117
- * The axis data is not changed when the phone is rotated.
120
+ * The axis data is not changed when the phone or controller is rotated.
118
121
  *
119
122
  * \sa SDL_GetDisplayOrientation()
120
123
  */
121
124
 
122
125
  /* Function prototypes */
123
126
 
127
+ /**
128
+ * Locking for multi-threaded access to the sensor API
129
+ *
130
+ * If you are using the sensor API or handling events from multiple threads
131
+ * you should use these locking functions to protect access to the sensors.
132
+ *
133
+ * In particular, you are guaranteed that the sensor list won't change, so
134
+ * the API functions that take a sensor index will be valid, and sensor
135
+ * events will not be delivered.
136
+ */
137
+ extern DECLSPEC void SDLCALL SDL_LockSensors(void);
138
+ extern DECLSPEC void SDLCALL SDL_UnlockSensors(void);
139
+
124
140
  /**
125
141
  * \brief Count the number of sensors attached to the system right now
126
142
  */
@@ -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
@@ -30,6 +30,12 @@
30
30
 
31
31
  #include "SDL_config.h"
32
32
 
33
+ #ifdef __APPLE__
34
+ #ifndef _DARWIN_C_SOURCE
35
+ #define _DARWIN_C_SOURCE 1 /* for memset_pattern4() */
36
+ #endif
37
+ #endif
38
+
33
39
  #ifdef HAVE_SYS_TYPES_H
34
40
  #include <sys/types.h>
35
41
  #endif
@@ -408,18 +414,25 @@ extern DECLSPEC int SDLCALL SDL_abs(int x);
408
414
 
409
415
  extern DECLSPEC int SDLCALL SDL_isdigit(int x);
410
416
  extern DECLSPEC int SDLCALL SDL_isspace(int x);
417
+ extern DECLSPEC int SDLCALL SDL_isupper(int x);
418
+ extern DECLSPEC int SDLCALL SDL_islower(int x);
411
419
  extern DECLSPEC int SDLCALL SDL_toupper(int x);
412
420
  extern DECLSPEC int SDLCALL SDL_tolower(int x);
413
421
 
422
+ extern DECLSPEC Uint32 SDLCALL SDL_crc32(Uint32 crc, const void *data, size_t len);
423
+
414
424
  extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len);
415
425
 
416
426
  #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
417
427
  #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
428
+ #define SDL_zeroa(x) SDL_memset((x), 0, sizeof((x)))
418
429
 
419
430
  /* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
420
431
  SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
421
432
  {
422
- #if defined(__GNUC__) && defined(i386)
433
+ #ifdef __APPLE__
434
+ memset_pattern4(dst, &val, dwords * 4);
435
+ #elif defined(__GNUC__) && defined(i386)
423
436
  int u0, u1, u2;
424
437
  __asm__ __volatile__ (
425
438
  "cld \n\t"
@@ -450,11 +463,16 @@ extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_
450
463
  extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
451
464
  extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
452
465
 
453
- extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr);
454
466
  extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
455
467
  extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
456
468
  extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
469
+ extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr);
470
+ extern DECLSPEC wchar_t *SDLCALL SDL_wcsstr(const wchar_t *haystack, const wchar_t *needle);
471
+
457
472
  extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
473
+ extern DECLSPEC int SDLCALL SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen);
474
+ extern DECLSPEC int SDLCALL SDL_wcscasecmp(const wchar_t *str1, const wchar_t *str2);
475
+ extern DECLSPEC int SDLCALL SDL_wcsncasecmp(const wchar_t *str1, const wchar_t *str2, size_t len);
458
476
 
459
477
  extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
460
478
  extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
@@ -467,6 +485,7 @@ extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
467
485
  extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
468
486
  extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
469
487
  extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
488
+ extern DECLSPEC char *SDLCALL SDL_strtokr(char *s1, const char *s2, char **saveptr);
470
489
  extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
471
490
 
472
491
  extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
@@ -520,6 +539,8 @@ extern DECLSPEC double SDLCALL SDL_fabs(double x);
520
539
  extern DECLSPEC float SDLCALL SDL_fabsf(float x);
521
540
  extern DECLSPEC double SDLCALL SDL_floor(double x);
522
541
  extern DECLSPEC float SDLCALL SDL_floorf(float x);
542
+ extern DECLSPEC double SDLCALL SDL_trunc(double x);
543
+ extern DECLSPEC float SDLCALL SDL_truncf(float x);
523
544
  extern DECLSPEC double SDLCALL SDL_fmod(double x, double y);
524
545
  extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y);
525
546
  extern DECLSPEC double SDLCALL SDL_log(double x);
@@ -566,6 +587,17 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
566
587
  /* force builds using Clang's static analysis tools to use literal C runtime
567
588
  here, since there are possibly tests that are ineffective otherwise. */
568
589
  #if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
590
+
591
+ /* The analyzer knows about strlcpy even when the system doesn't provide it */
592
+ #ifndef HAVE_STRLCPY
593
+ size_t strlcpy(char* dst, const char* src, size_t size);
594
+ #endif
595
+
596
+ /* The analyzer knows about strlcat even when the system doesn't provide it */
597
+ #ifndef HAVE_STRLCAT
598
+ size_t strlcat(char* dst, const char* src, size_t size);
599
+ #endif
600
+
569
601
  #define SDL_malloc malloc
570
602
  #define SDL_calloc calloc
571
603
  #define SDL_realloc realloc
@@ -574,15 +606,23 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
574
606
  #define SDL_memcpy memcpy
575
607
  #define SDL_memmove memmove
576
608
  #define SDL_memcmp memcmp
577
- #define SDL_strlen strlen
578
609
  #define SDL_strlcpy strlcpy
579
610
  #define SDL_strlcat strlcat
611
+ #define SDL_strlen strlen
612
+ #define SDL_wcslen wcslen
613
+ #define SDL_wcslcpy wcslcpy
614
+ #define SDL_wcslcat wcslcat
580
615
  #define SDL_strdup strdup
616
+ #define SDL_wcsdup wcsdup
581
617
  #define SDL_strchr strchr
582
618
  #define SDL_strrchr strrchr
583
619
  #define SDL_strstr strstr
620
+ #define SDL_wcsstr wcsstr
621
+ #define SDL_strtokr strtok_r
584
622
  #define SDL_strcmp strcmp
623
+ #define SDL_wcscmp wcscmp
585
624
  #define SDL_strncmp strncmp
625
+ #define SDL_wcsncmp wcsncmp
586
626
  #define SDL_strcasecmp strcasecmp
587
627
  #define SDL_strncasecmp strncasecmp
588
628
  #define SDL_sscanf sscanf
@@ -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
@@ -80,7 +80,9 @@ typedef struct SDL_Surface
80
80
 
81
81
  /** information needed for surfaces requiring locks */
82
82
  int locked; /**< Read-only */
83
- void *lock_data; /**< Read-only */
83
+
84
+ /** list of BlitMap that hold a reference to this surface */
85
+ void *list_blitmap; /**< Private */
84
86
 
85
87
  /** clipping information */
86
88
  SDL_Rect clip_rect; /**< Read-only */
@@ -235,6 +237,13 @@ extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
235
237
  extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
236
238
  int flag);
237
239
 
240
+ /**
241
+ * \brief Returns whether the surface is RLE enabled
242
+ *
243
+ * \return SDL_TRUE if the surface is RLE enabled, or SDL_FALSE if the surface is NULL or not RLE enabled
244
+ */
245
+ extern DECLSPEC SDL_bool SDLCALL SDL_HasSurfaceRLE(SDL_Surface * surface);
246
+
238
247
  /**
239
248
  * \brief Sets the color key (transparent pixel) in a blittable surface.
240
249
  *
@@ -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
@@ -89,7 +89,7 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int prio
89
89
  #endif /* __LINUX__ */
90
90
 
91
91
  /* Platform specific functions for iOS */
92
- #if defined(__IPHONEOS__) && __IPHONEOS__
92
+ #ifdef __IPHONEOS__
93
93
 
94
94
  #define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
95
95
  extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
@@ -101,7 +101,7 @@ extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
101
101
 
102
102
 
103
103
  /* Platform specific functions for Android */
104
- #if defined(__ANDROID__) && __ANDROID__
104
+ #ifdef __ANDROID__
105
105
 
106
106
  /**
107
107
  \brief Get the JNI environment for the current thread
@@ -120,6 +120,33 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void);
120
120
  */
121
121
  extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
122
122
 
123
+ /**
124
+ \brief Return API level of the current device
125
+
126
+ API level 30: Android 11
127
+ API level 29: Android 10
128
+ API level 28: Android 9
129
+ API level 27: Android 8.1
130
+ API level 26: Android 8.0
131
+ API level 25: Android 7.1
132
+ API level 24: Android 7.0
133
+ API level 23: Android 6.0
134
+ API level 22: Android 5.1
135
+ API level 21: Android 5.0
136
+ API level 20: Android 4.4W
137
+ API level 19: Android 4.4
138
+ API level 18: Android 4.3
139
+ API level 17: Android 4.2
140
+ API level 16: Android 4.1
141
+ API level 15: Android 4.0.3
142
+ API level 14: Android 4.0
143
+ API level 13: Android 3.2
144
+ API level 12: Android 3.1
145
+ API level 11: Android 3.0
146
+ API level 10: Android 2.3.3
147
+ */
148
+ extern DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void);
149
+
123
150
  /**
124
151
  \brief Return true if the application is running on Android TV
125
152
  */
@@ -172,10 +199,18 @@ extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void);
172
199
  */
173
200
  extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
174
201
 
202
+ /**
203
+ \brief Request permissions at runtime.
204
+
205
+ This blocks the calling thread until the permission is granted or
206
+ denied. Returns SDL_TRUE if the permission was granted.
207
+ */
208
+ extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permission);
209
+
175
210
  #endif /* __ANDROID__ */
176
211
 
177
212
  /* Platform specific functions for WinRT */
178
- #if defined(__WINRT__) && __WINRT__
213
+ #ifdef __WINRT__
179
214
 
180
215
  /**
181
216
  * \brief WinRT / Windows Phone path types
@@ -268,6 +303,17 @@ extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
268
303
  */
269
304
  extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void);
270
305
 
306
+ /* Functions used by iOS application delegates to notify SDL about state changes */
307
+ extern DECLSPEC void SDLCALL SDL_OnApplicationWillTerminate(void);
308
+ extern DECLSPEC void SDLCALL SDL_OnApplicationDidReceiveMemoryWarning(void);
309
+ extern DECLSPEC void SDLCALL SDL_OnApplicationWillResignActive(void);
310
+ extern DECLSPEC void SDLCALL SDL_OnApplicationDidEnterBackground(void);
311
+ extern DECLSPEC void SDLCALL SDL_OnApplicationWillEnterForeground(void);
312
+ extern DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void);
313
+ #ifdef __IPHONEOS__
314
+ extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void);
315
+ #endif
316
+
271
317
  /* Ends C function definitions when using C++ */
272
318
  #ifdef __cplusplus
273
319
  }