SuperTuxKart
Loading...
Searching...
No Matches
gamepad_device.hpp
1// SuperTuxKart - a fun racing game with go-kart
2//
3// Copyright (C) 2009-2015 Marianne Gagnon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 3
8// of the License, or (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, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19#ifndef HEADER_GAMEPAD_DEVICE_HPP
20#define HEADER_GAMEPAD_DEVICE_HPP
21
22#include "input/input_device.hpp"
23#include "utils/cpp2011.hpp"
24
25#include <vector>
26class GamepadConfig;
27
33{
34 void resetAxisDirection(const int axis, Input::AxisDirection direction);
35 std::vector<bool> m_button_pressed;
36
37 std::vector<Input::AxisDirection> m_prev_axis_directions;
38
41
42public:
43 GamePadDevice(const int irrIndex, const std::string &name,
44 const int axis_number,
45 const int button_count,
46 GamepadConfig *configuration);
47 virtual ~GamePadDevice();
48 bool isButtonPressed(const int i);
49 void setButtonPressed(const int i, bool isButtonPressed);
50
51 virtual bool processAndMapInput(Input::InputType type, const int id,
52 InputManager::InputDriverMode mode,
53 PlayerAction *action, int* value = NULL
54 ) OVERRIDE;
55 int getNumberOfButtons() const;
56 bool moved(int value) const;
57
58 // ------------------------------------------------------------------------
60 int getIrrIndex() const { return m_irr_index; }
61
62 // ------------------------------------------------------------------------
63 void setIrrIndex(int i ) { m_irr_index = i; }
64 bool useForceFeedback() const;
65 int getAutoCenterStrength() const;
66}; // class GamepadDevice
67
68#endif
specialisation of Inputdevice for gamepad type devices
Definition: gamepad_device.hpp:33
bool moved(int value) const
Returns if the specified value is larger than the deadzone.
Definition: gamepad_device.cpp:64
virtual bool processAndMapInput(Input::InputType type, const int id, InputManager::InputDriverMode mode, PlayerAction *action, int *value=NULL) OVERRIDE
Invoked when this device it used.
Definition: gamepad_device.cpp:142
int getNumberOfButtons() const
Returns the number of buttons of this gamepad.
Definition: gamepad_device.cpp:72
int m_irr_index
Irrlicht index of this gamepad.
Definition: gamepad_device.hpp:40
int getIrrIndex() const
Returns the irrlicht index of this gamepad.
Definition: gamepad_device.hpp:60
virtual ~GamePadDevice()
Destructor for GamePadDevice.
Definition: gamepad_device.cpp:58
specialisation of DeviceConfig for gamepad type devices
Definition: gamepad_config.hpp:43
base class for input devices
Definition: input_device.hpp:48
PlayerAction
types of input events / what actions the players can do
Definition: input.hpp:117