|
-
Dec 29th, 2001, 05:05 PM
#1
Thread Starter
Junior Member
Is my VC++ compiler broken?
Can someone test this DX7 app and see if it works for you?
Thanks a lot! BTW: I included the dxguid.lib and ddraw.lib too.
LPDIRECTDRAW lpDD;
HRESULT ddrval;
ddrval = DirectDrawCreate( NULL, &lpDD, NULL );
if( ddrval != DD_OK )
{
// Do some error checking here
}
//[Setting Cooperative Level]
ddrval = lpDD->SetCooperativeLevel( hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN );
if( ddrval != DD_OK)
{
//Do some error checking here
}
//[Setting Video Mode]
ddrval = lpDD->SetDisplayMode( 640, 480, 8);
if( ddrval != DD_OK)
{
//Do some error checking here
}
//[Creating Primary Surface]
LPDIRECTDRAWSURFACE lpDDSPrimary;
DDURFACEDESC ddsd;
HRESULT ddrval;
//Clear all fields in structure
memset( &&ddsd, 0, sizeof(ddsd) );
//Set flags in structure
ddsd.dwSize = sizeof( ddsd );
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
ddsd.dwBackBufferCount = 1;
//Create Surface
ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL );
if( ddrval != DD_OK )
{
//Do error checking here
}
//[Creating Back Surface]
DDSCAPS ddscaps;
LPDIRECTDRAWSURFACE lpDDSBack; ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
ddrval = lpDDSPrimary->GetAttachedSurface( &ddscaps, &lpDDSBack );
if( ddrval != DD_OK )
{
//Do error checking here
}
//[Creating Offscreen Surface]
LPDIRECTDRAWSURFACE lpDDSOffscreen;
DDSURFACEDESC ddsd;
HRESULT ddrval;
ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
ddsd.dwHeight = 480;
ddsd.dwWidth = 640;
ddrval = lpDD->CreateSurface( &ddsd, &lpDDSOffscreen, NULL );
if( ddrval != DD_OK )
{
//Do error checking here
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|