00001 /* 00002 $Id: inputbutton_to_axis_digital.h,v 1.1 2001/03/06 15:09:11 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 00016 00017 #ifndef header_inputbutton_to_axis_digital 00018 #define header_inputbutton_to_axis_digital 00019 00020 #include "../Input/inputbutton.h" 00021 #include "../Input/inputaxis.h" 00022 00023 class CL_InputButtonToAxis_Digital : public CL_InputAxis 00024 //: Converts two CL_InputButton's into one digital CL_InputAxis. 00025 { 00026 CL_InputButton *left; 00027 CL_InputButton *right; 00028 00029 public: 00030 CL_InputButtonToAxis_Digital( 00031 CL_InputButton *_left, 00032 CL_InputButton *_right) 00033 { 00034 left = _left; 00035 right = _right; 00036 } 00037 //: Constructs a button to axis converter using the two buttons 'left' 00038 //: and 'right'. 00039 00040 virtual float get_pos() 00041 { 00042 if (left->is_pressed()) return -1; 00043 if (right->is_pressed()) return 1; 00044 return 0; 00045 } 00046 //: Returns the axis position. 00048 }; 00049 00050 #endif
1.2.6 written by Dimitri van Heesch,
© 1997-2001