VirtualHand consists of group of fingers (1-5) and a palm location.
More...
#include <MultiWidgets/VirtualInput.hpp>
VirtualHand consists of group of fingers (1-5) and a palm location.
It always owns the fingers it has. Fingers can't be shared among the hands Only way to get access to the fingers is through the virtual hand that owns it (except simple API of VirtualInput (VirtualInput::fingerUp, VirtualInput::updateFinger and VirtualInput::fingerUp)).
| MultiWidgets::VirtualHand::VirtualHand |
( |
Nimble::Vector2f |
location, |
|
|
int |
fingers |
|
) |
| |
Creates a hand with given number of fingers (valid range from 1 to 5).
Places the fingers on the circle that has center at the location of hand palm and radius of 100. Generates the id automatically.
- Parameters
-
| location | Location of the hand palm. |
| fingers | Number of fingers to generate. |
| MultiWidgets::VirtualHand::VirtualHand |
( |
Nimble::Vector2f |
location, |
|
|
int |
fingers, |
|
|
long |
handId |
|
) |
| |
Adds finger to the hand and places the finger to the given location.
The finger that was added last will be having the largest index (used with removeFinger- and finger-functions) among the fingers.
- Parameters
-
| location | Location for the finger. |
Access to finger.
- Parameters
-
| index | Index number of the finger |
- Returns
- Reference to finger
Creates the hand with single finger.
The finger of the hand is placed to the given location.
- Parameters
-
| fingerLocation | Location of the finger |
- Returns
- Shared pointer to the created hand
- Examples:
- VirtualInputExample.cpp.
| int MultiWidgets::VirtualHand::fingers |
( |
| ) |
const |
Number of fingers in hand.
- Returns
- Number of fingers owned by hand
| virtual void MultiWidgets::VirtualHand::injectToSamples |
( |
MultiTouch::Screen & |
touchScreen, |
|
|
int |
sampleBegin, |
|
|
int |
sampleEnd |
|
) |
| |
|
virtual |
Injects the hand and its fingers to the samples of given touchscreen.
- Note
- If this function is called, there is no separate need to call VirtualFinger::injectToSamples of the fingers that are owned by this hand.
- Parameters
-
| touchScreen | The synthesized input is injected to this touchscreen's samples |
| sampleBegin | Index of the first sample to handle |
| sampleEnd | Index of the last sample (inclusive) to handle |
- See Also
- VirtualObject::injectToSamples
Implements MultiWidgets::VirtualObject.
Moves the fingers and the palm by given vector.
- Parameters
-
| v | Vector to apply to the locations of fingers and palm |
Reimplemented from MultiWidgets::VirtualObject.
| void MultiWidgets::VirtualHand::removeFinger |
( |
int |
index | ) |
|
Removes the finger from the hand.
- Parameters
-
| index | Index of the finger that is removed |
- See Also
- finger
| int MultiWidgets::VirtualHand::searchFinger |
( |
long |
id | ) |
const |
Tries to find finger from the hand with given id.
- Parameters
-
| id | Id of the searched finger. |
- Returns
- Index of the finger. -1 is returned if finger was not found.
| void MultiWidgets::VirtualHand::setLocationAboutFinger |
( |
size_t |
fingerIdx, |
|
|
Nimble::Vector2f |
location |
|
) |
| |
Sets the location for the whole hand using some of its fingers as a reference point.
The reference point finger is moved to the given location and the rest of the hand (palm and other fingers) are moved to locations so that the form of the whole hand stays the same.
- Parameters
-
| fingerIdx | Index of the finger that is used as a reference point |
| location | Location for the reference point finger |