From 3d655aec13bdda6a8cf852da0cb0680984136eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Rodr=C3=ADguez=20Mart=C3=ADnez?= Date: Tue, 5 May 2026 14:13:35 +0200 Subject: [PATCH 01/17] Working windows build fails tests tho --- engine/src/toast/events/event.cpp | 1 + engine/src/toast/events/event.hpp | 4 ++-- engine/src/toast/log.hpp | 1 + engine/src/toast/logger.cpp | 2 +- engine/xmake.lua | 3 ++- xmake.lua | 4 ++-- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/engine/src/toast/events/event.cpp b/engine/src/toast/events/event.cpp index 91dfcdb91..0ee9b58d2 100644 --- a/engine/src/toast/events/event.cpp +++ b/engine/src/toast/events/event.cpp @@ -1,5 +1,6 @@ #include "event.hpp" +#include #include #include #include diff --git a/engine/src/toast/events/event.hpp b/engine/src/toast/events/event.hpp index 23fc50fb0..0cb1ccea4 100644 --- a/engine/src/toast/events/event.hpp +++ b/engine/src/toast/events/event.hpp @@ -58,7 +58,7 @@ inline std::unordered_map> unsubs inline std::vector> deletion_queue; /// @brief allocates memory in the event queue pool -auto allocate(std::size_t size, std::size_t align) noexcept -> void*; +auto TOAST_API allocate(std::size_t size, std::size_t align) noexcept -> void*; } /// @brief queue's up an event @@ -91,7 +91,7 @@ void TOAST_API send(Args&&... args) noexcept; /// the callback itself /// template -struct TOAST_API Event : _detail::IEvent { +struct Event : _detail::IEvent { friend class Listener; /// @brief callbacks that return 'true' are consumed and do not propogate using callback_t = std::move_only_function; diff --git a/engine/src/toast/log.hpp b/engine/src/toast/log.hpp index 274cc5ca0..071498ca5 100644 --- a/engine/src/toast/log.hpp +++ b/engine/src/toast/log.hpp @@ -11,6 +11,7 @@ #include #include #include +#include #include /// @internal diff --git a/engine/src/toast/logger.cpp b/engine/src/toast/logger.cpp index fd560045e..3561b4632 100644 --- a/engine/src/toast/logger.cpp +++ b/engine/src/toast/logger.cpp @@ -94,7 +94,7 @@ auto Logger::create() noexcept -> std::unique_ptr { #if defined(_WIN32) // On Windows, 'start /B' runs the command in the background without opening a new window // For output redirection, we need to wrap it in 'cmd /C' - if (SHOW_SERVER_LOGS) { + if (show_server_logs) { cmd = "start /B " + server_path.string(); } else { cmd = "start /B cmd /C \"" + server_path.string() + " >nul 2>&1\""; diff --git a/engine/xmake.lua b/engine/xmake.lua index c39a841ff..37604f3fa 100644 --- a/engine/xmake.lua +++ b/engine/xmake.lua @@ -17,7 +17,8 @@ target("toast.engine", function() add_ldflags("-lstdc++exp", { tools = { "clang", "gcc" }, public = true }) -- adds library for stacktrace -- Apply clang-format rule - add_rules("clang-format") + -- FIX THIS SO CLANG FORMAT ALWAYS RUNS BEFORE THE DANTE HEADERS BULLSHIT + --add_rules("clang-format") add_rules("sync-headers") if is_plat("linux") then diff --git a/xmake.lua b/xmake.lua index 261a3e31b..23d9c4c20 100644 --- a/xmake.lua +++ b/xmake.lua @@ -1,7 +1,7 @@ add_rules("mode.debug", "mode.release") set_defaultmode("debug") -set_languages("c++23") +set_languages("c++latest") rule("clang-format") before_build(function(target) @@ -39,7 +39,7 @@ end -- Enables debug optimizations, needed on newer clang and gcc versions to avoid a warning if is_mode("debug") then set_optimize("none") - add_cxxflags("-Og") + add_cxxflags("-Og", { tools = { "clang", "gcc" }}) add_defines("DEBUG") end From 41dff6d73c77a3b6f749c45a684811115544be26 Mon Sep 17 00:00:00 2001 From: Dante Harper Date: Thu, 7 May 2026 17:27:24 +0200 Subject: [PATCH 02/17] stuff --- engine/xmake.lua | 2 +- tools/xmake.lua | 23 +++++++++++++---------- xmake.lua | 4 ++-- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/engine/xmake.lua b/engine/xmake.lua index 37604f3fa..1a519311d 100644 --- a/engine/xmake.lua +++ b/engine/xmake.lua @@ -14,7 +14,7 @@ target("toast.engine", function() -- External libraries go here -x add_packages("asio") - add_ldflags("-lstdc++exp", { tools = { "clang", "gcc" }, public = true }) -- adds library for stacktrace +-- add_syslinks("stdc++exp", { tools = { "clang", "gcc" }, public = true }) -- adds library for stacktrace -- Apply clang-format rule -- FIX THIS SO CLANG FORMAT ALWAYS RUNS BEFORE THE DANTE HEADERS BULLSHIT diff --git a/tools/xmake.lua b/tools/xmake.lua index 59fdde062..d99271756 100644 --- a/tools/xmake.lua +++ b/tools/xmake.lua @@ -1,19 +1,20 @@ add_requires("cargo::anyhow 1.0") add_requires("cargo::chrono 0.4") -add_requires("cargo::clap", {configs = {features = "derive"}}) +add_requires("cargo::clap", { configs = { features = "derive" } }) add_requires("cargo::csv 1.3.1") add_requires("cargo::crossterm 0.28.1") add_requires("cargo::prost 0.14") add_requires("cargo::prost-types 0.13.5") -add_requires("cargo::serde", {configs = {features = "derive"}}) +add_requires("cargo::serde", { configs = { features = "derive" } }) add_requires("cargo::textwrap 0.16") -add_requires("cargo::tokio", {configs = {features = "full"}}) +add_requires("cargo::tokio", { configs = { features = "full" } }) add_requires("cargo::tui-input 0.11") local tools_dir = os.scriptdir() target("player", function() set_kind("binary") + set_default(false) add_deps("toast.engine", "toast.dummy_game") add_files("player/**.cs") remove_files("player/obj/**") @@ -25,6 +26,7 @@ end) target("toast.dummy_game", function() set_kind("shared") + set_default(false) add_files("dummy_game/**.cpp") add_headerfiles("dummy_game/**.h") add_deps("toast.engine") @@ -37,31 +39,32 @@ target("kenzo", function() set_default(false) on_build(function(target) local oldir = os.cd("$(projectdir)/tools/kenzo") - + if is_mode("release") then - os.execv("cargo", {"build", "--release"}) + os.execv("cargo", { "build", "--release" }) else - os.execv("cargo", {"build"}) + os.execv("cargo", { "build" }) end - + -- Copy binary to xmake's output directory so xmake run works local target_subdir = is_mode("release") and "release" or "debug" local src_binary = "target/" .. target_subdir .. "/kenzo" local dst_dir = target:targetdir() os.mkdir(dst_dir) os.cp(src_binary, path.join(dst_dir, "kenzo")) - + os.cd(oldir) end) on_clean(function(target) local oldir = os.cd("$(projectdir)/tools/kenzo") - os.execv("cargo", {"clean"}) + os.execv("cargo", { "clean" }) os.cd(oldir) end) end) target("log_server", function() set_kind("binary") + set_default(false) -- set_languages("rust") add_files("log_server/src/main.rs") add_packages( @@ -76,6 +79,6 @@ end) target("toast.tools", function() set_kind("phony") + set_default(false) add_deps("kenzo", "log_server") end) - diff --git a/xmake.lua b/xmake.lua index 23d9c4c20..5522205c9 100644 --- a/xmake.lua +++ b/xmake.lua @@ -24,7 +24,7 @@ end) rule_end() add_rules("plugin.compile_commands.autoupdate") -add_cxxflags("-stdlib=libc++", { tools = { "clang", "gcc" } }) -- Use LLVM STL by default +add_syslinks("stdc++exp", { tools = { "clang", "gcc" } }) -- adds library for stacktrace -- Makes release have flto, fast math and SIMD intrinsic optimizations if is_mode("release") then @@ -39,7 +39,7 @@ end -- Enables debug optimizations, needed on newer clang and gcc versions to avoid a warning if is_mode("debug") then set_optimize("none") - add_cxxflags("-Og", { tools = { "clang", "gcc" }}) + add_cxxflags("-Og", { tools = { "clang", "gcc" } }) -- this line doesnt quite work add_defines("DEBUG") end From c1e01617e6ac09344906196abb97e4418a551e3e Mon Sep 17 00:00:00 2001 From: Dante Harper Date: Thu, 7 May 2026 18:23:38 +0200 Subject: [PATCH 03/17] possible fix --- engine/src/toast/events/event.cpp | 4 ++++ engine/src/toast/events/event.hpp | 12 ++++++------ engine/xmake.lua | 2 ++ xmake.lua | 5 ++++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/engine/src/toast/events/event.cpp b/engine/src/toast/events/event.cpp index 0ee9b58d2..5c1463415 100644 --- a/engine/src/toast/events/event.cpp +++ b/engine/src/toast/events/event.cpp @@ -27,6 +27,10 @@ uint8_t index = 0; namespace _detail { +std::mutex mutex; +std::unordered_map> unsubscribe_map; +std::vector> deletion_queue; + auto allocate(std::size_t size, std::size_t align) noexcept -> void* { void* mem = pools[index].pool.allocate(size, align); pools[index].queue.push_back(reinterpret_cast(mem)); diff --git a/engine/src/toast/events/event.hpp b/engine/src/toast/events/event.hpp index 0cb1ccea4..35997aa19 100644 --- a/engine/src/toast/events/event.hpp +++ b/engine/src/toast/events/event.hpp @@ -47,15 +47,15 @@ struct TOAST_API IEvent { }; /// @brief mutex for the event system -inline std::mutex mutex; +extern TOAST_API std::mutex mutex; /// @brief vtable for unsubscribing callbacks -inline std::unordered_map> unsubscribe_map; +extern TOAST_API std::unordered_map> unsubscribe_map; /// @brief callbacks will be cleaned up only before pollEvents /// @note unique pointers have the option of storing a pointer to the function that deletes the object /// so thats how i implement the deletion_queue -inline std::vector> deletion_queue; +extern TOAST_API std::vector> deletion_queue; /// @brief allocates memory in the event queue pool auto TOAST_API allocate(std::size_t size, std::size_t align) noexcept -> void*; @@ -66,7 +66,7 @@ auto TOAST_API allocate(std::size_t size, std::size_t align) noexcept -> void*; /// @param args arguments for the constructor template requires std::is_base_of_v<_detail::IEvent, T> -void TOAST_API send(Args&&... args) noexcept; +void send(Args&&... args) noexcept; /// @class Event /// @brief Base class for all events. Derive your event type as `struct Derived : Event`. @@ -95,7 +95,7 @@ struct Event : _detail::IEvent { friend class Listener; /// @brief callbacks that return 'true' are consumed and do not propogate using callback_t = std::move_only_function; - using iterator_t = std::multimap::iterator; + using iterator_t = std::multimap>::iterator; private: static inline struct G { @@ -103,7 +103,7 @@ struct Event : _detail::IEvent { std::multimap> callbacks; std::mutex mutex; std::vector processing; - bool cached; + bool cached = false; } g; /// @brief registers a callback to the event callbacks diff --git a/engine/xmake.lua b/engine/xmake.lua index 1a519311d..b98245487 100644 --- a/engine/xmake.lua +++ b/engine/xmake.lua @@ -24,6 +24,8 @@ target("toast.engine", function() if is_plat("linux") then add_syslinks("pthread") add_shflags("-Wl,--no-as-needed") + elseif is_plat("windows", "mingw") then + add_syslinks("ws2_32", "mswsock") end end) diff --git a/xmake.lua b/xmake.lua index 5522205c9..3b8219b4d 100644 --- a/xmake.lua +++ b/xmake.lua @@ -24,7 +24,10 @@ end) rule_end() add_rules("plugin.compile_commands.autoupdate") -add_syslinks("stdc++exp", { tools = { "clang", "gcc" } }) -- adds library for stacktrace +-- add_syslinks("stdc++exp", { tools = { "clang", "gcc" } }) -- adds library for stacktrace +if is_plat("linux", "macosx") then + add_syslinks("stdc++exp") +end -- Makes release have flto, fast math and SIMD intrinsic optimizations if is_mode("release") then From f4239142d3c5d3c5704c5830890994eba19aaf4b Mon Sep 17 00:00:00 2001 From: Dante Harper Date: Sat, 9 May 2026 11:10:16 +0200 Subject: [PATCH 04/17] setup test --- engine/src/toast/events/event.inl | 1 + engine/src/toast/events/event_system.cpp | 1 + engine/src/toast/events/event_system.hpp | 14 ++++++++++++++ tests/events/01-basic.cpp | 2 ++ 4 files changed, 18 insertions(+) create mode 100644 engine/src/toast/events/event_system.cpp create mode 100644 engine/src/toast/events/event_system.hpp diff --git a/engine/src/toast/events/event.inl b/engine/src/toast/events/event.inl index 11b9609e6..3ac001fbb 100644 --- a/engine/src/toast/events/event.inl +++ b/engine/src/toast/events/event.inl @@ -10,6 +10,7 @@ namespace event { template Event::G::G() noexcept { static_assert(std::is_base_of_v, T>, "CONTRACT VIOLATION: You Must Inhert as 'struct Derived : Event'"); + TOAST_INFO(_detail::IEvent,"Registering Event Type: {}",typeid(T).name()); // add function to the Event vtable _detail::unsubscribe_map.emplace(typeid(T), [](std::any iter) { auto it = std::any_cast(iter); diff --git a/engine/src/toast/events/event_system.cpp b/engine/src/toast/events/event_system.cpp new file mode 100644 index 000000000..adf61fc0c --- /dev/null +++ b/engine/src/toast/events/event_system.cpp @@ -0,0 +1 @@ +#include "event_system.hpp" diff --git a/engine/src/toast/events/event_system.hpp b/engine/src/toast/events/event_system.hpp new file mode 100644 index 000000000..8d607332c --- /dev/null +++ b/engine/src/toast/events/event_system.hpp @@ -0,0 +1,14 @@ +/** + * @file event_system.hpp + * @author Dante Harper + * @date 09 May 26 + * + * @brief Event System Singleton + */ + +#pragma once + +#include "toast/events/event.hpp" +#include "toast/export.hpp" + +struct TOAST_API Test : event::Event { }; diff --git a/tests/events/01-basic.cpp b/tests/events/01-basic.cpp index 451e6fb1a..fcdf56179 100644 --- a/tests/events/01-basic.cpp +++ b/tests/events/01-basic.cpp @@ -1,5 +1,6 @@ #include "toast/events/event.hpp" #include "toast/events/listener.hpp" +#include "toast/events/event_system.hpp" #include @@ -11,6 +12,7 @@ auto main() -> int { listener.subscribe([&called](BasicEvent& e) { called = true; }); event::send(); + event::send(); event::pollEvents(); assert(called); From 34467223862b0a34575842df267ceb2fb4f007fb Mon Sep 17 00:00:00 2001 From: Dante Harper Date: Sat, 9 May 2026 11:39:38 +0200 Subject: [PATCH 05/17] meow --- tests/events/01-basic.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/events/01-basic.cpp b/tests/events/01-basic.cpp index fcdf56179..451e6fb1a 100644 --- a/tests/events/01-basic.cpp +++ b/tests/events/01-basic.cpp @@ -1,6 +1,5 @@ #include "toast/events/event.hpp" #include "toast/events/listener.hpp" -#include "toast/events/event_system.hpp" #include @@ -12,7 +11,6 @@ auto main() -> int { listener.subscribe([&called](BasicEvent& e) { called = true; }); event::send(); - event::send(); event::pollEvents(); assert(called); From 27baece23740872efe18664f89de18d7882beeca Mon Sep 17 00:00:00 2001 From: Dante Harper Date: Sat, 9 May 2026 11:54:11 +0200 Subject: [PATCH 06/17] meow --- engine/src/toast/events/event.cpp | 9 ++---- engine/src/toast/events/event.hpp | 15 --------- engine/src/toast/events/event.inl | 20 ++++++------ engine/src/toast/events/event_system.cpp | 7 +++++ engine/src/toast/events/event_system.hpp | 40 +++++++++++++++++++++++- engine/src/toast/events/listener.cpp | 3 +- 6 files changed, 62 insertions(+), 32 deletions(-) diff --git a/engine/src/toast/events/event.cpp b/engine/src/toast/events/event.cpp index 5c1463415..991fec89e 100644 --- a/engine/src/toast/events/event.cpp +++ b/engine/src/toast/events/event.cpp @@ -1,4 +1,5 @@ #include "event.hpp" +#include "toast/events/event_system.hpp" #include #include @@ -27,10 +28,6 @@ uint8_t index = 0; namespace _detail { -std::mutex mutex; -std::unordered_map> unsubscribe_map; -std::vector> deletion_queue; - auto allocate(std::size_t size, std::size_t align) noexcept -> void* { void* mem = pools[index].pool.allocate(size, align); pools[index].queue.push_back(reinterpret_cast(mem)); @@ -43,12 +40,12 @@ void pollEvents() noexcept { TOAST_INFO(_detail::IEvent, "Polling Events"); // delete callbacks - _detail::deletion_queue.clear(); + EventSystem::deletion_queue.clear(); // swap memory pool uint32_t idx; { - std::scoped_lock _(_detail::mutex); + std::scoped_lock _(EventSystem::pool_mutex); idx = index; index = (index + 1) % pools.size(); } diff --git a/engine/src/toast/events/event.hpp b/engine/src/toast/events/event.hpp index 35997aa19..fcdbe5022 100644 --- a/engine/src/toast/events/event.hpp +++ b/engine/src/toast/events/event.hpp @@ -10,18 +10,14 @@ */ #pragma once -#include #include #include #include #include -#include #include #include #include #include -#include -#include #include namespace event { @@ -46,17 +42,6 @@ struct TOAST_API IEvent { virtual void notify() noexcept = 0; }; -/// @brief mutex for the event system -extern TOAST_API std::mutex mutex; - -/// @brief vtable for unsubscribing callbacks -extern TOAST_API std::unordered_map> unsubscribe_map; - -/// @brief callbacks will be cleaned up only before pollEvents -/// @note unique pointers have the option of storing a pointer to the function that deletes the object -/// so thats how i implement the deletion_queue -extern TOAST_API std::vector> deletion_queue; - /// @brief allocates memory in the event queue pool auto TOAST_API allocate(std::size_t size, std::size_t align) noexcept -> void*; } diff --git a/engine/src/toast/events/event.inl b/engine/src/toast/events/event.inl index 3ac001fbb..d9dd12c25 100644 --- a/engine/src/toast/events/event.inl +++ b/engine/src/toast/events/event.inl @@ -1,5 +1,6 @@ #pragma once #include "event.hpp" +#include "toast/events/event_system.hpp" #include "toast/log.hpp" #include @@ -9,13 +10,14 @@ namespace event { template Event::G::G() noexcept { - static_assert(std::is_base_of_v, T>, "CONTRACT VIOLATION: You Must Inhert as 'struct Derived : Event'"); - TOAST_INFO(_detail::IEvent,"Registering Event Type: {}",typeid(T).name()); - // add function to the Event vtable - _detail::unsubscribe_map.emplace(typeid(T), [](std::any iter) { - auto it = std::any_cast(iter); - unsubscribe(it); - }); + // static_assert(std::is_base_of_v, T>, "CONTRACT VIOLATION: You Must Inhert as 'struct Derived : Event'"); + // TOAST_INFO(_detail::IEvent,"Registering Event Type: {}",typeid(T).name()); + // // add function to the Event vtable + // _detail::unsubscribe_map.emplace(typeid(T), [](std::any iter) { + // auto it = std::any_cast(iter); + // unsubscribe(it); + // }); + event::EventSystem::registerEvent(); } template @@ -37,7 +39,7 @@ void Event::unsubscribe(iterator_t it) noexcept { { std::scoped_lock _(g.mutex); auto deleter = [](void* p) { delete static_cast*>(p); }; - _detail::deletion_queue.emplace_back((*it).second, deleter); + EventSystem::deletion_queue.emplace_back((*it).second, deleter); g.cached = false; g.callbacks.erase(it); } @@ -76,7 +78,7 @@ void send(Args&&... args) noexcept { TOAST_TRACE(_detail::IEvent, "Sending Event: {}", typeid(T).name()); // Allocate and enqueue event { - std::scoped_lock _(_detail::mutex); + std::scoped_lock _(EventSystem::pool_mutex); void* memory = _detail::allocate(sizeof(T), alignof(T)); assert(memory); _detail::IEvent* event = new (memory) T(std::forward(args)...); diff --git a/engine/src/toast/events/event_system.cpp b/engine/src/toast/events/event_system.cpp index adf61fc0c..2c94834ff 100644 --- a/engine/src/toast/events/event_system.cpp +++ b/engine/src/toast/events/event_system.cpp @@ -1 +1,8 @@ #include "event_system.hpp" + +namespace event { +std::unordered_map EventSystem::event_data; +std::mutex EventSystem::pool_mutex; +std::unordered_map> EventSystem::unsubscribe_map; +std::vector> EventSystem::deletion_queue; +} // namespace event diff --git a/engine/src/toast/events/event_system.hpp b/engine/src/toast/events/event_system.hpp index 8d607332c..d4abc62a4 100644 --- a/engine/src/toast/events/event_system.hpp +++ b/engine/src/toast/events/event_system.hpp @@ -11,4 +11,42 @@ #include "toast/events/event.hpp" #include "toast/export.hpp" -struct TOAST_API Test : event::Event { }; +#include +#include +#include + +namespace event { +struct TOAST_API EventSystem { + struct EventInfo { + std::mutex mutex; + std::multimap> callbacks; + std::vector processing; + bool cached = false; + }; + + /// @brief mutex for the event system pool + static std::mutex pool_mutex; + + /// @brief vtable for unsubscribing callbacks + static std::unordered_map> unsubscribe_map; + + /// @brief callbacks will be cleaned up only before pollEvents + /// @note unique pointers have the option of storing a pointer to the function that deletes the object + /// so thats how i implement the deletion_queue + static std::vector> deletion_queue; + + static std::unordered_map event_data; + + + template + static void registerEvent() { + static_assert(std::is_base_of_v, T>, "CONTRACT VIOLATION: You Must Inhert as 'struct Derived : Event'"); + TOAST_INFO(_detail::IEvent, "Registering Event Type: {}", typeid(T).name()); + + EventSystem::unsubscribe_map.emplace(typeid(T), [](const std::any& iter) { + auto it = std::any_cast(iter); + unsubscribe(it); + }); + } +}; +} diff --git a/engine/src/toast/events/listener.cpp b/engine/src/toast/events/listener.cpp index 9a998c215..368f0170a 100644 --- a/engine/src/toast/events/listener.cpp +++ b/engine/src/toast/events/listener.cpp @@ -1,6 +1,7 @@ #include "listener.hpp" #include "event.hpp" +#include "toast/events/event_system.hpp" namespace event { @@ -10,7 +11,7 @@ Listener::Listener() { Listener::~Listener() { for (auto& [type, name, callback] : m.callbacks) { - _detail::unsubscribe_map[type](callback); + EventSystem::unsubscribe_map[type](callback); } } From 3fbc2f69cdbcd464e864f209ec026214fa280ef3 Mon Sep 17 00:00:00 2001 From: Dante Harper Date: Sat, 9 May 2026 12:01:13 +0200 Subject: [PATCH 07/17] meow --- engine/src/toast/events/event.cpp | 6 ++- engine/src/toast/events/event.hpp | 53 +++++++++++++++++++++++- engine/src/toast/events/event.inl | 1 - engine/src/toast/events/event_system.cpp | 8 ---- engine/src/toast/events/event_system.hpp | 52 ----------------------- engine/src/toast/events/listener.cpp | 1 - 6 files changed, 57 insertions(+), 64 deletions(-) delete mode 100644 engine/src/toast/events/event_system.cpp delete mode 100644 engine/src/toast/events/event_system.hpp diff --git a/engine/src/toast/events/event.cpp b/engine/src/toast/events/event.cpp index 991fec89e..adeec8418 100644 --- a/engine/src/toast/events/event.cpp +++ b/engine/src/toast/events/event.cpp @@ -1,5 +1,4 @@ #include "event.hpp" -#include "toast/events/event_system.hpp" #include #include @@ -13,6 +12,11 @@ namespace event { +std::unordered_map EventSystem::event_data; +std::mutex EventSystem::pool_mutex; +std::unordered_map> EventSystem::unsubscribe_map; +std::vector> EventSystem::deletion_queue; + namespace { struct Pool { alignas(64) std::array buffer; diff --git a/engine/src/toast/events/event.hpp b/engine/src/toast/events/event.hpp index fcdbe5022..e524e2238 100644 --- a/engine/src/toast/events/event.hpp +++ b/engine/src/toast/events/event.hpp @@ -10,9 +10,13 @@ */ #pragma once +#include "toast/log.hpp" #include #include #include +#include +#include +#include #include #include #include @@ -104,6 +108,53 @@ struct Event : _detail::IEvent { void notify() noexcept override; }; -} + + + + +struct TOAST_API EventSystem { + struct EventInfo { + std::mutex mutex; + std::multimap> callbacks; + std::vector processing; + bool cached = false; + }; + + /// @brief mutex for the event system pool + static std::mutex pool_mutex; + + /// @brief vtable for unsubscribing callbacks + static std::unordered_map> unsubscribe_map; + + /// @brief callbacks will be cleaned up only before pollEvents + /// @note unique pointers have the option of storing a pointer to the function that deletes the object + /// so thats how i implement the deletion_queue + static std::vector> deletion_queue; + + static std::unordered_map event_data; + + + template + static void registerEvent() { + static_assert(std::is_base_of_v, T>, "CONTRACT VIOLATION: You Must Inhert as 'struct Derived : Event'"); + TOAST_INFO(_detail::IEvent, "Registering Event Type: {}", typeid(T).name()); + + EventSystem::unsubscribe_map.emplace(typeid(T), [](const std::any& iter) { + auto it = std::any_cast::iterator_t>(iter); + unsubscribe(it); + }); + } +}; + + + + + + + + + + +} #include "event.inl" diff --git a/engine/src/toast/events/event.inl b/engine/src/toast/events/event.inl index d9dd12c25..d2ce0732b 100644 --- a/engine/src/toast/events/event.inl +++ b/engine/src/toast/events/event.inl @@ -1,6 +1,5 @@ #pragma once #include "event.hpp" -#include "toast/events/event_system.hpp" #include "toast/log.hpp" #include diff --git a/engine/src/toast/events/event_system.cpp b/engine/src/toast/events/event_system.cpp deleted file mode 100644 index 2c94834ff..000000000 --- a/engine/src/toast/events/event_system.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "event_system.hpp" - -namespace event { -std::unordered_map EventSystem::event_data; -std::mutex EventSystem::pool_mutex; -std::unordered_map> EventSystem::unsubscribe_map; -std::vector> EventSystem::deletion_queue; -} // namespace event diff --git a/engine/src/toast/events/event_system.hpp b/engine/src/toast/events/event_system.hpp deleted file mode 100644 index d4abc62a4..000000000 --- a/engine/src/toast/events/event_system.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @file event_system.hpp - * @author Dante Harper - * @date 09 May 26 - * - * @brief Event System Singleton - */ - -#pragma once - -#include "toast/events/event.hpp" -#include "toast/export.hpp" - -#include -#include -#include - -namespace event { -struct TOAST_API EventSystem { - struct EventInfo { - std::mutex mutex; - std::multimap> callbacks; - std::vector processing; - bool cached = false; - }; - - /// @brief mutex for the event system pool - static std::mutex pool_mutex; - - /// @brief vtable for unsubscribing callbacks - static std::unordered_map> unsubscribe_map; - - /// @brief callbacks will be cleaned up only before pollEvents - /// @note unique pointers have the option of storing a pointer to the function that deletes the object - /// so thats how i implement the deletion_queue - static std::vector> deletion_queue; - - static std::unordered_map event_data; - - - template - static void registerEvent() { - static_assert(std::is_base_of_v, T>, "CONTRACT VIOLATION: You Must Inhert as 'struct Derived : Event'"); - TOAST_INFO(_detail::IEvent, "Registering Event Type: {}", typeid(T).name()); - - EventSystem::unsubscribe_map.emplace(typeid(T), [](const std::any& iter) { - auto it = std::any_cast(iter); - unsubscribe(it); - }); - } -}; -} diff --git a/engine/src/toast/events/listener.cpp b/engine/src/toast/events/listener.cpp index 368f0170a..6d5fbe141 100644 --- a/engine/src/toast/events/listener.cpp +++ b/engine/src/toast/events/listener.cpp @@ -1,7 +1,6 @@ #include "listener.hpp" #include "event.hpp" -#include "toast/events/event_system.hpp" namespace event { From 090b2c39ea9b40a00c6e28784f3d9faf145d05f2 Mon Sep 17 00:00:00 2001 From: Dante Harper Date: Sat, 9 May 2026 12:56:27 +0200 Subject: [PATCH 08/17] maybe fixed --- engine/src/toast/events/event.hpp | 63 ++++++++++++++++--------------- engine/src/toast/events/event.inl | 21 +++++------ 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/engine/src/toast/events/event.hpp b/engine/src/toast/events/event.hpp index e524e2238..8a76a228a 100644 --- a/engine/src/toast/events/event.hpp +++ b/engine/src/toast/events/event.hpp @@ -11,21 +11,24 @@ #pragma once #include "toast/log.hpp" + +#include #include #include #include -#include -#include -#include #include +#include #include #include #include #include +#include #include namespace event { +struct EventSystem; // Forward declaration + /// @brief dispatches all queued events to their callbacks /// @note Not thread-safe. Should be only ever called from a single thread / main thread void TOAST_API pollEvents() noexcept; @@ -82,20 +85,22 @@ void send(Args&&... args) noexcept; template struct Event : _detail::IEvent { friend class Listener; + friend struct EventSystem; /// @brief callbacks that return 'true' are consumed and do not propogate using callback_t = std::move_only_function; - using iterator_t = std::multimap>::iterator; + using iterator_t = std::multimap>::iterator; private: - static inline struct G { - G() noexcept; - std::multimap> callbacks; - std::mutex mutex; - std::vector processing; - bool cached = false; - } g; + static inline struct _Registrar { + _Registrar(); // Declared, not defined inline + bool registered; + } registrar; + + static void ensureRegistered() { + (void)registrar; // Casting to void "uses" the variable + } - /// @brief registers a callback to the event callbacks + /// @brief registers a callback to the event callbacks /// @param priority higher number callbacks first /// @param callback static auto subscribe(char priority, callback_t&& callback) noexcept -> iterator_t; @@ -108,11 +113,6 @@ struct Event : _detail::IEvent { void notify() noexcept override; }; - - - - - struct TOAST_API EventSystem { struct EventInfo { std::mutex mutex; @@ -121,6 +121,9 @@ struct TOAST_API EventSystem { bool cached = false; }; + /// @brief callback map for each type of event + static std::unordered_map event_data; + /// @brief mutex for the event system pool static std::mutex pool_mutex; @@ -132,29 +135,27 @@ struct TOAST_API EventSystem { /// so thats how i implement the deletion_queue static std::vector> deletion_queue; - static std::unordered_map event_data; - - template static void registerEvent() { static_assert(std::is_base_of_v, T>, "CONTRACT VIOLATION: You Must Inhert as 'struct Derived : Event'"); + if (event_data.contains(typeid(T))) { + TOAST_INFO(_detail::IEvent, "Registered Again Because Windows Is Shit", typeid(T).name()); + return; + } TOAST_INFO(_detail::IEvent, "Registering Event Type: {}", typeid(T).name()); + event_data.emplace( + std::piecewise_construct, + std::forward_as_tuple(typeid(T)), + std::forward_as_tuple() // This calls the EventInfo() constructor + ); EventSystem::unsubscribe_map.emplace(typeid(T), [](const std::any& iter) { - auto it = std::any_cast::iterator_t>(iter); - unsubscribe(it); + auto it = std::any_cast::iterator_t>(iter); + Event::unsubscribe(it); }); } }; - - - - - - - - - } + #include "event.inl" diff --git a/engine/src/toast/events/event.inl b/engine/src/toast/events/event.inl index d2ce0732b..4bbb42f82 100644 --- a/engine/src/toast/events/event.inl +++ b/engine/src/toast/events/event.inl @@ -2,32 +2,28 @@ #include "event.hpp" #include "toast/log.hpp" +#include #include #include namespace event { template -Event::G::G() noexcept { - // static_assert(std::is_base_of_v, T>, "CONTRACT VIOLATION: You Must Inhert as 'struct Derived : Event'"); - // TOAST_INFO(_detail::IEvent,"Registering Event Type: {}",typeid(T).name()); - // // add function to the Event vtable - // _detail::unsubscribe_map.emplace(typeid(T), [](std::any iter) { - // auto it = std::any_cast(iter); - // unsubscribe(it); - // }); - event::EventSystem::registerEvent(); +Event::_Registrar::_Registrar() : registered(true) { + EventSystem::registerEvent(); } template auto Event::subscribe(char priority, callback_t&& callback) noexcept -> iterator_t { + (void)registrar.registered; TOAST_TRACE(_detail::IEvent, "Subscribing Callback To: {}", typeid(T).name()); auto cb = new callback_t(std::move(callback)); + auto& g = EventSystem::event_data[typeid(T)]; { std::scoped_lock _(g.mutex); g.cached = false; - return g.callbacks.emplace(priority, cb); + return g.callbacks.emplace(priority, static_cast(cb)); } } @@ -35,6 +31,7 @@ template void Event::unsubscribe(iterator_t it) noexcept { TOAST_TRACE(_detail::IEvent, "Unsubscribing Callback To: {}", typeid(T).name()); + auto& g = EventSystem::event_data[typeid(T)]; { std::scoped_lock _(g.mutex); auto deleter = [](void* p) { delete static_cast*>(p); }; @@ -47,6 +44,8 @@ void Event::unsubscribe(iterator_t it) noexcept { template void Event::notify() noexcept { TOAST_TRACE(_detail::IEvent, "Notifying Event: {}", typeid(T).name()); + + auto& g = EventSystem::event_data[typeid(T)]; { // build cached list of all the callbacks in order // locks mutex for the shortest period possible @@ -63,7 +62,7 @@ void Event::notify() noexcept { // disptaches all of the callbacks for (auto& callback : g.processing) { - bool handled = (*callback)(static_cast(*this)); + bool handled = (*static_cast(callback))(static_cast(*this)); if (handled) { return; } From edf3be3ccdea477db531437d9d7ca08baddd5466 Mon Sep 17 00:00:00 2001 From: Dante Harper Date: Sat, 9 May 2026 12:58:19 +0200 Subject: [PATCH 09/17] meow --- engine/src/toast/events/event.hpp | 20 ++++++++------------ engine/src/toast/events/event.inl | 4 +++- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/engine/src/toast/events/event.hpp b/engine/src/toast/events/event.hpp index 8a76a228a..3f575f821 100644 --- a/engine/src/toast/events/event.hpp +++ b/engine/src/toast/events/event.hpp @@ -88,19 +88,15 @@ struct Event : _detail::IEvent { friend struct EventSystem; /// @brief callbacks that return 'true' are consumed and do not propogate using callback_t = std::move_only_function; - using iterator_t = std::multimap>::iterator; + using iterator_t = std::multimap>::iterator; private: - static inline struct _Registrar { - _Registrar(); // Declared, not defined inline + static inline struct Registrar { + Registrar(); bool registered; } registrar; - static void ensureRegistered() { - (void)registrar; // Casting to void "uses" the variable - } - - /// @brief registers a callback to the event callbacks + /// @brief registers a callback to the event callbacks /// @param priority higher number callbacks first /// @param callback static auto subscribe(char priority, callback_t&& callback) noexcept -> iterator_t; @@ -144,10 +140,10 @@ struct TOAST_API EventSystem { } TOAST_INFO(_detail::IEvent, "Registering Event Type: {}", typeid(T).name()); event_data.emplace( - std::piecewise_construct, - std::forward_as_tuple(typeid(T)), - std::forward_as_tuple() // This calls the EventInfo() constructor - ); + std::piecewise_construct, + std::forward_as_tuple(typeid(T)), + std::forward_as_tuple() // This calls the EventInfo() constructor + ); EventSystem::unsubscribe_map.emplace(typeid(T), [](const std::any& iter) { auto it = std::any_cast::iterator_t>(iter); diff --git a/engine/src/toast/events/event.inl b/engine/src/toast/events/event.inl index 4bbb42f82..50b4204ef 100644 --- a/engine/src/toast/events/event.inl +++ b/engine/src/toast/events/event.inl @@ -9,7 +9,7 @@ namespace event { template -Event::_Registrar::_Registrar() : registered(true) { +Event::Registrar::Registrar() : registered(true) { EventSystem::registerEvent(); } @@ -29,6 +29,7 @@ auto Event::subscribe(char priority, callback_t&& callback) noexcept -> itera template void Event::unsubscribe(iterator_t it) noexcept { + (void)registrar.registered; TOAST_TRACE(_detail::IEvent, "Unsubscribing Callback To: {}", typeid(T).name()); auto& g = EventSystem::event_data[typeid(T)]; @@ -43,6 +44,7 @@ void Event::unsubscribe(iterator_t it) noexcept { template void Event::notify() noexcept { + (void)registrar.registered; TOAST_TRACE(_detail::IEvent, "Notifying Event: {}", typeid(T).name()); auto& g = EventSystem::event_data[typeid(T)]; From e635f0d6531deaa629972b26396e6d8fda4d68a6 Mon Sep 17 00:00:00 2001 From: Dante Harper Date: Sat, 9 May 2026 13:19:32 +0200 Subject: [PATCH 10/17] more fixes --- engine/src/toast/events/event.hpp | 2 +- engine/src/toast/events/event.inl | 1 - engine/src/toast/events/listener.cpp | 5 +++++ engine/src/toast/events/listener.hpp | 6 +++++- engine/src/toast/events/listener.inl | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/engine/src/toast/events/event.hpp b/engine/src/toast/events/event.hpp index 3f575f821..1c7928c1e 100644 --- a/engine/src/toast/events/event.hpp +++ b/engine/src/toast/events/event.hpp @@ -135,7 +135,7 @@ struct TOAST_API EventSystem { static void registerEvent() { static_assert(std::is_base_of_v, T>, "CONTRACT VIOLATION: You Must Inhert as 'struct Derived : Event'"); if (event_data.contains(typeid(T))) { - TOAST_INFO(_detail::IEvent, "Registered Again Because Windows Is Shit", typeid(T).name()); + TOAST_INFO(_detail::IEvent, "Event type {} already registered (Windows Is Shit)", typeid(T).name()); return; } TOAST_INFO(_detail::IEvent, "Registering Event Type: {}", typeid(T).name()); diff --git a/engine/src/toast/events/event.inl b/engine/src/toast/events/event.inl index 50b4204ef..4da9833d8 100644 --- a/engine/src/toast/events/event.inl +++ b/engine/src/toast/events/event.inl @@ -2,7 +2,6 @@ #include "event.hpp" #include "toast/log.hpp" -#include #include #include diff --git a/engine/src/toast/events/listener.cpp b/engine/src/toast/events/listener.cpp index 6d5fbe141..10dbc22a7 100644 --- a/engine/src/toast/events/listener.cpp +++ b/engine/src/toast/events/listener.cpp @@ -8,6 +8,10 @@ Listener::Listener() { m.enabled = true; } +Listener::Listener(bool state) { + m.enabled = state; +} + Listener::~Listener() { for (auto& [type, name, callback] : m.callbacks) { EventSystem::unsubscribe_map[type](callback); @@ -22,4 +26,5 @@ void Listener::enabled(bool state) { auto Listener::enabled() const -> bool { return m.enabled; } + } diff --git a/engine/src/toast/events/listener.hpp b/engine/src/toast/events/listener.hpp index 19ccc35c7..348440ee8 100644 --- a/engine/src/toast/events/listener.hpp +++ b/engine/src/toast/events/listener.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -49,12 +50,15 @@ class TOAST_API Listener { public: Listener(); + + Listener(bool state); + ~Listener(); /// @brief unsubscribes every event in type TEvent with that name /// @param name event callback name/s to remove template - void unsubscribe(std::string name) noexcept; + void unsubscribe(std::string_view name) noexcept; /// @brief subscribes a callback to an TEvent /// @param name of the callback diff --git a/engine/src/toast/events/listener.inl b/engine/src/toast/events/listener.inl index 554c73e43..6eed2288f 100644 --- a/engine/src/toast/events/listener.inl +++ b/engine/src/toast/events/listener.inl @@ -7,7 +7,7 @@ namespace event { template -void Listener::unsubscribe(std::string name) noexcept { +void Listener::unsubscribe(std::string_view name) noexcept { TOAST_TRACE(Listener, "Unsubscribing Callback {} to {}", name, typeid(TEvent).name()); std::erase_if(m.callbacks, [&](auto& callback) { auto& [type, sub_name, any] = callback; From 29939eb0c67065d3cab4a2f234419e5ad8fe0db7 Mon Sep 17 00:00:00 2001 From: Xein Date: Sat, 9 May 2026 13:38:22 +0200 Subject: [PATCH 11/17] github workflows improved --- .github/workflows/clang-format.yml | 44 ++++++ .github/workflows/clang-tidy.yml | 45 ++++++ .github/workflows/draft-dev-to-main.yml | 103 +++++++++++++ .github/workflows/release-on-merge.yml | 87 +++++++++++ .github/workflows/test-linux-release.yml | 43 ++++++ .github/workflows/test-linux.yml | 44 ++++++ .github/workflows/test-windows-release.yml | 47 ++++++ .github/workflows/test-windows.yml | 48 ++++++ .github/workflows/tests.yml | 163 --------------------- 9 files changed, 461 insertions(+), 163 deletions(-) create mode 100644 .github/workflows/clang-format.yml create mode 100644 .github/workflows/clang-tidy.yml create mode 100644 .github/workflows/draft-dev-to-main.yml create mode 100644 .github/workflows/release-on-merge.yml create mode 100644 .github/workflows/test-linux-release.yml create mode 100644 .github/workflows/test-linux.yml create mode 100644 .github/workflows/test-windows-release.yml create mode 100644 .github/workflows/test-windows.yml delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml new file mode 100644 index 000000000..221fd1e6b --- /dev/null +++ b/.github/workflows/clang-format.yml @@ -0,0 +1,44 @@ +name: clang-format + +on: + pull_request: + branches: + - dev + - main + types: + - opened + - reopened + - synchronize + - edited + +permissions: + contents: read + pull-requests: read + +concurrency: + group: clang-format-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + format: + name: clang-format + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: read + steps: + - name: Checkout PR branch + uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.head_ref }} + fetch-depth: 0 + persist-credentials: true + + - name: Install Nix + uses: cachix/install-nix-action@v30 + + - name: Run clang-format + run: | + eval "$(nix --extra-experimental-features 'nix-command flakes' print-dev-env .)" + bash ./tools/ci/clang_format.sh diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml new file mode 100644 index 000000000..36e27be8d --- /dev/null +++ b/.github/workflows/clang-tidy.yml @@ -0,0 +1,45 @@ +name: clang-tidy + +on: + pull_request: + branches: + - dev + - main + types: + - opened + - reopened + - synchronize + - edited + +permissions: + contents: read + pull-requests: read + +concurrency: + group: clang-tidy-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + tidy: + name: clang-tidy + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.head_ref }} + fetch-depth: 0 + + - name: Install Nix + uses: cachix/install-nix-action@v30 + + - name: Generate compile_commands + run: | + eval "$(nix --extra-experimental-features 'nix-command flakes' print-dev-env .)" + xmake project -k compile_commands -y + + - name: Run clang-tidy + run: | + eval "$(nix --extra-experimental-features 'nix-command flakes' print-dev-env .)" + bash ./tools/ci/clang_tidy.sh diff --git a/.github/workflows/draft-dev-to-main.yml b/.github/workflows/draft-dev-to-main.yml new file mode 100644 index 000000000..8f4490fd1 --- /dev/null +++ b/.github/workflows/draft-dev-to-main.yml @@ -0,0 +1,103 @@ +name: draft-dev-to-main + +on: + pull_request: + branches: + - dev + types: + - closed + +permissions: + contents: read + pull-requests: write + issues: write + +jobs: + draft: + name: create dev -> main draft + runs-on: ubuntu-latest + if: github.event.pull_request.merged == true && github.event.pull_request.base.repo.fork == false && github.event.pull_request.base.repo.full_name == github.repository + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + + - name: Fetch main and dev + shell: bash + run: | + set -euo pipefail + git fetch origin main dev --prune --tags + + - name: Determine next tag + id: version + shell: bash + run: | + set -euo pipefail + + ahead_count="$(git rev-list --count origin/main..origin/dev)" + if [[ "${ahead_count}" -le 0 ]]; then + echo "dev is not ahead of main; skipping." + echo "create_pr=false" >> "${GITHUB_OUTPUT}" + exit 0 + fi + + latest_tag="$(git tag --list "2.*.*" --sort=-version:refname | head -n 1 || true)" + if [[ -z "${latest_tag}" ]]; then + new_tag="2.0.0" + else + IFS='.' read -r major minor patch <<< "${latest_tag}" + minor=$((minor + 1)) + patch=0 + new_tag="${major}.${minor}.${patch}" + fi + + echo "new_tag=${new_tag}" >> "${GITHUB_OUTPUT}" + echo "create_pr=true" >> "${GITHUB_OUTPUT}" + + - name: Create draft PR if missing + if: steps.version.outputs.create_pr == 'true' + uses: actions/github-script@v7 + with: + script: | + const owner = context.repo.owner; + const repo = context.repo.repo; + const tag = "${{ steps.version.outputs.new_tag }}"; + + const existing = await github.rest.pulls.list({ + owner, + repo, + state: "open", + base: "main", + head: `${owner}:dev` + }); + + if (existing.data.length > 0) { + core.info("Open dev -> main PR already exists; skipping."); + return; + } + + const pr = await github.rest.pulls.create({ + owner, + repo, + title: `Toast Engine v${tag}`, + head: "dev", + base: "main", + body: "", + draft: true + }); + + await github.rest.pulls.requestReviewers({ + owner, + repo, + pull_number: pr.data.number, + reviewers: ["ynks"] + }); + + await github.rest.issues.addAssignees({ + owner, + repo, + issue_number: pr.data.number, + assignees: ["ynks"] + }); diff --git a/.github/workflows/release-on-merge.yml b/.github/workflows/release-on-merge.yml new file mode 100644 index 000000000..2cb3fe064 --- /dev/null +++ b/.github/workflows/release-on-merge.yml @@ -0,0 +1,87 @@ +name: release-on-merge + +on: + pull_request: + branches: + - main + types: + - closed + +permissions: + contents: write + +jobs: + release: + name: tag and release + runs-on: ubuntu-latest + if: github.event.pull_request.merged == true && github.event.pull_request.base.repo.fork == false && github.event.pull_request.base.repo.full_name == github.repository + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + persist-credentials: true + + - name: Determine next tag + id: version + shell: bash + env: + HEAD_REF: ${{ github.event.pull_request.head.ref }} + MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }} + run: | + set -euo pipefail + + latest_tag="$(git tag --list "2.*.*" --sort=-version:refname | head -n 1 || true)" + if [[ -z "${latest_tag}" ]]; then + if [[ "${HEAD_REF}" == "dev" ]]; then + new_tag="2.0.0" + else + echo "No existing 2.*.* tags and merge is not dev -> main. Skipping." + echo "create_release=false" >> "${GITHUB_OUTPUT}" + exit 0 + fi + else + IFS='.' read -r major minor patch <<< "${latest_tag}" + if [[ "${HEAD_REF}" == "dev" ]]; then + minor=$((minor + 1)) + patch=0 + elif [[ "${HEAD_REF}" == hotfix/* ]]; then + patch=$((patch + 1)) + else + echo "Head ref '${HEAD_REF}' does not match dev or hotfix/*; skipping." + echo "create_release=false" >> "${GITHUB_OUTPUT}" + exit 0 + fi + new_tag="${major}.${minor}.${patch}" + fi + + if git rev-parse -q --verify "refs/tags/${new_tag}" > /dev/null; then + echo "Tag ${new_tag} already exists; skipping." + echo "create_release=false" >> "${GITHUB_OUTPUT}" + exit 0 + fi + + echo "new_tag=${new_tag}" >> "${GITHUB_OUTPUT}" + echo "merge_sha=${MERGE_SHA}" >> "${GITHUB_OUTPUT}" + echo "create_release=true" >> "${GITHUB_OUTPUT}" + + - name: Create tag + if: steps.version.outputs.create_release == 'true' + run: | + git tag "${{ steps.version.outputs.new_tag }}" "${{ steps.version.outputs.merge_sha }}" + git push origin "refs/tags/${{ steps.version.outputs.new_tag }}" + + - name: Create GitHub release + if: steps.version.outputs.create_release == 'true' + uses: actions/github-script@v7 + with: + script: | + const tag = "${{ steps.version.outputs.new_tag }}"; + await github.rest.repos.createRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + tag_name: tag, + name: `Toast Engine v${tag}`, + body: "" + }); diff --git a/.github/workflows/test-linux-release.yml b/.github/workflows/test-linux-release.yml new file mode 100644 index 000000000..f6ec14525 --- /dev/null +++ b/.github/workflows/test-linux-release.yml @@ -0,0 +1,43 @@ +name: test-linux-release + +on: + pull_request: + branches: + - main + types: + - opened + - reopened + - synchronize + - edited + +permissions: + contents: read + pull-requests: read + +concurrency: + group: test-linux-release-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + test: + name: test linux release + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.head_ref }} + fetch-depth: 0 + + - name: Install Nix + uses: cachix/install-nix-action@v30 + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + + - name: Run tests (Linux) + run: | + eval "$(nix --extra-experimental-features 'nix-command flakes' print-dev-env .)" + xmake f -m release -y + xmake test -y diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml new file mode 100644 index 000000000..b6b332e27 --- /dev/null +++ b/.github/workflows/test-linux.yml @@ -0,0 +1,44 @@ +name: test-linux + +on: + pull_request: + branches: + - dev + - main + types: + - opened + - reopened + - synchronize + - edited + +permissions: + contents: read + pull-requests: read + +concurrency: + group: test-linux-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + test: + name: test linux + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.head_ref }} + fetch-depth: 0 + + - name: Install Nix + uses: cachix/install-nix-action@v30 + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + + - name: Run tests (Linux) + run: | + eval "$(nix --extra-experimental-features 'nix-command flakes' print-dev-env .)" + xmake f -m debug -y + xmake test -y diff --git a/.github/workflows/test-windows-release.yml b/.github/workflows/test-windows-release.yml new file mode 100644 index 000000000..0211882cf --- /dev/null +++ b/.github/workflows/test-windows-release.yml @@ -0,0 +1,47 @@ +name: test-windows-release + +on: + pull_request: + branches: + - main + types: + - opened + - reopened + - synchronize + - edited + +permissions: + contents: read + pull-requests: read + +concurrency: + group: test-windows-release-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + test: + name: test windows release + runs-on: windows-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.head_ref }} + fetch-depth: 0 + + - name: Setup xmake + uses: xmake-io/github-action-setup-xmake@v1 + + - name: Setup .NET 10 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "10.0.x" + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + + - name: Run tests (Windows) + run: | + xmake f -m release -y + xmake test -y diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml new file mode 100644 index 000000000..8e801f5bd --- /dev/null +++ b/.github/workflows/test-windows.yml @@ -0,0 +1,48 @@ +name: test-windows + +on: + pull_request: + branches: + - dev + - main + types: + - opened + - reopened + - synchronize + - edited + +permissions: + contents: read + pull-requests: read + +concurrency: + group: test-windows-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + test: + name: test windows + runs-on: windows-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.head_ref }} + fetch-depth: 0 + + - name: Setup xmake + uses: xmake-io/github-action-setup-xmake@v1 + + - name: Setup .NET 10 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "10.0.x" + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + + - name: Run tests (Windows) + run: | + xmake f -m debug -y + xmake test -y diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index a1bd59af7..000000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,163 +0,0 @@ -name: tests - -on: - pull_request: - branches: - - dev - types: - - opened - - reopened - - synchronize - - edited - -permissions: - contents: read - pull-requests: read - -concurrency: - group: tests-${{ github.event.pull_request.number }} - cancel-in-progress: true - -jobs: - format: - name: clang-format - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: read - steps: - - name: Checkout PR branch - uses: actions/checkout@v4 - with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.head_ref }} - fetch-depth: 0 - persist-credentials: true - - - name: Install Nix - uses: cachix/install-nix-action@v30 - - - name: Run clang-format - run: | - eval "$(nix --extra-experimental-features 'nix-command flakes' print-dev-env .)" - bash ./tools/ci/clang_format.sh - - build: - name: build ${{ matrix.os }} - needs: format - runs-on: ${{ matrix.os }} - strategy: - fail-fast: true - matrix: - os: - - ubuntu-latest - - windows-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.head_ref }} - fetch-depth: 0 - - - name: Setup Nix - if: runner.os == 'Linux' - uses: cachix/install-nix-action@v30 - - - name: Setup xmake - if: runner.os == 'Windows' - uses: xmake-io/github-action-setup-xmake@v1 - - - name: Setup .NET - if: runner.os == 'Windows' - uses: actions/setup-dotnet@v4 - with: - dotnet-version: "10.0.x" - - - name: Setup Rust - uses: dtolnay/rust-toolchain@stable - - - name: Build (Linux) - if: runner.os == 'Linux' - run: | - eval "$(nix --extra-experimental-features 'nix-command flakes' print-dev-env .)" - xmake f -m debug - xmake --all - - - name: Build (Windows) - if: runner.os == 'Windows' - run: xmake f -m debug && xmake --all - - test: - name: test ${{ matrix.os }} - needs: build - runs-on: ${{ matrix.os }} - strategy: - fail-fast: true - matrix: - os: - - ubuntu-latest - - windows-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.head_ref }} - fetch-depth: 0 - - - name: Install Nix - if: runner.os == 'Linux' - uses: cachix/install-nix-action@v30 - - - name: Setup xmake - if: runner.os == 'Windows' - uses: xmake-io/github-action-setup-xmake@v1 - - - name: Setup .NET 10 - if: runner.os == 'Windows' - uses: actions/setup-dotnet@v4 - with: - dotnet-version: "10.0.x" - - - name: Setup Rust - uses: dtolnay/rust-toolchain@stable - - - name: Run tests (Linux) - if: runner.os == 'Linux' - run: | - eval "$(nix --extra-experimental-features 'nix-command flakes' print-dev-env .)" - xmake f -m debug - xmake test - - - name: Run tests (Windows) - if: runner.os == 'Windows' - run: | - xmake f -m debug - xmake test - - tidy: - name: clang-tidy - needs: test - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.head_ref }} - fetch-depth: 0 - - - name: Install Nix - uses: cachix/install-nix-action@v30 - - - name: Generate compile_commands - run: | - eval "$(nix --extra-experimental-features 'nix-command flakes' print-dev-env .)" - xmake project -k compile_commands - - - name: Run clang-tidy - run: | - eval "$(nix --extra-experimental-features 'nix-command flakes' print-dev-env .)" - bash ./tools/ci/clang_tidy.sh - From 1e2d981ab75977bb173c78e11f5774c4b098a687 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 9 May 2026 11:40:16 +0000 Subject: [PATCH 12/17] ci: apply clang-format to engine --- engine/src/toast/events/event.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/src/toast/events/event.inl b/engine/src/toast/events/event.inl index 4da9833d8..2f9c98aa7 100644 --- a/engine/src/toast/events/event.inl +++ b/engine/src/toast/events/event.inl @@ -9,7 +9,7 @@ namespace event { template Event::Registrar::Registrar() : registered(true) { - EventSystem::registerEvent(); + EventSystem::registerEvent(); } template From 471811197526bddca9df8be9e3fe518948c09f13 Mon Sep 17 00:00:00 2001 From: Dante Harper Date: Sat, 9 May 2026 13:04:35 +0200 Subject: [PATCH 13/17] some random fixes --- engine/src/toast/events/event.hpp | 2 +- engine/xmake.lua | 5 ++++- pch.h | 32 +++++++++++++++++++++++++++++++ tests/xmake.lua | 4 +++- xmake.lua | 9 ++++----- 5 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 pch.h diff --git a/engine/src/toast/events/event.hpp b/engine/src/toast/events/event.hpp index 1c7928c1e..4318c2709 100644 --- a/engine/src/toast/events/event.hpp +++ b/engine/src/toast/events/event.hpp @@ -45,7 +45,7 @@ struct TOAST_API IEvent { #endif private: - friend void event::pollEvents() noexcept; + friend void TOAST_API event::pollEvents() noexcept; virtual void notify() noexcept = 0; }; diff --git a/engine/xmake.lua b/engine/xmake.lua index b98245487..eb8dc90d5 100644 --- a/engine/xmake.lua +++ b/engine/xmake.lua @@ -11,10 +11,13 @@ target("toast.engine", function() add_files("**.cpp") add_headerfiles("src/(**.hpp)", { public = false, extra = { check = true } }) add_headerfiles("ffi/(**.h)", "include/toast/(**.hpp)", { prefixdir = "toast", extra = { check = true } }) + set_pcxxheader("../pch.h") -- External libraries go here -x add_packages("asio") --- add_syslinks("stdc++exp", { tools = { "clang", "gcc" }, public = true }) -- adds library for stacktrace + if not is_plat("windows") then + add_syslinks("stdc++exp") + end -- Apply clang-format rule -- FIX THIS SO CLANG FORMAT ALWAYS RUNS BEFORE THE DANTE HEADERS BULLSHIT diff --git a/pch.h b/pch.h new file mode 100644 index 000000000..e021e921d --- /dev/null +++ b/pch.h @@ -0,0 +1,32 @@ +/** + * @file pch.h + * @author Dante Harper + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/tests/xmake.lua b/tests/xmake.lua index 7cb400de7..580b18f9c 100644 --- a/tests/xmake.lua +++ b/tests/xmake.lua @@ -13,7 +13,9 @@ for _, filepath in ipairs(os.files(path.join(scriptdir, "**.cpp"))) do add_files(filepath) add_deps("toast.engine") - + if not is_plat("windows") then + add_syslinks("stdc++exp") + end add_defines("UNIT_TESTING") diff --git a/xmake.lua b/xmake.lua index 3b8219b4d..ab33d7587 100644 --- a/xmake.lua +++ b/xmake.lua @@ -24,10 +24,7 @@ end) rule_end() add_rules("plugin.compile_commands.autoupdate") --- add_syslinks("stdc++exp", { tools = { "clang", "gcc" } }) -- adds library for stacktrace -if is_plat("linux", "macosx") then - add_syslinks("stdc++exp") -end + -- Makes release have flto, fast math and SIMD intrinsic optimizations if is_mode("release") then @@ -42,7 +39,9 @@ end -- Enables debug optimizations, needed on newer clang and gcc versions to avoid a warning if is_mode("debug") then set_optimize("none") - add_cxxflags("-Og", { tools = { "clang", "gcc" } }) -- this line doesnt quite work + if not is_plat("windows") then + add_cxxflags("-Og") + end add_defines("DEBUG") end From 625b5a9b900fe4a131b86c5fbc6e08e673f41303 Mon Sep 17 00:00:00 2001 From: Xein Date: Sat, 9 May 2026 15:24:15 +0200 Subject: [PATCH 14/17] a bit more CI changes --- .github/workflows/branch_rules.yml | 2 +- .github/workflows/clang-format.yml | 4 ---- tools/ci/clang_format.sh | 16 +--------------- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/.github/workflows/branch_rules.yml b/.github/workflows/branch_rules.yml index ea653c685..04b296388 100644 --- a/.github/workflows/branch_rules.yml +++ b/.github/workflows/branch_rules.yml @@ -1,4 +1,4 @@ -name: branch_rules +name: branch-rules on: pull_request: diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 221fd1e6b..0ffbdfb08 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -23,9 +23,6 @@ jobs: format: name: clang-format runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: read steps: - name: Checkout PR branch uses: actions/checkout@v4 @@ -33,7 +30,6 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.head_ref }} fetch-depth: 0 - persist-credentials: true - name: Install Nix uses: cachix/install-nix-action@v30 diff --git a/tools/ci/clang_format.sh b/tools/ci/clang_format.sh index dcf575d26..9dc87f54a 100644 --- a/tools/ci/clang_format.sh +++ b/tools/ci/clang_format.sh @@ -22,20 +22,6 @@ nix --extra-experimental-features "nix-command flakes" develop .#default -c bash exit 0 fi - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add -- "${files[@]}" - - if ! git commit -m "ci: apply clang-format to engine"; then - echo "Formatting changes detected, but nothing was committed." - exit 1 - fi - - if git push; then - echo "Formatting fixes were pushed to the PR branch. Continuing with the updated commit in this run." - exit 0 - fi - - echo "::error::Formatting changes were detected, but this workflow could not push fixes. Format locally and push." + echo "::error::Formatting changes detected. Run clang-format locally and push the results." exit 1 ' From 0d74c9048bad1934e54a734fa84c0ce4e2db117f Mon Sep 17 00:00:00 2001 From: Xein Date: Sat, 9 May 2026 15:53:05 +0200 Subject: [PATCH 15/17] Fixed library exception error with GCC on windows Honestly theres no way i would have figured this out on my own ngl, github copilot tokens saved me ngl Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- engine/xmake.lua | 8 ++++++++ tests/xmake.lua | 3 +++ 2 files changed, 11 insertions(+) diff --git a/engine/xmake.lua b/engine/xmake.lua index eb8dc90d5..89a67c06f 100644 --- a/engine/xmake.lua +++ b/engine/xmake.lua @@ -18,6 +18,14 @@ target("toast.engine", function() if not is_plat("windows") then add_syslinks("stdc++exp") end + if is_plat("windows") and (get_config("toolchain") == "mingw" or get_config("toolchain") == "gcc") then + add_syslinks("stdc++exp") + add_defines("__cpp_lib_constexpr_exceptions=0") + on_load(function(target) + local implib = path.join(target:targetdir(), "lib" .. target:name() .. ".dll.a") + target:add("shflags", "-Wl,--out-implib," .. implib, { force = true }) + end) + end -- Apply clang-format rule -- FIX THIS SO CLANG FORMAT ALWAYS RUNS BEFORE THE DANTE HEADERS BULLSHIT diff --git a/tests/xmake.lua b/tests/xmake.lua index 580b18f9c..45dd44da2 100644 --- a/tests/xmake.lua +++ b/tests/xmake.lua @@ -16,6 +16,9 @@ for _, filepath in ipairs(os.files(path.join(scriptdir, "**.cpp"))) do if not is_plat("windows") then add_syslinks("stdc++exp") end + if is_plat("windows") and (get_config("toolchain") == "mingw" or get_config("toolchain") == "gcc") then + add_syslinks("stdc++exp") + end add_defines("UNIT_TESTING") From 4fdcdc89305ae112e3bb439b6166bf8799ea90fe Mon Sep 17 00:00:00 2001 From: Xein Date: Sat, 9 May 2026 16:08:44 +0200 Subject: [PATCH 16/17] Lol i didn't see this was getting gitignored because it had the word "build" --- .github/workflows/.gitignore | 4 ++ .github/workflows/build-linux-release.yml | 43 +++++++++++++++++++ .github/workflows/build-linux.yml | 44 ++++++++++++++++++++ .github/workflows/build-windows-release.yml | 45 ++++++++++++++++++++ .github/workflows/build-windows.yml | 46 +++++++++++++++++++++ 5 files changed, 182 insertions(+) create mode 100644 .github/workflows/.gitignore create mode 100644 .github/workflows/build-linux-release.yml create mode 100644 .github/workflows/build-linux.yml create mode 100644 .github/workflows/build-windows-release.yml create mode 100644 .github/workflows/build-windows.yml diff --git a/.github/workflows/.gitignore b/.github/workflows/.gitignore new file mode 100644 index 000000000..e63fcbedb --- /dev/null +++ b/.github/workflows/.gitignore @@ -0,0 +1,4 @@ +!build-linux.yml +!build-linux-release.yml +!build-windows.yml +!build-windows-release.yml \ No newline at end of file diff --git a/.github/workflows/build-linux-release.yml b/.github/workflows/build-linux-release.yml new file mode 100644 index 000000000..f1f8709c3 --- /dev/null +++ b/.github/workflows/build-linux-release.yml @@ -0,0 +1,43 @@ +name: build-linux-release + +on: + pull_request: + branches: + - main + types: + - opened + - reopened + - synchronize + - edited + +permissions: + contents: read + pull-requests: read + +concurrency: + group: build-linux-release-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + build: + name: build linux release + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.head_ref }} + fetch-depth: 0 + + - name: Setup Nix + uses: cachix/install-nix-action@v30 + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + + - name: Build (Linux) + run: | + eval "$(nix --extra-experimental-features 'nix-command flakes' print-dev-env .)" + xmake f -m release -y + xmake --all -y diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml new file mode 100644 index 000000000..35d050c24 --- /dev/null +++ b/.github/workflows/build-linux.yml @@ -0,0 +1,44 @@ +name: build-linux + +on: + pull_request: + branches: + - dev + - main + types: + - opened + - reopened + - synchronize + - edited + +permissions: + contents: read + pull-requests: read + +concurrency: + group: build-linux-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + build: + name: build linux + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.head_ref }} + fetch-depth: 0 + + - name: Setup Nix + uses: cachix/install-nix-action@v30 + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + + - name: Build (Linux) + run: | + eval "$(nix --extra-experimental-features 'nix-command flakes' print-dev-env .)" + xmake f -m debug -y + xmake --all -y diff --git a/.github/workflows/build-windows-release.yml b/.github/workflows/build-windows-release.yml new file mode 100644 index 000000000..46daa3ae4 --- /dev/null +++ b/.github/workflows/build-windows-release.yml @@ -0,0 +1,45 @@ +name: build-windows-release + +on: + pull_request: + branches: + - main + types: + - opened + - reopened + - synchronize + - edited + +permissions: + contents: read + pull-requests: read + +concurrency: + group: build-windows-release-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + build: + name: build windows release + runs-on: windows-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.head_ref }} + fetch-depth: 0 + + - name: Setup xmake + uses: xmake-io/github-action-setup-xmake@v1 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "10.0.x" + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + + - name: Build (Windows) + run: xmake f -m release -y && xmake --all -y diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml new file mode 100644 index 000000000..dd5b3259c --- /dev/null +++ b/.github/workflows/build-windows.yml @@ -0,0 +1,46 @@ +name: build-windows + +on: + pull_request: + branches: + - dev + - main + types: + - opened + - reopened + - synchronize + - edited + +permissions: + contents: read + pull-requests: read + +concurrency: + group: build-windows-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + build: + name: build windows + runs-on: windows-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.head_ref }} + fetch-depth: 0 + + - name: Setup xmake + uses: xmake-io/github-action-setup-xmake@v1 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "10.0.x" + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + + - name: Build (Windows) + run: xmake f -m debug -y && xmake --all -y From 586030ff4f3ae6eb0c24bb5a7b080ae2d383e6b9 Mon Sep 17 00:00:00 2001 From: Dante Harper Date: Sat, 9 May 2026 16:24:19 +0200 Subject: [PATCH 17/17] fixed linter errors should be ready for pr now --- engine/src/toast/events/event.hpp | 8 +++----- engine/src/toast/log.hpp | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/engine/src/toast/events/event.hpp b/engine/src/toast/events/event.hpp index 4318c2709..221427a74 100644 --- a/engine/src/toast/events/event.hpp +++ b/engine/src/toast/events/event.hpp @@ -27,8 +27,6 @@ namespace event { -struct EventSystem; // Forward declaration - /// @brief dispatches all queued events to their callbacks /// @note Not thread-safe. Should be only ever called from a single thread / main thread void TOAST_API pollEvents() noexcept; @@ -93,7 +91,7 @@ struct Event : _detail::IEvent { private: static inline struct Registrar { Registrar(); - bool registered; + bool registered = false; } registrar; /// @brief registers a callback to the event callbacks @@ -139,10 +137,10 @@ struct TOAST_API EventSystem { return; } TOAST_INFO(_detail::IEvent, "Registering Event Type: {}", typeid(T).name()); - event_data.emplace( + event_data.emplace( // this is goofy because eventinfo has a mutex inside it std::piecewise_construct, std::forward_as_tuple(typeid(T)), - std::forward_as_tuple() // This calls the EventInfo() constructor + std::forward_as_tuple() ); EventSystem::unsubscribe_map.emplace(typeid(T), [](const std::any& iter) { diff --git a/engine/src/toast/log.hpp b/engine/src/toast/log.hpp index 071498ca5..5c38b73eb 100644 --- a/engine/src/toast/log.hpp +++ b/engine/src/toast/log.hpp @@ -16,7 +16,7 @@ /// @internal namespace logging::_detail { -constexpr auto TOAST_API getOnlyName(std::string_view path) -> std::string_view { +constexpr auto getOnlyName(std::string_view path) -> std::string_view { size_t last_slash = path.find_last_of("\\/"); if (last_slash == std::string_view::npos) { return path;