kodi
Xbox360Controller.h
1 /*
2  * Copyright (C) 2009-2013 Team XBMC
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #pragma once
20 
21 #include <windows.h>
22 #include <XInput.h> // Defines XBOX controller API
23 #pragma comment(lib, "XInput.lib") // Library containing necessary 360
24  // functions
25 
27 {
28 private:
29  XINPUT_STATE state;
30  int num;
31  bool button_down[14];
32  bool button_pressed[14];
33  bool button_released[14];
34 
35  XINPUT_STATE getState();
36  void updateButton(int num, int button);
37 public:
38  Xbox360Controller(int num);
39  void updateState();
40  bool isConnected();
41  bool buttonPressed(int num);
42  bool buttonReleased(int num);
43  bool thumbMoved(int num);
44  SHORT getThumb(int num);
45  bool triggerMoved(int num);
46  BYTE getTrigger(int num);
47 };
Definition: Xbox360Controller.h:26