Archived

This topic is now archived and is closed to further replies.

genjuro_lyb

DX7SDK DirectDraw tutorials No.6 problem!

Recommended Posts

//----------------------------------------------------------------------------- // Name: DDOverlayInit() // Desc: Setup the overlay object //----------------------------------------------------------------------------- int DDOverlayInit() { DDSURFACEDESC2 ddsd; // DirectDraw surface descriptor HRESULT hRet; // I'm not even going to try... DDPIXELFORMAT ddpfOverlayFormat = // The pixel format that we want the surface to be in { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 16, 0xF800, 0x07e0, 0x001F, // 16 bit RGB 5:6:5 0 }; // Setup the overlay surface's attributes in the surface descriptor memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT; ddsd.ddsCaps.dwCaps = DDSCAPS_OVERLAY | DDSCAPS_VIDEOMEMORY; ddsd.dwWidth = BMAPX; ddsd.dwHeight = BMAPY; ddsd.ddpfPixelFormat = ddpfOverlayFormat; // Use 16 bit RGB 5:6:5 pixel format // Attempt to create the surface with theses settings hRet = g_pDD->CreateSurface(&ddsd, &g_pDDSOverlay, NULL); if (hRet != DD_OK) return FALSE; return TRUE; } ----------------------------------------------------------- CreateSurface() return : DDERR_INVALIDPIXELFORMAT /* * pixel format was invalid as specified */ how to solve it? if I delete the "DDSD_PIXELFORMAT" flag, it return : DDERR_NOOVERLAYHW /* * Operation could not be carried out because there is no overlay hardware * present or available. */ but my hardware support OVERLAY and OVERLAYSTRETCH.(dwCaps Viewer report it to me.) why? thank father mother and my friends. Edited by - genjuro_lyb on November 4, 2001 9:34:32 PM

Share this post


Link to post
Share on other sites