MAK RTIspy API Documentation for HLA Evolved
simpleDDMKeyboard.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 * Adapted from "Beginning Linux Programming", from Wrox Press -- www.wrox.com
00003 ******************************************************************************/
00004 /******************************************************************************
00005 ** $RCSfile: simpleDDMKeyboard.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    // Special Extended Key Definitions
00022    enum
00023    {
00024 #ifdef WIN32
00025        upKey            = '\110',
00026        downKey          = '\120',
00027        leftKey          = '\113',
00028        rightKey         = '\115'
00029 #else
00030        // Fix incorrect keybindings in *nix.
00031        // we're still using the keypad.
00032        upKey            = 'A',
00033        downKey          = 'B',
00034        leftKey          = 'D',
00035        rightKey         = 'C'
00036 #endif
00037    };
00038 
00039    keyboard();
00040 
00041    ~keyboard();
00042 
00043    // Returns 1 if keyboard input is ready; otherwise, 0
00044    int kbhit();
00045 
00046    // Returns character from keyboard if avaialable; otherwise, 0
00047    int keybrdTick();
00048 
00049 protected:
00050 
00051    // Return character from keyboard input
00052    int getkey();
00053 
00054 private:
00055 
00056 #ifndef WIN32
00057    struct termios initial_settings, new_settings;
00058    int peek_character;
00059 #endif
00060 
00061 };
00062 
00063 
00064 #endif
00065 

Document ID: Generated on Thu Jun 14 14:15:04 EDT 2012 from SVN revision 116116
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)