Original Post
Hi, I've tried to make a mini-game with DirectDraw, but there's a error with my game surfaces. Look at the code, before the call to CreateVideoSurface() the surface is 0, at the end of CreateVideoSurface() the surface is anything but not 0, and after the call to this function the surface again is zero. Here is the code: ================= ///////////////// // objects.cpp // ///////////////// LPDIRECTDRAWSURFACE7 g_lpDDSBackground; // Global variable int InitObjects() { ... // Hintergrund Image laden if(CreateVideoSurface(g_lpDDSBackground, 400, 300)) return(1); // -----------------> Here the Surface is 0 <----------------- ... } /////////////// // ddraw.cpp // /////////////// int CreateVideoSurface(LPDIRECTDRAWSURFACE7 lpDDSurface, int nWidth, int nHeight) { DDSURFACEDESC2 ddsd; A2PINITDDSTRUCT(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY; ddsd.dwWidth = nWidth; ddsd.dwHeight = nHeight; if(FAILED(g_lpDD->CreateSurface(&ddsd, &lpDDSurface, NULL))) return(1); // ----------------->Here the Surface is anything but not 0<----------------- // success return(0); } ================= Thanks for Help [Edited by - m4ster on June 14, 2006 12:48:24 PM]