]> git.lizzy.rs Git - irrlicht.git/blob - include/irrTypes.h
Reduce IrrCompileConfig usage to files that actually need it
[irrlicht.git] / include / irrTypes.h
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #ifndef __IRR_TYPES_H_INCLUDED__\r
6 #define __IRR_TYPES_H_INCLUDED__\r
7 \r
8 #include <stdint.h>\r
9 \r
10 namespace irr\r
11 {\r
12 \r
13 //! 8 bit unsigned variable.\r
14 typedef uint8_t                 u8;\r
15 \r
16 //! 8 bit signed variable.\r
17 typedef int8_t                  s8;\r
18 \r
19 //! 8 bit character variable.\r
20 /** This is a typedef for char, it ensures portability of the engine. */\r
21 typedef char                    c8;\r
22 \r
23 \r
24 \r
25 //! 16 bit unsigned variable.\r
26 typedef uint16_t                u16;\r
27 \r
28 //! 16 bit signed variable.\r
29 typedef int16_t                 s16;\r
30 \r
31 \r
32 \r
33 //! 32 bit unsigned variable.\r
34 typedef uint32_t                u32;\r
35 \r
36 //! 32 bit signed variable.\r
37 typedef int32_t                 s32;\r
38 \r
39 \r
40 //! 64 bit unsigned variable.\r
41 typedef uint64_t                u64;\r
42 \r
43 //! 64 bit signed variable.\r
44 typedef int64_t                 s64;\r
45 \r
46 \r
47 \r
48 //! 32 bit floating point variable.\r
49 /** This is a typedef for float, it ensures portability of the engine. */\r
50 typedef float                           f32;\r
51 \r
52 //! 64 bit floating point variable.\r
53 /** This is a typedef for double, it ensures portability of the engine. */\r
54 typedef double                          f64;\r
55 \r
56 \r
57 } // end namespace irr\r
58 \r
59 \r
60 #include <wchar.h>\r
61 //! Defines for s{w,n}printf_irr because s{w,n}printf methods do not match the ISO C\r
62 //! standard on Windows platforms.\r
63 //! We want int snprintf_irr(char *str, size_t size, const char *format, ...);\r
64 //! and int swprintf_irr(wchar_t *wcs, size_t maxlen, const wchar_t *format, ...);\r
65 #if defined(_MSC_VER)\r
66 #define swprintf_irr swprintf_s\r
67 #define snprintf_irr sprintf_s\r
68 #else\r
69 #define swprintf_irr swprintf\r
70 #define snprintf_irr snprintf\r
71 #endif // _MSC_VER\r
72 \r
73 namespace irr\r
74 {\r
75 \r
76 //! Type name for character type used by the file system.\r
77         typedef char fschar_t;\r
78         #define _IRR_TEXT(X) X\r
79 \r
80 } // end namespace irr\r
81 \r
82 //! define a break macro for debugging.\r
83 #if defined(_DEBUG)\r
84 #if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER)\r
85         #include <crtdbg.h>\r
86         #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_CrtDbgBreak();}\r
87 #else\r
88         #include <assert.h>\r
89         #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) assert( !(_CONDITION_) );\r
90 #endif\r
91 #else\r
92         #define _IRR_DEBUG_BREAK_IF( _CONDITION_ )\r
93 #endif\r
94 \r
95 //! Defines a deprecated macro which generates a warning at compile time\r
96 /** The usage is simple\r
97 For typedef:            typedef _IRR_DEPRECATED_ int test1;\r
98 For classes/structs:    class _IRR_DEPRECATED_ test2 { ... };\r
99 For methods:            class test3 { _IRR_DEPRECATED_ virtual void foo() {} };\r
100 For functions:          template<class T> _IRR_DEPRECATED_ void test4(void) {}\r
101 **/\r
102 #if defined(IGNORE_DEPRECATED_WARNING)\r
103 #define _IRR_DEPRECATED_\r
104 #elif defined(_MSC_VER)\r
105 #define _IRR_DEPRECATED_ __declspec(deprecated)\r
106 #elif defined(__GNUC__)\r
107 #define _IRR_DEPRECATED_  __attribute__ ((deprecated))\r
108 #else\r
109 #define _IRR_DEPRECATED_\r
110 #endif\r
111 \r
112 //! deprecated macro for virtual function override\r
113 /** prefer to use the override keyword for new code */\r
114 #define _IRR_OVERRIDE_ override\r
115 \r
116 //! creates four CC codes used in Irrlicht for simple ids\r
117 /** some compilers can create those by directly writing the\r
118 code like 'code', but some generate warnings so we use this macro here */\r
119 #define MAKE_IRR_ID(c0, c1, c2, c3) \\r
120                 ((irr::u32)(irr::u8)(c0) | ((irr::u32)(irr::u8)(c1) << 8) | \\r
121                 ((irr::u32)(irr::u8)(c2) << 16) | ((irr::u32)(irr::u8)(c3) << 24 ))\r
122 \r
123 #endif // __IRR_TYPES_H_INCLUDED__\r