Initial support for "haptic" (force feedback) devices.
[supertux.git] / src / control / haptic_manager.hpp
1 /*
2  *  SuperTux
3  *  Copyright (C) 2010 Florian Forster <octo at verplant.org>
4  *
5  *  This program is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation, either version 3 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #ifndef CONTROL_HAPTIC_MANAGER_H
20 #define CONTROL_HAPTIC_MANAGER_H 1
21
22 #include <SDL.h>
23
24 #if SDL_VERSION_ATLEAST(1,3,0)
25 # include <SDL_haptic.h>
26 #endif
27
28 typedef enum
29 {
30   ST_HAPTIC_EFFECT_BUTTJUMP,
31   ST_HAPTIC_EFFECT_MAX
32 } haptic_effect_t;
33
34 class HapticManager
35 {
36   public:
37     HapticManager ();
38
39     void addJoystick (SDL_Joystick *j);
40     void playEffect (haptic_effect_t e);
41
42   private:
43 #if SDL_VERSION_ATLEAST(1,3,0)
44     SDL_Haptic *_device;
45     SDL_HapticEffect _effects[ST_HAPTIC_EFFECT_MAX];
46     int _effect_ids[ST_HAPTIC_EFFECT_MAX];
47 #endif
48 }; /* class HapticManager */
49
50 #endif /* CONTROL_HAPTIC_MANAGER_H */
51 /* vim: set sw=2 sts=2 et : */