DirectDraw getting a bitmap from a surface prob.

Started by
2 comments, last by Gilzu 22 years, 8 months ago
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);
	SelectObject(hdcImage,bitmap);

	BitBlt(hdcImage, 0, 0, gwidth, gheight, hdc, x, y, SRCCOPY);
		
	pdds->ReleaseDC(hdc);	
	DeleteDC(hdcImage); 
};
    
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
[email=gil@gilzu.com]Gil Zussman[/email]Check out Goose Chase, Coming this fall!http://www.gilzu.com
Advertisement
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.



help?

Gil
[email=gil@gilzu.com]Gil Zussman[/email]Check out Goose Chase, Coming this fall!http://www.gilzu.com
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

  Downloads:  ZeroOne Realm

i did.
the problem is in the BitBlt() func.
but there''s no error code (it returns bool)
so i dunno whats wrong
[email=gil@gilzu.com]Gil Zussman[/email]Check out Goose Chase, Coming this fall!http://www.gilzu.com

This topic is closed to new replies.

Advertisement