Elevate Engine 1
Loading...
Searching...
No Matches
Assert.h
Go to the documentation of this file.
1#pragma once
2
3#include "Core.h"
4#include "Log.h"
5
6#ifdef EE_DEBUG
7 #define EE_ASSERTS_ENABLED 1
8#else
9 #define EE_ASSERTS_ENABLED 0
10 #define NDEBUG
11#endif
12
13#ifdef _MSC_VER
14 #include <intrin.h>
15 #define DEBUG_BREAK() __debugbreak()
16#else
17 #include <csignal>
18 #define DEBUG_BREAK() raise(SIGTRAP)
19#endif
20
21#if EE_ASSERTS_ENABLED
22 #define EE_ASSERT(x, ...) { if(!(x)) { EE_ERROR("Assertions Failed: {}", __VA_ARGS__); DEBUG_BREAK(); } }
23
24#define EE_CORE_ASSERT(x, ...) { if(!(x)) { EE_CORE_ERROR("Assertions Failed: {}", __VA_ARGS__); DEBUG_BREAK(); } }
25 #ifdef EE_ENGINE_BUILD
26 #define EE_CORE_ASSERT(x, ...) { if(!(x)) { EE_CORE_ERROR("Assertions Failed: {}", __VA_ARGS__); DEBUG_BREAK(); } }
27 #endif
28#else
29 #define EE_ASSERT(x, ...) { if(!(x)) { EE_ERROR("Assertions Failed: {}", __VA_ARGS__); } }
30 #if defined(EE_ENGINE_BUILD)
31 #define EE_CORE_ASSERT(x, ...) { if(!(x)) { EE_CORE_ERROR("Assertions Failed: {}", __VA_ARGS__); } }
32 #endif
33#endif