123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #include <stdio.h>
- #include "../Tests.h"
- #include "core/Logger.h"
- #include "core/Terminal.h"
- #include "core/Utility.h"
- #define KEY_CASE(key) \
- case key: puts(#key); break
- void testTerminal(void) {
- enterAlternativeTerminal();
- resetCursor();
- hideCursor();
- puts("Hi there");
- LOG_WARNING("This is a test");
- IntVector2 v = getTerminalSize();
- printf("%d %d\n", v.x, v.y);
- clearTerminal();
- resetCursor();
- showCursor();
- puts("the final!!!");
- sleepMillis(500);
- enterRawTerminal();
- while(true) {
- u64 c = getRawChar();
- if(c == 'q') {
- break;
- } else if(c == 0) {
- continue;
- }
- switch(c) {
- KEY_CASE(TERMINAL_KEY_ARROW_LEFT);
- KEY_CASE(TERMINAL_KEY_ARROW_RIGHT);
- KEY_CASE(TERMINAL_KEY_ARROW_UP);
- KEY_CASE(TERMINAL_KEY_ARROW_DOWN);
- KEY_CASE(TERMINAL_KEY_ARROW_DELETE);
- default: printf("%lu\n", c); break;
- }
- }
- leaveRawTerminal();
- leaveAlternativeTerminal();
- }
|