2
0

raylib_shapes.c 3.9 KB

123456789101112131415161718192021222324252627282930313233
  1. // Basic shapes drawing functions
  2. void DrawPixel(int posX, int posY, Color color); // Draw a pixel
  3. void DrawPixelV(Vector2 position, Color color); // Draw a pixel (Vector version)
  4. void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line
  5. void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (Vector version)
  6. void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line defining thickness
  7. void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line using cubic-bezier curves in-out
  8. void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle
  9. void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); // Draw a gradient-filled circle
  10. void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version)
  11. void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline
  12. void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle
  13. void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle
  14. void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters
  15. void DrawRectangleGradient(int posX, int posY, int width, int height, Color color1, Color color2); // Draw a gradient-filled rectangle
  16. void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version)
  17. void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline
  18. void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle
  19. void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline
  20. void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version)
  21. void DrawPolyEx(Vector2 *points, int numPoints, Color color); // Draw a closed polygon defined by points
  22. void DrawPolyExLines(Vector2 *points, int numPoints, Color color); // Draw polygon lines
  23. // Basic shapes collision detection functions
  24. bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2); // Check collision between two rectangles
  25. bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, float radius2); // Check collision between two circles
  26. bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec); // Check collision between circle and rectangle
  27. Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision
  28. bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle
  29. bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle
  30. bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle