OpenMortal Apocalypse mirror
Sourceforge mirror
SourceForge.net Logo
      News | Info | Characters | Arenas | Screenshots | Forums | Download  
Developer: Making of | Character-HOWTO | AI Design | Submit a Character
Documentation: Main Page | Modules | Class Hierarchy | Class List | File List

Joystick.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           Joystick.h  -  description
00003                              -------------------
00004     begin                : Sat Feb 14 2004
00005     copyright            : (C) 2004 by upi
00006     email                : upi@feel
00007  ***************************************************************************/
00008 
00009 
00010 #ifndef JOYSTICK_H
00011 #define JOYSTICK_H
00012 
00013 #include "SDL.h"
00014 
00015 struct SMortalEvent;
00016 
00020 class CJoystick
00021 {
00022 public:
00023     CJoystick();
00024     ~CJoystick();
00025 
00026     int Init();
00027     bool TranslateEvent( const SDL_Event* a_poInEvent, SMortalEvent* a_poOutEvent );
00028     const char* GetJoystickName( int a_iJoystickNumber );
00029 
00030 protected:
00031 
00032     int AxisWorkaround( const SDL_JoyAxisEvent& a_roEvent );
00033 
00034     enum {
00035         mg_iMaxJoysticks = 32,
00036     };
00037 
00038     int             m_iNumJoysticks;
00039     SDL_Joystick*   m_apoJoysticks[mg_iMaxJoysticks];
00040     const char*     m_apcJoystickNames[mg_iMaxJoysticks];
00041     bool            m_abWorkaround[mg_iMaxJoysticks];
00042 
00043     int             m_aiHorizontalAxis[mg_iMaxJoysticks];
00044     int             m_aiVerticalAxis[mg_iMaxJoysticks];
00045 };
00046 
00047 
00048 extern CJoystick g_oJoystick;
00049 
00050 #endif // JOYSTICK_H