Skip to content

Commit 406465d

Browse files
committed
2 parents a631b40 + 9b7bf36 commit 406465d

2 files changed

Lines changed: 20 additions & 34 deletions

File tree

README.md

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,28 +50,21 @@ Want to add your own insane stuff to this mod? You can register your very own ho
5050
```cpp
5151
using namespace horrible;
5252

53-
$on_mod(Loaded){
54-
OptionManager::get()->registerOption({
55-
"my-option"_spr,
56-
"My Very Cool Option!",
57-
"This option is so very cool!",
58-
"Cool Options",
59-
SillyTier::Medium
60-
});
53+
inline static Option const option = {
54+
"my-option"_spr,
55+
"My Very Cool Option!",
56+
"This option is so very cool!",
57+
"Cool Options",
58+
SillyTier::Medium
6159
};
62-
```
63-
```cpp
64-
using namespace horrible;
60+
HORRIBLE_REGISTER_OPTION(option);
6561

6662
class $modify(MyPlayLayer, PlayLayer) {
67-
struct Fields {
68-
bool enabled = OptionManager::get()->getOption("my-option"_spr);
69-
};
63+
HORRIBLE_DELEGATE_HOOKS(option.id);
7064

65+
// a vanilla hook
7166
void setupHasCompleted() {
72-
if (m_fields->enabled) {
73-
// do insane stuff with my option!
74-
};
67+
// do insane stuff with my option!
7568

7669
PlayLayer::setupHasCompleted();
7770
};

about.md

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,21 @@ Want to add your own insane stuff to this mod? You can <cy>register your very ow
4646
```cpp
4747
using namespace horrible;
4848

49-
$on_mod(Loaded){
50-
OptionManager::get()->registerOption({
51-
"my-option"_spr,
52-
"My Very Cool Option!",
53-
"This option is so very cool!",
54-
"Cool Options",
55-
SillyTier::Medium
56-
});
49+
inline static Option const option = {
50+
"my-option"_spr,
51+
"My Very Cool Option!",
52+
"This option is so very cool!",
53+
"Cool Options",
54+
SillyTier::Medium
5755
};
58-
```
59-
```cpp
60-
using namespace horrible;
56+
HORRIBLE_REGISTER_OPTION(option);
6157

6258
class $modify(MyPlayLayer, PlayLayer) {
63-
struct Fields {
64-
bool enabled = OptionManager::get()->getOption("my-option"_spr);
65-
};
59+
HORRIBLE_DELEGATE_HOOKS(option.id);
6660

61+
// a vanilla hook
6762
void setupHasCompleted() {
68-
if (m_fields->enabled) {
69-
// do insane stuff with my option!
70-
};
63+
// do insane stuff with my option!
7164

7265
PlayLayer::setupHasCompleted();
7366
};

0 commit comments

Comments
 (0)