Just™ Game Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
assert.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021-2022 Konstanty Misiak
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7#pragma once
8#include "jng/debug/log.hpp"
9
10#ifdef JNG_DEBUG
11
12#ifdef JNG_WINDOWS
13#define __JNG_DEBUG_BREAK() __debugbreak()
14#else
15#include <signal.h>
16#define __JNG_DEBUG_BREAK() raise(SIGTRAP)
17#endif
18
19#define JNG_CORE_ASSERT(x, message) if (!(x)) { JNG_CORE_FATAL("Assertion failed: {0}\nFile: {1}:{2}", message, __FILE__, __LINE__); __JNG_DEBUG_BREAK(); }
20#define JNG_USER_ASSERT(x, message) if (!(x)) { JNG_USER_FATAL("Assertion failed: {0}\nFile: {1}:{2}", message, __FILE__, __LINE__); __JNG_DEBUG_BREAK(); }
21
22#else
23
24#define JNG_CORE_ASSERT(x, ...)
25#define JNG_USER_ASSERT(x, ...)
26
27#endif