Jump to content
  • Advertisement


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


DirectDraw getting a bitmap from a surface prob.

This topic is 6199 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'm writing a mouse interface for ddraw, only one surface so theres no flipping. my prob, is that something in the getting the background of the mouse sprite is wrong. i use standard API functions in the mean time and i thought that will make it easier...
void CSprite::Get(IDirectDrawSurface *pdds, int x, int y, int gwidth, int gheight)
	HDC                 hdcImage;
	HDC                 hdc;

	pdds->GetDC(&hdc);          //getting surface dc

	DeleteObject(bitmap);       //deleting old background

	bitmap = CreateCompatibleBitmap(hdc, gwidth, gheight);
	hdcImage = CreateCompatibleDC(hdc);

	BitBlt(hdcImage, 0, 0, gwidth, gheight, hdc, x, y, SRCCOPY);
and it doesnt seem to put the area inside "bitmap". every other method in the Sprite class seem to work but this doesnt. anyone? Gil Edited by - gilzu on July 28, 2001 10:35:16 PM

Share this post

Link to post
Share on other sites
C''mon people...
i know you can help me, i''m desparate here.
i''ve already designed a small RTS unit where
i have 2 units battling eachother and doing
whatever youll tell them to do, but,

this small thingy prevents me from using mouse
or putting it all to more speed.



Share this post

Link to post
Share on other sites
Im not exatly sure what u are trying to do, maybe u should dump the hdc and just use lpDDS->Blt() in your CSprite class.

Also I noticed u do not have any error checking - this could lead to unexpected crashing later on, if you check the return values of GetDC, CreateCompatibleDC, and BltBit for errors u could pinpoint the problem.

  Downloads:  ZeroOne Realm

Share this post

Link to post
Share on other sites
i did.
the problem is in the BitBlt() func.
but there''s no error code (it returns bool)
so i dunno whats wrong

Share this post

Link to post
Share on other sites

  • 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!