@@ -6,21 +6,20 @@ Adds support for customizing keybinds in the editor and while playing.
66
77You can use Custom Keybinds as a dependency by declaring it in your ` mod.json ` :
88
9- ``` json
9+ ``` jsonc
1010{
11- "dependencies" : [
12- {
11+ " dependencies" : {
12+ " geode.custom-keybinds " : {
1313 " id" : " geode.custom-keybinds" ,
1414 " version" : " v1.1.0" ,
1515 " importance" : " required"
16- }
16+ },
1717 // or the optional api version
18- {
19- "id" : " geode.custom-keybinds" ,
18+ " geode.custom-keybinds" : {
2019 " version" : " v1.1.0" ,
2120 " importance" : " recommended"
2221 }
23- ]
22+ }
2423}
2524```
2625
@@ -30,6 +29,8 @@ Registering can be done easily using `$execute`:
3029
3130``` cpp
3231#include < geode.custom-keybinds/include/Keybinds.hpp>
32+ // optional api version
33+ #include < geode.custom-keybinds/include/OptionalAPI.hpp>
3334
3435using namespace keybinds ;
3536
@@ -72,13 +73,15 @@ Now your bind shows up in the UI, and the user can assign their own binds to it.
7273
7374``` cpp
7475#include < geode.custom-keybinds/include/Keybinds.hpp>
76+ // optional api version
77+ #include < geode.custom-keybinds/include/OptionalAPI.hpp>
7578
7679using namespace keybinds ;
7780
7881bool MyLayer::init () {
7982 ...
8083
81- this->template addEventListener<InvokeBindFilter>([=](InvokeBindEvent* event) {
84+ this->addEventListener<InvokeBindFilter>([=](InvokeBindEvent* event) {
8285 if (event->isDown()) {
8386 // do a backflip!
8487 }
@@ -88,7 +91,7 @@ bool MyLayer::init() {
8891 }, "backflip"_spr);
8992
9093 // optional api version
91- this->template addEventListener<InvokeBindFilterV2>([=](InvokeBindEventV2* event) {
94+ this->addEventListener<InvokeBindFilterV2>([=](InvokeBindEventV2* event) {
9295 if (event->isDown()) {
9396 // do a backflip!
9497 }
@@ -109,6 +112,8 @@ You can listen for global keybinds via an `$execute` block:
109112
110113``` cpp
111114#include < geode.custom-keybinds/include/Keybinds.hpp>
115+ // optional api version
116+ #include < geode.custom-keybinds/include/OptionalAPI.hpp>
112117
113118using namespace keybinds ;
114119
0 commit comments