From 18c7e528f3df31d62cd05c2cc34be92be83d5367 Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Fri, 20 Dec 2024 12:17:14 +0100 Subject: button now using channel --- src/crepe/api/Script.h | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'src/crepe/api/Script.h') diff --git a/src/crepe/api/Script.h b/src/crepe/api/Script.h index 5f68928..bbee920 100644 --- a/src/crepe/api/Script.h +++ b/src/crepe/api/Script.h @@ -8,6 +8,7 @@ #include "../manager/Mediator.h" #include "../manager/ReplayManager.h" #include "../system/CollisionSystem.h" +#include "../system/InputSystem.h" #include "../types.h" #include "../util/Log.h" #include "../util/OptionalRef.h" @@ -270,7 +271,42 @@ void Script::subscribe(const EventHandler & callback); template <> void Script::subscribe(const EventHandler & callback, event_channel_t) = delete; - +/** + * \brief Subscribe to ButtonPressEvent for the current GameObject + * + * This is a template specialization for Script::subscribe which automatically sets the event + * channel so the callback handler is only called for ButtonPressEvent events that apply to the + * current GameObject the parent BehaviorScript is attached to. + */ +template <> +void Script::subscribe(const EventHandler & callback); +template <> +void Script::subscribe(const EventHandler & callback, event_channel_t) + = delete; +/** + * \brief Subscribe to ButtonExitEvent for the current GameObject + * + * This is a template specialization for Script::subscribe which automatically sets the event + * channel so the callback handler is only called for ButtonExitEvent events that apply to the + * current GameObject the parent BehaviorScript is attached to. + */ +template <> +void Script::subscribe(const EventHandler & callback); +template <> +void Script::subscribe(const EventHandler & callback, event_channel_t) + = delete; +/** + * \brief Subscribe to ButtonEnterEvent for the current GameObject + * + * This is a template specialization for Script::subscribe which automatically sets the event + * channel so the callback handler is only called for ButtonEnterEvent events that apply to the + * current GameObject the parent BehaviorScript is attached to. + */ +template <> +void Script::subscribe(const EventHandler & callback); +template <> +void Script::subscribe(const EventHandler & callback, event_channel_t) + = delete; } // namespace crepe #include "Script.hpp" -- cgit v1.2.3