-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5e8e4b
commit 281d794
Showing
19 changed files
with
439 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include "Client.h" | ||
|
||
Client* Client::get() | ||
{ | ||
return instance; | ||
} | ||
|
||
bool Client::handleKeybinds(enumKeyCodes key, bool isDown, bool isRepeatedKey) | ||
{ | ||
if (!isDown || key == enumKeyCodes::KEY_Unknown) | ||
return false; | ||
|
||
bool shouldPropogate = true; | ||
|
||
for (auto window : windows) | ||
{ | ||
for (auto module : window->modules) | ||
{ | ||
if (isRepeatedKey ? module->keybind.canRepeat : true) | ||
{ | ||
bool shouldSend = true; | ||
|
||
if (module->keybind.key == enumKeyCodes::KEY_Unknown) | ||
shouldSend = false; | ||
|
||
if (module->keybind.shift && !CCKeyboardDispatcher::get()->getShiftKeyPressed()) | ||
shouldSend = false; | ||
|
||
if (module->keybind.control && !CCKeyboardDispatcher::get()->getControlKeyPressed()) | ||
shouldSend = false; | ||
|
||
if (module->keybind.alt && !CCKeyboardDispatcher::get()->getAltKeyPressed()) | ||
shouldSend = false; | ||
|
||
if (module->keybind.command && !CCKeyboardDispatcher::get()->getCommandKeyPressed()) | ||
shouldSend = false; | ||
|
||
if (shouldSend) | ||
{ | ||
module->onToggleAndroid(nullptr); | ||
|
||
log::info("toggled: {}", module->id); | ||
|
||
if (!shouldPropogate) | ||
return true; | ||
} | ||
} | ||
} | ||
} | ||
|
||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "KeyStruct.hpp" | ||
|
||
using namespace geode::prelude; | ||
|
||
KeyStruct KeyStruct::loadFromModule(std::string id) | ||
{ | ||
KeyStruct key; | ||
|
||
key.key = as<enumKeyCodes>(Mod::get()->getSavedValue<int>(fmt::format("{}_bind-key", id), -1)); | ||
key.shift = Mod::get()->getSavedValue<bool>(fmt::format("{}_bind-shift", id), key.shift); | ||
key.alt = Mod::get()->getSavedValue<bool>(fmt::format("{}_bind-alt", id), key.alt); | ||
key.canRepeat = Mod::get()->getSavedValue<bool>(fmt::format("{}_bind-can-repeat", id), key.canRepeat); | ||
key.command = Mod::get()->getSavedValue<bool>(fmt::format("{}_bind-cmd", id), key.command); | ||
key.control = Mod::get()->getSavedValue<bool>(fmt::format("{}_bind-ctrl", id), key.control); | ||
|
||
return key; | ||
} | ||
|
||
void KeyStruct::saveToModule(std::string id) | ||
{ | ||
Mod::get()->setSavedValue<int >(fmt::format("{}_bind-key" , id), as<int>(key)); | ||
Mod::get()->setSavedValue<bool>(fmt::format("{}_bind-shift" , id), shift); | ||
Mod::get()->setSavedValue<bool>(fmt::format("{}_bind-alt" , id), alt); | ||
Mod::get()->setSavedValue<bool>(fmt::format("{}_bind-can-repeat", id), canRepeat); | ||
Mod::get()->setSavedValue<bool>(fmt::format("{}_bind-cmd" , id), command); | ||
Mod::get()->setSavedValue<bool>(fmt::format("{}_bind-ctrl" , id), control); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
|
||
#include <Geode/Geode.hpp> | ||
|
||
struct KeyStruct | ||
{ | ||
public: | ||
// Modifiers | ||
bool control; | ||
bool alt; | ||
bool shift; | ||
bool command; | ||
|
||
cocos2d::enumKeyCodes key = cocos2d::enumKeyCodes::KEY_Unknown; | ||
bool canRepeat = true; | ||
|
||
static KeyStruct loadFromModule(std::string id); | ||
void saveToModule(std::string id); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.