SDL Wiki

SDL_Rect

A structure that contains the definition of a rectangle, with the origin at the upper left.

Data Fields

int

x

the x location of the rectangle's upper left corner

int

y

the y location of the rectangle's upper left corner

int

w

the width of the rectangle

int

h

the height of the rectangle

Code Examples

SDL_Rect srcrect;
SDL_Rect dstrect;

srcrect.x = 0;
srcrect.y = 0;
srcrect.w = 32;
srcrect.h = 32;
dstrect.x = 640/2;
dstrect.y = 480/2;
dstrect.w = 0;
dstrect.h = 0;

SDL_BlitSurface(src, &srcrect, dst, &dstrect);

Remarks

An SDL_Rect defines a rectangular area of the screen. It is used by SDL_BlitSurface() to define blitting regions and by several other video functions.

SDL_BlitSurface
SDL_EnclosePoints
SDL_GetDisplayBounds
SDL_HasIntersection
SDL_IntersectRect
SDL_LockTexture
SDL_RenderCopy
SDL_RenderDrawRect
SDL_RenderDrawRects
SDL_RenderReadPixels
SDL_UnionRect
SDL_UpdateTexture

CategoryStruct, CategoryRect


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.