Assembla home | Assembla project page
 

root/week1oplossing/GameDefines.h

Revision 1, 1.4 kB (checked in by machiel.sleeuwaert, 1 year ago)

--

Line 
1 #pragma once
2
3 // Defines for UNICODE
4
5 #include <string>               
6 #include <sstream>
7 #include <iostream>
8 #include <fstream>
9 #include <tchar.h>
10 using namespace std;
11
12 #ifdef _UNICODE // extra unicode defines
13         #define tstring wstring
14         #define tcin wcin
15         #define tcout wcout
16         #define tstringstream wstringstream
17         #define tofstream wofstream
18         #define tifstream wifstream
19         #define tfstream wfstream
20 #else
21
22         #define tstring string
23         #define tcin cin
24         #define tcout cout
25         #define tstringstream stringstream
26         #define tofstream ofstream
27         #define tifstream ifstream
28         #define tfstream fstream
29 #endif
30
31
32 // ASSERT macro
33
34 #ifndef NDEBUG
35 #define ASSERT \
36 if ( false ) {} \
37 else \
38 struct LocalAssert { \
39         int mLine; \
40         LocalAssert(int line=__LINE__) : mLine(line) {} \
41         LocalAssert(bool isOK, const TCHAR* message=_T("")) { \
42                 if ( !isOK ) { \
43                         tstringstream buffer; \
44                         buffer << _T("ERROR!! Assert failed on line ") << LocalAssert().mLine << _T(" in file '") << __FILE__ << _T("'\nBoodschap: \"") << message << _T("\"\n"); \
45                         OutputDebugString(buffer.str().c_str()); \
46                         __asm { int 3 } \
47                 } \
48         } \
49 } myAsserter = LocalAssert
50 #else
51
52 #define ASSERT \
53 if ( true ) {} else \
54 struct NoAssert { \
55         NoAssert(bool isOK, const TCHAR* message=_T("")) {} \
56 } myAsserter = NoAssert
57 #endif
58
59
60 // GAME_ENGINE define
61
62 #define GAME_ENGINE (GameEngine::GetSingleton())
Note: See TracBrowser for help on using the browser.