is touching
This commit is contained in:
parent
f575830f56
commit
b5099d1b83
@ -6,6 +6,8 @@
|
|||||||
bool kinectRunning = false;
|
bool kinectRunning = false;
|
||||||
bool kinectStarted = false;
|
bool kinectStarted = false;
|
||||||
|
|
||||||
|
extern VRFoot VR_FOOTS[2];
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
@ -207,6 +209,8 @@ void fire_touches(drs_touch_t* events, size_t event_count) {
|
|||||||
touch_callback(&dev, game_touches.get(), (int)event_count, 0, user_data);
|
touch_callback(&dev, game_touches.get(), (int)event_count, 0, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VRFoot foot;
|
||||||
|
|
||||||
void start_kinect() {
|
void start_kinect() {
|
||||||
|
|
||||||
if (kinectRunning) return;
|
if (kinectRunning) return;
|
||||||
@ -220,58 +224,20 @@ void start_kinect() {
|
|||||||
const float touch_height = 1.f;
|
const float touch_height = 1.f;
|
||||||
|
|
||||||
// main loop
|
// main loop
|
||||||
while (kinectRunning) {
|
while (true) {
|
||||||
|
foot.id = 0;
|
||||||
|
foot.index = 0;
|
||||||
|
|
||||||
// iterate foots
|
// update event details
|
||||||
for (auto& foot : VR_FOOTS) {
|
foot.event.id = foot.id;
|
||||||
|
foot.event.x = 0;
|
||||||
|
foot.event.y = 0;
|
||||||
|
foot.event.width = 100;
|
||||||
|
foot.event.height = foot.event.width;
|
||||||
|
foot.event.type = DRS_DOWN;
|
||||||
|
|
||||||
|
fire_touches(&foot.event, 1);
|
||||||
// update event details
|
puts("touch fired!!!");
|
||||||
foot.event.id = foot.id;
|
|
||||||
foot.event.x = 0;
|
|
||||||
foot.event.y = 0;
|
|
||||||
foot.event.width = 100;
|
|
||||||
foot.event.height = foot.event.width;
|
|
||||||
foot.event.type = DRS_DOWN;
|
|
||||||
|
|
||||||
// check previous event
|
|
||||||
switch (foot.event.type) {
|
|
||||||
case DRS_UP:
|
|
||||||
|
|
||||||
// generate down event
|
|
||||||
foot.event.type = DRS_DOWN;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DRS_DOWN:
|
|
||||||
case DRS_MOVE:
|
|
||||||
|
|
||||||
// generate move event
|
|
||||||
foot.event.type = DRS_MOVE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// send event
|
|
||||||
fire_touches(&foot.event, 1);
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// foot not intersecting with plane
|
|
||||||
switch (foot.event.type) {
|
|
||||||
case DRS_DOWN:
|
|
||||||
case DRS_MOVE:
|
|
||||||
|
|
||||||
// generate up event
|
|
||||||
foot.event.type = DRS_UP;
|
|
||||||
fire_touches(&foot.event, 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DRS_UP:
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// slow down
|
// slow down
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
@ -304,4 +270,6 @@ void hookDancepad() {
|
|||||||
MH_CreateHookApi(L"TouchSDKDll.dll", "?InitTouch@TouchSDK@@QEAAHPEAU_DeviceInfo@@HP6AXU2@PEBU_TouchPointData@@HHPEBX@ZP6AX1_N3@ZPEAX@Z", TouchSDK_InitTouch, NULL);
|
MH_CreateHookApi(L"TouchSDKDll.dll", "?InitTouch@TouchSDK@@QEAAHPEAU_DeviceInfo@@HP6AXU2@PEBU_TouchPointData@@HHPEBX@ZP6AX1_N3@ZPEAX@Z", TouchSDK_InitTouch, NULL);
|
||||||
|
|
||||||
MH_EnableHook(MH_ALL_HOOKS);
|
MH_EnableHook(MH_ALL_HOOKS);
|
||||||
|
|
||||||
|
start_kinect();
|
||||||
}
|
}
|
@ -1,5 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
enum DRS_TOUCH_TYPE {
|
enum DRS_TOUCH_TYPE {
|
||||||
DRS_DOWN = 0,
|
DRS_DOWN = 0,
|
||||||
DRS_UP = 1,
|
DRS_UP = 1,
|
||||||
@ -27,11 +26,11 @@ struct VRFoot {
|
|||||||
//linalg::aliases::float3 to_world(linalg::aliases::float3 pos);
|
//linalg::aliases::float3 to_world(linalg::aliases::float3 pos);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern char DRS_TAPELED[38 * 49][3];
|
//extern char DRS_TAPELED[38 * 49][3];
|
||||||
//extern linalg::aliases::float3 VR_SCALE;
|
//extern linalg::aliases::float3 VR_SCALE;
|
||||||
//extern linalg::aliases::float3 VR_OFFSET;
|
//extern linalg::aliases::float3 VR_OFFSET;
|
||||||
extern float VR_ROTATION;
|
//extern float VR_ROTATION;
|
||||||
extern VRFoot VR_FOOTS[2];
|
//extern VRFoot VR_FOOTS[2];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user