Bitmap Render Problem

Started by
0 comments, last by iedoc 12 years, 10 months ago
im trying to get a bitmap image of a bucket for this simple "bomb catching" game to render on screen but its not working. Im using a function to draw the surface onto the backbuffer. I think the main problem im having is with StretchRect. The rectangles are confusing me i guess and i cant seem to figure out how to render the image in the right coordinates and how to scale it down to size. Here's the code is use to draw the surface to screen





void DrawSurface(LPDIRECT3DSURFACE9 source, LPDIRECT3DSURFACE9 dest, float x, float y)
{
D3DSURFACE_DESC desc;
source -> GetDesc(&desc);

RECT source_rect = {0, 0, desc.Width, desc.Height};
RECT dest_rect = {x, y, x + desc.Width, y + desc.Height};

device -> StretchRect(source, &source_rect, dest, &dest_rect, D3DTEXF_NONE);
}



any help? I know it probably has to do something with my rectangles lol :P
Advertisement
I know i may have just missed it, but what exactly is the problem you are having? is the bitmap not showing up at all? or is it being stretched? or is it upside down or backwards? is the bucket covering the entire screen?

I'm not sure at all, but i was just looking at your code, try setting the dest rect to the size of your backbuffer, and the source rec to what you have as your dest rect right now. just a suggestion

This topic is closed to new replies.

Advertisement