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

HELP!!!!!!!!!!!!!

Started by
4 comments, last by GameDev.net 24 years, 9 months ago
Dude, you don't just stretch the bitmap onto the DC, this is the most pathetic way of doing it I've seen. It should work, but even if it will, it's gonna be so slow, it will be no use. Check out the DDLoadBitmap in ddutils.c, it's the code that loads the bitmap in the surface.
Advertisement
Um, kill, hate to disappoint you, but what he's got there is pretty much the exact way the DirectX examples show you how to load a bitmap into the surface. All he did really was concatenate all of the functions they use into a single one.
As for speed, that really depends on when you're planning on loading bitmaps into the surfaces in your game. If you're just doing the loading during a specific loading period and not during the actual game action it should work fine as long as you're not loading too much that way.
At first glance I don't notice any problems with the code posted...
yeah! thats what I did it,and also found the problem, but it is slow I know that, I just needed to load the menu an some splahs screens thanks anyway for the concern.
And Kill I used the DDloadbitmap ind another program I just tried to do it other way.
thanks:

_José

couple of real quick brainstorms for you:

- does it work if you use Blt() instead of BltFast?

- where's the Flip() command? Or are you using one?

Mason McCuskey
Spin Studios
www.spin-studios.com

Founder, Cuttlefish Industries
The Cuttlefish Engine lets anyone develop great games for iPad, iPhone, Android, WP7, the web, and more!
hey how is every1 doing.
I need some help guys, I trying to load a bitmap to a surface but nothing happens.
I mean DD initialize (I know because the screen goes black, and when press esc escape) but the bitmap does'n show up
here is my code:
void ProcesoPrincipal()
{
secundaria->BltFast(0,0,fuera1,▭,DDBLTFAST_NOCOLORKEY);
primaria->BltFast(0,0,secundaria,▭,DDBLTFAST_WAIT | DDBLTFAST_SRCCOLORKEY);


}
IDirectDrawSurface* CreaBitmap(IDirectDraw* dd, LPCTSTR arc, int dw, int dh)
{
HBITMAP hbm;
BITMAP bm;
DDSURFACEDESC surf;
IDirectDrawSurface* superficie;
HDC hdcb;
HDC hdcs;

hbm = (HBITMAP)LoadImage(NULL,arc,IMAGE_BITMAP,dw,dh,LR_LOADFROMFILE | LR_CREATEDIBSECTION);

GetObject(hbm,sizeof(bm),&bm);

ZeroMemory(&surf,sizeof(surf));
surf.dwSize = sizeof(surf);
surf.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
surf.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
surf.dwWidth = bm.bmWidth;
surf.dwHeight = bm.bmHeight;

if (dd->CreateSurface(&surf,&superficie,NULL) !=DD_OK) return NULL;

//copia el bitmap a la superficie///
hdcb = CreateCompatibleDC(NULL);
SelectObject(hdcb,hbm);
superficie->GetDC(&hdcs);

StretchBlt(hdcs,0,0,surf.dwWidth,surf.dwHeight,hdcb,0,0,bm.bmWidth,bm.bmHeight,SRCCOPY);
superficie->ReleaseDC(hdcs);
DeleteDC(hdcb);
DeleteObject(hbm);
return superficie;
}
some of the names are in spanish, I'm spanish talking.

thanks in advance:
_José



hey mason it's better for me to use BltFast
and yes I used Flip() but in the main function.
thanks anyway guys you are the greatest

This topic is closed to new replies.

Advertisement