Grindstone Game Engine
v0.2.0
An open source game engine and toolkit.
Loading...
Searching...
No Matches
Assert.hpp
1
#pragma once
2
3
#include <Windows.h>
4
#include <iostream>
5
6
#include <Common/Break.hpp>
7
#include <Common/String.hpp>
8
9
#ifdef _DEBUG
10
#define GS_ENABLE_ASSERTS
11
#endif
12
13
#ifdef GS_ENABLE_ASSERTS
14
#define GS_ASSERT_LOG(text, ...) \
15
std::wcout << TEXT(__FILE__) << TEXT("(" << __LINE__ << "): ") << TEXT("Assertion Failed") << std::endl; \
16
MessageBox( \
17
NULL, \
18
TEXT(#text), \
19
TEXT("Assertion Failed"), \
20
MB_ICONEXCLAMATION | MB_OK \
21
);
22
23
#define GS_BREAK_WITH_MESSAGE(msg, ...) \
24
GS_ASSERT_LOG(msg, __VA_ARGS__); \
25
GS_DEBUG_BREAK;
26
27
#define GS_ASSERT_ENGINE_WITH_MESSAGE(condition, msg, ...) \
28
if(!(condition)) { \
29
GS_ASSERT_LOG(msg, __VA_ARGS__); \
30
GS_DEBUG_BREAK; \
31
}
32
33
#define GS_ASSERT_WITH_MESSAGE(condition, msg, ...) \
34
if(!(condition)) { \
35
GS_ASSERT_LOG(msg, __VA_ARGS__); \
36
GS_DEBUG_BREAK; \
37
}
38
#define GS_ASSERT_ENGINE(condition) \
39
if(!(condition)) { \
40
GS_ASSERT_LOG(condition); \
41
GS_DEBUG_BREAK; \
42
}
43
44
#define GS_ASSERT(condition) \
45
if(!(condition)) { \
46
GS_ASSERT_LOG(condition); \
47
GS_DEBUG_BREAK; \
48
}
49
#else
50
#define GS_ASSERT_LOG(text, ...)
51
#define GS_BREAK_WITH_MESSAGE(msg, ...)
52
#define GS_ASSERT_ENGINE_WITH_MESSAGE(condition, msg, ...)
53
#define GS_ASSERT_WITH_MESSAGE(condition, msg, ...)
54
#define GS_ASSERT_ENGINE(condition)
55
#define GS_ASSERT(condition)
56
#endif
sources
code
Common
Assert.hpp
Generated by
1.12.0