dxhelper.h
来自「<B>DirectX9.0 3D游戏编程</B>」· C头文件 代码 · 共 45 行
H
45 行
/********************************************************************
* Advanced 3D Game Programming using DirectX 9.0 *
********************************************************************
* copyright (c) 2003 by Peter A Walsh and Adrian Perez *
* See license.txt for modification and distribution information *
********************************************************************/
#ifndef _D3DHELPER_H
#define _D3DHELPER_H
#include <memory.h>
/**
* This class takes care of the annoying gruntwork
* of having to zero-out and set the size parameter
* of our Windows and DirectX structures.
*/
template <class T>
struct sAutoZero : public T
{
sAutoZero()
{
memset( this, 0, sizeof(T) );
dwSize = sizeof(T);
}
};
/**
* The Right Way to release our COM interfaces.
* If they're still valid, release them, then
* invalidate them and null them.
*/
template <class T>
inline void SafeRelease( T& iface )
{
if( iface )
{
iface->Release();
iface = NULL;
}
}
#endif // _D3DHELPER_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?