Skip to content

Commit 718a2a2

Browse files
committed
Make it a keybind setting (and bump to v4)
1 parent 492429c commit 718a2a2

2 files changed

Lines changed: 18 additions & 14 deletions

File tree

mod.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"geode": "5.0.0-beta.1",
2+
"geode": "5.0.0-beta.4",
33
"version": "v1.13.0",
44
"gd": {
55
"win": "2.2081",
@@ -25,6 +25,17 @@
2525
"name": "Use GD window",
2626
"description": "Determines if the DevTools should use a custom GD window or not. Required to disable for some exotic configurations (MacOS Wine).",
2727
"default": true
28+
},
29+
"open-bind": {
30+
"type": "keybind",
31+
"name": "DevTools Keybind",
32+
"descriptions": "The keybind to open DevTools",
33+
"default": {
34+
"win": "F11",
35+
"mac": ["F10", "F11"],
36+
"android": "F11",
37+
"ios": "F11"
38+
}
2839
}
2940
},
3041
"resources": {

src/main.cpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,17 @@ class $modify(CCNode) {
2020
}
2121
};
2222

23-
// todo: use shortcuts api once Geode has those
24-
#ifndef GEODE_IS_IOS
25-
class $modify(CCKeyboardDispatcher) {
26-
bool dispatchKeyboardMSG(enumKeyCodes key, bool down, bool arr, double timestamp) {
27-
if (down && (key == KEY_F11 GEODE_MACOS(|| key == KEY_F10))) {
28-
DevTools::get()->toggle();
29-
return true;
30-
}
31-
return CCKeyboardDispatcher::dispatchKeyboardMSG(key, down, arr, timestamp);
32-
}
33-
};
34-
#endif
35-
3623
#include <Geode/loader/GameEvent.hpp>
3724
$execute {
3825
GameEvent(GameEventType::Loaded).listen([] {
3926
if (DevTools::get()->isButtonEnabled()) DevTools::get()->setupDragButton();
4027
}).leak();
28+
29+
listenForKeybindSettingPresses("open-bind", [](Keybind const& keybind, bool down, bool repeat, double timestamp) {
30+
if (down && !repeat) {
31+
DevTools::get()->toggle();
32+
}
33+
});
4134
}
4235

4336
#include <Geode/modify/CCScene.hpp>

0 commit comments

Comments
 (0)