Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
7142 siemargl 1
#include 
2
#include 
3
#ifndef KOS32
4
#include 
5
#else
6
#include 
7
#endif
8
#ifndef WINDOWS
9
#include 
10
#include 
11
#include 
12
#endif
13
 
14
void randomize(void) {
15
#ifndef KOS32
16
	srand((int)time(NULL));
17
#else
18
	srand(get_tick_count());
19
#endif
20
}
21
 
22
///#ifndef WINDOWS
23
int max(int a, int b) {
24
	if (a > b) return a;
25
	return b;
26
}
27
 
28
int min(int a, int b) {
29
	if (a < b) return a;
30
	return b;
31
}
32
#ifndef WINDOWS
33
int // 
34
getch// 
35
(void) {
36
	char chbuf[1];
37
    struct termios oldstate, newstate;
38
    fflush(stdout);
39
	tcgetattr(0, &oldstate);
40
	newstate = oldstate;
41
	newstate.c_lflag &= ~ICANON;
42
	newstate.c_lflag &= ~ECHO;
43
	tcsetattr(0, TCSANOW,  &newstate);
44
	read(0, &chbuf, 1);
45
	tcsetattr(0, TCSANOW, &oldstate);
46
        return chbuf[0];
47
}
48
#endif