|
-
Oct 18th, 2002, 05:38 AM
#1
Thread Starter
Fanatic Member
Direct Draw *RESOLVED
Hello,
I'm new to Direct Draw and i want to learn it.
I have source code to a program, but when i build it, I get errors:
--------------------Configuration: Direct Draw1 - Win32 Debug--------------------
Compiling...
DD1.CPP
C:\Documents and Settings\Peter Backman\Mina dokument\Programmering\C++\DDraw\Direct Draw1\DD1.CPP(7) : error C2146: syntax error : missing ';' before identifier 'g_pdd'
C:\Documents and Settings\Peter Backman\Mina dokument\Programmering\C++\DDraw\Direct Draw1\DD1.CPP(7) : error C2501: 'LPDIRECTDRAW7' : missing storage-class or type specifiers
C:\Documents and Settings\Peter Backman\Mina dokument\Programmering\C++\DDraw\Direct Draw1\DD1.CPP(7) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
Direct Draw1.exe - 3 error(s), 0 warning(s)
By the way, here is the Source:
#include <afxwin.h>
#include <ddraw.h>
#include <ctime>
#include <cstdlib>
HRESULT hRet;
LPDIRECTDRAW7 g_pdd; //The 3 errors is pointing to this.
LPDIRECTDRAWSURFACE7 g_pddsprimary;
LPDIRECTDRAWSURFACE7 g_pddsback;
LPDIRECTDRAWSURFACE7 g_pddsone;
DDSURFACEDESC2 ddsd;
DDSCAPS2 ddsc;
class cDDProg : public CWinApp
{
public:
virtual BOOL InitInstance();
};
cDDProg DDProgram;
class cDDWind : public CFrameWnd
{
CStatic* WelcomeStatic;
public:
cDDWind();
};
BOOL cDDProg::InitInstance()
{
m_pMainWnd = new cDDWind();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
cDDWind::cDDWind()
{
WelcomeStatic = new CStatic();
Create(NULL,"Direct Draw Test.",WS_OVERLAPPEDWINDOW,CRect(100,100,500,300));
WelcomeStatic->Create("Welcome to the Direct Draw test by Peter Backman!",WS_CHILD|WS_VISIBLE,CRect(0,0,400,200),this);
//Initialize Direct Draw
hRet = DirectDrawCreateEx(NULL,(void**)&g_pdd,IID_IDirectDraw7,NULL);
if (hRet != DD_OK)
MessageBox("DirectDrawEx Failed!","Direct Draw",MB_EXCLAMATION);
//Now, set the cooperative level
hRet = g_pdd->SetCooperativeLevel(cDDWind::m_hWnd,DDSCL_FULLSCREEN|DDSCL_EXCLUSIVE);
if (hRet != DD_OK)
MessageBox("SetCooperativeLevel Failed","Direct Draw",MB_EXCLAMATION);
//Set display mode, 640x480 with 16 bit color deepth
hRet = g_pdd->SetDisplayMode(640,480,16,0,0);
if (hRet != DD_OK)
MessageBox("SetDisplayMode Failed!","Direct Draw",MB_EXCLAMATION);
//Prepare primary surface info
ZeroMemory(&ddsd,sizeof(ddsd));
}
Last edited by petrus; Oct 18th, 2002 at 04:46 PM.
ICQ: 128716725
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
|