mygui设置两点触摸
MyGUI支持多点触摸,可以通过以下步骤启用两点触摸:
- 在初始化MyGUI之前,设置MyGUI的输入模式为“多点触摸”:
MyGUI::InputManager::getInstance().setMultiTouchEnabled(true);
- 在窗口的鼠标事件回调函数中获取触摸点的数量和位置:
void MyWindow::onMousePressed(int _x, int _y, MyGUI::MouseButton _id)
{
int touchCount = MyGUI::InputManager::getInstance().getTouchCount();
if (touchCount == 2)
{
MyGUI::IntPoint point1 = MyGUI::InputManager::getInstance().getTouchPoint(0);
MyGUI::IntPoint point2 = MyGUI::InputManager::getInstance().getTouchPoint(1);
// 处理两点触摸事件
}
}
注意,在使用多点触摸时,需要使用MyGUI的触摸点接口(getTouchCount/getTouchPoint),而不是鼠标接口(getMousePosition)
原文地址: https://www.cveoy.top/t/topic/fIh4 著作权归作者所有。请勿转载和采集!