#ifndef __d3dUtilityH__<br />#define __d3dUtilityH__</p><p>#include <d3dx9.h><br />#include <string></p><p>namespace d3d<br />{<br />bool InitD3D(//初始化DirectX3D<br />HINSTANCE hInstance, // [in] Application instance.<br />int width, int height, // [in] Backbuffer dimensions.<br />bool windowed, // [in] Windowed (true)or full screen (false).<br />D3DDEVTYPE deviceType, // [in] HAL or REF<br />IDirect3DDevice9** device);// [out]The created device.</p><p>int EnterMsgLoop( //訊息迴圈<br />bool (*ptr_display)(float timeDelta));</p><p>LRESULT CALLBACK WndProc(<br />HWND hwnd,<br />UINT msg,<br />WPARAM wParam,<br />LPARAM lParam);</p><p>template<class T> void Release(T t)<br />{<br />if( t )<br />{<br />t->Release();<br />t = 0;<br />}<br />}</p><p>template<class T> void Delete(T t)<br />{<br />if( t )<br />{<br />delete t;<br />t = 0;<br />}<br />}<br />}</p><p>#endif // __d3dUtilityH__