SDL_gpu  0.11.0
A hardware-accelerated, cross-platform 2D graphics API
Macros | Functions
SDL_gpu_shapes.c File Reference
#include "SDL_gpu.h"
#include "SDL_gpu_RendererImpl.h"
#include <string.h>

Go to the source code of this file.

Macros

#define CHECK_RENDERER()
 
#define CHECK_RENDERER_1(ret)
 

Functions

float GPU_SetLineThickness (float thickness)
 
float GPU_GetLineThickness (void)
 
void GPU_Pixel (GPU_Target *target, float x, float y, SDL_Color color)
 
void GPU_Line (GPU_Target *target, float x1, float y1, float x2, float y2, SDL_Color color)
 
void GPU_Arc (GPU_Target *target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color)
 
void GPU_ArcFilled (GPU_Target *target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color)
 
void GPU_Circle (GPU_Target *target, float x, float y, float radius, SDL_Color color)
 
void GPU_CircleFilled (GPU_Target *target, float x, float y, float radius, SDL_Color color)
 
void GPU_Ellipse (GPU_Target *target, float x, float y, float rx, float ry, float degrees, SDL_Color color)
 
void GPU_EllipseFilled (GPU_Target *target, float x, float y, float rx, float ry, float degrees, SDL_Color color)
 
void GPU_Sector (GPU_Target *target, float x, float y, float inner_radius, float outer_radius, float start_angle, float end_angle, SDL_Color color)
 
void GPU_SectorFilled (GPU_Target *target, float x, float y, float inner_radius, float outer_radius, float start_angle, float end_angle, SDL_Color color)
 
void GPU_Tri (GPU_Target *target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color)
 
void GPU_TriFilled (GPU_Target *target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color)
 
void GPU_Rectangle (GPU_Target *target, float x1, float y1, float x2, float y2, SDL_Color color)
 
void GPU_Rectangle2 (GPU_Target *target, GPU_Rect rect, SDL_Color color)
 
void GPU_RectangleFilled (GPU_Target *target, float x1, float y1, float x2, float y2, SDL_Color color)
 
void GPU_RectangleFilled2 (GPU_Target *target, GPU_Rect rect, SDL_Color color)
 
void GPU_RectangleRound (GPU_Target *target, float x1, float y1, float x2, float y2, float radius, SDL_Color color)
 
void GPU_RectangleRound2 (GPU_Target *target, GPU_Rect rect, float radius, SDL_Color color)
 
void GPU_RectangleRoundFilled (GPU_Target *target, float x1, float y1, float x2, float y2, float radius, SDL_Color color)
 
void GPU_RectangleRoundFilled2 (GPU_Target *target, GPU_Rect rect, float radius, SDL_Color color)
 
void GPU_Polygon (GPU_Target *target, unsigned int num_vertices, float *vertices, SDL_Color color)
 
void GPU_PolygonFilled (GPU_Target *target, unsigned int num_vertices, float *vertices, SDL_Color color)
 

Macro Definition Documentation

◆ CHECK_RENDERER

#define CHECK_RENDERER ( )
Value:
if(renderer == NULL) \
return;
DECLSPEC GPU_Renderer *SDLCALL GPU_GetCurrentRenderer(void)
Definition: SDL_gpu.c:113

Definition at line 5 of file SDL_gpu_shapes.c.

◆ CHECK_RENDERER_1

#define CHECK_RENDERER_1 (   ret)
Value:
if(renderer == NULL) \
return ret;
DECLSPEC GPU_Renderer *SDLCALL GPU_GetCurrentRenderer(void)
Definition: SDL_gpu.c:113

Definition at line 10 of file SDL_gpu_shapes.c.

Function Documentation

◆ GPU_Arc()

void GPU_Arc ( GPU_Target target,
float  x,
float  y,
float  radius,
float  start_angle,
float  end_angle,
SDL_Color  color 
)

Renders a colored arc curve (circle segment).

Parameters
targetThe destination render target
xx-coord of center point
yy-coord of center point
radiusThe radius of the circle / distance from the center point that rendering will occur
start_angleThe angle to start from, in degrees. Measured clockwise from the positive x-axis.
end_angleThe angle to end at, in degrees. Measured clockwise from the positive x-axis.
colorThe color of the shape to render

Definition at line 41 of file SDL_gpu_shapes.c.

◆ GPU_ArcFilled()

void GPU_ArcFilled ( GPU_Target target,
float  x,
float  y,
float  radius,
float  start_angle,
float  end_angle,
SDL_Color  color 
)

Renders a colored filled arc (circle segment / pie piece).

Parameters
targetThe destination render target
xx-coord of center point
yy-coord of center point
radiusThe radius of the circle / distance from the center point that rendering will occur
start_angleThe angle to start from, in degrees. Measured clockwise from the positive x-axis.
end_angleThe angle to end at, in degrees. Measured clockwise from the positive x-axis.
colorThe color of the shape to render

Definition at line 48 of file SDL_gpu_shapes.c.

◆ GPU_Circle()

void GPU_Circle ( GPU_Target target,
float  x,
float  y,
float  radius,
SDL_Color  color 
)

Renders a colored circle outline.

Parameters
targetThe destination render target
xx-coord of center point
yy-coord of center point
radiusThe radius of the circle / distance from the center point that rendering will occur
colorThe color of the shape to render

Definition at line 54 of file SDL_gpu_shapes.c.

◆ GPU_CircleFilled()

void GPU_CircleFilled ( GPU_Target target,
float  x,
float  y,
float  radius,
SDL_Color  color 
)

Renders a colored filled circle.

Parameters
targetThe destination render target
xx-coord of center point
yy-coord of center point
radiusThe radius of the circle / distance from the center point that rendering will occur
colorThe color of the shape to render

Definition at line 60 of file SDL_gpu_shapes.c.

◆ GPU_Ellipse()

void GPU_Ellipse ( GPU_Target target,
float  x,
float  y,
float  rx,
float  ry,
float  degrees,
SDL_Color  color 
)

Renders a colored ellipse outline.

Parameters
targetThe destination render target
xx-coord of center point
yy-coord of center point
rxx-radius of ellipse
ryy-radius of ellipse
degreesThe angle to rotate the ellipse
colorThe color of the shape to render

Definition at line 66 of file SDL_gpu_shapes.c.

◆ GPU_EllipseFilled()

void GPU_EllipseFilled ( GPU_Target target,
float  x,
float  y,
float  rx,
float  ry,
float  degrees,
SDL_Color  color 
)

Renders a colored filled ellipse.

Parameters
targetThe destination render target
xx-coord of center point
yy-coord of center point
rxx-radius of ellipse
ryy-radius of ellipse
degreesThe angle to rotate the ellipse
colorThe color of the shape to render

Definition at line 72 of file SDL_gpu_shapes.c.

◆ GPU_GetLineThickness()

float GPU_GetLineThickness ( void  )

Returns the current line thickness value.

Definition at line 22 of file SDL_gpu_shapes.c.

◆ GPU_Line()

void GPU_Line ( GPU_Target target,
float  x1,
float  y1,
float  x2,
float  y2,
SDL_Color  color 
)

Renders a colored line.

Parameters
targetThe destination render target
x1x-coord of starting point
y1y-coord of starting point
x2x-coord of ending point
y2y-coord of ending point
colorThe color of the shape to render

Definition at line 34 of file SDL_gpu_shapes.c.

◆ GPU_Polygon()

void GPU_Polygon ( GPU_Target target,
unsigned int  num_vertices,
float *  vertices,
SDL_Color  color 
)

Renders a colored polygon outline. The vertices are expected to define a convex polygon.

Parameters
targetThe destination render target
num_verticesNumber of vertices (x and y pairs)
verticesAn array of vertex positions stored as interlaced x and y coords, e.g. {x1, y1, x2, y2, ...}
colorThe color of the shape to render

Definition at line 150 of file SDL_gpu_shapes.c.

◆ GPU_PolygonFilled()

void GPU_PolygonFilled ( GPU_Target target,
unsigned int  num_vertices,
float *  vertices,
SDL_Color  color 
)

Renders a colored filled polygon. The vertices are expected to define a convex polygon.

Parameters
targetThe destination render target
num_verticesNumber of vertices (x and y pairs)
verticesAn array of vertex positions stored as interlaced x and y coords, e.g. {x1, y1, x2, y2, ...}
colorThe color of the shape to render

Definition at line 156 of file SDL_gpu_shapes.c.

◆ GPU_Rectangle()

void GPU_Rectangle ( GPU_Target target,
float  x1,
float  y1,
float  x2,
float  y2,
SDL_Color  color 
)

Renders a colored rectangle outline.

Parameters
targetThe destination render target
x1x-coord of top-left corner
y1y-coord of top-left corner
x2x-coord of bottom-right corner
y2y-coord of bottom-right corner
colorThe color of the shape to render

Definition at line 102 of file SDL_gpu_shapes.c.

◆ GPU_Rectangle2()

void GPU_Rectangle2 ( GPU_Target target,
GPU_Rect  rect,
SDL_Color  color 
)

Renders a colored rectangle outline.

Parameters
targetThe destination render target
rectThe rectangular area to draw
colorThe color of the shape to render

Definition at line 108 of file SDL_gpu_shapes.c.

◆ GPU_RectangleFilled()

void GPU_RectangleFilled ( GPU_Target target,
float  x1,
float  y1,
float  x2,
float  y2,
SDL_Color  color 
)

Renders a colored filled rectangle.

Parameters
targetThe destination render target
x1x-coord of top-left corner
y1y-coord of top-left corner
x2x-coord of bottom-right corner
y2y-coord of bottom-right corner
colorThe color of the shape to render

Definition at line 114 of file SDL_gpu_shapes.c.

◆ GPU_RectangleFilled2()

void GPU_RectangleFilled2 ( GPU_Target target,
GPU_Rect  rect,
SDL_Color  color 
)

Renders a colored filled rectangle.

Parameters
targetThe destination render target
rectThe rectangular area to draw
colorThe color of the shape to render

Definition at line 120 of file SDL_gpu_shapes.c.

◆ GPU_RectangleRound()

void GPU_RectangleRound ( GPU_Target target,
float  x1,
float  y1,
float  x2,
float  y2,
float  radius,
SDL_Color  color 
)

Renders a colored rounded (filleted) rectangle outline.

Parameters
targetThe destination render target
x1x-coord of top-left corner
y1y-coord of top-left corner
x2x-coord of bottom-right corner
y2y-coord of bottom-right corner
radiusThe radius of the corners
colorThe color of the shape to render

Definition at line 126 of file SDL_gpu_shapes.c.

◆ GPU_RectangleRound2()

void GPU_RectangleRound2 ( GPU_Target target,
GPU_Rect  rect,
float  radius,
SDL_Color  color 
)

Renders a colored rounded (filleted) rectangle outline.

Parameters
targetThe destination render target
rectThe rectangular area to draw
radiusThe radius of the corners
colorThe color of the shape to render

Definition at line 132 of file SDL_gpu_shapes.c.

◆ GPU_RectangleRoundFilled()

void GPU_RectangleRoundFilled ( GPU_Target target,
float  x1,
float  y1,
float  x2,
float  y2,
float  radius,
SDL_Color  color 
)

Renders a colored filled rounded (filleted) rectangle.

Parameters
targetThe destination render target
x1x-coord of top-left corner
y1y-coord of top-left corner
x2x-coord of bottom-right corner
y2y-coord of bottom-right corner
radiusThe radius of the corners
colorThe color of the shape to render

Definition at line 138 of file SDL_gpu_shapes.c.

◆ GPU_RectangleRoundFilled2()

void GPU_RectangleRoundFilled2 ( GPU_Target target,
GPU_Rect  rect,
float  radius,
SDL_Color  color 
)

Renders a colored filled rounded (filleted) rectangle.

Parameters
targetThe destination render target
rectThe rectangular area to draw
radiusThe radius of the corners
colorThe color of the shape to render

Definition at line 144 of file SDL_gpu_shapes.c.

◆ GPU_Sector()

void GPU_Sector ( GPU_Target target,
float  x,
float  y,
float  inner_radius,
float  outer_radius,
float  start_angle,
float  end_angle,
SDL_Color  color 
)

Renders a colored annular sector outline (ring segment).

Parameters
targetThe destination render target
xx-coord of center point
yy-coord of center point
inner_radiusThe inner radius of the ring
outer_radiusThe outer radius of the ring
start_angleThe angle to start from, in degrees. Measured clockwise from the positive x-axis.
end_angleThe angle to end at, in degrees. Measured clockwise from the positive x-axis.
colorThe color of the shape to render

Definition at line 78 of file SDL_gpu_shapes.c.

◆ GPU_SectorFilled()

void GPU_SectorFilled ( GPU_Target target,
float  x,
float  y,
float  inner_radius,
float  outer_radius,
float  start_angle,
float  end_angle,
SDL_Color  color 
)

Renders a colored filled annular sector (ring segment).

Parameters
targetThe destination render target
xx-coord of center point
yy-coord of center point
inner_radiusThe inner radius of the ring
outer_radiusThe outer radius of the ring
start_angleThe angle to start from, in degrees. Measured clockwise from the positive x-axis.
end_angleThe angle to end at, in degrees. Measured clockwise from the positive x-axis.
colorThe color of the shape to render

Definition at line 84 of file SDL_gpu_shapes.c.

◆ GPU_SetLineThickness()

float GPU_SetLineThickness ( float  thickness)

Sets the thickness of lines for the current context.

Parameters
thicknessNew line thickness in pixels measured across the line. Default is 1.0f.
Returns
The old thickness value

Definition at line 16 of file SDL_gpu_shapes.c.

◆ GPU_Tri()

void GPU_Tri ( GPU_Target target,
float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3,
SDL_Color  color 
)

Renders a colored triangle outline.

Parameters
targetThe destination render target
x1x-coord of first point
y1y-coord of first point
x2x-coord of second point
y2y-coord of second point
x3x-coord of third point
y3y-coord of third point
colorThe color of the shape to render

Definition at line 90 of file SDL_gpu_shapes.c.

◆ GPU_TriFilled()

void GPU_TriFilled ( GPU_Target target,
float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3,
SDL_Color  color 
)

Renders a colored filled triangle.

Parameters
targetThe destination render target
x1x-coord of first point
y1y-coord of first point
x2x-coord of second point
y2y-coord of second point
x3x-coord of third point
y3y-coord of third point
colorThe color of the shape to render

Definition at line 96 of file SDL_gpu_shapes.c.