File: d3d9_util.h

package info (click to toggle)
glest 3.2.2-2
  • links: PTS, VCS
  • area: contrib
  • in suites: squeeze
  • size: 2,800 kB
  • ctags: 6,581
  • sloc: cpp: 32,575; sh: 8,341; makefile: 63
file content (26 lines) | stat: -rw-r--r-- 558 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef _SHARED_D3D9_D3D9UTIL_H_
#define _SHARED_D3D9_D3D9UTIL_H_

#include <d3d9.h>

#include <string>
#include <stdexcept>

#define D3DCALL(X) checkResult(X, #X);

using std::string;
using std::runtime_error;

namespace Shared{ namespace Graphics{ namespace D3d9{

string d3dErrorToStr(HRESULT result);

inline void checkResult(HRESULT result, const string &functionCall){
	if(result!=D3D_OK){
		throw runtime_error("Direct3D Error\nCode: " + d3dErrorToStr(result) + "\nFunction: " + functionCall);
	}
}

}}}//end namespace

#endif