19#ifndef HEADER_MULTITOUCH_DEVICE_HPP
20#define HEADER_MULTITOUCH_DEVICE_HPP
26#include "input/input_device.hpp"
28#include "IEventReceiver.h"
30#define NUMBER_OF_MULTI_TOUCHES 10
32enum MultitouchButtonType
39 BUTTON_LOOK_BACKWARDS,
59 MultitouchButtonType type;
62 unsigned int event_id;
70 void (*callback)(
unsigned int, bool);
101 bool isGameRunning();
103 std::map<unsigned, std::vector<MultitouchButton*> > m_affected_linked_buttons;
107 std::array<MultitouchEvent, NUMBER_OF_MULTI_TOUCHES>
m_events;
114 InputManager::InputDriverMode mode,
120 void addButton(MultitouchButtonType type,
int x,
int y,
int width,
121 int height,
void (*callback)(
unsigned int,
bool) = NULL);
139 void updateAxisX(
float value);
140 void updateAxisY(
float value);
145 void updateController();
This is the base class for kart controller - that can be a player or a a robot.
Definition: controller.hpp:46
Definition: multitouch_device.hpp:76
bool isAccelerometerActive()
Get accelerometer state.
Definition: multitouch_device.cpp:208
MultitouchDevice()
The multitouch device constructor.
Definition: multitouch_device.cpp:35
float m_deadzone
The parameter that is used for steering button and determines dead area in a center of button.
Definition: multitouch_device.hpp:85
bool processAndMapInput(Input::InputType type, const int id, InputManager::InputDriverMode mode, PlayerAction *action, int *value=NULL)
Unused function.
Definition: multitouch_device.hpp:113
MultitouchButton * getButton(unsigned int i)
Returns pointer to the selected button.
Definition: multitouch_device.hpp:129
virtual ~MultitouchDevice()
The multitouch device destructor.
Definition: multitouch_device.cpp:51
void deactivateGyroscope()
Deativates gyroscope.
Definition: multitouch_device.cpp:229
std::vector< MultitouchButton * > m_buttons
The list of pointers to all created buttons.
Definition: multitouch_device.hpp:79
void activateGyroscope()
Activates gyroscope.
Definition: multitouch_device.cpp:216
void clearButtons()
Deletes all previously created buttons.
Definition: multitouch_device.cpp:146
bool isGyroscopeActive()
Get gyroscope state.
Definition: multitouch_device.cpp:241
void updateConfigParams()
Updates config parameters i.e.
Definition: multitouch_device.cpp:422
float getOrientation()
Returns device orientation Z angle, in radians, where 0 is landscape orientation parallel to the floo...
Definition: multitouch_device.cpp:511
void updateDeviceState(unsigned int event_id)
The function that is executed when touch event occurs.
Definition: multitouch_device.cpp:251
float getSteeringFactor(float value, float sensitivity)
Helper function that returns a steering factor for steering button.
Definition: multitouch_device.cpp:439
void activateAccelerometer()
Activates accelerometer.
Definition: multitouch_device.cpp:185
void reset()
Sets all buttons and events to default state.
Definition: multitouch_device.cpp:159
float m_sensitivity_y
A parameter in range that determines the sensitivity for y axis.
Definition: multitouch_device.hpp:91
void deactivateAccelerometer()
Deativates accelerometer.
Definition: multitouch_device.cpp:196
std::array< MultitouchEvent, NUMBER_OF_MULTI_TOUCHES > m_events
The array that contains data for all multitouch input events.
Definition: multitouch_device.hpp:107
void updateOrientationFromGyroscope(float z)
Update device orientation from the gyroscope measurements.
Definition: multitouch_device.cpp:568
void handleControls(MultitouchButton *button)
Sends proper action for player controller depending on the button type and state.
Definition: multitouch_device.cpp:609
void updateOrientationFromAccelerometer(float x, float y)
Update device orientation from the accelerometer measurements.
Definition: multitouch_device.cpp:523
unsigned int getButtonsCount()
Returns the number of created buttons.
Definition: multitouch_device.hpp:126
float m_sensitivity_x
A parameter in range that determines the sensitivity for x axis.
Definition: multitouch_device.hpp:88
void addButton(MultitouchButtonType type, int x, int y, int width, int height, void(*callback)(unsigned int, bool)=NULL)
Creates a button of specified type and position.
Definition: multitouch_device.cpp:84
unsigned int getActiveTouchesCount()
Returns a number of fingers that are currently in use.
Definition: multitouch_device.cpp:59
IrrlichtDevice * m_irrlicht_device
Pointer to the irrlicht device.
Definition: multitouch_device.hpp:97
Definition: multitouch_device.hpp:50
Declares the general types that are used by the network.