00001 /* 00002 $Id: keyboard_ggi.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_ggi 00016 #define header_keyboard_ggi 00017 00018 00019 #ifdef USE_GGI 00020 00021 #include "API/Display/Input/inputbutton.h" 00022 #include "API/Display/Input/keyboard.h" 00023 #include "API/Core/System/keep_alive.h" 00024 #include "Core/System/Unix/init_linux.h" 00025 #include "Display/Display/GGI/display_ggi.h" 00026 00027 #include <ggi/ggi.h> 00028 00029 class CL_InputButton_GGIKeyboard : public CL_InputButton 00030 { 00031 public: 00032 CL_InputButton_GGIKeyboard(int key, char *keymap); 00033 bool is_pressed(); 00034 00035 private: 00036 int key; 00037 char *keymap; 00038 }; 00039 00040 class CL_GGIKeyboard : public CL_Keyboard, CL_KeepAlive 00041 { 00042 public: 00043 CL_GGIKeyboard(CL_GGI_DisplayCard* card); 00044 virtual ~CL_GGIKeyboard(); 00045 00046 virtual char *get_name() const; 00047 00048 virtual int get_num_buttons() const; 00049 virtual CL_InputButton *get_button(int button_num); 00050 00051 virtual int get_num_axes() const; 00052 virtual CL_InputAxis *get_axis(int axis_num); 00053 00054 virtual int get_num_hats() const; 00055 virtual CL_InputHat *get_hat(int hat_num); 00056 00057 virtual int get_num_cursors() const; 00058 virtual CL_InputCursor *get_cursor(int cursor_num); 00059 00060 virtual void keep_alive(); 00061 00062 private: 00063 char keymap[128]; 00064 ggi_visual_t m_vis; 00065 00066 void handle_event(gii_event* event); 00067 char translate(int kb_value); 00068 char translate_ascii(int kb_value); 00069 00070 CL_InputButton_GGIKeyboard **buttons; 00071 }; 00072 00073 #endif /* USE_GGI */ 00074 00075 #endif
1.2.6 written by Dimitri van Heesch,
© 1997-2001