SDL2_wip.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. SDL2_wip.h: Some basic geometric primatives written using SDL2's
  3. RenderGeometry function
  4. Inspired by the work by:
  5. Copyright (C) 2012-2014 Andreas Schiffler
  6. Additions for BBC BASIC (C) 2016-2020 Richard Russell
  7. This software is provided 'as-is', without any express or implied
  8. warranty. In no event will the authors be held liable for any damages
  9. arising from the use of this software.
  10. Permission is granted to anyone to use this software for any purpose,
  11. including commercial applications, and to alter it and redistribute it
  12. freely, subject to the following restrictions:
  13. 1. The origin of this software must not be misrepresented; you must not
  14. claim that you wrote the original software. If you use this software
  15. in a product, an acknowledgment in the product documentation would be
  16. appreciated but is not required.
  17. 2. Altered source versions must be plainly marked as such, and must not be
  18. misrepresented as being the original software.
  19. 3. This notice may not be removed or altered from any source
  20. distribution.
  21. Andreas Schiffler -- aschiffler at ferzkopp dot net
  22. Richard Russell -- richard at rtrussell dot co dot uk
  23. Avon -- avon61002 at g mail dot com
  24. */
  25. #ifndef _SDL2_wip_h
  26. #define _SDL2_wip_h
  27. #include <math.h>
  28. #ifndef M_PI
  29. #define M_PI 3.1415926535897932384626433832795
  30. #endif
  31. #include <SDL.h>
  32. #ifdef __cplusplus
  33. extern "C"
  34. {
  35. #endif
  36. int point (SDL_Renderer *renderer, float x, float y, Uint8 r, Uint8 g,
  37. Uint8 b, Uint8 a);
  38. int lineRaw (SDL_Renderer *renderer, float x1, float y1, float x2, float y2,
  39. Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  40. int linesRaw (SDL_Renderer *renderer, float *vx, float *vy,
  41. Sint16 num_points);
  42. int rectRaw (SDL_Renderer *renderer, float x1, float y1, float x2, float y2,
  43. Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  44. int rectsRaw (SDL_Renderer *renderer, float *vx, float *vy,
  45. Sint16 num_points);
  46. int filledRectRaw (SDL_Renderer *renderer, float x1, float y1, float x2,
  47. float y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  48. int filledRectsRaw (SDL_Renderer *renderer, float *vx, float *vy,
  49. Sint16 num_points, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  50. int hLine (SDL_Renderer *renderer, float x1, float y, float x2,
  51. float thickness, Uint8 cap_type, Uint8 r, Uint8 g, Uint8 b,
  52. Uint8 a);
  53. int vLine (SDL_Renderer *renderer, float x, float y1, float y2,
  54. float thickness, Uint8 cap_type, Uint8 r, Uint8 g, Uint8 b,
  55. Uint8 a);
  56. int line (SDL_Renderer *renderer, float x1, float y1, float x2, float y2,
  57. float thickness, Uint8 cap_type, Uint8 r, Uint8 g, Uint8 b,
  58. Uint8 a);
  59. int _polylineSegment (SDL_Renderer *renderer, float x1, float y1, float x2,
  60. float y2, float x3, float y3, float thickness,
  61. Uint8 joint_type, Uint8 cap_type, Uint8 start_cap,
  62. Uint8 end_cap, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  63. int polyline (SDL_Renderer *renderer, float *vx, float *vy, Sint16 num_points,
  64. float thickness, Uint8 joint_type, Uint8 cap_type, Uint8 r,
  65. Uint8 g, Uint8 b, Uint8 a);
  66. int aaRect (SDL_Renderer *renderer, float x1, float y1, float x2, float y2,
  67. float stroke_thickness, Uint8 joint_type, Uint8 stroke_r,
  68. Uint8 stroke_g, Uint8 stroke_b, Uint8 stroke_a, Uint8 filled,
  69. Uint8 fill_r, Uint8 fill_g, Uint8 fill_b, Uint8 fill_a);
  70. int regularPolygon (SDL_Renderer *renderer, float xc, float yc, float rad,
  71. Sint16 num_sides, float stroke_thickness,
  72. Uint8 joint_type, Uint8 stroke_r, Uint8 stroke_g,
  73. Uint8 stroke_b, Uint8 stroke_a, Uint8 filled,
  74. Uint8 fill_r, Uint8 fill_g, Uint8 fill_b, Uint8 fill_a);
  75. int convexPolygon (SDL_Renderer *renderer, float *vx, float *vy,
  76. Sint16 num_points, float stroke_thickness,
  77. Uint8 joint_type, Uint8 stroke_r, Uint8 stroke_g,
  78. Uint8 stroke_b, Uint8 stroke_a, Uint8 filled, Uint8 fill_r,
  79. Uint8 fill_g, Uint8 fill_b, Uint8 fill_a);
  80. int polygon (SDL_Renderer *renderer, float *vx, float *vy, Sint16 num_points,
  81. float stroke_thickness, Uint8 joint_type, Uint8 stroke_r,
  82. Uint8 stroke_g, Uint8 stroke_b, Uint8 stroke_a, Uint8 filled,
  83. Uint8 fill_r, Uint8 fill_g, Uint8 fill_b, Uint8 fill_a);
  84. int arc ();
  85. int bezier ();
  86. int bSpline ();
  87. int NUBS ();
  88. int hermite ();
  89. int catmullRom ();
  90. int circle ();
  91. int ellipse ();
  92. int polyBezier ();
  93. #ifdef __cplusplus
  94. }
  95. #endif
  96. #endif /* SDL2_wip.h */