2014-10-25 08:09:00 -04:00
|
|
|
// SuperTuxKart - a fun racing game with go-kart
|
|
|
|
//
|
2015-03-29 20:31:42 -04:00
|
|
|
// Copyright (C) 2009-2015 Marianne Gagnon
|
2014-10-25 08:09:00 -04:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 3
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
#ifndef HEADER_GAMEPAD_DEVICE_HPP
|
|
|
|
#define HEADER_GAMEPAD_DEVICE_HPP
|
|
|
|
|
|
|
|
#include "input/input_device.hpp"
|
2014-10-28 02:04:00 -04:00
|
|
|
#include "utils/cpp2011.hpp"
|
2014-10-25 08:09:00 -04:00
|
|
|
|
2017-07-30 09:03:40 -04:00
|
|
|
#include <vector>
|
2014-10-26 22:26:52 -04:00
|
|
|
class GamepadConfig;
|
2014-10-28 02:04:00 -04:00
|
|
|
|
2014-10-25 08:09:00 -04:00
|
|
|
/**
|
|
|
|
* \brief specialisation of Inputdevice for gamepad type devices
|
|
|
|
* \ingroup input
|
|
|
|
*/
|
|
|
|
class GamePadDevice : public InputDevice
|
|
|
|
{
|
2014-10-27 18:00:22 -04:00
|
|
|
void resetAxisDirection(const int axis, Input::AxisDirection direction);
|
2017-07-30 09:03:40 -04:00
|
|
|
std::vector<bool> m_button_pressed;
|
2014-10-25 08:09:00 -04:00
|
|
|
|
2017-07-30 09:03:40 -04:00
|
|
|
std::vector<Input::AxisDirection> m_prev_axis_directions;
|
2014-10-25 08:09:00 -04:00
|
|
|
|
2014-10-28 02:04:00 -04:00
|
|
|
/** Irrlicht index of this gamepad. */
|
|
|
|
int m_irr_index;
|
|
|
|
|
|
|
|
public:
|
|
|
|
GamePadDevice(const int irrIndex, const std::string &name,
|
|
|
|
const int axis_number,
|
|
|
|
const int button_count,
|
|
|
|
GamepadConfig *configuration);
|
2014-10-25 08:09:00 -04:00
|
|
|
virtual ~GamePadDevice();
|
2014-10-28 02:04:00 -04:00
|
|
|
bool isButtonPressed(const int i);
|
|
|
|
void setButtonPressed(const int i, bool isButtonPressed);
|
2014-10-25 08:09:00 -04:00
|
|
|
|
2014-10-28 02:04:00 -04:00
|
|
|
virtual bool processAndMapInput(Input::InputType type, const int id,
|
|
|
|
InputManager::InputDriverMode mode,
|
|
|
|
PlayerAction *action, int* value = NULL
|
|
|
|
) OVERRIDE;
|
2014-10-30 17:16:15 -04:00
|
|
|
int getNumberOfButtons() const;
|
2014-10-28 17:22:25 -04:00
|
|
|
bool moved(int value) const;
|
2014-10-25 08:09:00 -04:00
|
|
|
|
2014-10-28 02:04:00 -04:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
/** Returns the irrlicht index of this gamepad. */
|
|
|
|
int getIrrIndex() const { return m_irr_index; }
|
2014-10-28 17:22:25 -04:00
|
|
|
|
2014-10-28 02:04:00 -04:00
|
|
|
// ------------------------------------------------------------------------
|
2020-04-20 12:14:32 -04:00
|
|
|
void setIrrIndex(int i ) { m_irr_index = i; }
|
2021-05-21 20:12:56 -04:00
|
|
|
bool useForceFeedback() const;
|
2021-10-06 01:24:27 -04:00
|
|
|
int getAutoCenterStrength() const;
|
2014-10-28 02:04:00 -04:00
|
|
|
}; // class GamepadDevice
|
2014-10-25 08:09:00 -04:00
|
|
|
|
|
|
|
#endif
|