KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Karma
src
Karma
Core.h
Go to the documentation of this file.
1
10
#pragma once
11
18
#ifdef KR_DYNAMIC_LINK
19
#ifdef KR_WINDOWS_PLATFORM
20
#ifdef KR_BUILD_DLL
21
#define KARMA_API __declspec(dllexport)
22
#else
23
#define KARMA_API __declspec(dllimport)
24
#endif
25
#elif defined KR_LINUX_PLATFORM
26
#ifdef KR_BUILD_SO
27
#define KARMA_API __attribute__((visibility("default")))
28
#else
29
#define KARMA_API
30
#endif
31
#elif defined KR_MAC_PLATFORM
32
#ifdef KR_BUILD_SO
33
#define KARMA_API __attribute__((visibility("default")))
34
#else
35
#define KARMA_API
36
#endif
37
#else
38
#error Unsupported Platform detected!
39
#endif
40
#else
41
#define KARMA_API
42
#endif
43
52
#define BIT(x) (1 << x)
53
54
// https://github.com/gabime/spdlog/issues/3251
55
#ifdef KR_WINDOWS_PLATFORM
56
#define FMT_UNICODE 0
57
#endif
58
59
// Assertions
66
#ifdef KR_ENABLE_ASSERTS
67
#include "
Karma/Log.h
"
73
#if _MSC_VER
74
#include <intrin.h>
75
#define debugBreak() __debugbreak()
76
#else
77
#include <signal.h>
78
#define debugBreak() raise(SIGTRAP)
79
#endif
80
87
#define KR_ASSERT(expr, ...) \
88
if(expr){} \
89
else \
90
{\
91
KR_ERROR("Assertion Failed: {0}. Refer file: {1}, line: {2}", __VA_ARGS__, __FILE__, __LINE__); \
92
debugBreak(); \
93
}
100
#define KR_CORE_ASSERT(expr, ...) \
101
if(expr){} \
102
else \
103
{\
104
KR_CORE_ERROR("Assertion Failed: {0}. Refer file: {1}, line: {2}", __VA_ARGS__, __FILE__, __LINE__); \
105
debugBreak(); \
106
}
107
#else
108
#define KR_ASSERT(expr, ...)
109
#define KR_CORE_ASSERT(expr, ...)
110
#endif
111
117
#define checkNoEntry() KR_CORE_ASSERT(false, "Enclosing block should never be called")
118
119
125
#define KR_BIND_EVENT_FN(fn) std::bind(&fn, this, std::placeholders::_1)
126
140
#define KR_NONCOPYABLE(TypeName) \
141
TypeName(TypeName&&) = delete; \
142
TypeName(const TypeName&) = delete; \
143
TypeName& operator=(const TypeName&) = delete; \
144
TypeName& operator=(TypeName&&) = delete;
145
146
147
// Need to write Platform.h and WindowsPlatform.h specialization for these Unreal type of defines
148
// only for MSW
149
#define FUNCTION_NON_NULL_RETURN_START
//_Ret_notnull_ /* Indicate that the function never returns nullptr. */
150
151
/* Wrap a function signature in these to indicate that the function never returns nullptr */
152
#ifndef FUNCTION_NON_NULL_RETURN_START
153
#define FUNCTION_NON_NULL_RETURN_START
154
#endif
155
#ifndef FUNCTION_NON_NULL_RETURN_END
156
#define FUNCTION_NON_NULL_RETURN_END
157
#endif
158
159
/*
160
* For mac or appleclang inline
161
* for MSW __forceinline
162
*/
163
169
#ifndef FORCEINLINE
170
#define FORCEINLINE inline
171
#endif
Log.h
This file contains the Log class. I want to imagine the Log pronounciation match with that of that ht...
Generated by
1.15.0