KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
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 KR_BIND_EVENT_FN(fn) std::bind(&fn, this, std::placeholders::_1)
118
132#define KR_NONCOPYABLE(TypeName) \
133 TypeName(TypeName&&) = delete; \
134 TypeName(const TypeName&) = delete; \
135 TypeName& operator=(const TypeName&) = delete; \
136 TypeName& operator=(TypeName&&) = delete;
137
138
139// Need to write Platform.h and WindowsPlatform.h specialization for these Unreal type of defines
140// only for MSW
141#define FUNCTION_NON_NULL_RETURN_START //_Ret_notnull_ /* Indicate that the function never returns nullptr. */
142
143/* Wrap a function signature in these to indicate that the function never returns nullptr */
144#ifndef FUNCTION_NON_NULL_RETURN_START
145#define FUNCTION_NON_NULL_RETURN_START
146#endif
147#ifndef FUNCTION_NON_NULL_RETURN_END
148#define FUNCTION_NON_NULL_RETURN_END
149#endif
150
151/*
152 * For mac or appleclang inline
153 * for MSW __forceinline
154 */
155
161#ifndef FORCEINLINE
162#define FORCEINLINE inline
163#endif
This file contains the Log class. I want to imagine the Log pronounciation match with that of that ht...