![]() |
MAK RTIspy API Documentation for HLA Evolved
|
00001 /******************************************************************************* 00002 * Adapted from "Beginning Linux Programming", from Wrox Press -- www.wrox.com 00003 *******************************************************************************/ 00004 /******************************************************************************* 00005 ** $RCSfile: simpleTimeKeyboard.h,v $ $Revision: 1.1 $ $State: Exp $ 00006 *******************************************************************************/ 00007 00008 // Utility to allow keyboard input without blocking 00009 00010 #ifndef MYKBHIT_H_ 00011 #define MYKBHIT_H_ 00012 00013 #ifndef WIN32 00014 #include <termios.h> 00015 #endif 00016 00017 class keyboard 00018 { 00019 public: 00020 00021 keyboard(); 00022 00023 ~keyboard(); 00024 00025 // Returns 1 if keyboard input is ready; otherwise, 0 00026 int kbhit(); 00027 00028 // Returns character from keyboard if avaialable; otherwise, 0 00029 int keybrdTick(); 00030 00031 protected: 00032 00033 // Return character from keyboard input 00034 int getkey(); 00035 00036 private: 00037 00038 #ifndef WIN32 00039 struct termios initial_settings, new_settings; 00040 int peek_character; 00041 #endif 00042 00043 }; 00044 00045 00046 #endif 00047