Archived

This topic is now archived and is closed to further replies.

blitting to a surface

This topic is 5868 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

I don''t seem to quit understand how to blit to a surface I have a cache surface where I store my 7 cubes of 16x16 so my bitmap is 16x112 (7 cubes on a row) I use this function to blit to my backbuffer RECT dest, src ; SetRect(&src,0 , 112, 16, 112) ; SetRect(&dest,0 , 112, 16, 112) ; G.lpDDSBack->Blt(&dest, G.lpDDSBuffer, &src, DDBLT_WAIT, NULL) ; and further in my game loop I flip my backbuffer with my front buffer but nothing appears?!? when I just use this Blit-function I see my blocks but stretched?!? G.lpDDSBack->Blt(NULL, G.lpDDSBuffer, NULL, DDBLT_WAIT, NULL) ; I already read the dx7 docs over and over and now I''m desperate can someone help me pls thanx in advance...

Share this post


Link to post
Share on other sites
That''s not enough information to give an answer. Anyway, when my DX programs refused to work whatever I did I usually turned to the examples that come with the DX SDK and compare my not working sources with them.

Share this post


Link to post
Share on other sites
Wait a minute..

You said SetRect(&src,0 , 112, 16, 112)? But this rect has 0 height.

Try SetRect (&src, 0, 0, 16, 16); Also, read up on the SetRect function in the MSDN.

Share this post


Link to post
Share on other sites
I already found it but still thanx alot diodor (again)
second time you helped me

anyway just got now still one question
how can I now blit my 16x16 cube somewhere else on the screen
it appears at the top and when I change the values in RECT it get''s stretched

Share this post


Link to post
Share on other sites

You should change how you set your destination rect.

SetRect(&dest, x_pos , y_pos, x_pos + 16, y_pos + 16 );

Where x_pos, y_pos is where you want to set your cube.
x_pos + 16, y_pos + 16 is the bottom right of your cube
based on it''s width and position.

Guy


Share this post


Link to post
Share on other sites