mldirectxerror.h
来自「这是一个混合动画的实例代码」· C头文件 代码 · 共 57 行
H
57 行
///////////////////////////////////////////////////////////////////////////////
//
// File: mlDirectXError.h
//
// Author: Frank Luna (C) All Rights Reserved
//
// System: Athlon 1800+ XP, 512 DDR, Radeon 9500 Pro, Windows XP, MSVC++ 7.0
//
// Desc: Contains exception classes for handling DirectX errors.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef __mlDirectXErrorH__
#define __mlDirectXErrorH__
#include "mlWinAppUtility.h"
namespace dx_err
{
class DirectXError
{
public:
DirectXError();
DirectXError(HRESULT& hrCode, cstring& filename, uint32& lineNum);
cstring& getHRCode();
cstring& getFilename();
cstring& getLineNum();
std::string getFullError();
private:
std::string _hrCode;
std::string _filename;
std::string _lineNum;
};
inline void ThrowDxErr(HRESULT hr, cstring& filename, uint32 lineNum)
{
if(FAILED(hr))
{
throw DirectXError(hr, filename, lineNum);
}
}
// We do not want the client to have to enter in the __FILE__ and __LINE__
// macros everytime. So we provide a simpler interface. Note that we must
// use a macro, instead of a function, since __FILE__ and __LINE__ are
// relative to the file they are called in. So we need the macro to be
// expanded in the actual file we write THROW_DXERR. If we used a function
// __FILE__ and __LINE__ would be relative to this file "mlDirectXError.h".
// Note: '#' operator, in '#hr' for example, returns the value of hr
// as a string.
#define THROW_DXERR(hr) ThrowDxErr(hr, __FILE__, __LINE__);
}
#endif // __mlDirectXErrorH__
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?