From 70b1bf50de703330436f2ae9cb103fe33cbb567e Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Thu, 21 Nov 2024 10:00:35 +0100 Subject: `make format` --- src/crepe/api/Event.h | 4 ++-- src/crepe/api/Script.cpp | 1 - src/crepe/api/Script.h | 4 +++- src/crepe/api/Script.hpp | 15 +++++++++------ 4 files changed, 14 insertions(+), 10 deletions(-) (limited to 'src/crepe') diff --git a/src/crepe/api/Event.h b/src/crepe/api/Event.h index ab4be2b..b267e3e 100644 --- a/src/crepe/api/Event.h +++ b/src/crepe/api/Event.h @@ -93,7 +93,7 @@ public: /** * \brief Event triggered during a collision between objects. */ -class CollisionEvent : public Event { }; +class CollisionEvent : public Event {}; /** * \brief Event triggered when text is submitted, e.g., from a text input. @@ -109,4 +109,4 @@ public: */ class ShutDownEvent : public Event {}; -} +} // namespace crepe diff --git a/src/crepe/api/Script.cpp b/src/crepe/api/Script.cpp index d3fae07..0e73848 100644 --- a/src/crepe/api/Script.cpp +++ b/src/crepe/api/Script.cpp @@ -14,4 +14,3 @@ void Script::subscribe(const EventHandler & callback) { const game_object_id_t & game_object_id = *this->game_object_id_ref; this->subscribe_internal(callback, game_object_id); } - diff --git a/src/crepe/api/Script.h b/src/crepe/api/Script.h index 373b253..8356fd2 100644 --- a/src/crepe/api/Script.h +++ b/src/crepe/api/Script.h @@ -127,6 +127,7 @@ protected: Script() = default; //! Only \c BehaviorScript instantiates Script friend class BehaviorScript; + public: // std::unique_ptr destroys script virtual ~Script(); @@ -180,7 +181,8 @@ private: template <> void Script::subscribe(const EventHandler & callback); template <> -void Script::subscribe(const EventHandler & callback, event_channel_t) = delete; +void Script::subscribe(const EventHandler & callback, event_channel_t) + = delete; } // namespace crepe diff --git a/src/crepe/api/Script.hpp b/src/crepe/api/Script.hpp index 8186bd4..e60be07 100644 --- a/src/crepe/api/Script.hpp +++ b/src/crepe/api/Script.hpp @@ -31,13 +31,16 @@ void Script::logf(Args &&... args) { } template -void Script::subscribe_internal(const EventHandler & callback, event_channel_t channel) { +void Script::subscribe_internal(const EventHandler & callback, + event_channel_t channel) { EventManager & mgr = *this->event_manager_ref; - subscription_t listener = mgr.subscribe([this, callback](const EventType & data) -> bool { - bool & active = *this->active_ref; - if (!active) return false; - return callback(data); - }, channel); + subscription_t listener = mgr.subscribe( + [this, callback](const EventType & data) -> bool { + bool & active = *this->active_ref; + if (!active) return false; + return callback(data); + }, + channel); this->listeners.push_back(listener); } -- cgit v1.2.3