diff --git a/modules/debug/include/debug/assertions.hpp b/modules/debug/include/debug/assertions.hpp index 9276457..4356306 100644 --- a/modules/debug/include/debug/assertions.hpp +++ b/modules/debug/include/debug/assertions.hpp @@ -6,7 +6,10 @@ namespace lt { struct FailedAssertion: std::exception { - FailedAssertion(const char *file, int line); + FailedAssertion(const char *file, int line) + { + log_crt("Assertion failed in: {} (line {})", file, line); + } }; #define lt_assert(x, ...) \ diff --git a/modules/engine/CMakeLists.txt b/modules/engine/CMakeLists.txt index e1a373d..52335db 100644 --- a/modules/engine/CMakeLists.txt +++ b/modules/engine/CMakeLists.txt @@ -1,7 +1,6 @@ if(NOT WIN32) add_library_module(engine core/application.cpp - debug/exceptions.cpp debug/instrumentor.cpp layer/layer.cpp layer/layer_stack.cpp @@ -11,7 +10,6 @@ if(NOT WIN32) else() add_library_module(engine core/application.cpp - debug/exceptions.cpp debug/instrumentor.cpp layer/layer.cpp layer/layer_stack.cpp diff --git a/modules/engine/include/engine/debug/exceptions.hpp b/modules/engine/include/engine/debug/exceptions.hpp deleted file mode 100644 index dcfe18f..0000000 --- a/modules/engine/include/engine/debug/exceptions.hpp +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#define dxc(x) dxc_no_redifinition(x, __LINE__) - -#define dxc_no_redifinition(x, line) dxc_no_redifinition2(x, line) - -#define dxc_no_redifinition2(x, line) \ - HRESULT hr##line; \ - if (FAILED(hr##line = x)) \ - throw dxException(hr##line, __FILE__, line) - -namespace lt { - -#ifdef LIGHT_PLATFORM_WINDOWS -// DirectX -struct dxException: std::exception -{ - dxException(long hr, const char *file, int line); -}; -#endif - -} // namespace lt diff --git a/modules/engine/src/debug/exceptions.cpp b/modules/engine/src/debug/exceptions.cpp deleted file mode 100644 index 9753055..0000000 --- a/modules/engine/src/debug/exceptions.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include - -#ifdef LIGHT_PLATFORM_WINDOWS - #include -#endif - -namespace lt { - -FailedAssertion::FailedAssertion(const char *file, int line) -{ - log_crt("Assertion failed in: {} (line {})", file, line); -} - -#ifdef LIGHT_PLATFORM_WINDOWS -dxException::dxException(long hr, const char *file, int line) -{ - char *message; - FormatMessageA( - FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - nullptr, - hr, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPSTR)(&message), - NULL, - nullptr - ); - - // #todo: improve - log_crt("________________________________________"); - log_crt("dxException::dxException::"); - log_crt(" File: {}, Line: {}", file, line); - log_crt(" {}", message); - log_crt("________________________________________"); - - LocalFree(message); -} -#endif - -} // namespace lt diff --git a/modules/window/CMakeLists.txt b/modules/window/CMakeLists.txt index 9fe6c0a..92e9b74 100644 --- a/modules/window/CMakeLists.txt +++ b/modules/window/CMakeLists.txt @@ -5,6 +5,9 @@ else() endif() target_link_libraries(window PUBLIC + glm::glm + + PRIVATE glfw logger lt_debug