Lets talk bitmaps....
ok...
first off i cant even seem to load a bitmap let alone move it to my primary surface....
I am ever cursed by LeMothe and his bugggy code...
not only is his code compleatly wrong at times but he didnt explain why he wrote it like that....
Enough of my rant though...
I need help...
I took LeMothe''s advice and made one struct to hold it all...
like this: typedef struct BITMAP_FILE_TAG{
BITMAPFILEHEADER bitmapfileheader;
BITMAPINFOHEADER bitmapinfoheader;
PALETTEENTRY palette[256];
UCHAR *buffer;
}BITMAP_FILE, *BITMAP_FILE_PTR;//and make a bitmap1 to hold it.
you know the drill
BITMAP_FILE bitmap1;
I tried to use LoadBitmap() with my struct //at least LeMothe couldnt mess up that... and of corse i Couldnt because of the Handel and pointer conflict...(next)
and i tried to use LeMothe''s crazy code to Load_Bitmap_File
and that was a compleatly confusing disaster...
now i would like to get a freaken bitmap on my screen but i would settle for just loading one for now...
so help me if you can (i probably need mental help after listening to "His" code...)
and if you need more of my code.... try to tell me what im missing....(and please dont let me use LoadBitmap() or any other NON- LeMothe code...)!thanx for your time...
Keep conjuring the undead, my friends...
Keep conjuring the undead, my friends...
My problem stems from lack of Handel understanding...
I thought you make a handel by **hOne....
(at least that is how my compiler refers to them)
this is very confusing to me...
other wise i understand the LoadBitmap... and Blt()procedure
so if you could show me how a good Loadbitmap functions...
that would help...(scence LeMothe''s code is nice and error free
*cough* yah right...
I thought you make a handel by **hOne....
(at least that is how my compiler refers to them)
this is very confusing to me...
other wise i understand the LoadBitmap... and Blt()procedure
so if you could show me how a good Loadbitmap functions...
that would help...(scence LeMothe''s code is nice and error free
*cough* yah right...
Keep conjuring the undead, my friends...
November 06, 2000 07:33 PM
wish i could help
but i concurr Andre` LaMothe will bug up his code
but i concurr Andre` LaMothe will bug up his code
Here''s my suggestion: don''t use LaMothe''s bmp code. I believe even he says it sucks...
Instead, use DDLoadBitmap(), found in ddutil.cpp and ddutil.h (it should be in some of the DDraw example directories of the DX SDK). Trust me, it''s really nice and easy. To find out how to use it, there''s an article somewhere in the programming reference section.
Excuse me whilst I conquer Earth...
Commander M
(a.k.a. Crazy Yank)
http://commanderm.8m.com
CmndrM@gdnmail.net
Instead, use DDLoadBitmap(), found in ddutil.cpp and ddutil.h (it should be in some of the DDraw example directories of the DX SDK). Trust me, it''s really nice and easy. To find out how to use it, there''s an article somewhere in the programming reference section.
Excuse me whilst I conquer Earth...
Commander M
(a.k.a. Crazy Yank)
http://commanderm.8m.com
CmndrM@gdnmail.net
whoaw it gave me these for errors...
''BITMAP_ID'' : undeclared identifier
C:\WINDOWS\Desktop\Moo!\Graphics\Graphics.cpp(182) : error C2065: ''_RGB16BIT'' : undeclared identifier
C:\WINDOWS\Desktop\Moo!\Graphics\Graphics.cpp(210) : error C2065: ''Flip_Bitmap'' : undeclared identifier
C:\WINDOWS\Desktop\Moo!\Graphics\Graphics.cpp(441) : error C2065: ''DDLoadBitmap'' : undeclared identifier
what didnt i do right to setup the ddutil.h and ddutil.cpp
I thought that because the ddutil.cpp has a #include ddutil.h
in it it would work what did i do wrong?
and thanx this looks like the best function...
Keep conjuring the undead, my friends...
''BITMAP_ID'' : undeclared identifier
C:\WINDOWS\Desktop\Moo!\Graphics\Graphics.cpp(182) : error C2065: ''_RGB16BIT'' : undeclared identifier
C:\WINDOWS\Desktop\Moo!\Graphics\Graphics.cpp(210) : error C2065: ''Flip_Bitmap'' : undeclared identifier
C:\WINDOWS\Desktop\Moo!\Graphics\Graphics.cpp(441) : error C2065: ''DDLoadBitmap'' : undeclared identifier
what didnt i do right to setup the ddutil.h and ddutil.cpp
I thought that because the ddutil.cpp has a #include ddutil.h
in it it would work what did i do wrong?
and thanx this looks like the best function...
Keep conjuring the undead, my friends...
Keep conjuring the undead, my friends...
Did you #include ddutil.h in the file you are calling those functions from? You need the proto''s to use the external functions, otherwise VC complains.
-----------------------------
A wise man once said "A person with half a clue is more dangerous than a person with or without one."
The Micro$haft BSOD T-Shirt
-----------------------------
A wise man once said "A person with half a clue is more dangerous than a person with or without one."
The Micro$haft BSOD T-Shirt
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt
here''s a little something
Hope that helps
LPDIRECTDRAWSURFACE7 BitmapSurface(LPCTSTR filename, LPDIRECTDRAW7 &rLocalDD){ HDC hdc; HBITMAP hbitmap; LPDIRECTDRAWSURFACE7 surface; //Load image to handle hbitmap = (HBITMAP)LoadImage(NULL, filename, IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE); //If fail return Null if (!hbitmap) { return(NULL); }//end if //Get the bitmap''s size BITMAP bitmap; GetObject(hbitmap, sizeof(bitmap), &bitmap); int surfwidth = bitmap.bmWidth; int surfheight = bitmap.bmHeight; HRESULT ddrval; //Setup surface for creation DDSURFACEDESC2 ddsd; ZeroMemory(&ddsd, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; ddsd.dwWidth = surfwidth; ddsd.dwHeight = surfheight; ddrval = rLocalDD->CreateSurface(&ddsd, &surface, NULL); //If failed, clean up and return Null if (ddrval != DD_OK) { DeleteObject(hbitmap); return(NULL); } //Bit the temp DC to the surface''s dc and return the surface else { surface->GetDC(&hdc); HDC bitDC = CreateCompatibleDC(hdc); SelectObject(bitDC, hbitmap); BitBlt(hdc, 0, 0, surfwidth, surfheight, bitDC, 0, 0, SRCCOPY); surface->ReleaseDC(hdc); DeleteDC(bitDC); }//end if DeleteObject(hbitmap); //Return success return(surface);}//this is DirectX7//assume DirectDraw is created as lpDDLPDIRECTDRAWSURFACE7 lpMySurface;lpMySurface = BitmapSurface("mybitmap.bmp", lpDD);
Hope that helps
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement