🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

blitting to a surface

Started by
4 comments, last by da_cobra 22 years, 7 months ago
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...
Advertisement
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.
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.
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

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


Adulthood is the vehicle for making you childhood dreams come true.
that helped alot
thanx!!!!

This topic is closed to new replies.

Advertisement