New version 0.6.6: app edit was improved; app nc was improved + code cleanup; app...
[ZeXOS.git] / apps / tutorial / main.c
blobf9aaca0caac840678a6652b97e637c54eb43a5ab
1 /*
2 * ZeX/OS
3 * Copyright (C) 2007 Tomas 'ZeXx86' Jedrzejek (zexx86@gmail.com)
4 * Copyright (C) 2008 Tomas 'ZeXx86' Jedrzejek (zexx86@gmail.com)
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include <stdio.h>
22 #include <string.h>
23 #include <stdlib.h>
24 #include <unistd.h>
26 #define ESC 1
28 unsigned key_pressed (int keycode)
30 int scancode = getkey ();
32 if (scancode == keycode)
33 return 1;
35 if (scancode == keycode+128)
36 return 2;
37 else
38 return 0;
41 int main (int argc, char **argv)
43 cls ();
45 setcolor (14, 1);
46 printf ("ZeX/OS\n");
48 setcolor (7, 1);
49 printf ("Tutorial by ZeXx86 ");
51 sleep (1);
53 setcolor (7, 0);
54 printf ("Heh, wow !\nPress escape for exit app\n");
56 unsigned char key = 0;
57 while (1) {
58 if (key_pressed (ESC))
59 break;
61 key = getch ();
63 if (key)
64 putch (key);
66 schedule ();
69 return 0;