You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: include/Horrible.hpp
+13-2Lines changed: 13 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -19,15 +19,18 @@
19
19
20
20
#include<cocos2d.h>
21
21
22
+
#include<Geode/utils/function.hpp>
23
+
#include<Geode/utils/ZStringView.hpp>
24
+
22
25
// Container for Horrible Ideas API functions
23
26
namespacehorrible {
24
27
// Mod option manager for Horrible Ideas
25
28
classAWCW_HORRIBLE_API_DLL OptionManager final : public cocos2d::CCObject {
26
29
private:
27
30
std::vector<Option> m_options; // Array of registered options
28
31
std::vector<std::string> m_categories; // Array of auto-registered categories
32
+
std::unordered_map<std::string_view, std::vector<std::function<void()>>> m_delegates; // Map of option ID to array of delegates to call when that option is toggled
29
33
30
-
protected:
31
34
/**
32
35
* Register a category if not already registered
33
36
*
@@ -55,6 +58,14 @@ namespace horrible {
55
58
*/
56
59
voidregisterOption(Option option);
57
60
61
+
/**
62
+
* Upsert a new hook delegate
63
+
*
64
+
* @param id The ID of the option to set the delegate for
65
+
* @param callback The hook callback to register for this option's delegate
0 commit comments