|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] RE: Win 98 acting like dos
Yes, that's right, that this way is very slowly, but when you don't want to use
DirectX you should use this way!
Here is the code for full screen by using DirectX(also creating a primary
surface and set a cooperative level )(especially DirectDraw):
static BOOL doInit( HINSTANCE hInstance, int nCmdShow )
{
HWND hwnd;
WNDCLASS wc;
DDSURFACEDESC ddsd;
DDCAPS ddcaps;
DDPIXELFORMAT ddpf;
// Set up and register window class.
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon( hInstance, IDI_APPLICATION );
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
wc.hbrBackground = NULL;
wc.lpszMenuName = NAME;
wc.lpszClassName = NAME;
RegisterClass( &wc );
// Create a fullscreen window.
hwnd = CreateWindowEx(
WS_EX_TOPMOST,
NAME,
TITLE,
WS_POPUP,
0, 0,
GetSystemMetrics( SM_CXSCREEN ),
GetSystemMetrics( SM_CYSCREEN ),
NULL,
NULL,
hInstance,
NULL );
if ( !hwnd )
{
return FALSE;
}
ShowWindow( hwnd, nCmdShow );
UpdateWindow( hwnd );
// Create the DirectDraw object -- we just need an IDirectDraw
// interface so we won't bother to query an IDirectDraw2.
if ( FAILED( DirectDrawCreate( NULL, &lpDD, NULL ) ) )
{
return Fail( hwnd, "Couldn't create DirectDraw object.\n" );
}
// Get exclusive mode.
if ( FAILED( lpDD->SetCooperativeLevel( hwnd,
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ) ) )
{
return Fail( hwnd, "Couldn't set cooperative level.\n" );
}
if ( FAILED( lpDD->SetDisplayMode( 640, 480, 32 ) ) )
{
if ( FAILED( lpDD->SetDisplayMode( 640, 480, 24 ) ) )
{
if ( FAILED( lpDD->SetDisplayMode( 640, 480, 16 ) ) )
{
return Fail( hwnd, "Fehler beim Setzen des Videomodus.\n" );
}
}
}
// Create the primary surface.
ddsd.dwSize = sizeof( ddsd );
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
if ( FAILED( lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL ) ) )
{
return Fail( hwnd, "Couldn't create primary surface.\n" );
}
=================================================================
To SUBSCRIBE or UNSUBSCRIBE please visit
http://gameprogrammer.com/mailinglist.html
|
|