/*
需要包含以下库
d3d9.lib
d3dx9.lib
winmm.lib
*/
#include <d3dx9.h>
namespace d3d {
bool InitD3D(HWND hwd,
HINSTANCE hInstance, //[in]应用程序实例
int width, int height,//[in]Back buffer尺寸
bool windowed, //[in]是否全屏
D3DDEVTYPE deviceType,//[in]HAL or REF
IDirect3DDevice9** device); //[out]创建的设备
LRESULT CALLBACK WndProc(HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam);
int EnterMsgLoop(bool(*ptr_display)(float timeDelta));
template<class T>
void Release(T t)
{
if (t)
{
t->Release();
t = 0;
}
}
template<class T>
void Delete(T t)
{
if (t)
{
delete t;
t = 0;
}
}
}
#include "stdafx.h"
#include "d3dUtility.h"
bool d3d::InitD3D(HWND hwd,
HINSTANCE hInstance, //[in]应用程序实例
int width, int height,//[in]Back buffer尺寸
bool windowed, //[in]是否全屏
D3DD