Last active
July 6, 2019 04:06
-
-
Save adrianparvino/458214ebe52cbbae405916f97d0677ab to your computer and use it in GitHub Desktop.
This file contains hidden or 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
struct event | |
event_getevent() | |
{ | |
for (;;) | |
{ | |
errno = 0; | |
int c = getch(); | |
switch (c) | |
{ | |
case RET: | |
return (struct event) { .tag = RET }; | |
case UP: // 'A' | |
case DOWN: // 'B' | |
return (struct event) { .tag = c }; | |
break; | |
} | |
return (struct event) { .tag = CHAR, .character = c }; | |
} | |
} |
This file contains hidden or 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
enum EVENT_TAG { | |
NONE, | |
UP = 72, | |
DOWN = 80, | |
RET = '\r', | |
CHAR, | |
RESIZE | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment