From 8644e03586ac9c39741f62cbcbce87b18805538c Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 14 Mar 2019 23:12:54 +0800 Subject: =?UTF-8?q?*=E5=A4=A7=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/Asura.Engine/config.h | 82 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Source/Asura.Engine/config.h (limited to 'Source/Asura.Engine/config.h') diff --git a/Source/Asura.Engine/config.h b/Source/Asura.Engine/config.h new file mode 100644 index 0000000..f02a2ba --- /dev/null +++ b/Source/Asura.Engine/config.h @@ -0,0 +1,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__ \ No newline at end of file -- cgit v1.1-26-g67d0