SLikeNet  0.1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Getche.cpp
Go to the documentation of this file.
1 /*
2  * Original work: Copyright (c) 2014, Oculus VR, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7  * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8  *
9  *
10  * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11  *
12  * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13  * license found in the license.txt file in the root directory of this source tree.
14  */
15 
16 #if defined(_WIN32)
17 #include <conio.h> /* _getche() */
18 #elif defined(__S3E__)
19 
20 #else
21 
22 #include "slikenet/Getche.h"
23 
24 char _getche()
25 {
26 
27 
28  struct termios oldt,
29  newt;
30  char ch;
31  tcgetattr( STDIN_FILENO, &oldt );
32  newt = oldt;
33  newt.c_lflag &= ~( ICANON | ECHO );
34  tcsetattr( STDIN_FILENO, TCSANOW, &newt );
35  ch = getchar();
36  tcsetattr( STDIN_FILENO, TCSANOW, &oldt );
37  return ch;
38 
39 }
40 #endif