DirectDrawCreateEx in Borland Compiler 5.5
-
Hallo Keute, ich habe mal eine Frage:
Ich habe folgendes Programm:
#include <windows.h> #include <ddraw.h> LPDIRECTDRAW lpDD=0; LPDIRECTDRAWSURFACE lpDDSPrimary=0; LPDIRECTDRAWSURFACE lpDDSBack=0; LPDIRECTDRAWSURFACE lpBitmap=0; LPDIRECTDRAWSURFACE lpBitmapp=0; int Reihe=1; LRESULT CALLBACK WindowProc(HWND,unsigned,WPARAM,LPARAM); LPDIRECTDRAWSURFACE bitmap_surface(LPCTSTR); int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) { WNDCLASS wc; wc.style=CS_HREDRAW|CS_VREDRAW; wc.lpfnWndProc=(WNDPROC) WindowProc; wc.cbClsExtra=0; wc.cbWndExtra=sizeof(DWORD); wc.hInstance=hInstance; wc.hIcon=0; wc.hCursor=LoadCursor(0,IDC_ARROW); wc.hbrBackground=(HBRUSH) GetStockObject(BLACK_BRUSH); wc.lpszMenuName=0; wc.lpszClassName="WinProg"; RegisterClass(&wc); int ScreenWidth=GetSystemMetrics(SM_CXSCREEN); int ScreenHeigth=GetSystemMetrics(SM_CYSCREEN); HWND hWnd; hWnd=CreateWindow("WinProg", "Jokefish", WS_VISIBLE|WS_POPUP, 0, 0, ScreenWidth, ScreenHeigth, 0, 0, hInstance, 0); ShowWindow(hWnd,nCmdShow); UpdateWindow(hWnd); ShowCursor(false); SetTimer(hWnd,0,1000,0); DirectDrawCreateEx(0,(void**) &lpDD,IID_IDirectDraw,0); lpDD->SetCooperativeLevel(hWnd,DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN); lpDD->SetDisplayMode(640,480,16); DDSURFACEDESC ddsd; ZeroMemory(&ddsd,sizeof(ddsd)); ddsd.dwSize=sizeof(ddsd); ddsd.dwFlags=DDSD_CAPS|DDSD_BACKBUFFERCOUNT; ddsd.ddsCaps.dwCaps=DDSCAPS_FLIP|DDSCAPS_PRIMARYSURFACE|DDSCAPS_COMPLEX; ddsd.dwBackBufferCount=1; lpDD->CreateSurface(&ddsd,&lpDDSPrimary,0); DDSCAPS ddscaps; ZeroMemory(&ddscaps,sizeof(ddscaps)); ddscaps.dwCaps=DDSCAPS_BACKBUFFER; lpDDSPrimary->GetAttachedSurface(&ddscaps,&lpDDSBack); lpBitmap=bitmap_surface("bitmap.bmp"); lpBitmapp=bitmap_surface("bitmapp.bmp"); MSG msg; while(GetMessage(&msg,0,0,0)) { TranslateMessage(&msg); DispatchMessage(&msg); } lpBitmapp->Release(); lpBitmap->Release(); lpDDSBack->Release(); lpDDSPrimary->Release(); lpDD->Release(); ShowCursor(true); return msg.wParam; } LRESULT CALLBACK WindowProc(HWND hWnd,unsigned uMsg,WPARAM wParam,LPARAM lParam) { switch(uMsg) { case WM_TIMER: RECT rects; rects.top=0; rects.left=0; rects.right=639; rects.bottom=479; if(Reihe==1) { lpDDSBack->BltFast(0,0,lpBitmap,&rects,DDBLTFAST_NOCOLORKEY); Reihe=2; } if(Reihe==2) { lpDDSBack->BltFast(0,0,lpBitmapp,&rects,DDBLTFAST_NOCOLORKEY); Reihe=1; } lpDDSPrimary->Flip(0,DDFLIP_WAIT); return 0; case WM_KEYDOWN: DestroyWindow(hWnd); return 0; case WM_DESTROY: PostQuitMessage(0); return 0; default: return DefWindowProc(hWnd,uMsg,wParam,lParam); } } LPDIRECTDRAWSURFACE bitmap_surface(LPCTSTR filename) { HDC hdc; HBITMAP bit; LPDIRECTDRAWSURFACE surf; bit=(HBITMAP) LoadImage(0,filename,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE); if (!bit) return 0; BITMAP bitmap; GetObject(bit,sizeof(BITMAP),&bitmap); int surf_width=bitmap.bmWidth; int surf_height=bitmap.bmHeight; HRESULT ddrval; DDSURFACEDESC ddsd; ZeroMemory(&ddsd,sizeof(ddsd)); ddsd.dwSize=sizeof(DDSURFACEDESC); ddsd.dwFlags=DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT; ddsd.ddsCaps.dwCaps=DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY; ddsd.dwHeight=surf_height; ddsd.dwWidth=surf_width; ddrval=lpDD->CreateSurface(&ddsd,&surf,0); if(ddrval!=DD_OK) { DeleteObject(bit); return 0; } else { surf->GetDC(&hdc); HDC bitdc =CreateCompatibleDC(hdc); SelectObject(bitdc,bit); BitBlt(hdc,0,0,surf_width,surf_height,bitdc,0,0,SRCCOPY); surf->ReleaseDC(hdc); DeleteDC(bitdc); } DeleteObject(bit); return surf; }
Der Compiler kauft mir dieses Programm ohne Probleme ab. Aber der Linker sagt mir, die externe Funktion DirectDrawCreateEx nicht abrufbar ist. Kann mir jemand sagen, welche Parameter (v.a. welche LIBs) ich an den Linker übergeben muss? P.S.:Ich hab schon probiert, die ddraw.lib aus dem Verzeichnis Lib\Psdk in das Verzeichnis Lib zu kopieren.
-
Entschuldigung, es heißt natürlich Hallo Leute!
-
hassu deinem compiler gesagt, wo er das lib und include verzeichnis findet?
-
Natürlich: LIB-Verzeichnis: \Borland\BCC55\Lib
Include-Verzeichnis: \Borland\Bcc55\Include
-
Hallo, antwortet mal jemand?!