D3D盗墓笔记
来源:互联网 发布:ntfs for mac 破解版 编辑:程序博客网 时间:2024/04/25 23:41
D3D盗墓笔记
呵呵,既然最近在看鬼吹灯,又在学D3D,同时有做最近这个游戏项目中一些比较简单的工作,闲暇时间,便找写代码和知识过来
前文我是已经模糊不清,只能从中间开始
#if defined(DEBUG) | defined(_DEBUG)
#ifndef HR
#define HR(x) /
{ /
HRESULT hr = x; /
if(FAILED(hr)) /
{ /
DXTrace(__FILE__, __LINE__, hr, #x, TRUE); /
} /
} /
#endif
#else
#ifndef HR
#define HR(x) x;
#endif #endif
用这种方法就可以用少量的代码来控制错误异常这些内容了。
例如HR(D3DXCreateFontIndirect(gd3dDevice, &fontDesc, &mFont));
这样看上去貌似节省了很多的代码,同时也使得代码的复杂度大大的降低了,更容易让人理解其中的内容了。宏定义的使用还是有很重要的作用的。
Observe that we pass #x into the fourth parameter; this turns the HR macro's argument token into a string. In this way, we can output the function call that caused the error; see Figure 4.14 (in particular, the "Calling: D3DXCreateFontIndirect…," which corresponds to this fourth parameter of DXTrace).
By construction, the HR macro only does anything in debug mode. This is fine, because by the time we are shipping an application, all the Direct3D bugs should be worked out.
HR needs to be a macro and not a function, because if it were a function, __FlLE__ and __LINE__ would refer to the file and line of the function implementation, and not the file and line where the function HR was called. So we need a macro so that the code is actually substituted into the place where we write HR.
这些是写什么意思,自己理解便是。
- D3D盗墓笔记
- 盗墓笔记
- 盗墓笔记
- 《盗墓笔记》解谜!
- 【星星眼】盗墓笔记
- "盗墓笔记"何以总写不完
- 《盗墓笔记》解密
- 盗墓
- D3D笔记
- 盗墓笔记 藏海花 喜欢 跟随三叔微博
- 盗墓笔记——路由器密码破解
- PPT怎么制作盗墓笔记的文字效果?
- python爬虫-爬取盗墓笔记
- D3D小笔记
- D3D学习笔记:绘制
- D3D学习笔记:纹理
- D3D学习笔记:混合
- D3D学习笔记:模板
- 8位字节的比特翻转
- LuaForS60 工程来由、目标 Etc......
- 隐藏URL
- 我们期待功能强大的ZoomLa! 逐浪CMS v3.0终于发布了
- 拥抱iPhone,拥抱软件开发的未来
- D3D盗墓笔记
- 把Flash Player10卸载干净
- 2009 March 2nd Monday (三月 二日 月曜日)
- 2009 March 3nd Tuesday (三月 三日 火曜日)
- 2009 March 4th Wednesday (三月 四日 水曜日)
- Linux C 函数参考
- 2009 March 5th Thursday (三月 五日 木曜日)
- 2009 March 6th Friday (三月 六日 金曜日)
- 2009 March 9th Monday (三月 九日 月曜日)