feat(console): add partial implementation for function OnKeyDown

This commit is contained in:
Tristan Cormier 2023-04-15 18:06:01 -04:00
parent 884e491b25
commit 475cf34a83

View File

@ -1,4 +1,5 @@
#include "console/Handlers.hpp" #include "console/Handlers.hpp"
#include "console/Console.hpp"
#include "event/Event.hpp" #include "event/Event.hpp"
#include <cstdint> #include <cstdint>
@ -15,8 +16,25 @@ int32_t OnIdle(const EVENT_DATA_IDLE* data, void* param) {
} }
int32_t OnKeyDown(const EVENT_DATA_KEY* data, void* param) { int32_t OnKeyDown(const EVENT_DATA_KEY* data, void* param) {
// TODO if (data->key == ConsoleGetHotKey() && ConsoleAccessGetEnabled()) {
// Toggle the console on/off if the console hotkey is pressed down
// and the console access is enabled for the client
ConsoleSetActive(!ConsoleGetActive());
// Reset the highlight when toggled off
if (!ConsoleGetActive()) {
// TODO ResetHighlight();
}
return 0;
}
if (EventIsKeyDown(ConsoleGetHotKey()) || !ConsoleGetActive()) {
return 1; return 1;
}
// TODO
return 0;
} }
int32_t OnKeyDownRepeat(const EVENT_DATA_KEY* data, void* param) { int32_t OnKeyDownRepeat(const EVENT_DATA_KEY* data, void* param) {