summaryrefslogtreecommitdiff
path: root/Source/Asura.Engine/Config.h
blob: f02a2ba26f2629a2a41d000cc67a1489c15af9a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef __ASURA_CONFIG_H__
#define __ASURA_CONFIG_H__

namespace AsuraEngine
{

	//----------------------------------------------------------------------------------------------------------------
	// 

	typedef int8_t   int8;
	typedef uint8_t  uint8;
	typedef uint8	   byte;
	typedef int16_t  int16;
	typedef uint16_t uint16;
	typedef int32_t  int32;
	typedef uint32_t uint32;
	typedef int64_t  int64;
	typedef uint64_t uint64;

	typedef uint32_t uint;
	typedef int32_t  sint;

	typedef std::size_t size_t;

	//----------------------------------------------------------------------------------------------------------------
	// assert

#ifndef ASSERT
	#ifdef NDEBUG
		#define ASSERT(x) { false ? (void)(x) : (void)0; }
	#else
		#ifdef _WIN32
			#define ASURA_DEBUG_BREAK() __debugbreak()
		#else
			#define ASURA_DEBUG_BREAK()  raise(SIGTRAP) 
		#endif
		#define ASSERT(x) do { const volatile bool asura_assert_b____ = !(x); if(asura_assert_b____) ASURA_DEBUG_BREAK(); } while (false)
	#endif
#endif

	//----------------------------------------------------------------------------------------------------------------
	// 

#ifdef _WIN32
	#define ASURA_FINAL final
	#define ASURA_LIBRARY_EXPORT __declspec(dllexport)
	#define ASURA_LIBRARY_IMPORT __declspec(dllimport)
	#define ASURA_FORCE_INLINE __forceinline
	#define ASURA_RESTRICT __restrict
	#define ASURA_ATTRIBUTE_USED	
	#define ASURA_ABSTRACT
	#define ASURA_API ASURA_LIBRARY_EXPORT
#else 
	#define  ASURA_FINAL final
	#define ASURA_LIBRARY_EXPORT __attribute__((visibility("default")))
	#define ASURA_LIBRARY_IMPORT 
	#define ASURA_FORCE_INLINE __attribute__((always_inline)) inline
	#define ASURA_RESTRICT __restrict__
	#define ASURA_ATTRIBUTE_USED __attribute__((used))
	#define ASURA_ABSTRACT
	#define ASURA_API ASURA_LIBRARY_EXPORT
#endif

	//----------------------------------------------------------------------------------------------------------------
	// Ĭ

#define ASURA_RUN(App)  \
int main(int argc, char* args[]) \
{	\
	App app;              \
	app.InitSubModules(); \
	app.PortToLua();		  \
	app.Run(argc, args);  \
	return 0; \
}

	//----------------------------------------------------------------------------------------------------------------
	// 

} // namespace AsuraEngine

#endif // __ASURA_CONFIG_H__