Sign in to follow this  
sarim

Bitmap Render Problem

Recommended Posts

sarim    440
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


[code]


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);
}

[/code]

any help? I know it probably has to do something with my rectangles lol :P

Share this post


Link to post
Share on other sites
iedoc    2525
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this