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// Assertions
61#ifdef KR_ENABLE_ASSERTS
62#include "Karma/Log.h"
68 #if _MSC_VER
69 #include <intrin.h>
70 #define debugBreak() __debugbreak()
71 #else
72 #include <signal.h>
73 #define debugBreak() raise(SIGTRAP)
74 #endif
75
82 #define KR_ASSERT(expr, ...) \
83 if(expr){} \
84 else \
85 {\
86 KR_ERROR("Assertion Failed: {0}. Refer file: {1}, line: {2}", __VA_ARGS__, __FILE__, __LINE__); \
87 debugBreak(); \
88 }
95 #define KR_CORE_ASSERT(expr, ...) \
96 if(expr){} \
97 else \
98 {\
99 KR_CORE_ERROR("Assertion Failed: {0}. Refer file: {1}, line: {2}", __VA_ARGS__, __FILE__, __LINE__); \
100 debugBreak(); \
101 }
102#else
103 #define KR_ASSERT(expr, ...)
104 #define KR_CORE_ASSERT(expr, ...)
105#endif
106
112#define KR_BIND_EVENT_FN(fn) std::bind(&fn, this, std::placeholders::_1)
113
127#define KR_NONCOPYABLE(TypeName) \
128 TypeName(TypeName&&) = delete; \
129 TypeName(const TypeName&) = delete; \
130 TypeName& operator=(const TypeName&) = delete; \
131 TypeName& operator=(TypeName&&) = delete;
132
133
134// Need to write Platform.h and WindowsPlatform.h specialization for these Unreal type of defines
135// only for MSW
136#define FUNCTION_NON_NULL_RETURN_START //_Ret_notnull_ /* Indicate that the function never returns nullptr. */
137
138/* Wrap a function signature in these to indicate that the function never returns nullptr */
139#ifndef FUNCTION_NON_NULL_RETURN_START
140#define FUNCTION_NON_NULL_RETURN_START
141#endif
142#ifndef FUNCTION_NON_NULL_RETURN_END
143#define FUNCTION_NON_NULL_RETURN_END
144#endif
145
146/*
147 * For mac or appleclang inline
148 * for MSW __forceinline
149 */
150
156#ifndef FORCEINLINE
157#define FORCEINLINE inline
158#endif
This file contains the Log class. I want to imagine the Log pronounciation match with that of that ht...