|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Getting Started: Why won't this work
------------------------------------------------------------ GameProgrammer.Com: Getting Started: Why won't this work ------------------------------------------------------------ By Ronny Althenn on Saturday, July 8, 2000 - 09:27 pm: When I compile this, I get an error saying that it cannot convert a DDSURFACEDESC2 struct to a DDSURFACEDESC struct. I'm using the IDirectDraw4 interface as described in hour 2 of "SAMS Teach Yourself DirectX 7 in 24 Hours" by Robert Dunlop, Dale Shepherd and Mark Martin, as well as in Chapter 6 of "Tricks of the Windows Game Programming Gurus" by André LaMothe. I just got through figuring out I had to add dxguid.dll to my project to get a different error involving IID_IDirectDraw4 being an unresolved external symbol, and now I get this. GRRRR! I know is in my include path, and I set the SDK's version ahead of VC's version, since it's the newer version. Somehow I think I'm still getting the older version included. Here's the code that's giving me trouble: -------- #include #define INITGUID #include #define KEYDOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1:0) extern HINSTANCE hinstance_app; extern HWND main_window_handle; LPDIRECTDRAW lpdd4 = NULL; LPDIRECTDRAWSURFACE4 lpddsprimary = NULL; DDSURFACEDESC2 ddsd; int Game_Init(void *parms=NULL, int num_parms=0) { PALETTEENTRY palette[256]; LPDIRECTDRAW lpdd = NULL; LPDIRECTDRAWPALETTE lpddpal = NULL; /* setup DirectDraw */ if (FAILED(DirectDrawCreate(NULL, &lpdd, NULL))) return(0); if (FAILED(lpdd->QueryInterface(IID_IDirectDraw4, (LPVOID*) &lpdd4))) return(0); lpdd->Release(); lpdd = NULL; if (FAILED(lpdd4->SetCooperativeLevel(main_window_handle, DDSCL_FULLSCREEN | DDSCL_ALLOWMODEX | DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT))) return(0); /* create palette */ for (int color=0; colorCreatePalette(DDPCAPS_8BIT | DDPCAPS_ALLOW256 | DDPCAPS_INITIALIZE, palette, &lpddpal, NULL))) { return(0); } /* create surface */ ddsd.dwSize = sizeof(DDSURFACEDESC2); ddsd.dwFlags = DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; if (FAILED(lpdd4->CreateSurface(&ddsd, &lpddsprimary, NULL))) { return(0); } if (FAILED(lpddsprimary->SetPalette(lpddpal))) { return(0); } return(1); } int Game_Main(void *parms=NULL, int num_parms=0) { int mempitch; UCHAR* screen; int i; int x; int y; UCHAR color; if (KEYDOWN(VK_ESCAPE)) SendMessage(main_window_handle, WM_CLOSE, 0, 0); memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); if (FAILED(lpddsprimary->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL))) { return(0); } mempitch = (int) ddsd.lPitch; screen = (UCHAR*) ddsd.lpSurface; for (i = 0; iUnlock(NULL); return(1); } int Game_Shutdown(void *parms=NULL, int num_parms=0) { if (lpdd4) { lpdd4->Release(); lpdd4 = NULL; } return(1); } --------- Any help would be appreciated. Thanks. BTW, I tried really hard to get this message as accurate as possible. The preview is showing curly brackets ( { and } ) as { and }. Hopefully when I post it will look normal. - Neisayer ------------------------------------------------------------ DO NOT REPLY TO THIS MESSAGE! It is an automatic e-mail notification message from the discussion board indicating that a new message was posted. If you do not wish to receive further e-mail notification messages from this discussion board, edit your user or moderator profile to turn off the e-mail notification option. Use this link to go directly to the discussion: http://gameprogrammer.com/cgi-bin/comm/gameprogrammer/discus/show.pl?5/72
|
|