ruby2d 0.9.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. checksums.yaml +4 -4
  2. data/assets/README.md +7 -8
  3. data/assets/Rakefile +85 -0
  4. data/assets/include/SDL2/SDL.h +4 -1
  5. data/assets/include/SDL2/SDL_assert.h +3 -1
  6. data/assets/include/SDL2/SDL_atomic.h +20 -2
  7. data/assets/include/SDL2/SDL_audio.h +47 -14
  8. data/assets/include/SDL2/SDL_bits.h +10 -1
  9. data/assets/include/SDL2/SDL_blendmode.h +10 -7
  10. data/assets/include/SDL2/SDL_clipboard.h +1 -1
  11. data/assets/include/SDL2/SDL_config.h +24 -390
  12. data/assets/include/SDL2/SDL_config_android.h +182 -0
  13. data/assets/include/SDL2/SDL_config_iphoneos.h +207 -0
  14. data/assets/include/SDL2/SDL_config_macosx.h +266 -0
  15. data/assets/include/SDL2/SDL_config_minimal.h +85 -0
  16. data/assets/include/SDL2/SDL_config_os2.h +188 -0
  17. data/assets/include/SDL2/SDL_config_pandora.h +135 -0
  18. data/assets/include/SDL2/SDL_config_psp.h +165 -0
  19. data/assets/include/SDL2/SDL_config_windows.h +288 -0
  20. data/assets/include/SDL2/SDL_config_winrt.h +243 -0
  21. data/assets/include/SDL2/SDL_config_wiz.h +149 -0
  22. data/assets/include/SDL2/SDL_copying.h +20 -0
  23. data/assets/include/SDL2/SDL_cpuinfo.h +119 -8
  24. data/assets/include/SDL2/SDL_egl.h +4 -1
  25. data/assets/include/SDL2/SDL_endian.h +6 -3
  26. data/assets/include/SDL2/SDL_error.h +38 -2
  27. data/assets/include/SDL2/SDL_events.h +67 -28
  28. data/assets/include/SDL2/SDL_filesystem.h +1 -1
  29. data/assets/include/SDL2/SDL_gamecontroller.h +160 -9
  30. data/assets/include/SDL2/SDL_gesture.h +1 -1
  31. data/assets/include/SDL2/SDL_haptic.h +10 -1
  32. data/assets/include/SDL2/SDL_hints.h +460 -17
  33. data/assets/include/SDL2/SDL_image.h +2 -2
  34. data/assets/include/SDL2/SDL_joystick.h +115 -24
  35. data/assets/include/SDL2/SDL_keyboard.h +1 -1
  36. data/assets/include/SDL2/SDL_keycode.h +11 -9
  37. data/assets/include/SDL2/SDL_loadso.h +1 -1
  38. data/assets/include/SDL2/SDL_locale.h +101 -0
  39. data/assets/include/SDL2/SDL_log.h +3 -3
  40. data/assets/include/SDL2/SDL_main.h +28 -16
  41. data/assets/include/SDL2/SDL_messagebox.h +6 -4
  42. data/assets/include/SDL2/SDL_metal.h +117 -0
  43. data/assets/include/SDL2/SDL_misc.h +75 -0
  44. data/assets/include/SDL2/SDL_mouse.h +1 -1
  45. data/assets/include/SDL2/SDL_mutex.h +1 -1
  46. data/assets/include/SDL2/SDL_name.h +1 -1
  47. data/assets/include/SDL2/SDL_opengl.h +1 -1
  48. data/assets/include/SDL2/SDL_opengl_glext.h +3 -0
  49. data/assets/include/SDL2/SDL_opengles.h +1 -1
  50. data/assets/include/SDL2/SDL_opengles2.h +1 -1
  51. data/assets/include/SDL2/SDL_pixels.h +27 -18
  52. data/assets/include/SDL2/SDL_platform.h +1 -1
  53. data/assets/include/SDL2/SDL_power.h +1 -1
  54. data/assets/include/SDL2/SDL_quit.h +1 -1
  55. data/assets/include/SDL2/SDL_rect.h +29 -3
  56. data/assets/include/SDL2/SDL_render.h +230 -3
  57. data/assets/include/SDL2/SDL_revision.h +2 -2
  58. data/assets/include/SDL2/SDL_rwops.h +51 -22
  59. data/assets/include/SDL2/SDL_scancode.h +2 -2
  60. data/assets/include/SDL2/SDL_sensor.h +28 -12
  61. data/assets/include/SDL2/SDL_shape.h +1 -1
  62. data/assets/include/SDL2/SDL_stdinc.h +44 -4
  63. data/assets/include/SDL2/SDL_surface.h +12 -2
  64. data/assets/include/SDL2/SDL_system.h +50 -4
  65. data/assets/include/SDL2/SDL_syswm.h +39 -9
  66. data/assets/include/SDL2/SDL_test.h +1 -1
  67. data/assets/include/SDL2/SDL_test_assert.h +1 -1
  68. data/assets/include/SDL2/SDL_test_common.h +32 -2
  69. data/assets/include/SDL2/SDL_test_compare.h +1 -1
  70. data/assets/include/SDL2/SDL_test_crc32.h +1 -1
  71. data/assets/include/SDL2/SDL_test_font.h +1 -1
  72. data/assets/include/SDL2/SDL_test_fuzzer.h +1 -1
  73. data/assets/include/SDL2/SDL_test_harness.h +1 -1
  74. data/assets/include/SDL2/SDL_test_images.h +1 -1
  75. data/assets/include/SDL2/SDL_test_log.h +1 -1
  76. data/assets/include/SDL2/SDL_test_md5.h +1 -1
  77. data/assets/include/SDL2/SDL_test_memory.h +3 -3
  78. data/assets/include/SDL2/SDL_test_random.h +1 -1
  79. data/assets/include/SDL2/SDL_thread.h +34 -11
  80. data/assets/include/SDL2/SDL_timer.h +1 -1
  81. data/assets/include/SDL2/SDL_touch.h +17 -1
  82. data/assets/include/SDL2/SDL_types.h +1 -1
  83. data/assets/include/SDL2/SDL_version.h +2 -2
  84. data/assets/include/SDL2/SDL_video.h +11 -5
  85. data/assets/include/SDL2/SDL_vulkan.h +9 -11
  86. data/assets/include/SDL2/begin_code.h +8 -9
  87. data/assets/include/SDL2/close_code.h +4 -1
  88. data/assets/macos/lib/libFLAC.a +0 -0
  89. data/assets/macos/lib/libSDL2.a +0 -0
  90. data/assets/macos/lib/libSDL2_image.a +0 -0
  91. data/assets/macos/lib/libSDL2_mixer.a +0 -0
  92. data/assets/macos/lib/libSDL2_ttf.a +0 -0
  93. data/assets/macos/lib/libfreetype.a +0 -0
  94. data/assets/macos/lib/libjpeg.a +0 -0
  95. data/assets/macos/lib/libmpg123.a +0 -0
  96. data/assets/macos/lib/libogg.a +0 -0
  97. data/assets/macos/lib/libpng16.a +0 -0
  98. data/assets/macos/lib/libtiff.a +0 -0
  99. data/assets/macos/lib/libvorbis.a +0 -0
  100. data/assets/macos/lib/libvorbisfile.a +0 -0
  101. data/assets/macos/lib/libwebp.a +0 -0
  102. data/assets/mingw/bin/SDL2.dll +0 -0
  103. data/assets/mingw/bin/SDL2_image.dll +0 -0
  104. data/assets/mingw/bin/libpng16-16.dll +0 -0
  105. data/assets/mingw/bin/libtiff-5.dll +0 -0
  106. data/assets/mingw/bin/libwebp-7.dll +0 -0
  107. data/assets/mingw/lib/libSDL2.a +0 -0
  108. data/assets/mingw/lib/libSDL2.dll.a +0 -0
  109. data/assets/mingw/lib/libSDL2_image.a +0 -0
  110. data/assets/mingw/lib/libSDL2_image.dll.a +0 -0
  111. data/assets/mingw/lib/libSDL2_test.a +0 -0
  112. data/assets/mingw/lib/libSDL2main.a +0 -0
  113. data/bin/ruby2d +2 -1
  114. data/{assets/linux/simple2d/src/simple2d.c → ext/ruby2d/common.c} +32 -32
  115. data/{assets/linux/simple2d/src → ext/ruby2d}/controllers.c +17 -17
  116. data/ext/ruby2d/extconf.rb +6 -36
  117. data/{assets/linux/simple2d/src → ext/ruby2d}/gl.c +106 -85
  118. data/{assets/linux/simple2d/src → ext/ruby2d}/gl2.c +35 -20
  119. data/{assets/linux/simple2d/src → ext/ruby2d}/gl3.c +146 -58
  120. data/{assets/linux/simple2d/src → ext/ruby2d}/gles.c +41 -26
  121. data/{assets/linux/simple2d/src → ext/ruby2d}/image.c +16 -16
  122. data/{assets/linux/simple2d/src → ext/ruby2d}/input.c +8 -8
  123. data/{assets/linux/simple2d/src → ext/ruby2d}/music.c +30 -17
  124. data/ext/ruby2d/ruby2d.c +427 -290
  125. data/ext/ruby2d/ruby2d.h +789 -0
  126. data/{assets/linux/simple2d/src → ext/ruby2d}/shapes.c +18 -18
  127. data/ext/ruby2d/sound.c +118 -0
  128. data/{assets/linux/simple2d/src → ext/ruby2d}/sprite.c +16 -16
  129. data/{assets/linux/simple2d/src → ext/ruby2d}/text.c +22 -22
  130. data/ext/ruby2d/tileset.c +30 -0
  131. data/{assets/linux/simple2d/src → ext/ruby2d}/window.c +71 -60
  132. data/lib/ruby2d.rb +5 -2
  133. data/lib/ruby2d/circle.rb +18 -2
  134. data/lib/ruby2d/cli/build.rb +3 -8
  135. data/lib/ruby2d/cli/colorize.rb +10 -0
  136. data/lib/ruby2d/dsl.rb +16 -9
  137. data/lib/ruby2d/entity.rb +17 -0
  138. data/lib/ruby2d/font.rb +4 -3
  139. data/lib/ruby2d/image.rb +24 -1
  140. data/lib/ruby2d/line.rb +20 -0
  141. data/lib/ruby2d/music.rb +5 -0
  142. data/lib/ruby2d/pixel.rb +17 -0
  143. data/lib/ruby2d/quad.rb +18 -0
  144. data/lib/ruby2d/rectangle.rb +11 -2
  145. data/lib/ruby2d/renderable.rb +4 -8
  146. data/lib/ruby2d/sound.rb +5 -0
  147. data/lib/ruby2d/sprite.rb +35 -3
  148. data/lib/ruby2d/square.rb +9 -0
  149. data/lib/ruby2d/text.rb +22 -1
  150. data/lib/ruby2d/tileset.rb +69 -0
  151. data/lib/ruby2d/triangle.rb +16 -0
  152. data/lib/ruby2d/version.rb +1 -1
  153. data/lib/ruby2d/window.rb +249 -22
  154. metadata +41 -27
  155. data/assets/include/simple2d.h +0 -735
  156. data/assets/linux/simple2d/Makefile +0 -250
  157. data/assets/linux/simple2d/bin/simple2d.sh +0 -1249
  158. data/assets/linux/simple2d/include/simple2d.h +0 -735
  159. data/assets/linux/simple2d/src/sound.c +0 -56
  160. data/assets/macos/lib/libsimple2d.a +0 -0
  161. data/assets/mingw/lib/libsimple2d.a +0 -0
  162. data/lib/ruby2d/colorize.rb +0 -10
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 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-2018 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-2018 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-2018 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
@@ -40,7 +40,7 @@ extern "C" {
40
40
  #endif
41
41
 
42
42
  /**
43
- * \brief The structure that defines a point
43
+ * \brief The structure that defines a point (integer)
44
44
  *
45
45
  * \sa SDL_EnclosePoints
46
46
  * \sa SDL_PointInRect
@@ -52,7 +52,20 @@ typedef struct SDL_Point
52
52
  } SDL_Point;
53
53
 
54
54
  /**
55
- * \brief A rectangle, with the origin at the upper left.
55
+ * \brief The structure that defines a point (floating point)
56
+ *
57
+ * \sa SDL_EnclosePoints
58
+ * \sa SDL_PointInRect
59
+ */
60
+ typedef struct SDL_FPoint
61
+ {
62
+ float x;
63
+ float y;
64
+ } SDL_FPoint;
65
+
66
+
67
+ /**
68
+ * \brief A rectangle, with the origin at the upper left (integer).
56
69
  *
57
70
  * \sa SDL_RectEmpty
58
71
  * \sa SDL_RectEquals
@@ -67,6 +80,19 @@ typedef struct SDL_Rect
67
80
  int w, h;
68
81
  } SDL_Rect;
69
82
 
83
+
84
+ /**
85
+ * \brief A rectangle, with the origin at the upper left (floating point).
86
+ */
87
+ typedef struct SDL_FRect
88
+ {
89
+ float x;
90
+ float y;
91
+ float w;
92
+ float h;
93
+ } SDL_FRect;
94
+
95
+
70
96
  /**
71
97
  * \brief Returns true if point resides inside a rectangle.
72
98
  */
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2018 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
  *
@@ -835,6 +895,148 @@ extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer,
835
895
  const SDL_Point *center,
836
896
  const SDL_RendererFlip flip);
837
897
 
898
+
899
+ /**
900
+ * \brief Draw a point on the current rendering target.
901
+ *
902
+ * \param renderer The renderer which should draw a point.
903
+ * \param x The x coordinate of the point.
904
+ * \param y The y coordinate of the point.
905
+ *
906
+ * \return 0 on success, or -1 on error
907
+ */
908
+ extern DECLSPEC int SDLCALL SDL_RenderDrawPointF(SDL_Renderer * renderer,
909
+ float x, float y);
910
+
911
+ /**
912
+ * \brief Draw multiple points on the current rendering target.
913
+ *
914
+ * \param renderer The renderer which should draw multiple points.
915
+ * \param points The points to draw
916
+ * \param count The number of points to draw
917
+ *
918
+ * \return 0 on success, or -1 on error
919
+ */
920
+ extern DECLSPEC int SDLCALL SDL_RenderDrawPointsF(SDL_Renderer * renderer,
921
+ const SDL_FPoint * points,
922
+ int count);
923
+
924
+ /**
925
+ * \brief Draw a line on the current rendering target.
926
+ *
927
+ * \param renderer The renderer which should draw a line.
928
+ * \param x1 The x coordinate of the start point.
929
+ * \param y1 The y coordinate of the start point.
930
+ * \param x2 The x coordinate of the end point.
931
+ * \param y2 The y coordinate of the end point.
932
+ *
933
+ * \return 0 on success, or -1 on error
934
+ */
935
+ extern DECLSPEC int SDLCALL SDL_RenderDrawLineF(SDL_Renderer * renderer,
936
+ float x1, float y1, float x2, float y2);
937
+
938
+ /**
939
+ * \brief Draw a series of connected lines on the current rendering target.
940
+ *
941
+ * \param renderer The renderer which should draw multiple lines.
942
+ * \param points The points along the lines
943
+ * \param count The number of points, drawing count-1 lines
944
+ *
945
+ * \return 0 on success, or -1 on error
946
+ */
947
+ extern DECLSPEC int SDLCALL SDL_RenderDrawLinesF(SDL_Renderer * renderer,
948
+ const SDL_FPoint * points,
949
+ int count);
950
+
951
+ /**
952
+ * \brief Draw a rectangle on the current rendering target.
953
+ *
954
+ * \param renderer The renderer which should draw a rectangle.
955
+ * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
956
+ *
957
+ * \return 0 on success, or -1 on error
958
+ */
959
+ extern DECLSPEC int SDLCALL SDL_RenderDrawRectF(SDL_Renderer * renderer,
960
+ const SDL_FRect * rect);
961
+
962
+ /**
963
+ * \brief Draw some number of rectangles on the current rendering target.
964
+ *
965
+ * \param renderer The renderer which should draw multiple rectangles.
966
+ * \param rects A pointer to an array of destination rectangles.
967
+ * \param count The number of rectangles.
968
+ *
969
+ * \return 0 on success, or -1 on error
970
+ */
971
+ extern DECLSPEC int SDLCALL SDL_RenderDrawRectsF(SDL_Renderer * renderer,
972
+ const SDL_FRect * rects,
973
+ int count);
974
+
975
+ /**
976
+ * \brief Fill a rectangle on the current rendering target with the drawing color.
977
+ *
978
+ * \param renderer The renderer which should fill a rectangle.
979
+ * \param rect A pointer to the destination rectangle, or NULL for the entire
980
+ * rendering target.
981
+ *
982
+ * \return 0 on success, or -1 on error
983
+ */
984
+ extern DECLSPEC int SDLCALL SDL_RenderFillRectF(SDL_Renderer * renderer,
985
+ const SDL_FRect * rect);
986
+
987
+ /**
988
+ * \brief Fill some number of rectangles on the current rendering target with the drawing color.
989
+ *
990
+ * \param renderer The renderer which should fill multiple rectangles.
991
+ * \param rects A pointer to an array of destination rectangles.
992
+ * \param count The number of rectangles.
993
+ *
994
+ * \return 0 on success, or -1 on error
995
+ */
996
+ extern DECLSPEC int SDLCALL SDL_RenderFillRectsF(SDL_Renderer * renderer,
997
+ const SDL_FRect * rects,
998
+ int count);
999
+
1000
+ /**
1001
+ * \brief Copy a portion of the texture to the current rendering target.
1002
+ *
1003
+ * \param renderer The renderer which should copy parts of a texture.
1004
+ * \param texture The source texture.
1005
+ * \param srcrect A pointer to the source rectangle, or NULL for the entire
1006
+ * texture.
1007
+ * \param dstrect A pointer to the destination rectangle, or NULL for the
1008
+ * entire rendering target.
1009
+ *
1010
+ * \return 0 on success, or -1 on error
1011
+ */
1012
+ extern DECLSPEC int SDLCALL SDL_RenderCopyF(SDL_Renderer * renderer,
1013
+ SDL_Texture * texture,
1014
+ const SDL_Rect * srcrect,
1015
+ const SDL_FRect * dstrect);
1016
+
1017
+ /**
1018
+ * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
1019
+ *
1020
+ * \param renderer The renderer which should copy parts of a texture.
1021
+ * \param texture The source texture.
1022
+ * \param srcrect A pointer to the source rectangle, or NULL for the entire
1023
+ * texture.
1024
+ * \param dstrect A pointer to the destination rectangle, or NULL for the
1025
+ * entire rendering target.
1026
+ * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
1027
+ * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2).
1028
+ * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
1029
+ *
1030
+ * \return 0 on success, or -1 on error
1031
+ */
1032
+ extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer,
1033
+ SDL_Texture * texture,
1034
+ const SDL_Rect * srcrect,
1035
+ const SDL_FRect * dstrect,
1036
+ const double angle,
1037
+ const SDL_FPoint *center,
1038
+ const SDL_RendererFlip flip);
1039
+
838
1040
  /**
839
1041
  * \brief Read pixels from the current rendering target.
840
1042
  *
@@ -876,6 +1078,31 @@ extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture);
876
1078
  */
877
1079
  extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer);
878
1080
 
1081
+ /**
1082
+ * \brief Force the rendering context to flush any pending commands to the
1083
+ * underlying rendering API.
1084
+ *
1085
+ * You do not need to (and in fact, shouldn't) call this function unless
1086
+ * you are planning to call into OpenGL/Direct3D/Metal/whatever directly
1087
+ * in addition to using an SDL_Renderer.
1088
+ *
1089
+ * This is for a very-specific case: if you are using SDL's render API,
1090
+ * you asked for a specific renderer backend (OpenGL, Direct3D, etc),
1091
+ * you set SDL_HINT_RENDER_BATCHING to "1", and you plan to make
1092
+ * OpenGL/D3D/whatever calls in addition to SDL render API calls. If all of
1093
+ * this applies, you should call SDL_RenderFlush() between calls to SDL's
1094
+ * render API and the low-level API you're using in cooperation.
1095
+ *
1096
+ * In all other cases, you can ignore this function. This is only here to
1097
+ * get maximum performance out of a specific situation. In all other cases,
1098
+ * SDL will do the right thing, perhaps at a performance loss.
1099
+ *
1100
+ * This function is first available in SDL 2.0.10, and is not needed in
1101
+ * 2.0.9 and earlier, as earlier versions did not queue rendering commands
1102
+ * at all, instead flushing them to the OS immediately.
1103
+ */
1104
+ extern DECLSPEC int SDLCALL SDL_RenderFlush(SDL_Renderer * renderer);
1105
+
879
1106
 
880
1107
  /**
881
1108
  * \brief Bind the texture to the current OpenGL/ES/ES2 context for use with
@@ -1,2 +1,2 @@
1
- #define SDL_REVISION "hg-12373:8feb5da6f2fb"
2
- #define SDL_REVISION_NUMBER 12373
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-2018 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
@@ -176,19 +168,48 @@ extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
176
168
  #define RW_SEEK_END 2 /**< Seek relative to the end of data */
177
169
 
178
170
  /**
179
- * \name Read/write macros
171
+ * Return the size of the file in this rwops, or -1 if unknown
172
+ */
173
+ extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context);
174
+
175
+ /**
176
+ * Seek to \c offset relative to \c whence, one of stdio's whence values:
177
+ * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
180
178
  *
181
- * Macros to easily read and write from an SDL_RWops structure.
179
+ * \return the final offset in the data stream, or -1 on error.
182
180
  */
183
- /* @{ */
184
- #define SDL_RWsize(ctx) (ctx)->size(ctx)
185
- #define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
186
- #define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
187
- #define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
188
- #define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
189
- #define SDL_RWclose(ctx) (ctx)->close(ctx)
190
- /* @} *//* Read/write macros */
181
+ extern DECLSPEC Sint64 SDLCALL SDL_RWseek(SDL_RWops *context,
182
+ Sint64 offset, int whence);
183
+
184
+ /**
185
+ * Return the current offset in the data stream, or -1 on error.
186
+ */
187
+ extern DECLSPEC Sint64 SDLCALL SDL_RWtell(SDL_RWops *context);
191
188
 
189
+ /**
190
+ * Read up to \c maxnum objects each of size \c size from the data
191
+ * stream to the area pointed at by \c ptr.
192
+ *
193
+ * \return the number of objects read, or 0 at error or end of file.
194
+ */
195
+ extern DECLSPEC size_t SDLCALL SDL_RWread(SDL_RWops *context,
196
+ void *ptr, size_t size, size_t maxnum);
197
+
198
+ /**
199
+ * Write exactly \c num objects each of size \c size from the area
200
+ * pointed at by \c ptr to data stream.
201
+ *
202
+ * \return the number of objects written, or 0 at error or end of file.
203
+ */
204
+ extern DECLSPEC size_t SDLCALL SDL_RWwrite(SDL_RWops *context,
205
+ const void *ptr, size_t size, size_t num);
206
+
207
+ /**
208
+ * Close and free an allocated SDL_RWops structure.
209
+ *
210
+ * \return 0 if successful or -1 on write error when flushing data.
211
+ */
212
+ extern DECLSPEC int SDLCALL SDL_RWclose(SDL_RWops *context);
192
213
 
193
214
  /**
194
215
  * Load all the data from an SDL data stream.
@@ -209,9 +230,17 @@ extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize,
209
230
  /**
210
231
  * Load an entire file.
211
232
  *
212
- * Convenience macro.
233
+ * The data is allocated with a zero byte at the end (null terminated)
234
+ *
235
+ * If \c datasize is not NULL, it is filled with the size of the data read.
236
+ *
237
+ * If \c freesrc is non-zero, the stream will be closed after being read.
238
+ *
239
+ * The data should be freed with SDL_free().
240
+ *
241
+ * \return the data, or NULL if there was an error.
213
242
  */
214
- #define SDL_LoadFile(file, datasize) SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1)
243
+ extern DECLSPEC void *SDLCALL SDL_LoadFile(const char *file, size_t *datasize);
215
244
 
216
245
  /**
217
246
  * \name Read endian functions