[SDL] Android: SDL_RenderCopy using dest rectangle not working

William Dyce wilbefast at gmail.com
Sun Jul 31 22:43:34 PDT 2011

Eureka! I think I'm really on to something now :)

So, the problem occurs when multiple images are blitted one on top of the
other. I was drawing a background texture first, followed by a sprite, then
    // Clear the entire screen to the Renderer's base colour

    // Render the background
    SDL_RenderCopy(renderer, background, NULL, NULL);

    // Draw the game objects

    // Flip the buffers to update the screen

where Thing::draw(SDL_renderer* renderer) is:

*    static SDL_Rect draw_dest, draw_src;
    draw_dest.x = position.x - size.x/2;
    draw_dest.y = position.y - size.y/2;
    draw_dest.w = size.x;
    draw_dest.h = size.y;

    draw_src.x = draw_src.y = 0;
    draw_src.w = draw_src.h = 32;

    SDL_RenderCopy(renderer, sprite, &draw_src, &draw_dest);*

It seems that I can draw one texture OR the other, but not both one on top
of eachother, unless the second completely covers up the first. Am I using
RenderCopy and RenderPresent the wrong way? And if so, why does it work on

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20110801/46977838/attachment-0008.htm>

More information about the SDL mailing list