cpp-sdl2
C++ header-only SDL2 wrapper
|
#include <haptic.hpp>
Classes | |
union | Effect |
Effect defintion. More... | |
class | InstalledEffect |
Installed effect handle. More... | |
Public Member Functions | |
SDL_Haptic * | ptr () const |
The the C pointer. More... | |
Haptic () | |
Uninitialized dummy haptic device. More... | |
Haptic (int haptic_index) | |
Open haptic device from index. More... | |
Haptic (SDL_Joystick *joystick) | |
Open haptic device from joystick pointer. More... | |
~Haptic () | |
close the haptic device automatically More... | |
Haptic (Haptic const &)=delete | |
Haptic & | operator= (Haptic const &)=delete |
Haptic (Haptic &&other) noexcept | |
move ctor More... | |
Haptic & | operator= (Haptic &&other) noexcept |
move assign opeartor More... | |
bool | valid () const |
Return true if the device is correctly opened. More... | |
unsigned int | get_capabilities () const |
Get a bitflag that describe the device capabilities. More... | |
bool | is_capable_of (int haptic_flag) const |
Check the SDL_HAPTIC_ flag agianst the device capabilities. More... | |
InstalledEffect | new_effect (Effect const &e) |
Install the effect. More... | |
effect_list::size_type | registered_effect_count () const |
Get the number of effects installed. More... | |
effect_sdlid | get_effect_sdlid (InstalledEffect const &h) const |
Get the SDL assigned ID (an integer) to the effect. More... | |
void | remove_effect (effect_sdlid e) |
Deactiave the effect. This only set the registered id in question to -1. More... | |
void | run_effect (InstalledEffect const &h, uint32_t iterations=1) const |
Run an effect, if said effect is valid. More... | |
bool | is_effect_compatible (Effect const &e) const |
Check if you can safely attemp to install the effect ont he haptic device. More... | |
Private Types | |
using | effect_sdlid = int |
Type of an installed "effect" for SDL. More... | |
using | effect_list = std::vector< effect_sdlid > |
Installed effect storage type. More... | |
Private Attributes | |
SDL_Haptic * | haptic_ = nullptr |
Pointer to C sdl haptic device. More... | |
effect_list | my_effects {} |
Installed effect storage. More... | |
Definition at line 8 of file haptic.hpp.
|
private |
Installed effect storage type.
Definition at line 17 of file haptic.hpp.
|
private |
Type of an installed "effect" for SDL.
Definition at line 14 of file haptic.hpp.
|
inline |
Uninitialized dummy haptic device.
Definition at line 128 of file haptic.hpp.
|
inline |
Open haptic device from index.
Definition at line 131 of file haptic.hpp.
|
inline |
Open haptic device from joystick pointer.
Definition at line 140 of file haptic.hpp.
|
inline |
close the haptic device automatically
Definition at line 149 of file haptic.hpp.
References sdl::Haptic::InstalledEffect::Haptic, and sdl::Haptic::InstalledEffect::operator=().
|
delete |
|
inlinenoexcept |
move ctor
Definition at line 162 of file haptic.hpp.
|
inline |
Get a bitflag that describe the device capabilities.
Definition at line 180 of file haptic.hpp.
References valid().
Referenced by is_capable_of().
|
inline |
Get the SDL assigned ID (an integer) to the effect.
Definition at line 224 of file haptic.hpp.
References sdl::Haptic::InstalledEffect::index_, and my_effects.
Referenced by run_effect(), and sdl::Haptic::InstalledEffect::~InstalledEffect().
|
inline |
Check the SDL_HAPTIC_ flag agianst the device capabilities.
Definition at line 198 of file haptic.hpp.
References get_capabilities().
Referenced by is_effect_compatible(), and new_effect().
|
inline |
Check if you can safely attemp to install the effect ont he haptic device.
Definition at line 249 of file haptic.hpp.
References is_capable_of(), and sdl::Haptic::Effect::type.
|
inline |
Install the effect.
Definition at line 205 of file haptic.hpp.
References is_capable_of(), my_effects, and sdl::Haptic::Effect::type.
|
inline |
The the C pointer.
Definition at line 24 of file haptic.hpp.
References haptic_.
Referenced by sdl::Haptic::InstalledEffect::~InstalledEffect().
|
inline |
Get the number of effects installed.
Definition at line 221 of file haptic.hpp.
References my_effects.
|
inline |
Deactiave the effect. This only set the registered id in question to -1.
Definition at line 230 of file haptic.hpp.
References my_effects.
Referenced by sdl::Haptic::InstalledEffect::~InstalledEffect().
|
inline |
Run an effect, if said effect is valid.
Definition at line 239 of file haptic.hpp.
References get_effect_sdlid().
Referenced by sdl::Haptic::InstalledEffect::run().
|
inline |
Return true if the device is correctly opened.
Definition at line 177 of file haptic.hpp.
Referenced by get_capabilities().
|
private |
Pointer to C sdl haptic device.
Definition at line 11 of file haptic.hpp.
Referenced by operator=(), and ptr().
|
private |
Installed effect storage.
Definition at line 20 of file haptic.hpp.
Referenced by get_effect_sdlid(), new_effect(), operator=(), registered_effect_count(), and remove_effect().