本文整理汇总了C++中EventCallback::MouseMoved方法的典型用法代码示例。如果您正苦于以下问题:C++ EventCallback::MouseMoved方法的具体用法?C++ EventCallback::MouseMoved怎么用?C++ EventCallback::MouseMoved使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventCallback
的用法示例。
在下文中一共展示了EventCallback::MouseMoved方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InputMouseMove
/**
** Called if the mouse is moved
**
** @param callbacks Callback structure for events.
** @param ticks Denotes time-stamp of video-system
** @param x X movement
** @param y Y movement
*/
void InputMouseMove(const EventCallback &callbacks,
unsigned ticks, int x, int y)
{
// Don't reset the mouse state unless we really moved
#ifdef USE_TOUCHSCREEN
const int buff = 32;
if (((x - buff) <= MouseX && MouseX <= (x + buff)) == 0
|| ((y - buff) <= MouseY && MouseY <= (y + buff)) == 0) {
MouseState = InitialMouseState;
LastMouseTicks = ticks;
}
if (MouseX != x || MouseY != y) {
MouseX = x;
MouseY = y;
}
#else
if (MouseX != x || MouseY != y) {
MouseState = InitialMouseState;
LastMouseTicks = ticks;
MouseX = x;
MouseY = y;
}
#endif
const PixelPos pos(x, y);
callbacks.MouseMoved(pos);
}
示例2: InputMouseMove
/**
** Called if the mouse is moved
**
** @param callbacks Callback structure for events.
** @param ticks Denotes time-stamp of video-system
** @param x X movement
** @param y Y movement
*/
void InputMouseMove(const EventCallback &callbacks,
unsigned ticks, int x, int y)
{
PixelPos mousePos(x, y);
// Don't reset the mouse state unless we really moved
#ifdef USE_TOUCHSCREEN
const int buff = 32;
const PixelDiff diff = LastMousePos - mousePos;
if (abs(diff.x) > buff || abs(diff.y) > buff) {
MouseState = InitialMouseState;
LastMouseTicks = ticks;
// Reset rectangle select cursor state if we moved by a lot
// - rectangle select should be a drag, not a tap
if (CursorState == CursorStateRectangle
&& (abs(diff.x) > 2 * buff || abs(diff.y) > 2 * buff)) {
CursorState = CursorStatePoint;
}
}
LastMousePos = mousePos;
#else
if (LastMousePos != mousePos) {
MouseState = InitialMouseState;
LastMouseTicks = ticks;
LastMousePos = mousePos;
}
#endif
callbacks.MouseMoved(mousePos);
}