C++ Game Framework  2013-06-04
CGF is a DirectX 11 game framework, built in C++ and DirectX 11. This is used to contain many to the DirectX functionality and wrap them into a framework to make game development easier.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
dxerr.h
Go to the documentation of this file.
1 //--------------------------------------------------------------------------------------
2 // File: DXErr.h
3 //
4 // DirectX Error Library
5 //
6 // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
7 // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
8 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
9 // PARTICULAR PURPOSE.
10 //
11 // Copyright (c) Microsoft Corporation. All rights reserved.
12 //--------------------------------------------------------------------------------------
13 
14 // This version only supports UNICODE.
15 
16 #ifdef _MSC_VER
17 #pragma once
18 #endif
19 
20 #include <windows.h>
21 #include <sal.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 //--------------------------------------------------------------------------------------
28 // DXGetErrorString
29 //--------------------------------------------------------------------------------------
30 const WCHAR* WINAPI DXGetErrorStringW( _In_ HRESULT hr );
31 
32 #define DXGetErrorString DXGetErrorStringW
33 
34 //--------------------------------------------------------------------------------------
35 // DXGetErrorDescription has to be modified to return a copy in a buffer rather than
36 // the original static string.
37 //--------------------------------------------------------------------------------------
38 void WINAPI DXGetErrorDescriptionW( _In_ HRESULT hr, _Out_cap_(count) WCHAR* desc, _In_ size_t count );
39 
40 #define DXGetErrorDescription DXGetErrorDescriptionW
41 
42 //--------------------------------------------------------------------------------------
43 // DXTrace
44 //
45 // Desc: Outputs a formatted error message to the debug stream
46 //
47 // Args: WCHAR* strFile The current file, typically passed in using the
48 // __FILEW__ macro.
49 // DWORD dwLine The current line number, typically passed in using the
50 // __LINE__ macro.
51 // HRESULT hr An HRESULT that will be traced to the debug stream.
52 // CHAR* strMsg A string that will be traced to the debug stream (may be NULL)
53 // BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
54 //
55 // Return: The hr that was passed in.
56 //--------------------------------------------------------------------------------------
57 HRESULT WINAPI DXTraceW( _In_z_ const WCHAR* strFile, _In_ DWORD dwLine, _In_ HRESULT hr, _In_opt_ const WCHAR* strMsg, _In_ bool bPopMsgBox );
58 
59 #define DXTrace DXTraceW
60 
61 //--------------------------------------------------------------------------------------
62 //
63 // Helper macros
64 //
65 //--------------------------------------------------------------------------------------
66 #if defined(DEBUG) || defined(_DEBUG)
67 #define DXTRACE_MSG(str) DXTrace( __FILEW__, (DWORD)__LINE__, 0, str, false )
68 #define DXTRACE_ERR(str,hr) DXTrace( __FILEW__, (DWORD)__LINE__, hr, str, false )
69 #define DXTRACE_ERR_MSGBOX(str,hr) DXTrace( __FILEW__, (DWORD)__LINE__, hr, str, true )
70 #else
71 #define DXTRACE_MSG(str) (0L)
72 #define DXTRACE_ERR(str,hr) (hr)
73 #define DXTRACE_ERR_MSGBOX(str,hr) (hr)
74 #endif
75 
76 #ifdef __cplusplus
77 }
78 #endif //__cplusplus