summaryrefslogtreecommitdiff
path: root/userspace/snake.c
blob: 7deaa6c97d6f6c5d573ce271e5c0d8da419a1731 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <stdio.h>

int main()
{
    printf("Hello I am FoolSnake 0.1\n");
    printf("setvbuf returned %i\n",setvbuf(stdin,NULL,_IONBF,0));

    fool_tune(1,0,0); // activate gaming mode

    while(1)
    {
	uint8_t x=0;


	while(!has_data_waiting())
	{
	    x++;

	    putc('\b',stdout);
	    if(x%4==0)putc('/',stdout);
	    if(x%4==1)putc('-',stdout);
	    if(x%4==2)putc('\\',stdout);
	    if(x%4==3)putc('|',stdout);
	}

	char c=fgetc(stdin);
	printf("[%c]\n",c);
	if(c=='q')break;
	
    }

    fool_tune(0,0,0); // de-activate gaming mode
}