本文整理汇总了C++中EventCallback::ButtonPressed方法的典型用法代码示例。如果您正苦于以下问题:C++ EventCallback::ButtonPressed方法的具体用法?C++ EventCallback::ButtonPressed怎么用?C++ EventCallback::ButtonPressed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventCallback
的用法示例。
在下文中一共展示了EventCallback::ButtonPressed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InputMouseTimeout
/**
** Called each frame to handle mouse timeouts.
**
** @param callbacks Callback structure for events.
** @param ticks Denotes time-stamp of video-system
*/
void InputMouseTimeout(const EventCallback &callbacks, unsigned ticks)
{
if (MouseButtons & (1 << LastMouseButton)) {
if (ticks > StartMouseTicks + DoubleClickDelay) {
MouseState = InitialMouseState;
}
if (ticks > LastMouseTicks + HoldClickDelay) {
LastMouseTicks = ticks;
MouseButtons |= (1 << LastMouseButton) << MouseHoldShift;
callbacks.ButtonPressed(LastMouseButton | (LastMouseButton << MouseHoldShift));
}
}
}
示例2: InputMouseButtonPress
/**
** Called if any mouse button is pressed down
**
** Handles event conversion to double click, dragging, hold.
**
** FIXME: dragging is not supported.
**
** @param callbacks Callback structure for events.
** @param ticks Denotes time-stamp of video-system
** @param button Mouse button pressed.
*/
void InputMouseButtonPress(const EventCallback &callbacks,
unsigned ticks, unsigned button)
{
// Button new pressed.
if (!(MouseButtons & (1 << button))) {
MouseButtons |= (1 << button);
// Detect double click
if (MouseState == ClickedMouseState && button == LastMouseButton
&& ticks < StartMouseTicks + DoubleClickDelay) {
MouseButtons |= (1 << button) << MouseDoubleShift;
button |= button << MouseDoubleShift;
} else {
MouseState = InitialMouseState;
StartMouseTicks = ticks;
LastMouseButton = button;
}
}
LastMouseTicks = ticks;
callbacks.ButtonPressed(button);
}