我宣布属性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()函数。
为什么没有工作,我怎么能解决呢?