Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

keyboard_fbdev.h

Go to the documentation of this file.
00001 /*
00002         $Id: keyboard_fbdev.h,v 1.1 2001/03/06 15:09:20 mbn Exp $
00003 
00004         ------------------------------------------------------------------------
00005         ClanLib, the platform independent game SDK.
00006 
00007         This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE
00008         version 2. See COPYING for details.
00009 
00010         For a total list of contributers see CREDITS.
00011 
00012         ------------------------------------------------------------------------
00013 */
00014 
00015 #ifndef header_keyboard_fbdev
00016 #define header_keyboard_fbdev
00017 
00018 #ifndef USE_TTY_INPUT
00019 #ifdef USE_SVGALIB
00020 #define USE_TTY_INPUT
00021 #else
00022 #ifdef USE_FBDEV
00023 #define USE_TTY_INPUT
00024 #endif
00025 #endif
00026 #endif
00027 
00028 #ifdef USE_TTY_INPUT
00029 
00030 #include "API/Display/Input/inputbutton.h"
00031 #include "API/Display/Input/keyboard.h"
00032 #include "API/Core/System/keep_alive.h"
00033 #include "Core/System/Unix/init_linux.h"
00034 
00035 #include <termios.h>
00036 
00037 class CL_InputButton_FBDevKeyboard : public CL_InputButton
00038 {
00039 public:
00040         CL_InputButton_FBDevKeyboard(int key, char *keymap);
00041         virtual bool is_pressed();
00042 
00043 private:
00044         int key;
00045         char *keymap;
00046 };
00047 
00048 class CL_FBDevKeyboard : public CL_Keyboard, CL_KeepAlive
00049 {
00050 public:
00051         CL_FBDevKeyboard();
00052         virtual ~CL_FBDevKeyboard();
00053 
00054         virtual char *get_name() const;
00055 
00056         virtual int get_num_buttons() const;
00057         virtual CL_InputButton *get_button(int button_num);
00058 
00059         virtual int get_num_axes() const;
00060         virtual CL_InputAxis *get_axis(int axis_num);
00061 
00062         virtual int get_num_hats() const;
00063         virtual CL_InputHat *get_hat(int hat_num);
00064 
00065         virtual int get_num_cursors() const;
00066         virtual CL_InputCursor *get_cursor(int cursor_num);
00067 
00068         virtual void keep_alive();
00069 
00070 private:
00071         void restore();
00072 
00073         char keymap[128];
00074         
00075         int fd;
00076         int old_mode;
00077         int old_kd;
00078         struct termios old_termios;
00079         void handle_code(char code);
00080         char translate(int kb_value);
00081         
00082         CL_InputButton_FBDevKeyboard **buttons;
00083 };
00084 
00085 #endif /* USE_TTY_INPUT */
00086 
00087 #endif

Generated at Wed Apr 4 19:54:01 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001