www.pudn.com > D3DITEM01.rar > D3DInitfun.h


#pragma once 
 
#ifndef _D3DINITFUN_H 
#define _D3DINITFUN_H 
 
#include  
#include  
 
extern D3DPRESENT_PARAMETERS g_d3dpp; 
 
namespace d3d 
{ 
	bool InitD3D( 
		HINSTANCE hInstance,        
		int width, int height,      
		bool windowed,             
		D3DDEVTYPE deviceType,     
		IDirect3DDevice9** device); 
 
	int EnterMsgLoop(  
		bool (*ptr_display)(float timeDelta)); 
 
	LRESULT CALLBACK WndProc( 
		HWND hwnd, 
		UINT msg,  
		WPARAM wParam, 
		LPARAM lParam); 
 
	template void Release(T t)		//撤消模板函数 
	{ 
		if( t ) 
		{ 
			t->Release(); 
			t = 0;		//设置地址为空(安全的撤消) 
		} 
	} 
		 
	template void Delete(T t)		//撤消模板函数 
	{ 
		if( t ) 
		{ 
			delete t; 
			t = 0; 
		} 
	} 
} 
 
#endif