The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Macros | Functions
SDL_gpuShapes.c File Reference
#include "SDL_gpu.h"
#include <string.h>
Include dependency graph for SDL_gpuShapes.c:

Go to the source code of this file.

Macros

#define CHECK_RENDERER(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_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_RectangleFilled (GPU_Target *target, float x1, float y1, float x2, float y2, SDL_Color color)
 
void GPU_RectangleRound (GPU_Target *target, float x1, float y1, float x2, float y2, 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_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

#define CHECK_RENDERER (   ret)

Function Documentation

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 47 of file SDL_gpuShapes.c.

References CHECK_RENDERER.

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 57 of file SDL_gpuShapes.c.

References CHECK_RENDERER.

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 66 of file SDL_gpuShapes.c.

References CHECK_RENDERER.

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 75 of file SDL_gpuShapes.c.

References CHECK_RENDERER.

float GPU_GetLineThickness ( void  )

Returns the current line thickness value.

Definition at line 19 of file SDL_gpuShapes.c.

References CHECK_RENDERER.

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 37 of file SDL_gpuShapes.c.

References CHECK_RENDERER.

void GPU_Pixel ( GPU_Target target,
float  x,
float  y,
SDL_Color  color 
)

Renders a colored point.

Parameters
targetThe destination render target
xx-coord of the point
yy-coord of the point
colorThe color of the shape to render

Definition at line 28 of file SDL_gpuShapes.c.

References CHECK_RENDERER.

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 156 of file SDL_gpuShapes.c.

References CHECK_RENDERER.

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 165 of file SDL_gpuShapes.c.

References CHECK_RENDERER.

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 120 of file SDL_gpuShapes.c.

References CHECK_RENDERER.

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 129 of file SDL_gpuShapes.c.

References CHECK_RENDERER.

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 138 of file SDL_gpuShapes.c.

References CHECK_RENDERER.

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 147 of file SDL_gpuShapes.c.

References CHECK_RENDERER.

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 84 of file SDL_gpuShapes.c.

References CHECK_RENDERER.

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 93 of file SDL_gpuShapes.c.

References CHECK_RENDERER.

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 10 of file SDL_gpuShapes.c.

References CHECK_RENDERER.

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 102 of file SDL_gpuShapes.c.

References CHECK_RENDERER.

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 111 of file SDL_gpuShapes.c.

References CHECK_RENDERER.