mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(console): add OnChar event handler
This commit is contained in:
parent
fb6437f9ff
commit
4706cd3b15
@ -4,13 +4,26 @@
|
||||
#include "event/Event.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
void DrawHighlight();
|
||||
void ResetHighlight();
|
||||
void PasteInInputLine(const char* inputLine);
|
||||
|
||||
namespace {
|
||||
|
||||
int32_t OnChar(const EVENT_DATA_CHAR* data, void* param) {
|
||||
// TODO
|
||||
return 1;
|
||||
if (!EventIsKeyDown(ConsoleGetHotKey()) || !ConsoleAccessGetEnabled()) {
|
||||
if (!ConsoleGetActive()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
char character[2];
|
||||
character[0] = data->ch;
|
||||
character[1] = '\0';
|
||||
|
||||
PasteInInputLine(character);
|
||||
ResetHighlight();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t OnIdle(const EVENT_DATA_IDLE* data, void* param) {
|
||||
|
||||
@ -93,6 +93,10 @@ void ResetHighlight() {
|
||||
s_hRect = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
}
|
||||
|
||||
void PasteInInputLine(const char* inputLine) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void ConsoleScreenAnimate(float elapsedSec) {
|
||||
auto finalPos = ConsoleGetActive() ? std::min(1.0f - s_consoleHeight, 1.0f) : 1.0f;
|
||||
finalPos = std::max(finalPos, 0.0f);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user