, SDL2.
, , SDL2, OGL/DX, 2D .
, SDL_RenderCopyEx
, . SDL1 rotozoom .
, . , SDL_RenderDrawLine
, SDL1 , , .
, , , , , .
, , SDL1 "", SDL2 . , SDL2. , (SDL_Surface
- ), , . .
, " ", , . , - , :
struct SurfaceElement {
SDL_Surface* s;
SDL_Rect clip;
SDL_Rect position;
struct SurfaceElement * next;
};
typedef struct SurfaceElement SurfaceElement;
void ProcessingLoop() {
SurfaceElement *surfacesList = (SurfaceElement *)malloc(sizeof(SurfaceElement));
surfacesList = AddToBlitList(yourSurface, yourClipPos, yourBlitPos, surfacesList);
TextureBlittingProcess(surfacesList, renderer);
}
SurfaceElement* AddToBlitList(SDL_Surface *s, SDL_Rect clip, SDL_Rect position, SurfaceElement *head) {
SurfaceElement *current = (SurfaceElement*)malloc(sizeof(SurfaceElement));
current->s = s;
current->clip = clip;
current->position = position;
current->next = head;
return current;
}
void TextureBlittingProcess(SurfaceElement *surfacesList, SDL_Renderer *renderer) {
while (surfaceList) {
SDL_Texture *t = SDL_CreateTextureFromSurface(renderer, surfaceList->s)
SDL_RenderCopy(renderer, t, &(surfaceList->clip), &(surfaceList->position));
surfaceList = surfaceList->next;
}
}
, , , , , SDL . Matlab , , Scripting, Python Caml.