pet-rock/everything else/kbhittext.c
2022-05-05 11:33:25 -06:00

44 lines
1.2 KiB
C

#include <stdio.h>
#include <conio.h>
//int bruh = 0;
int health = 100;
char in;
int main() {
/*while(1) {
printf("bruh");
//bruh = kbhit();
if (kbhit()) {
printf("%c",getch());
}
}*/
system("mode con: cols=64 lines=68");
while(1) {
if (kbhit()) {
in = getch();
if (in == 0 || in == 0xE0) in = getch(); //dang ol windows makes you call functions and arrows keys twice to get the input
switch(in) {
/*case 0 : //no key
break;*/
case 31 : //1
//printf("\033[1;1H1");
health = health + 10;
break;
case 32 : //2
//printf("\033[1;1H2");
health = health + 10;
break;
case 33 : //3
//printf("\033[1;1H3");
health = health + 10;
break;
default :
//printf("\a"); //bell, possibly annoying
break;
}
}
printf("\033[H%d",health);
}
}