MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
simpleDDMKeyboard.h
Go to the documentation of this file.
1 /******************************************************************************
2 * Adapted from "Beginning Linux Programming", from Wrox Press -- www.wrox.com
3 ******************************************************************************/
4 /******************************************************************************
5 ** $RCSfile: simpleDDMKeyboard.h,v $ $Revision: 1.1 $ $State: Exp $
6 ******************************************************************************/
7 
8 // Utility to allow keyboard input without blocking
9 
10 #ifndef MYKBHIT_H_
11 #define MYKBHIT_H_
12 
13 #ifndef WIN32
14 #include <termios.h>
15 #endif
16 
17 class keyboard
18 {
19 public:
20 
21  // Special Extended Key Definitions
22  enum
23  {
24 #ifdef WIN32
25  upKey = '\110',
26  downKey = '\120',
27  leftKey = '\113',
28  rightKey = '\115'
29 #else
30  // Fix incorrect keybindings in *nix.
31  // we're still using the keypad.
32  upKey = 'A',
33  downKey = 'B',
34  leftKey = 'D',
35  rightKey = 'C'
36 #endif
37  };
38 
39  keyboard();
40 
41  ~keyboard();
42 
43  // Returns 1 if keyboard input is ready; otherwise, 0
44  int kbhit();
45 
46  // Returns character from keyboard if avaialable; otherwise, 0
47  int keybrdTick();
48 
49 protected:
50 
51  // Return character from keyboard input
52  int getkey();
53 
54 private:
55 
56 #ifndef WIN32
57  struct termios initial_settings, new_settings;
58  int peek_character;
59 #endif
60 
61 };
62 
63 
64 #endif
65 
Definition: simpleDDMKeyboard.h:32
int getkey()
Definition: simpleDDMKeyboard.h:35
int kbhit()
Definition: rtiSimpleKeyboard.h:14
struct termios initial_settings new_settings
Definition: rtiSimpleKeyboard.h:36
int peek_character
Definition: rtiSimpleKeyboard.h:37
int keybrdTick()
Definition: simpleDDMKeyboard.h:34
Definition: simpleDDMKeyboard.h:33

Document ID: Generated on Mon Sep 7 15:40:32 EDT 2020 from SVN revision 217499
Copyright © 2005-2020 MAK Technologies Inc. All Rights Reserved (www.mak.com)