figure out holding. hold shift to touch entire pad
This commit is contained in:
parent
dbe551c9b8
commit
0cfd5bdcaa
@ -210,6 +210,7 @@ void fire_touches(drs_touch_t* events, size_t event_count) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
VRFoot foot;
|
VRFoot foot;
|
||||||
|
unsigned long counters[] = {0,0,0,0,0,0,0,0,0,0};
|
||||||
|
|
||||||
void start_kinect() {
|
void start_kinect() {
|
||||||
|
|
||||||
@ -230,16 +231,33 @@ void start_kinect() {
|
|||||||
|
|
||||||
// update event details ghosting simulator
|
// update event details ghosting simulator
|
||||||
foot.event.id = foot.id;
|
foot.event.id = foot.id;
|
||||||
foot.event.x = (rand() / (double)RAND_MAX) * (1 - 0) + 0;
|
foot.event.x = 0.5;
|
||||||
foot.event.y = (rand() / (double)RAND_MAX) * (1 - 0) + 0;
|
foot.event.y = 0.5;
|
||||||
foot.event.width = (rand() / (double)RAND_MAX) * (0.1 - 0) + 0;
|
foot.event.width = 1;
|
||||||
foot.event.height = foot.event.width;
|
foot.event.height = foot.event.width;
|
||||||
|
|
||||||
|
if (GetKeyState(VK_SHIFT) & 0x8000)
|
||||||
foot.event.type = DRS_DOWN;
|
{
|
||||||
fire_touches(&foot.event, 1);
|
counters[0] = 0; // holding down
|
||||||
foot.event.type = DRS_UP;
|
counters[1]++;
|
||||||
fire_touches(&foot.event, 1);
|
|
||||||
|
if (counters[1] == 1) {
|
||||||
|
foot.event.type = DRS_DOWN;
|
||||||
|
fire_touches(&foot.event, 1);
|
||||||
|
}
|
||||||
|
else if (counters[1] > 1) {
|
||||||
|
foot.event.type = DRS_MOVE;
|
||||||
|
fire_touches(&foot.event, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
counters[0]++; // released
|
||||||
|
counters[1] == 0;
|
||||||
|
foot.event.type = DRS_UP;
|
||||||
|
if (counters[0] == 1) fire_touches(&foot.event, 1); // send up event very shortly
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// slow down
|
// slow down
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
|
Loading…
Reference in New Issue
Block a user