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: mods/settings.md
+59Lines changed: 59 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -352,6 +352,64 @@ auto rgba = Mod::get()->getSettingValue<cocos2d::ccColor4B>("rgba-setting-exampl
352
352
353
353
---
354
354
355
+
### Keybind (`keybind`)
356
+
357
+

358
+
359
+
Keybind settings allow the user to pick a key or combination of keys for a specified action, such as the keybind to open a mod's menu. The default keybind can be specified as either a single keybind or an array of keybinds.
360
+
361
+
```json
362
+
"keybind-example": {
363
+
"type": "keybind",
364
+
"name": "Groovy Menu Keybind",
365
+
"default": "Ctrl+Shift+G"
366
+
}
367
+
"multiple-keybind-example": {
368
+
"type": "keybind",
369
+
"name": "Groovy Action Keybinds",
370
+
"default": ["G", "Ctrl+W"]
371
+
}
372
+
```
373
+
374
+
```cpp
375
+
auto keybinds = Mod::get()->getSettingValue<std::vector<geode::Keybind>>("keybind-example");
376
+
```
377
+
378
+
You can listen for keybinds globally via the `listenForKeybindSettingPresses` function, or locally via an event listener for `KeybindSettingPressedEventV3`.
Mods can also specify custom setting types. Unlike the old system, where custom settings where defined per-setting, under the new system you can reuse the same custom setting type for multiple settings.
@@ -841,3 +899,4 @@ Unless your custom settings are particularly complex, **it is recommended to jus
841
899
It is heavily recommended to follow the practices laid out in the [Custom Settings part of this tutorial](#custom-settings) for setting nodes, as this results in conventional, easy-to-use and easy-to-maintain UIs. However, if you do have a reason to make a setting that has unconventional UI, you can of course always hide the name label and do what you want.
0 commit comments