1 #ifndef __SDLX_JOYSTICK_H__
2 #define __SDLX_JOYSTICK_H__
3 
4 /* sdlx - c++ wrapper for libSDL
5  * Copyright (C) 2005-2007 Vladimir Menshakov
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11 
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21 
22 #include <string>
23 #include "sdlx.h"
24 
25 namespace sdlx {
26 class SDLXAPI Joystick {
27 public:
28 	static const int getCount();
29 	static const std::string getName(const int idx);
30 	static void sendEvents(const bool enable);
31 
32 	Joystick();
33 	Joystick(const int idx);
34 	const bool opened() const;
35 	void open(const int idx);
36 
37 	Sint16 get_axis(const int idx) const;
38 	const bool get_button(const int idx) const;
39 	const int get_hat(const int idx) const;
40 	void get_ball(const int idx, int &dx, int &dy) const;
41 
42 	const int get_axis_num() const;
43 	const int get_buttons_num() const;
44 	const int get_balls_num() const;
45 	const int get_hats_num() const;
46 
47 	void close();
48 	~Joystick();
49 private:
50 	Joystick(const Joystick &);
51 	const Joystick& operator=(const Joystick &);
52 	SDL_Joystick *_joy;
53 };
54 }
55 
56 
57 #endif
58 
59