Kochol Game Engine  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
kgedef.h
Go to the documentation of this file.
1 // File name: kgedef.h
2 // Des: The definitions
3 // Date: 6/5/1385(jalali) , updated: 6,5,1389(jalali)
4 // Programmer: Ali Akbar Mohammadi(Kochol), Pooya Shahinfar (Pswin)
5 
6 #ifndef KGEDEF_H
7 #define KGEDEF_H
8 
9 #include "config.h"
10 
11 #define kgedecref(s) if (s) {s->DecRef(); s = NULL;}
12 
13 //************************************
14 // Version Information
15 //************************************
16 #define KGE_VERSION_NUM 0.0.11
17 #define KGE_VERSION_MAJOR 0
18 #define KGE_VERSION_MINOR 0
19 #define KGE_VERSION_RELEASE 11
20 #define KGE_VERSION_SUFFIX ""
21 #define KGE_VERSION_NAME "Kochol Game Engine 0.0.11"
22 
23 #define KGE_VERSION ((KGE_VERSION_MAJOR << 16) | (KGE_VERSION_MINOR << 8) | KGE_VERSION_RELEASE)
24 
25 //**************************************
26 // compiler and platform
27 //**************************************
28 
29 #define KGE_PLATFORM_UNKNOWN 0 // Unknown platform
30 #define KGE_PLATFORM_WINDOWS 1 // Microsoft Windows
31 #define KGE_PLATFORM_LINUX 2 // Linux OS
32 #define KGE_PLATFORM_APPLE 3 // Apple MAC-OS
33 #define KGE_PLATFORM_ANDROID 4 // Android platform
34 
35 #define KGE_COMPILER_UNKNOWN 0 // Unknown compiler
36 #define KGE_COMPILER_MSVC 1 // Microsoft Visual C++
37 #define KGE_COMPILER_GNUC 2 // GNU C/C++ compilers
38 #define KGE_COMPILER_BORL 3 // Borland C/C++ compiler
39 #define KGE_COMPILER_NDK 4 // NDK build system
40 
41 #define KGE_ARCHITECTURE_UNKNOWN 0 // Unknown architecture
42 #define KGE_ARCHITECTURE_32 1 // 32-bit architecture CPU
43 #define KGE_ARCHITECTURE_64 2 // 64-bit architecture CPU
44 
45 // find compiler type and version
46 #if defined( _MSC_VER )
47  #define KGE_COMPILER KGE_COMPILER_MSVC
48  #define KGE_COMP_VER _MSC_VER
49 
50 #elif defined( __GNUC__ )
51  #define KGE_COMPILER KGE_COMPILER_GNUC
52  #define KGE_COMP_VER (((__GNUC__)*100) + \
53  (__GNUC_MINOR__*10) + \
54  __GNUC_PATCHLEVEL__)
55 
56 #elif defined( __BORLANDC__ )
57  #define KGE_COMPILER KGE_COMPILER_BORL
58  #define KGE_COMP_VER __BCPLUSPLUS__
59 
60 #elif defined( NDK )
61  #define KGE_COMPILER KGE_PLATFORM_ANDROID
62  #define KGE_COMP_VER 7
63 
64 #else
65  #define KGE_COMPILER KGE_COMPILER_UNKNOWN
66  #pragma error "No known compiler. Compiling Abrot!"
67 #endif
68 
69 // finds the platform
70 #if defined( __WIN32__ ) || defined( _WIN32 ) || defined(_WIN64)
71  #define KGE_PLATFORM KGE_PLATFORM_WINDOWS
72 #elif defined( __APPLE_CC__)
73  #define KGE_PLATFORM KGE_PLATFORM_APPLE
74 #elif defined(ANDROID)
75  #define KGE_PLATFORM KGE_PLATFORM_ANDROID
76 #elif defined(__unix__)
77  #define KGE_PLATFORM KGE_PLATFORM_LINUX
78 #else
79  #define KGE_PLATFORM KGE_PLATFORM_UNKNOWN
80 #endif
81 
82 // finds the CPU architecture type
83 #if defined(__x86_x64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__)
84  #define KGE_ARCHITECTURE_TYPE KGE_ARCHITECTURE_64
85 #else
86  #define KGE_ARCHITECTURE_TYPE KGE_ARCHITECTURE_32
87 #endif
88 
89 //*************************************
90 // Defining debug mode
91 //*************************************
92 #if defined(DEBUG) || defined(_DEBUG)
93  #define KGE_DEBUG_MODE 1
94 #else
95  #define KGE_DEBUG_MODE 0
96 #endif
97 
98 //**************************************
99 // unicode
100 //**************************************
101 #if defined(_UNICODE) && (KGE_USE_UNICODE == 1)
102  #define KGE_SUPPORT_UNICODE 1
103 #else
104  #define KGE_SUPPORT_UNICODE 0
105 #endif
106 
107 //**************************************
108 // compiler specific config
109 //**************************************
110 
111 #if KGE_COMPILER == KGE_COMPILER_MSVC
112  // common compiler defines
113  #define KGE_USE_MSVC_ASM 1
114 #ifdef KGE_EXPORT
115  #define KGE_API __declspec(dllexport)
116 #else
117  #define KGE_API __declspec(dllimport)
118 #endif
119 #ifdef KGELIB_EXPORTS
120 # define KGELIB_API __declspec( dllexport )
121 #else
122 # define KGELIB_API __declspec( dllimport )
123 #endif
124  #define KGE_IMPORT __declspec( dllimport )
125  #define NAKED_FUNC void _declspec (naked)
126 
127 
128  // Unwanted VC++ level 4 warnings to disable.
129  #pragma warning(disable : 4244) // conversion to float, possible loss of data
130  #pragma warning(disable : 4699) // creating precompiled header
131  #pragma warning(disable : 4200) // Zero-length array item at end of structure, a VC-specific extension
132  #pragma warning(disable : 4100) // unreferenced formal parameter
133  #pragma warning(disable : 4514) // unreferenced inline function has been removed
134  #pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union
135  #pragma warning(disable : 4710) // inline function not expanded
136  #pragma warning(disable : 4714) // __forceinline function not expanded
137  #pragma warning(disable : 4702) // unreachable code in inline expanded function
138  #pragma warning(disable : 4711) // function selected for autmatic inlining
139  #pragma warning(disable : 4127) // Conditional expression is constant
140  #pragma warning(disable : 4512) // assignment operator could not be generated
141  #pragma warning(disable : 4245) // conversion from 'enum ' to 'unsigned long', signed/unsigned mismatch
142  #pragma warning(disable : 4389) // signed/unsigned mismatch
143  #pragma warning(disable : 4251) // needs to have dll-interface to be used by clients of class
144  #pragma warning(disable : 4275) // non dll-interface class used as base for dll-interface class
145  #pragma warning(disable : 4511) // copy constructor could not be generated
146  #pragma warning(disable : 4284) // return type is not a UDT or reference to a UDT
147  #pragma warning(disable : 4355) // this used in base initializer list
148  #pragma warning(disable : 4291) // typedef-name '' used as synonym for class-name ''
149  #pragma warning(disable : 4324) // structure was padded due to __declspec(align())
150 
151  // Unwanted VC++ level 1 warnings to disable.
152  #pragma warning(disable : 4996) // 'function': was declared deprecated
153 
154  // It'd be nice to turn these on, they can't be used in DEBUG due to the varargs stuff.
155  #if KGE_DEBUG_MODE
156  #else
157  #pragma warning(disable : 4189) // local variable is initialized but not referenced
158  #pragma warning(disable : 4505) // unreferenced local function has been removed
159  #endif
160 
161 
162 #else
163  #define KGE_API
164  #define KGE_IMPORT
165  #define NAKED_FUNC void
166 #endif
167 
168 //**************************************
169 // constants
170 //**************************************
171 
172 #define MAXID 65535 // MAXID = NULL for u32 IDs
173 #define KGE_BB_SPHERE
174 #define KGE_DEVICE_LOST 0x8001
175 #define KGE_DEVICE_RESET 0x8002
176 
177 //**************************************
178 // type definations
179 //**************************************
180 
181 namespace kge
182 {
183 
185  typedef unsigned int uint;
186 
187  // 64-bit architecture
188 #if defined(__x86_x64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__)
189 # error "kge dosen't support 64-bit compilition yet"
190 #else // 32-bit CPU architecture
191 
193  typedef unsigned int u32;
194 
196  typedef signed int s32;
197 
199  typedef unsigned long long u64;
200 
202  typedef signed long long s64;
203 
205  typedef unsigned long ul32;
206 
208  typedef unsigned short u16;
209 
211  typedef signed short s16;
212 
214  typedef unsigned char u8;
215 
216  const double Rounding_Error_Double = 0.00000001;
217 
219  typedef float f32;
220 
222  typedef double f64;
223 
224 #endif
225 
226 } // kge
227 
228 #endif // KGEDEF_H