我是靠谱客的博主 无心百合,这篇文章主要介绍openni+nite体感鼠标模拟4(鼠标点击模拟),现在分享给大家,希望可以做个参考。

void MouseButtonDown()
{
INPUT
Input={0};
Input.type
= INPUT_MOUSE;
Input.mi.dwFlags
= MOUSEEVENTF_LEFTDOWN;
::SendInput(1,&Input,sizeof(INPUT));
}
void MouseButtonUp()
{
INPUT
Input={0};
Input.type
= INPUT_MOUSE;
Input.mi.dwFlags
= MOUSEEVENTF_LEFTUP;
::SendInput(1,&Input,sizeof(INPUT));
}
void RightClickDown()
{
INPUT
Input={0};
// 右键按下
Input.type
= INPUT_MOUSE;
Input.mi.dwFlags
= MOUSEEVENTF_RIGHTDOWN;
::SendInput(1,&Input,sizeof(INPUT));
}
void RightClickUp()
{
INPUT
Input={0};
Input.type
= INPUT_MOUSE;
Input.mi.dwFlags
= MOUSEEVENTF_RIGHTUP;
::SendInput(1,&Input,sizeof(INPUT));
}

这部分是鼠标模拟的代码,通过函数实现鼠标左右键的点击。

然后通过判断左右手的动作去掉用这些函数,进而实现姿势模拟点击。

if (PointList.size()==4)
{
if (PointList.front().Z-PointList.back().Z>100&&PointList.front().X-PointList.back().X<100&&PointList.front().Z-PointList.back().Z<200)
{
MouseButtonDown();
MouseButtonUp();
}
else if (PointList.front().Z-PointList.back().Z<100&&PointList.front().X-PointList.back().X>100)
{
RightClickDown();
RightClickUp();
}
if (MainPointList.front().Z-MainPointList.back().Z>100&&MainPointList.front().Z-MainPointList.back().Z<200)
{
MouseButtonDown();
}
else if (MainPointList.front().Z-MainPointList.back().Z<-50)
{
MouseButtonUp();
iswhell=FALSE;
}


最后

以上就是无心百合最近收集整理的关于openni+nite体感鼠标模拟4(鼠标点击模拟)的全部内容,更多相关openni+nite体感鼠标模拟4(鼠标点击模拟)内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(136)

评论列表共有 0 条评论

立即
投稿
返回
顶部