equal
deleted
inserted
replaced
3 #include <Console.h> |
3 #include <Console.h> |
4 |
4 |
5 #ifdef WIN32 |
5 #ifdef WIN32 |
6 #include <conio.h> |
6 #include <conio.h> |
7 |
7 |
8 int getch () |
8 int cross_getch () |
9 { |
9 { |
10 int ch = -1; |
10 int ch = -1; |
11 |
11 |
12 while (!kbhit ()) { |
12 while (!kbhit ()) { |
13 ch =::getch (); |
13 ch = getch (); |
14 } |
14 } |
15 |
15 |
16 return ch; |
16 return ch; |
17 } |
17 } |
18 |
18 |
19 #else |
19 #else |
20 #include <termios.h> |
20 #include <termios.h> |
21 |
21 |
22 int getch () |
22 int cross_getch () |
23 { |
23 { |
24 int ch = -1, fd = 0; |
24 int ch = -1, fd = 0; |
25 struct termios neu, alt; |
25 struct termios neu, alt; |
26 |
26 |
27 fd = fileno (stdin); |
27 fd = fileno (stdin); |
35 } |
35 } |
36 #endif |
36 #endif |
37 |
37 |
38 JNIEXPORT jint JNICALL Java_Console_getch (JNIEnv * env, jclass lass) |
38 JNIEXPORT jint JNICALL Java_Console_getch (JNIEnv * env, jclass lass) |
39 { |
39 { |
40 return getch (); |
40 return cross_getch (); |
41 } |
41 } |