Oxygine  1
2g game engine
oxygine-include.h
1 #pragma once
2 #ifndef OXYGINE_INCLUDE_HEADER
3 #define OXYGINE_INCLUDE_HEADER
4 
5 #include <assert.h>
6 #include <string.h>
7 #include <stdio.h>
8 #include <stdarg.h>
9 
10 
11 #if __APPLE__
12 #include <TargetConditionals.h>
13 #endif
14 
15 #if EMSCRIPTEN
16 #include <emscripten.h>
17 #endif
18 
19 
20 //Round everything to whole pixels during rendering.
21 // Helps to avoid artifacts in pixel art games
22 // when using textures with linearFilter="false"
23 // and fractional sprite coordinates or sprite scaling.
24 // Introduces some CPU overhead.
25 //#define OXYGINE_NO_SUBPIXEL_RENDERING 1
26 
27 
28 #ifdef __ANDROID__
29 #define HAVE_NPOT_RT() (true)
30 #else
31 #define HAVE_NPOT_RT() (true)
32 #endif
33 
34 #define OX_HAS_GLOBAL_TF_SCALE 1
35 
36 //#define OXYGINE_NO_YEILD 1
37 
38 // Bypass SDL file functions and use plain fopen, fread etc.
39 //#define OXYGINE_FILESYSTEM_USE_STDIO 1
40 
41 #if __S3E__
42 # define OXYGINE_MARMALADE 1
43 # ifdef IW_DEBUG
44 # define OX_DEBUG 1
45 # endif
46 #elif EMSCRIPTEN
47 # define OXYGINE_EMSCRIPTEN 1
48 # define OXYGINE_SDL 1
49 # ifndef NDEBUG
50 # define OX_DEBUG 1
51 # endif // DEBUG
52 #elif OXYGINE_EDITOR
53 # define OXYGINE_FILESYSTEM_USE_STDIO 1
54 # include <qglobal.h>
55 #else
56 # define OXYGINE_SDL 1
57 # ifdef _WIN32
58 # ifndef _CRT_SECURE_NO_WARNINGS
59 # define _CRT_SECURE_NO_WARNINGS
60 # endif
61 # endif
62 #endif
63 
64 
65 #if _DEBUG || DEBUG
66 # ifndef OX_DEBUG
67 # define OX_DEBUG 1
68 # endif
69 #endif
70 
71 
72 #define DYNAMIC_OBJECT_NAME 1
73 
74 
75 #ifndef OX_DEBUG
76 # ifndef EMSCRIPTEN
77 # define USE_MEMORY_POOL 1
78 # define OBJECT_POOL_ALLOCATOR 1
79 # endif
80 #endif
81 
82 #if OX_DEBUG
83 # define OXYGINE_DEBUG_TRACE_LEAKS 1
84 # define OXYGINE_DEBUG_T2P 1
85 # define OXYGINE_DEBUG_SAFECAST 1
86 # define OXYGINE_TRACE_VIDEO_STATS 1
87 #endif
88 
89 #define OXYGINE_ASSERT2LOG 1
90 
91 #ifdef EMSCRIPTEN
92 void emscStackTrace();
93 #endif
94 
95 namespace oxygine { namespace log { void error(const char* format, ...); } }
96 
97 #define OX_LOG_ERROR(x) if (!(x)) {oxygine::log::error("Assert! %s in %s:%d", #x, __FILE__, __LINE__);}
98 
99 
100 //assert without log::error
101 #ifdef OXYGINE_QT
102 # define OX_ASSERT_NL(x) { if (!(x)) __asm("int3"); Q_ASSERT(x);}
103 #elif !OX_DEBUG || EMSCRIPTEN
104 # define OX_ASSERT_NL(x)
105 #else
106 # define OX_ASSERT_NL(x) {assert(x);}
107 #endif
108 
109 
110 #if OXYGINE_ASSERT2LOG
111 # define OX_ASSERT(x) {OX_LOG_ERROR(x); OX_ASSERT_NL(x);}
112 #else
113 # define OX_ASSERT(x) {OX_ASSERT_NL(x);}
114 #endif
115 
116 #define OXYGINE_HAS_RESTORE
117 
118 #define OXYGINE_RENDERER 4
119 
120 #define OXYGINE_VERSION 6
121 
122 #ifdef __GNUC__
123 # define OXYGINE_DEPRECATED __attribute__((deprecated))
124 #elif defined(_MSC_VER)
125 # define OXYGINE_DEPRECATED __declspec(deprecated)
126 #else
127 # pragma message("WARNING: You need to implement DEPRECATED for this compiler")
128 # define OXYGINE_DEPRECATED
129 #endif
130 
131 
132 #ifdef _MSC_VER
133 # define OVERRIDE override
134 #else
135 # define OVERRIDE
136 #endif
137 
138 
139 #ifndef __S3E__
140 # if defined(_MSC_VER) || defined(__BORLANDC__)
141 typedef unsigned __int64 uint64;
142 typedef signed __int64 int64;
143 # else
144 typedef unsigned long long uint64;
145 typedef signed long long int64;
146 # endif
147 #endif
148 
149 #ifdef OXYGINE_QT
150 #define INHERITED(CLASS) private: typedef Editor##CLASS inherited
151 #else
152 #define INHERITED(CLASS) private: typedef CLASS inherited
153 #endif
154 
155 #ifndef EDITOR_INCLUDE
156 #define EDITOR_INCLUDE(CLASS)
157 #endif
158 
159 
160 #if !defined(__S3E__) && ( (defined(_MSC_VER) && (_MSC_VER > 1800)) || (__cplusplus > 199711L))
161 #define OX_HAS_CPP11
162 #endif
163 
164 namespace oxygine
165 {
166  enum error_policy
167  {
168  ep_show_error,//shows assert and prints error to log
169  ep_show_warning,//prints warning to log
170  ep_ignore_error//doesn't show any errors
171  };
172 
173 
174  void handleErrorPolicy(error_policy ep, const char* format, ...);
175 
176  typedef int timeMS;
177  typedef unsigned char pointer_index;
178 
180  timeMS getTimeMS();
181 
182  void* fastAlloc(size_t size);
183  void fastFree(void* data);
184 }
185 
186 #include "oxygine-forwards.h"
187 #endif
timeMS getTimeMS()
–oxgl-end–!
Definition: Actor.h:14