SDL_BlitSurface();

In SDL_BlitSurface(): what is the use of the second argument
for example

1
2
3
SDL_BlitSurface(image,NULL,screen,&position);
SDL_BlitSurface(image,&position,screen,NULL);
SDL_BlitSurface(image,&position,screen,&position);

what is the difference between the three lines
The documentation explains it pretty well:

http://wiki.libsdl.org/SDL_BlitSurface

The 2nd param is where on the source surface (image) you want to pull the rectangle from.

The 4th param is where on the destination surface (screen) you want to copy the rectangle to.

If you specify NULL for the source rect... it will copy the entire source surface
If you specify NULL for the dest rect... it will copy the rectangle to 0,0 on the dest surface.


EDIT: Also.. FWIW, surface blitting is slow. Look into SDL 2.0's rendering functions if you want something that performs better and isn't crazy old.
Last edited on
Yes i have started using sdl 1.2.5 recently because there aren't tutorials available(lazyfoo.net , youtube) right now but i will change to it as soon as i get a little hang of it and thank you for explaining i get it now :)
Topic archived. No new replies allowed.