diff --git a/modules/app/public/entrypoint.hpp b/modules/app/public/entrypoint.hpp index 8708c92..805e426 100644 --- a/modules/app/public/entrypoint.hpp +++ b/modules/app/public/entrypoint.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include auto main(int argc, char *argv[]) -> int32_t @@ -21,7 +22,7 @@ try } catch (const std::exception &exp) { - log_crt("Terminating due to uncaught exception:"); - log_crt("\texception.what(): {}", exp.what()); + lt::log::critical("Terminating due to uncaught exception:"); + lt::log::critical("\texception.what(): {}", exp.what()); return EXIT_FAILURE; } diff --git a/modules/app/public/system.hpp b/modules/app/public/system.hpp index b513dfb..0d0736f 100644 --- a/modules/app/public/system.hpp +++ b/modules/app/public/system.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include namespace lt::app { @@ -72,7 +73,7 @@ public: { auto diag = m_diagnosis.emplace_back(std::move(diagnosis)); - log_dbg("message: {}", diag.message); + log::debug("message: {}", diag.message); } [[nodiscard]] auto empty_diagnosis() const -> bool diff --git a/modules/asset_baker/private/entrypoint/baker.cpp b/modules/asset_baker/private/entrypoint/baker.cpp index 7ab8fe0..2c0b69a 100644 --- a/modules/asset_baker/private/entrypoint/baker.cpp +++ b/modules/asset_baker/private/entrypoint/baker.cpp @@ -1,5 +1,6 @@ #include #include +#include auto main(int argc, char *argv[]) -> int32_t try @@ -34,8 +35,8 @@ try } catch (const std::exception &exp) { - log_crt("Terminating due to uncaught exception:"); - log_crt("\texception.what: {}:", exp.what()); + lt::log::critical("Terminating due to uncaught exception:"); + lt::log::critical("\texception.what: {}:", exp.what()); return EXIT_FAILURE; } diff --git a/modules/asset_baker/public/bakers.hpp b/modules/asset_baker/public/bakers.hpp index 0415fdc..7555aee 100644 --- a/modules/asset_baker/public/bakers.hpp +++ b/modules/asset_baker/public/bakers.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include inline void bake_shader( const std::filesystem::path &in_path, @@ -13,7 +14,7 @@ inline void bake_shader( auto glsl_path = in_path.string(); auto spv_path = std::format("{}.spv", glsl_path); - log_trc( + lt::log::trace( "Compiling {} shader {} -> {}", type == vertex ? "vertex" : "fragment", glsl_path, @@ -46,7 +47,7 @@ inline void bake_shader( auto bytes = std::vector(size); stream.seekg(0, std::ios::beg); stream.read((char *)bytes.data(), size); // NOLINT - log_dbg("BYTES: {}", bytes.size()); + lt::log::debug("BYTES: {}", bytes.size()); stream.close(); std::filesystem::remove(spv_path); diff --git a/modules/debug/private/instrumentor.cpp b/modules/debug/private/instrumentor.cpp index adfb1c3..966a829 100644 --- a/modules/debug/private/instrumentor.cpp +++ b/modules/debug/private/instrumentor.cpp @@ -15,7 +15,7 @@ void Instrumentor::end_session_impl() { if (m_current_session_count == 0u) { - log_wrn("0 profiling for the ended session"); + log::warn("0 profiling for the ended session"); } m_current_session_count = 0u; diff --git a/modules/debug/public/assertions.hpp b/modules/debug/public/assertions.hpp index 62a2d15..514a8c5 100644 --- a/modules/debug/public/assertions.hpp +++ b/modules/debug/public/assertions.hpp @@ -1,7 +1,6 @@ #pragma once #include -#include #include namespace lt { @@ -28,7 +27,6 @@ struct ensure } }; - template ensure(Expression_T, std::format_string, Args_T &&...) -> ensure; diff --git a/modules/ecs/public/sparse_set.hpp b/modules/ecs/public/sparse_set.hpp index 3b93d1a..05a5265 100644 --- a/modules/ecs/public/sparse_set.hpp +++ b/modules/ecs/public/sparse_set.hpp @@ -55,10 +55,10 @@ public: auto new_capacity = std::max(static_cast(identifier + 1), m_sparse.size() * 2); new_capacity = std::min(new_capacity, max_capacity); - // log_dbg("Increasing sparse vector size:", m_dead_count); - // log_dbg("\tdead_count: {}", m_dead_count); - // log_dbg("\talive_count: {}", m_alive_count); - // log_dbg("\tsparse.size: {} -> {}", m_sparse.size(), new_capacity); + // log::debug("Increasing sparse vector size:", m_dead_count); + // log::debug("\tdead_count: {}", m_dead_count); + // log::debug("\talive_count: {}", m_alive_count); + // log::debug("\tsparse.size: {} -> {}", m_sparse.size(), new_capacity); m_sparse.resize(new_capacity, null_identifier); } diff --git a/modules/input/private/system.cpp b/modules/input/private/system.cpp index 22c4319..b514762 100644 --- a/modules/input/private/system.cpp +++ b/modules/input/private/system.cpp @@ -101,7 +101,7 @@ void System::on_key_press(const lt::surface::KeyPressedEvent &event) { if (event.get_key() > m_keys.size()) { - log_dbg( + log::debug( "Key code larger than key container size, implement platform-dependant " "key-code-mapping!" ); @@ -116,7 +116,7 @@ void System::on_key_release(const lt::surface::KeyReleasedEvent &event) { if (event.get_key() > m_keys.size()) { - log_dbg( + log::debug( "Key code larger than key container size, implement platform-dependant " "key-code-mapping!" ); diff --git a/modules/logger/public/logger.hpp b/modules/logger/public/logger.hpp index 223334b..e4a2f0e 100644 --- a/modules/logger/public/logger.hpp +++ b/modules/logger/public/logger.hpp @@ -1,10 +1,10 @@ #pragma once #include +#include #include #include #include -#include #include #include @@ -78,13 +78,14 @@ struct [[maybe_unused]] print "{} {} ==> {}", to_string(level, location), std::format("{}:{}", path.filename().c_str(), location.line()), - std::format(format, std::forward(arguments)...) + std::format(format, std::forward(arguments)...) ); } }; template -print(Level level, std::format_string, Args &&...) noexcept -> print; +print(Level, const std::source_location &, std::format_string, Args &&...) noexcept + -> print; template struct [[maybe_unused]] trace @@ -95,7 +96,7 @@ struct [[maybe_unused]] trace const std::source_location &location = std::source_location::current() ) noexcept { - print(Level::trace, location, format, std::forward(arguments)...); + print(Level::trace, location, format, std::forward(arguments)...); } }; @@ -111,7 +112,7 @@ struct [[maybe_unused]] debug const std::source_location &location = std::source_location::current() ) noexcept { - print(Level::debug, location, format, std::forward(arguments)...); + print(Level::debug, location, format, std::forward(arguments)...); } }; @@ -127,7 +128,7 @@ struct [[maybe_unused]] info const std::source_location &location = std::source_location::current() ) noexcept { - print(Level::info, location, format, std::forward(arguments)...); + print(Level::info, location, format, std::forward(arguments)...); } }; @@ -143,7 +144,7 @@ struct [[maybe_unused]] warn const std::source_location &location = std::source_location::current() ) noexcept { - print(Level::warn, location, format, std::forward(arguments)...); + print(Level::warn, location, format, std::forward(arguments)...); } }; @@ -159,7 +160,7 @@ struct [[maybe_unused]] error const std::source_location &location = std::source_location::current() ) noexcept { - print(Level::error, location, format, std::forward(arguments)...); + print(Level::error, location, format, std::forward(arguments)...); } }; @@ -175,7 +176,7 @@ struct [[maybe_unused]] critical const std::source_location &location = std::source_location::current() ) noexcept { - print(Level::critical, location, format, std::forward(arguments)...); + print(Level::critical, location, format, std::forward(arguments)...); } }; diff --git a/modules/math/public/components/transform.hpp b/modules/math/public/components/transform.hpp new file mode 100644 index 0000000..fc3193d --- /dev/null +++ b/modules/math/public/components/transform.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include + +namespace lt::math::components { + +struct Transform +{ + math::vec3 translation; + + math::vec3 scale; + + math::vec3 rotation; +}; + +} // namespace lt::math::components diff --git a/modules/surface/private/linux/system.cpp b/modules/surface/private/linux/system.cpp index ac310b6..5a9dde3 100644 --- a/modules/surface/private/linux/system.cpp +++ b/modules/surface/private/linux/system.cpp @@ -91,8 +91,8 @@ System::~System() } catch (const std::exception &exp) { - log_err("Uncaught exception in surface::~System:"); - log_err("\twhat: {}", exp.what()); + log::error("Uncaught exception in surface::~System:"); + log::error("\twhat: {}", exp.what()); } } @@ -189,9 +189,9 @@ try } catch (const std::exception &exp) { - log_err("Exception thrown when on_constructing surface component"); - log_err("\tentity: {}", entity); - log_err("\twhat: {}", exp.what()); + log::error("Exception thrown when on_constructing surface component"); + log::error("\tentity: {}", entity); + log::error("\twhat: {}", exp.what()); m_registry->remove(entity); } @@ -200,7 +200,7 @@ void System::on_surface_destruct(ecs::Registry ®istry, ecs::EntityId entity) const auto &[display, window, _] = registry.get(entity).get_native_data(); if (!display) { - log_wrn("Surface component destroyed with null display"); + log::warn("Surface component destroyed with null display"); return; } @@ -316,7 +316,7 @@ void System::handle_requests(SurfaceComponent &surface) [&](const ModifyResolutionRequest &request) { modify_resolution(surface, request); }, [&](const ModifyPositionRequest &request) { modify_position(surface, request); }, [&](const ModifyVisibilityRequest &request) { modify_visiblity(surface, request); }, - [&](const auto &) { log_err("Unknown surface request"); }, + [&](const auto &) { log::error("Unknown surface request"); }, }; for (const auto &request : surface.peek_requests()) @@ -380,7 +380,7 @@ void System::modify_resolution(SurfaceComponent &surface, const ModifyResolution std::this_thread::sleep_for(std::chrono::microseconds { 100 }); if (timer.elapsed_time() > lifespan) { - log_err("Timed out waiting for XResizeWindow's event"); + log::error("Timed out waiting for XResizeWindow's event"); return; } } @@ -419,7 +419,7 @@ void System::modify_position(SurfaceComponent &surface, const ModifyPositionRequ std::this_thread::sleep_for(std::chrono::microseconds { 100 }); if (timer.elapsed_time() > lifespan) { - log_err("Timed out waiting for XMoveWindow's event"); + log::error("Timed out waiting for XMoveWindow's event"); return; } } diff --git a/modules/surface/private/system.test.cpp b/modules/surface/private/system.test.cpp index 3ea6643..4168e97 100644 --- a/modules/surface/private/system.test.cpp +++ b/modules/surface/private/system.test.cpp @@ -268,11 +268,11 @@ Suite tick_handles_requests = "tick_handles_requests"_suite = [] { expect_eq(surface.get_position(), position); expect_eq(surface.get_resolution(), resolution); - log_dbg("EVENT COUNT: {}", surface.peek_events().size()); + log::debug("EVENT COUNT: {}", surface.peek_events().size()); for (const auto &event : surface.peek_events()) { const auto visitor = overloads { - [&](auto event) { log_dbg("event: {}", event.to_string()); }, + [&](auto event) { log::debug("event: {}", event.to_string()); }, }; std::visit(visitor, event); diff --git a/modules/test/CMakeLists.txt b/modules/test/CMakeLists.txt index 66e40dd..f502666 100644 --- a/modules/test/CMakeLists.txt +++ b/modules/test/CMakeLists.txt @@ -1,7 +1,7 @@ add_library_module(test test.cpp entrypoint.cpp) add_library_module(fuzz_test test.cpp fuzz.cpp) -target_link_libraries(test PUBLIC tbb logger) -target_link_libraries(fuzz_test PUBLIC tbb logger) +target_link_libraries(test PUBLIC logger) +target_link_libraries(fuzz_test PUBLIC logger) add_test_module(test test.test.cpp) diff --git a/modules/test/private/entrypoint.cpp b/modules/test/private/entrypoint.cpp index b9cf266..98b2be2 100644 --- a/modules/test/private/entrypoint.cpp +++ b/modules/test/private/entrypoint.cpp @@ -85,14 +85,14 @@ try } catch (const std::exception &exp) { - log_crt("Terminated due to uncaught exception:"); - log_crt("\twhat: {}", exp.what()); + lt::log::critical("Terminated due to uncaught exception:"); + lt::log::critical("\twhat: {}", exp.what()); return EXIT_FAILURE; } catch (...) { - log_crt("Terminated due to uncaught non-std exception!"); + lt::log::critical("Terminated due to uncaught non-std exception!"); return EXIT_FAILURE; }