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