| 826cf176 |
sago007 |
2016-03-12 10:53 |
1 |
/* |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
2 |
=========================================================================== |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
3 |
blockattack - Block Attack - Rise of the Blocks |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
4 |
Copyright (C) 2005-2016 Poul Sander |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
5 |
|
| 826cf176 |
sago007 |
2016-03-12 10:53 |
6 |
This program is free software: you can redistribute it and/or modify |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
7 |
it under the terms of the GNU General Public License as published by |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
8 |
the Free Software Foundation, either version 2 of the License, or |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
9 |
(at your option) any later version. |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
10 |
|
| 826cf176 |
sago007 |
2016-03-12 10:53 |
11 |
This program is distributed in the hope that it will be useful, |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
14 |
GNU General Public License for more details. |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
15 |
|
| 826cf176 |
sago007 |
2016-03-12 10:53 |
16 |
You should have received a copy of the GNU General Public License |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
17 |
along with this program. If not, see http://www.gnu.org/licenses/ |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
18 |
|
| 826cf176 |
sago007 |
2016-03-12 10:53 |
19 |
Source information and contacts persons can be found at |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
20 |
http://www.blockattack.net |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
21 |
=========================================================================== |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
22 |
*/ |
| 826cf176 |
sago007 |
2016-03-12 10:53 |
23 |
|
| 66e1a55c |
Poul Sander |
2018-12-23 16:25 |
24 |
#ifndef GAMECONTROLLER_H |
| e7e97e11 |
Haelwenn (lanodan) Monnier |
2023-07-20 01:27 |
25 |
#define GAMECONTROLLER_H |
| 66e1a55c |
Poul Sander |
2018-12-23 16:25 |
26 |
|
| ce5aa7d3 |
sago007 |
2016-03-13 11:44 |
27 |
#include "SDL.h" |
| bf4572f8 |
sago007 |
2018-04-10 22:25 |
28 |
#include <vector> |
| bf4572f8 |
sago007 |
2018-04-10 22:25 |
29 |
#include <string> |
| a077dceb |
sago007 |
2016-03-19 19:19 |
30 |
|
| a077dceb |
sago007 |
2016-03-19 19:19 |
31 |
const int deadZoneLimit = 20000; |
| a077dceb |
sago007 |
2016-03-19 19:19 |
32 |
|
| ce5aa7d3 |
sago007 |
2016-03-13 11:44 |
33 |
void InitGameControllers(); |
| 8c5c4f5a |
Poul Sander |
2020-06-27 13:06 |
34 |
void UnInitGameControllers(); |
| ce5aa7d3 |
sago007 |
2016-03-13 11:44 |
35 |
|
| f73e7c50 |
sago007 |
2020-07-04 08:03 |
36 |
bool isControllerDownEvent(const SDL_Event& event); |
| f73e7c50 |
sago007 |
2020-07-04 08:03 |
37 |
bool isControllerUpEvent(const SDL_Event& event); |
| f73e7c50 |
sago007 |
2020-07-04 08:03 |
38 |
bool isControllerLeftEvent(const SDL_Event& event); |
| f73e7c50 |
sago007 |
2020-07-04 08:03 |
39 |
bool isControllerRightEvent(const SDL_Event& event); |
| f73e7c50 |
sago007 |
2020-07-04 08:03 |
40 |
|
| ce5aa7d3 |
sago007 |
2016-03-13 11:44 |
41 |
bool isPlayerDownEvent(int playerNumber, const SDL_Event& event); |
| ce5aa7d3 |
sago007 |
2016-03-13 11:44 |
42 |
bool isPlayerUpEvent(int playerNumber, const SDL_Event& event); |
| ce5aa7d3 |
sago007 |
2016-03-13 11:44 |
43 |
bool isPlayerLeftEvent(int playerNumber, const SDL_Event& event); |
| ce5aa7d3 |
sago007 |
2016-03-13 11:44 |
44 |
bool isPlayerRightEvent(int playerNumber, const SDL_Event& event); |
| ce5aa7d3 |
sago007 |
2016-03-13 11:44 |
45 |
bool isPlayerSwitchEvent(int playerNumber, const SDL_Event& event); |
| 2cb68251 |
sago007 |
2016-03-14 18:01 |
46 |
bool isPlayerPushEvent(int playerNumber, const SDL_Event& event); |
| db84be96 |
sago007 |
2020-06-27 22:07 |
47 |
bool isGameControllerConnectionEvent(const SDL_Event& event); |
| a077dceb |
sago007 |
2016-03-19 19:19 |
48 |
void GameControllerSetVerbose(bool value); |
| bf4572f8 |
sago007 |
2018-04-10 22:25 |
49 |
const std::vector<std::string>& GetSupportedControllerNames(); |
| a077dceb |
sago007 |
2016-03-19 19:19 |
50 |
|
| a077dceb |
sago007 |
2016-03-19 19:19 |
51 |
/** |
| a077dceb |
sago007 |
2016-03-19 19:19 |
52 |
* Checks that the given event is in the dead zone. |
| a077dceb |
sago007 |
2016-03-19 19:19 |
53 |
* If it is in the dead zone. Then the dead zone variable for that axis will be set to true; |
| a077dceb |
sago007 |
2016-03-19 19:19 |
54 |
* Otherwise nothing is done |
| 66e1a55c |
Poul Sander |
2018-12-23 16:25 |
55 |
* @param event An SDL |
| a077dceb |
sago007 |
2016-03-19 19:19 |
56 |
*/ |
| a077dceb |
sago007 |
2016-03-19 19:19 |
57 |
void checkDeadZone(const SDL_Event& event); |
| a077dceb |
sago007 |
2016-03-19 19:19 |
58 |
|
| a077dceb |
sago007 |
2016-03-19 19:19 |
59 |
/** |
| a077dceb |
sago007 |
2016-03-19 19:19 |
60 |
* Checks that the given axis on a given gamepad was in a dead zone last time checked. |
| a077dceb |
sago007 |
2016-03-19 19:19 |
61 |
* @param id The gamepad |
| a077dceb |
sago007 |
2016-03-19 19:19 |
62 |
* @param axis The axis on the gamepad |
| a077dceb |
sago007 |
2016-03-19 19:19 |
63 |
* @return true if the axis has been in the dead zone |
| a077dceb |
sago007 |
2016-03-19 19:19 |
64 |
*/ |
| a077dceb |
sago007 |
2016-03-19 19:19 |
65 |
bool getDeadZone(SDL_JoystickID id, int axis); |
| a077dceb |
sago007 |
2016-03-19 19:19 |
66 |
|
| a077dceb |
sago007 |
2016-03-19 19:19 |
67 |
/** |
| 66e1a55c |
Poul Sander |
2018-12-23 16:25 |
68 |
* Sets dead zone status on a given axis on a given gamepad |
| a077dceb |
sago007 |
2016-03-19 19:19 |
69 |
* @param id The gamepad |
| a077dceb |
sago007 |
2016-03-19 19:19 |
70 |
* @param axis The axis on the gamepad |
| a077dceb |
sago007 |
2016-03-19 19:19 |
71 |
* @param value Value to set. Should normally be false as true will be set by checkDeadZone |
| a077dceb |
sago007 |
2016-03-19 19:19 |
72 |
*/ |
| 66e1a55c |
Poul Sander |
2018-12-23 16:25 |
73 |
void setDeadZone(SDL_JoystickID id, int axis, bool value); |
| 66e1a55c |
Poul Sander |
2018-12-23 16:25 |
74 |
|
| 66e1a55c |
Poul Sander |
2018-12-23 16:25 |
75 |
#endif //GAMECONTROLLER |
|
|
1970-01-01 00:00 |
76 |
|