000
30.07.2002, 19:29
snoopdog
|
hmm hab nu das 7er sdk und das 8er durchprobiert von DX(klar,ne? :) ) naja und hab die ddutil.h in mein Projekt eingebunden und auch die ddraw.lib und dxguid.lib nur der meckert
main.obj : error LNK2001: Nichtaufgeloestes externes Symbol _DDLoadBitmap Debug/prog1.exe : fatal error LNK1120: 1 unaufgeloeste externe Verweise Fehler beim Ausführen von link.exe.
was fehlt dem denn noch ???
--
Visit our 500er Gamer Lan @ www.evil-lanparty.de or @ www.evil-havoc.com Visit the HaVoc Lanparty Community @ www.havoc-lanparty.com
|
|
Profil || Suche
|
001
30.07.2002, 20:42
Gnomo
|
Vielleicht hast du einen Prototyp für eine Funktion geschrieben, diese aber nicht implementiert?
--
|
|
Profil || Suche
|
002
30.07.2002, 20:54
snoopdog
|
was meinst du mit prototyp? von meiner DDLoadBitmap funktion?? öhm ich glaub sowas hab ich net *g*
--
Visit our 500er Gamer Lan @ www.evil-lanparty.de or @ www.evil-havoc.com Visit the HaVoc Lanparty Community @ www.havoc-lanparty.com
|
|
Profil || Suche
|
003
01.08.2002, 05:06
feigling
|
Hmm, zeig doch mal den ganzen Code von der Funktion. So hätte ich keine Ahnung, wodran es liegen könnte.
--
|
|
Profil || Suche
|
004
01.08.2002, 07:34
Tron
|
nicht aufgeloeste symbole klingen schwer danach, dass du vergessen hast mit den entsprechenden .libs zu linken, schau mal nach, ob dieses symbol wirklich von einer der beiden .libs exportiert wird.
--
'KEINE PANIK' - aus der Triologie in fuenf Baenden von Douglas Adams
'FÜR DEINN FERD' - aus 'Gevatter Tod' von Terry Pratchett
|
|
Profil || Suche
|
005
01.08.2002, 20:19
snoopdog
|
wie kann ich das nachschauen??
also der code von der funktion is hier:
BOOL PaintBitmap(LPDIRECTDRAWSURFACE7 lpDDSSurface,LPDIRECTDRAWSURFACE7 lpDDSZielSurface) { lpDDSSurface = DDLoadBitmap(lpDD,"pic.bmp",400,400);
RECT rBMP;
SetRect(&rBMP,400,400,400,400);
lpDDSZielSurface->Blt(&rBMP,lpDDSSurface,NULL,DDBLT_WAIT, NULL);
return true;
}
was brauch ich denn alles für libs.?? oder rbauch ich da noch ne extra lib für ??
--
Visit our 500er Gamer Lan @ www.evil-lanparty.de or @ www.evil-havoc.com Visit the HaVoc Lanparty Community @ www.havoc-lanparty.com
|
|
Profil || Suche
|
006
02.08.2002, 15:20
theDon
|
ähm vielleicht die directdraw libs?!
--
\o tanz den naziprau! o/
And more than ever, I hope to never fall, Where enough is not the same it was before
|
|
Profil || Suche
|
007
02.08.2002, 17:28
feigling
|
Hau einfach die darein. dinput.lib ddraw.lib d3dim.lib d3drm.lib d3dx.lib d3dxd.lib d3dxof.lib dplayx.lib DSETUP.lib dsound.lib dxguid.lib
Das sind (glaube ich) alle *.libs vom Direct X 7 SDK. Die habe ich bei meinem Spiel auch alle drin, obwohl ich nur 3 libs bräuchte.
--
|
|
Profil || Suche
|
008
02.08.2002, 22:33
snoopdog
|
geht immernoch net :(
--
Visit our 500er Gamer Lan @ www.evil-lanparty.de or @ www.evil-havoc.com Visit the HaVoc Lanparty Community @ www.havoc-lanparty.com
|
|
Profil || Suche
|
009
03.08.2002, 12:09
Diablo_bth
|
oder code halt schnell nen eigenen bitmap-loader. Die Dateispezifikation und sample-Source gibts überall im netz
--
|
|
Profil || Suche
|
010
03.08.2002, 15:01
feigling
|
Ich habe hier gerade einen. Vielleicht kannst du den ja brauchen:
bitmap.h
#include <io.h>
#define MAX_COLORS 256
BOOL BMP_into_Surface(const char* File, LPDIRECTDRAWSURFACE7 DDSurface, BOOL Load_Palette); HANDLE BMP_OPEN_FILE(const char* File);
bitmap.cpp
BOOL BMP_into_Surface(const char* File, LPDIRECTDRAWSURFACE7 DDSurface, BOOL Load_Palette) { LPBYTE lpbyImage; HANDLE hfile; BITMAPFILEHEADER BMPFileHead; BITMAPINFOHEADER BMPFileInfo; RGBQUAD Palette[256]; DWORD dwRead_Buffer; DDSURFACEDESC2 ddsd; LPSTR TargetRAM; LPSTR SourceRAM; int Width; int Height;
ZeroMemory(&ddsd,sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd);
DDSurface->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
Width = ddsd.dwWidth; Height = ddsd.dwHeight;
if(!(lpbyImage=(LPBYTE)malloc(Width*Height))) return false;
hfile = BMP_OPEN_FILE(File);
if(hfile == INVALID_HANDLE_VALUE) return false;
if(!ReadFile(hfile, &BMPFileHead, sizeof(BMPFileHead), &dwRead_Buffer, NULL)) { CloseHandle(hfile); return false; }
if(!ReadFile(hfile, &BMPFileInfo, sizeof(BMPFileInfo), &dwRead_Buffer, NULL)) { CloseHandle(hfile); return false; }
if((BMPFileInfo.biWidth != Width) || (BMPFileInfo.biHeight != Height) || (BMPFileInfo.biBitCount != 8)) { CloseHandle(hfile); return false; }
if(!ReadFile(hfile, Palette, sizeof(Palette), &dwRead_Buffer, NULL)) { CloseHandle(hfile); return false; }
if(!ReadFile(hfile, lpbyImage, Width * Height, &dwRead_Buffer, NULL)) { CloseHandle(hfile); return false; }
CloseHandle(hfile);
TargetRAM = (LPSTR)ddsd.lpSurface; SourceRAM = (LPSTR) (&lpbyImage[(Height-1)*Width]);
for(int i=0;i <Height;i++) { memcpy(TargetRAM, SourceRAM, Width); TargetRAM += ddsd.lPitch; SourceRAM -= Width; }
DDSurface->Unlock(NULL);
if(lpbyImage) free(lpbyImage);
if(Load_Palette) { PALETTEENTRY pe[256]; HRESULT check;
ZeroMemory(pe, MAX_COLORS*sizeof(PALETTEENTRY));
for(int j=0;j<MAX_COLORS;j++) { pe[j].peRed = Palette[j].rgbRed; pe[j].peGreen = Palette[j].rgbGreen; pe[j].peBlue = Palette[j].rgbBlue; pe[j].peFlags = PC_NOCOLLAPSE; }
check = DD->CreatePalette(DDPCAPS_8BIT | DDPCAPS_ALLOW256, pe, &DD_Palette, NULL);
if(check != DD_OK) { Process_Error("Bitmap Fehler bei CreatePalette"); return false; }
check = Primary_Surface->SetPalette(DD_Palette);
if(check != DD_OK) { Process_Error("Bitmap Fehler bei SetPalette"); return false; } } return true; }
HANDLE BMP_OPEN_FILE(const char* File) { HANDLE hfile;
hfile = CreateFile(File,GENERIC_READ,FILE_SHARE_READ,(LPSECURITY_ATTRIBUTES) NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,(HANDLE) NULL);
if(hfile != INVALID_HANDLE_VALUE) return hfile;
return INVALID_HANDLE_VALUE; }
Musst du sehen, was du davon noch anpassen musst.
--
Dieser Beitrag wurde am 03.08.2002 um 15:01 von feigling bearbeitet.
|
|
Profil || Suche
|
011
03.08.2002, 21:48
snoopdog
|
ja ich hab sowas schonmal probiert, nen eigenen zu machen, nur da kam wieder das Problem, das der mir dann die anwendung automatisch wieder geschlossen hat. Hier mal der code
BOOL ReadFile(char *lpFile, LPDIRECTDRAWSURFACE7 lpDDSSurface, int bHeight, int bWidth) { HFILE File; OFSTRUCT fData;
int Width; int Height;
bitmap->BitmapData = (LPBYTE)malloc(400*400);
DDSURFACEDESC2 ddsd;
LPSTR lpZielRam; LPSTR lpQuellRam;
File = OpenFile(lpFile,&fData,OF_READ);
_lread(File,&bitmap->FileHeader,sizeof(BITMAPFILEHEADER));
_lread(File,&bitmap->InfoHeader,sizeof(BITMAPINFOHEADER));
_lread(File,&bitmap->BitmapData,sizeof(bWidth*bHeight));
_lclose(File);
ZeroMemory(&ddsd,sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd);
lpDDSSurface->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
Width = ddsd.dwWidth; Height = ddsd.dwHeight;
lpZielRam = (LPSTR)ddsd.lpSurface; lpQuellRam = (LPSTR)(&bitmap->BitmapData[(Height-1)*Width]);
for(int i=0;i<Height;i++) { memcpy(lpZielRam,lpQuellRam,Width); lpZielRam += ddsd.lPitch; lpQuellRam -= Height; }
lpDDSSurface->Unlock(NULL);
//delete[bitmap->BitmapData];
return true;
}
und hier der code wo ich die funktion aufrufe
while(!bDone) { while(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg);
}
if(bDone!=TRUE) { //paint(lpDDSBack,szText); ReadFile("pic.bmp",lpDDSBack,400,400);
FlipSurface();
Clear_Puffer(lpDDSBack); } else { DD_End(); }
hmm vielleicht findet ihr ja den Fehler
--
Visit our 500er Gamer Lan @ www.evil-lanparty.de or @ www.evil-havoc.com Visit the HaVoc Lanparty Community @ www.havoc-lanparty.com
|
|
Profil || Suche
|
012
04.08.2002, 05:16
feigling
|
Du hast oben bitmap->BitmapData = (LPBYTE)malloc(400*400);
Müsste da nicht bitmap->BitmapData = (LPBYTE)malloc(BMPSize); stehen und dann müsstest du die BMPSize auch noch mal herausfinden. Viellleicht liest deine Funktion die ganze BMP Datei ein und die BMP-DataSize ist größer als 400x400 und es kommt zum Fehler, weil du den Speicherbereich nicht "mallociert" hast (kommt jetzt nicht auf das korrekte Word dafür). Also dass du auf Speicher zu Schreiben versuchst, der garnicht vorhanden ist. Aber ka, ob es wirklich daran liegt >:D
P.S. Du nutzt nicht zufällig die Bücher "3D Spieleprogrammierung mit Direct X in C/C++", oder ? :D
--
|
|
Profil || Suche
|
013
04.08.2002, 11:38
snoopdog
|
ja das nutze ich....aber des is da recht blöde beschrieben in dem Buch :( außerdem will ich nur 24Bit BMPs laden, so das ich die FarbPalette net brauche.
--
Visit our 500er Gamer Lan @ www.evil-lanparty.de or @ www.evil-havoc.com Visit the HaVoc Lanparty Community @ www.havoc-lanparty.com
|
|
Profil || Suche
|
014
04.08.2002, 14:54
theDon
|
das richtige word ist "allozieren" ;)
--
\o tanz den naziprau! o/
And more than ever, I hope to never fall, Where enough is not the same it was before
|
|
Profil || Suche
|
015
04.08.2002, 22:52
snoopdog
|
hmm hab die funktion nun mal ausgebaut mit CreateFile, nur jetzt hängt sich mein Programm immer auf :( hier der code
BOOL ReadFile(char *lpFile, LPDIRECTDRAWSURFACE7 lpDDSSurface, int bHeight, int bWidth) { HANDLE File;
int Width = bWidth; int Height = bHeight;
DWORD dwLeseSpeicher;
bitmap.BitmapData = (LPBYTE)malloc(400*400);
DDSURFACEDESC2 ddsd;
LPSTR lpZielRam; LPSTR lpQuellRam;
File = CreateFile("pic.bmp",GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
ReadFile(File,&bitmap.FileHeader,sizeof(bitmap.FileHeader),&dwLeseSpeicher,NULL);
CloseHandle(File);
ReadFile(File,&bitmap.InfoHeader,sizeof(bitmap.InfoHeader),&dwLeseSpeicher,NULL);
CloseHandle(File);
ReadFile(File,&bitmap.BitmapData,Height*Width,&dwLeseSpeicher,NULL);
CloseHandle(File);
ZeroMemory(&ddsd,sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd);
lpDDSSurface->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
Width = ddsd.dwWidth; Height = ddsd.dwHeight;
lpZielRam = (LPSTR)ddsd.lpSurface; lpQuellRam = (LPSTR)(&bitmap.BitmapData[(Height-1)*Width]);
for(int i=0;i<Height;i++) { memcpy(lpZielRam,lpQuellRam,Width); lpZielRam += ddsd.lPitch; lpQuellRam -= Height; }
lpDDSSurface->Unlock(NULL);
free(bitmap.BitmapData);
return true;
}
was is da falsch? bzw. könnt ihr mir helfen, das ich endlich die bmps laden kann?
--
Visit our 500er Gamer Lan @ www.evil-lanparty.de or @ www.evil-havoc.com Visit the HaVoc Lanparty Community @ www.havoc-lanparty.com
|
|
Profil || Suche
|
016
18.08.2002, 07:30
feigling
|
Ich weiß, was daran falsch ist ... Du hast:
ReadFile(File,&bitmap.FileHeader,sizeof(bitmap.FileHeader),&dwLeseSpeicher,NULL); CloseHandle(File); ReadFile(File,&bitmap.InfoHeader,sizeof(bitmap.InfoHeader),&dwLeseSpeicher,NULL); CloseHandle(File); ReadFile(File,&bitmap.BitmapData,Height*Width,&dwLeseSpeicher,NULL); CloseHandle(File);
Naja, ich hoffe mal, es liegt daran und zwar öffnest du ja erst die Datei, dann liest du FileHeader aus und dann schließt du die Datei wieder und versuchst dann noch weiter, InfoHeader und so auszulesen, obwohl die Datei schon zu ist. Ich könnte mir vorstellen, dass es daran liegt. Mach einfach die zwei (fettgedruckten) CloseHandle(File); weg und versuch es nochmal. Ich hoffe, mein Tipp kommt jetzt nicht zu spät =) Ist mir gerade so aufgefallen.
--
Dieser Beitrag wurde am 18.08.2002 um 07:32 von feigling bearbeitet.
|
|
Profil || Suche
|