Jump to content
  • Advertisement
Sign in to follow this  
sarim

Bitmap Render Problem

This topic is 2564 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!