Fawkes API
Fawkes Development Version
|
Cause force feedback on a joystick. More...
#include "force_feedback.h"
Public Types | |
enum | Direction { DIRECTION_DOWN = 0x0000, DIRECTION_LEFT = 0x4000, DIRECTION_UP = 0x8000, DIRECTION_RIGHT = 0xC000 } |
Direction of the effect. More... | |
Public Member Functions | |
JoystickForceFeedback (const char *device_name) | |
Constructor. More... | |
~JoystickForceFeedback () | |
Destructor. More... | |
void | rumble (uint16_t strong_magnitude, uint16_t weak_magnitude, Direction direction=DIRECTION_DOWN, uint16_t length=0, uint16_t delay=0) |
Rumble the joystick. More... | |
void | stop_all () |
Stop all current effects. More... | |
void | stop_rumble () |
Stop rumbling. More... | |
bool | is_rumbling () |
Check if rumbling effect is active. More... | |
bool | can_rumble () |
Check if rumbling effect is supported. More... | |
bool | can_periodic () |
Check if periodic effect is supported. More... | |
bool | can_constant () |
Check if constant effect is supported. More... | |
bool | can_spring () |
Check if spring effect is supported. More... | |
bool | can_friction () |
Check if friction effect is supported. More... | |
bool | can_damper () |
Check if damper effect is supported. More... | |
bool | can_inertia () |
Check if inertia effect is supported. More... | |
bool | can_ramp () |
Check if ramp effect is supported. More... | |
bool | can_square () |
Check if square effect is supported. More... | |
bool | can_triangle () |
Check if triangle effect is supported. More... | |
bool | can_sine () |
Check if sine effect is supported. More... | |
bool | can_saw_up () |
Check if upward saw effect is supported. More... | |
bool | can_saw_down () |
Check if downward saw effect is supported. More... | |
bool | can_custom () |
Check if custom effect is supported. More... | |
Cause force feedback on a joystick.
An instance of this class opens an input device which belongs to the given device name. It searches all input devices to find the correct device file. Once opened, it detects the available features of the joystick and provides conventient access to it allowing for rumbling effects, for instance.
Definition at line 30 of file force_feedback.h.
Direction of the effect.
Enumerator | |
---|---|
DIRECTION_DOWN | Downward effect direction. |
DIRECTION_LEFT | Left effect direction. |
DIRECTION_UP | Upward effect direction. |
DIRECTION_RIGHT | Right effect direction. |
Definition at line 34 of file force_feedback.h.
JoystickForceFeedback::JoystickForceFeedback | ( | const char * | device_name | ) |
Constructor.
device_name | device name, note that this is not the device file, but rather the event files are tried and the device name is compared. |
Definition at line 123 of file force_feedback.cpp.
JoystickForceFeedback::~JoystickForceFeedback | ( | ) |
Destructor.
Definition at line 227 of file force_feedback.cpp.
|
inline |
Check if constant effect is supported.
Definition at line 69 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if custom effect is supported.
Definition at line 124 of file force_feedback.h.
|
inline |
Check if damper effect is supported.
Definition at line 84 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if friction effect is supported.
Definition at line 79 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if inertia effect is supported.
Definition at line 89 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if periodic effect is supported.
Definition at line 64 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if ramp effect is supported.
Definition at line 94 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if rumbling effect is supported.
Definition at line 59 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if downward saw effect is supported.
Definition at line 119 of file force_feedback.h.
|
inline |
Check if upward saw effect is supported.
Definition at line 114 of file force_feedback.h.
|
inline |
Check if sine effect is supported.
Definition at line 109 of file force_feedback.h.
|
inline |
Check if spring effect is supported.
Definition at line 74 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if square effect is supported.
Definition at line 99 of file force_feedback.h.
|
inline |
Check if triangle effect is supported.
Definition at line 104 of file force_feedback.h.
|
inline |
Check if rumbling effect is active.
Definition at line 54 of file force_feedback.h.
void JoystickForceFeedback::rumble | ( | uint16_t | strong_magnitude, |
uint16_t | weak_magnitude, | ||
Direction | direction = DIRECTION_DOWN , |
||
uint16_t | length = 0 , |
||
uint16_t | delay = 0 |
||
) |
Rumble the joystick.
This is the most basic force feedback for example in force feedback joypads. Often such joysticks provide two effect magnitudes, a strong heavier motor for larger effects, and a smaller one for vibrating effects.
strong_magnitude | magnitude to use on the larger motor |
weak_magnitude | magnitude to use on the smaller motor |
direction | direction of the effect, meaningful on joysticks (rather than joypads) |
length | length of the effect in ms |
delay | delay before the effect starts in ms |
Definition at line 246 of file force_feedback.cpp.
Referenced by JoystickActThread::MessageProcessor::process_message().
void JoystickForceFeedback::stop_all | ( | ) |
Stop all current effects.
Definition at line 291 of file force_feedback.cpp.
Referenced by JoystickActThread::MessageProcessor::process_message().
void JoystickForceFeedback::stop_rumble | ( | ) |
Stop rumbling.
Definition at line 279 of file force_feedback.cpp.
Referenced by JoystickActThread::MessageProcessor::process_message().