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
DirectDraw getting a bitmap from a surface prob.
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...
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
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
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.
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement