
24-04-2007, 19:13
|
|
|
|
חבר מתאריך: 15.08.04
הודעות: 283
|
|
|
עזרה בDirectX SDK
שלום לכולם!
חיפשתי בפורום כיצד ניתן ללמוד גרפיקה ומצאתי שנתנו את האתר הבא:
http://www.gamedev.net
הורדתי את Directx SDK וניסיתי להריץ קטע קוד כדי לראות עם הVisual Studio 2003
מזהה את הספריות החדשות :
קוד:
2. Initializing DirectDraw
The first thing to learn about DirectDraw is how to initialize it. Read the detailed comments in the following source code for explanations at each step.
קוד:
// globals (ugh)
#include <ddraw.h>
LPDIRECTDRAW lpDD; // DirectDraw object defined in DDRAW.H
/*
* Function to initialize DirectDraw
* Demonstrates:
* 1) Creating the Direct Draw Object
* 2) Setting the Cooperative level
* 3) Setting the Display mode
*
*/
bool DirectDrawInit(HWND hwnd)
{
HRESULT ddrval;
/*
* Create the main DirectDraw object.
*
* This function takes care of initializing COM and Constructing
* the DirectDraw object.
*/
ddrval = DirectDrawCreate( NULL, &lpDD, NULL );
if( ddrval != DD_OK )
{
return(false);
}
/*
* The cooperative level determines how much control we have over the
* screen. This must at least be either DDSCL_EXCLUSIVE or DDSCL_NORMAL
*
* DDSCL_EXCLUSIVE allows us to change video modes, and requires
* the DDSCL_FULLSCREEN flag, which will cause the window to take over
* the fullscreen. This is the preferred DirectDraw mode because it allows
* us to have control of the whole screen without regard for GDI.
*
* DDSCL_NORMAL is used to allow the DirectDraw app to run windowed.
*/
ddrval = lpDD->SetCooperativeLevel( hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN );
if( ddrval != DD_OK )
{
lpDD->Release();
return(false);
}
/*
* Set the video mode to 640x480x8
* This is allowed because we have set exclusive mode above
*/
ddrval = lpDD->SetDisplayMode( 640, 480, 8);
if( ddrval != DD_OK )
{
lpDD->Release();
return(false);
}
return(true);
}
ואני מקבל את הארור:
קוד:
fatal error C1010: unexpected end of file while looking for precompiled header directive
מישהו יכול להגיד לי מה הבעיה בדיוק? ואולי לתת לי אתר אחר שהוא מכיר שיכול לעזור בנושא?
תודה מראש.
|