WNDCLASSEX wc
我在头文件中声明该属性,如下所示:
private:
HWND hWnd;
LPDIRECT3D9 g_pD3D; // Used to create the D3DDevice
LPDIRECT3DDEVICE9 g_pd3dDevice; // Our rendering device
WNDCLASSEX wc;
我想在我的 Init() 函数中初始化它,如下所示:
void RAT_RendererDX9::Init(RAT_WindowManager* argWMan)
{
wMan = argWMan;
// Register the window class
wc =
{
sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc, 0, 0,
GetModuleHandle( NULL ), NULL, NULL, NULL, NULL,
"D3D Tutorial", NULL
};
RegisterClassEx( &wc );
hWnd = CreateWindow( "", "abc", WS_OVERLAPPEDWINDOW, 10, 10, 20, 20,
NULL, NULL, wc.hInstance, NULL );
g_pD3D = (LPDIRECT3D9)Direct3DCreate9( D3D_SDK_VERSION );
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof( d3dpp ) );
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp, &g_pd3dDevice );
}
但是,由于它,我收到以下错误:
1>e:\rat_engine\rat_engine\rat_engine\rat_rendererdx9.cpp(18): 错误 C2059: 语法错误: '{'
1>e:\rat_engine\rat_engine\rat_engine\rat_rendererdx9.cpp(18):错误 C2143:语法错误:缺少 ';' 前 '{'
1>e:\rat_engine\rat_engine\rat_engine\rat_rendererdx9.cpp(19): 错误 C3867: 'RAT_ENGINE::RAT_RendererDX9::MsgProc': 函数调用缺少参数列表;使用 '&RAT_ENGINE::RAT_RendererDX9::MsgProc' 创建指向成员的指针
1>e:\rat_engine\rat_engine\rat_engine\rat_rendererdx9.cpp(22): 错误 C2143: 语法错误: 缺少';' 前 '}'
但是我实际上从教程中复制了该初始化,唯一的例外是 wc 在 WinMain() 函数中初始化,而不是在 Init() 函数中初始化。
为什么它不起作用,我该如何解决?