SDL_gpu  0.11.0
A hardware-accelerated, cross-platform 2D graphics API
Data Structures
Target Controls

Data Structures

struct  GPU_Camera
 
struct  GPU_Target
 
DECLSPEC GPU_Target *SDLCALL GPU_CreateAliasTarget (GPU_Target *target)
 
DECLSPEC GPU_Target *SDLCALL GPU_LoadTarget (GPU_Image *image)
 
DECLSPEC GPU_Target *SDLCALL GPU_GetTarget (GPU_Image *image)
 
DECLSPEC void SDLCALL GPU_FreeTarget (GPU_Target *target)
 
DECLSPEC void SDLCALL GPU_SetVirtualResolution (GPU_Target *target, Uint16 w, Uint16 h)
 
DECLSPEC void SDLCALL GPU_GetVirtualResolution (GPU_Target *target, Uint16 *w, Uint16 *h)
 
DECLSPEC void SDLCALL GPU_GetVirtualCoords (GPU_Target *target, float *x, float *y, float displayX, float displayY)
 
DECLSPEC void SDLCALL GPU_UnsetVirtualResolution (GPU_Target *target)
 
DECLSPEC GPU_Rect SDLCALL GPU_MakeRect (float x, float y, float w, float h)
 
DECLSPEC SDL_Color SDLCALL GPU_MakeColor (Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 
DECLSPEC void SDLCALL GPU_SetViewport (GPU_Target *target, GPU_Rect viewport)
 
DECLSPEC void SDLCALL GPU_UnsetViewport (GPU_Target *target)
 
DECLSPEC GPU_Camera SDLCALL GPU_GetDefaultCamera (void)
 
DECLSPEC GPU_Camera SDLCALL GPU_GetCamera (GPU_Target *target)
 
DECLSPEC GPU_Camera SDLCALL GPU_SetCamera (GPU_Target *target, GPU_Camera *cam)
 
DECLSPEC void SDLCALL GPU_EnableCamera (GPU_Target *target, GPU_bool use_camera)
 
DECLSPEC GPU_bool SDLCALL GPU_IsCameraEnabled (GPU_Target *target)
 
DECLSPEC SDL_Color SDLCALL GPU_GetPixel (GPU_Target *target, Sint16 x, Sint16 y)
 
DECLSPEC GPU_Rect SDLCALL GPU_SetClipRect (GPU_Target *target, GPU_Rect rect)
 
DECLSPEC GPU_Rect SDLCALL GPU_SetClip (GPU_Target *target, Sint16 x, Sint16 y, Uint16 w, Uint16 h)
 
DECLSPEC void SDLCALL GPU_UnsetClip (GPU_Target *target)
 
DECLSPEC GPU_bool SDLCALL GPU_IntersectRect (GPU_Rect A, GPU_Rect B, GPU_Rect *result)
 
DECLSPEC GPU_bool SDLCALL GPU_IntersectClipRect (GPU_Target *target, GPU_Rect B, GPU_Rect *result)
 
DECLSPEC void SDLCALL GPU_SetTargetColor (GPU_Target *target, SDL_Color color)
 
DECLSPEC void SDLCALL GPU_SetTargetRGB (GPU_Target *target, Uint8 r, Uint8 g, Uint8 b)
 
DECLSPEC void SDLCALL GPU_SetTargetRGBA (GPU_Target *target, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 
DECLSPEC void SDLCALL GPU_UnsetTargetColor (GPU_Target *target)
 

Detailed Description

Function Documentation

◆ GPU_CreateAliasTarget()

DECLSPEC GPU_Target* SDLCALL GPU_CreateAliasTarget ( GPU_Target target)

Creates a target that aliases the given target. Aliases can be used to store target settings (e.g. viewports) for easy switching. GPU_FreeTarget() frees the alias's memory, but does not affect the original.

Definition at line 486 of file SDL_gpu.c.

◆ GPU_EnableCamera()

DECLSPEC void SDLCALL GPU_EnableCamera ( GPU_Target target,
GPU_bool  use_camera 
)

Enables or disables using the built-in camera matrix transforms.

Definition at line 891 of file SDL_gpu.c.

◆ GPU_FreeTarget()

DECLSPEC void SDLCALL GPU_FreeTarget ( GPU_Target target)

Deletes a render target in the proper way for this renderer.

Definition at line 1323 of file SDL_gpu.c.

◆ GPU_GetCamera()

DECLSPEC GPU_Camera SDLCALL GPU_GetCamera ( GPU_Target target)
Returns
The camera of the given render target. If target is NULL, returns the default camera.

Definition at line 873 of file SDL_gpu.c.

◆ GPU_GetDefaultCamera()

DECLSPEC GPU_Camera SDLCALL GPU_GetDefaultCamera ( void  )
Returns
A GPU_Camera with position (0, 0, -10), angle of 0, and zoom of 1.

Definition at line 867 of file SDL_gpu.c.

◆ GPU_GetPixel()

DECLSPEC SDL_Color SDLCALL GPU_GetPixel ( GPU_Target target,
Sint16  x,
Sint16  y 
)
Returns
The RGBA color of a pixel.

Definition at line 1975 of file SDL_gpu.c.

◆ GPU_GetTarget()

DECLSPEC GPU_Target* SDLCALL GPU_GetTarget ( GPU_Image image)

Creates a new render target from the given image. It can then be accessed from image->target. This does not increment the internal refcount of the target, so it will be invalidated when the image is freed.

Definition at line 1313 of file SDL_gpu.c.

◆ GPU_GetVirtualCoords()

DECLSPEC void SDLCALL GPU_GetVirtualCoords ( GPU_Target target,
float *  x,
float *  y,
float  displayX,
float  displayY 
)

Converts screen space coordinates (such as from mouse input) to logical drawing coordinates. This interacts with GPU_SetCoordinateMode() when the y-axis is flipped (screen space is assumed to be inverted: (0,0) in the upper-left corner).

Definition at line 788 of file SDL_gpu.c.

◆ GPU_GetVirtualResolution()

DECLSPEC void SDLCALL GPU_GetVirtualResolution ( GPU_Target target,
Uint16 *  w,
Uint16 *  h 
)

Query the logical size of the given target.

Definition at line 538 of file SDL_gpu.c.

◆ GPU_IntersectClipRect()

DECLSPEC GPU_bool SDLCALL GPU_IntersectClipRect ( GPU_Target target,
GPU_Rect  B,
GPU_Rect result 
)

Returns GPU_TRUE if the given target's clip rect and the given B rect overlap, in which case it also fills the given result rect with the intersection. result can be NULL if you don't need the intersection. If the target doesn't have a clip rect enabled, this uses the whole target area.

Definition at line 1608 of file SDL_gpu.c.

◆ GPU_IntersectRect()

DECLSPEC GPU_bool SDLCALL GPU_IntersectRect ( GPU_Rect  A,
GPU_Rect  B,
GPU_Rect result 
)

Returns GPU_TRUE if the given rects A and B overlap, in which case it also fills the given result rect with the intersection. result can be NULL if you don't need the intersection.

Definition at line 1559 of file SDL_gpu.c.

◆ GPU_IsCameraEnabled()

DECLSPEC GPU_bool SDLCALL GPU_IsCameraEnabled ( GPU_Target target)

Returns 1 if the camera transforms are enabled, 0 otherwise.

Definition at line 899 of file SDL_gpu.c.

◆ GPU_LoadTarget()

DECLSPEC GPU_Target* SDLCALL GPU_LoadTarget ( GPU_Image image)

Creates a new render target from the given image. It can then be accessed from image->target. This increments the internal refcount of the target, so it should be matched with a GPU_FreeTarget().

Definition at line 1302 of file SDL_gpu.c.

◆ GPU_MakeColor()

DECLSPEC SDL_Color SDLCALL GPU_MakeColor ( Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)
Returns
An SDL_Color with the given values.

Definition at line 833 of file SDL_gpu.c.

◆ GPU_MakeRect()

DECLSPEC GPU_Rect SDLCALL GPU_MakeRect ( float  x,
float  y,
float  w,
float  h 
)
Returns
A GPU_Rect with the given values.

Definition at line 822 of file SDL_gpu.c.

◆ GPU_SetCamera()

DECLSPEC GPU_Camera SDLCALL GPU_SetCamera ( GPU_Target target,
GPU_Camera cam 
)

Sets the current render target's current camera.

Parameters
targetA pointer to the target that will copy this camera.
camA pointer to the camera data to use or NULL to use the default camera.
Returns
The old camera.

Definition at line 880 of file SDL_gpu.c.

◆ GPU_SetClip()

DECLSPEC GPU_Rect SDLCALL GPU_SetClip ( GPU_Target target,
Sint16  x,
Sint16  y,
Uint16  w,
Uint16  h 
)

Sets the clipping rect for the given render target.

Definition at line 1539 of file SDL_gpu.c.

◆ GPU_SetClipRect()

DECLSPEC GPU_Rect SDLCALL GPU_SetClipRect ( GPU_Target target,
GPU_Rect  rect 
)

Sets the clipping rect for the given render target.

Definition at line 1528 of file SDL_gpu.c.

◆ GPU_SetTargetColor()

DECLSPEC void SDLCALL GPU_SetTargetColor ( GPU_Target target,
SDL_Color  color 
)

Sets the modulation color for subsequent drawing of images and shapes on the given target. This has a cumulative effect with the image coloring functions. e.g. GPU_SetRGB(image, 255, 128, 0); GPU_SetTargetRGB(target, 128, 128, 128); Would make the image draw with color of roughly (128, 64, 0).

Definition at line 1668 of file SDL_gpu.c.

◆ GPU_SetTargetRGB()

DECLSPEC void SDLCALL GPU_SetTargetRGB ( GPU_Target target,
Uint8  r,
Uint8  g,
Uint8  b 
)

Sets the modulation color for subsequent drawing of images and shapes on the given target. This has a cumulative effect with the image coloring functions. e.g. GPU_SetRGB(image, 255, 128, 0); GPU_SetTargetRGB(target, 128, 128, 128); Would make the image draw with color of roughly (128, 64, 0).

Definition at line 1677 of file SDL_gpu.c.

◆ GPU_SetTargetRGBA()

DECLSPEC void SDLCALL GPU_SetTargetRGBA ( GPU_Target target,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Sets the modulation color for subsequent drawing of images and shapes on the given target. This has a cumulative effect with the image coloring functions. e.g. GPU_SetRGB(image, 255, 128, 0); GPU_SetTargetRGB(target, 128, 128, 128); Would make the image draw with color of roughly (128, 64, 0).

Definition at line 1692 of file SDL_gpu.c.

◆ GPU_SetViewport()

DECLSPEC void SDLCALL GPU_SetViewport ( GPU_Target target,
GPU_Rect  viewport 
)

Sets the given target's viewport.

Definition at line 855 of file SDL_gpu.c.

◆ GPU_SetVirtualResolution()

DECLSPEC void SDLCALL GPU_SetVirtualResolution ( GPU_Target target,
Uint16  w,
Uint16  h 
)

Change the logical size of the given target. Rendering to this target will be scaled as if the dimensions were actually the ones given.

Definition at line 552 of file SDL_gpu.c.

◆ GPU_UnsetClip()

DECLSPEC void SDLCALL GPU_UnsetClip ( GPU_Target target)

Turns off clipping for the given target.

Definition at line 1550 of file SDL_gpu.c.

◆ GPU_UnsetTargetColor()

DECLSPEC void SDLCALL GPU_UnsetTargetColor ( GPU_Target target)

Unsets the modulation color for subsequent drawing of images and shapes on the given target. This has the same effect as coloring with pure opaque white (255, 255, 255, 255).

Definition at line 1707 of file SDL_gpu.c.

◆ GPU_UnsetViewport()

DECLSPEC void SDLCALL GPU_UnsetViewport ( GPU_Target target)

Resets the given target's viewport to the entire target area.

Definition at line 861 of file SDL_gpu.c.

◆ GPU_UnsetVirtualResolution()

DECLSPEC void SDLCALL GPU_UnsetVirtualResolution ( GPU_Target target)

Reset the logical size of the given target to its original value.

Definition at line 565 of file SDL_gpu.c.