[SDL] version verify

npguy Last Name npguy at my-deja.com
Wed Aug 15 06:25:01 PDT 2001

On Fri, Aug 03, 2001 at 12:16:04PM -0700, Joel Dudley wrote:
> Hmmm, I changed the code and still nothing is drawn. Since the image is
> loaded the surface must exist somewhere. Why doesn't it get drawn to the
> screen with SDL_BlitSurface?? Thanks for the great responses!

>         /* Blit onto the screen surface */
>         if(SDL_BlitSurface(woods, NULL, screen, NULL) != 0)
>                 fprintf(stderr, "BlitSurface error: %s\n", SDL_GetError());

I think this is the issue.  The sizes (width/height) of the
source surface (woods) and your destination (screen) aren't the same,
but you're telling SDL_BlitSurface() to take one and fill up the entirety
of the other with it.

In other words, you should do this:

SDL_Rect dest;

dest.x = 0;
dest.y = 0;
dest.w = woods -> w;
dest.h = woods -> h;

... SDL_BlitSurface(woods, NULL, screen, &dest) != 0 ...

Good luck!


More information about the SDL mailing list