本文整理汇总了C++中MouseInput类的典型用法代码示例。如果您正苦于以下问题:C++ MouseInput类的具体用法?C++ MouseInput怎么用?C++ MouseInput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MouseInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void Gui::handleMouseInput()
{
while (!mInput->isMouseQueueEmpty())
{
MouseInput mouseInput = mInput->dequeueMouseInput();
// Save the current mouse state. It will be needed if modal focus
// changes or modal mouse input focus changes.
mLastMouseX = mouseInput.getX();
mLastMouseY = mouseInput.getY();
switch (mouseInput.getType())
{
case MouseInput::PRESSED:
handleMousePressed(mouseInput);
break;
case MouseInput::RELEASED:
handleMouseReleased(mouseInput);
break;
case MouseInput::MOVED:
handleMouseMoved(mouseInput);
break;
case MouseInput::WHEEL_MOVED_DOWN:
handleMouseWheelMovedDown(mouseInput);
break;
case MouseInput::WHEEL_MOVED_UP:
handleMouseWheelMovedUp(mouseInput);
break;
default:
throw GCN_EXCEPTION("Unknown mouse input type.");
break;
}
}
}
示例2: HandleKeyboard
//-------------------------------------------------------------------------------------------------
ALVR_RESULT HandleKeyboard(UINT_PTR ch)
{
if(ch == 'E' || ch == 'e')
{
g_MouseInput.SetEmulation(!g_MouseInput.GetEmulation());
}
else if(ch == 'L' || ch == 'l')
{
g_bLateLatchRight = !g_bLateLatchRight;
}
else if(ch == 'A' || ch == 'a')
{
g_bRotate = !g_bRotate;
}
else if(ch == VK_UP)
{
ChangeDrawRepeat(true);
}
else if(ch == VK_DOWN)
{
ChangeDrawRepeat(false);
}
else
{
return ALVR_FALSE;
}
return ALVR_OK;
}
示例3:
Qt3DCore::QBackendNode *MouseInputFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
{
MouseInput *input = m_handler->mouseInputManager()->getOrCreateResource(frontend->id());
input->setFactory(factory);
input->setInputHandler(m_handler);
input->setPeer(frontend);
return input;
}
示例4: pushMotionInput
void GLUTInput::pushMotionInput(int x, int y)
{
MouseInput mouseInput;
mouseInput.setX(x);
mouseInput.setY(y);
mouseInput.setButton(MouseInput::EMPTY);
mouseInput.setType(MouseInput::MOVED);
mMouseInputQueue.push(mouseInput);
}
示例5: pushMouseWheelMovedDown
void GenericInput::pushMouseWheelMovedDown(int x, int y)
{
MouseInput mouseInput;
mouseInput.setX(x);
mouseInput.setY(y);
mouseInput.setType(MouseInput::WHEEL_MOVED_DOWN);
mMouseInputQueue.push(mouseInput);
}
示例6: pushMouseMoved
void GenericInput::pushMouseMoved(int x, int y)
{
MouseInput mouseInput;
mouseInput.setX(x);
mouseInput.setY(y);
mouseInput.setType(MouseInput::MOVED);
mMouseInputQueue.push(mouseInput);
}
示例7: pushMouseButtonReleased
void GenericInput::pushMouseButtonReleased(int x, int y, int button)
{
MouseInput mouseInput;
mouseInput.setX(x);
mouseInput.setY(y);
mouseInput.setButton(button);
mouseInput.setType(MouseInput::RELEASED);
mMouseInputQueue.push(mouseInput);
}
示例8: GetTargetApzc
void
DragBlockState::DispatchEvent(const InputData& aEvent) const
{
MouseInput mouseInput = aEvent.AsMouseInput();
if (!mouseInput.TransformToLocal(mTransformToApzc)) {
return;
}
GetTargetApzc()->HandleDragEvent(mouseInput, mDragMetrics);
}
示例9: main
int main(int argc, char ** argv) {
std::cout << "Starting Controller Mouse Emulator" << std::endl;
float mouseSpeed = 15;
float scrollSpeed = 25;
MouseInput mouseInput;
Gamepad gamepad;
int dx, dy;
int sy;
while (true) {
gamepad.update();
dx = (int)(gamepad.getLThumbX() * mouseSpeed);
dy = (int)(-gamepad.getLThumbY() * mouseSpeed);
sy = (int)(gamepad.getRThumbY() * scrollSpeed);
mouseInput.moveMouse(dx, dy);
mouseInput.scrollWheel(sy);
if (gamepad.aPressed())
mouseInput.setLeftMouseDown(true);
else if (gamepad.aReleased())
mouseInput.setLeftMouseDown(false);
if (gamepad.bPressed())
mouseInput.setRightMouseDown(true);
else if (gamepad.bReleased())
mouseInput.setRightMouseDown(false);
if (gamepad.rsPressed())
mouseInput.setMiddleMouseDown(true);
else if (gamepad.rsReleased())
mouseInput.setMiddleMouseDown(false);
if (gamepad.rbPressed() && mouseSpeed < MAX_MOUSE_SPEED) {
mouseSpeed += SPEED_INCREMENT;
std::cout << "Mouse speed: " << mouseSpeed << std::endl;
}
if (gamepad.lbPressed() && mouseSpeed > SPEED_INCREMENT) {
mouseSpeed -= SPEED_INCREMENT;
std::cout << "Mouse speed: " << mouseSpeed << std::endl;
}
gamepad.updateInput();
Sleep(15);
}
return 0;
}
示例10: ConvertMouseEvent
static void ConvertMouseEvent( wxMouseEvent& event, MouseInput& input )
{
uint32_t buttons = 0x0;
buttons |= event.LeftIsDown() ? MouseButtons::Left : 0x0;
buttons |= event.MiddleIsDown() ? MouseButtons::Middle : 0x0;
buttons |= event.RightIsDown() ? MouseButtons::Right : 0x0;
buttons |= event.Aux1IsDown() ? MouseButtons::Backward : 0x0;
buttons |= event.Aux2IsDown() ? MouseButtons::Forward : 0x0;
buttons |= event.AltDown() ? AcceleratorButtons::Alt : 0x0;
buttons |= event.ControlDown() ? AcceleratorButtons::Ctrl : 0x0;
buttons |= event.ShiftDown() ? AcceleratorButtons::Shift : 0x0;
input.SetButtons( buttons );
input.SetPosition( Point( event.GetX(), event.GetY() ) );
}
示例11: handleMouseWheelMovedUp
void Gui::handleMouseWheelMovedUp(const MouseInput& mouseInput)
{
WidgetPtr sourceWidget = GetMouseEventSource(mouseInput.getX(), mouseInput.getY());
if (mFocusHandler->GetDraggedWidget() != NULL)
{
sourceWidget = mFocusHandler->GetDraggedWidget();
}
int sourceWidgetX, sourceWidgetY;
sourceWidget->getAbsolutePosition(sourceWidgetX, sourceWidgetY);
distributeMouseEvent(sourceWidget,
MouseEvent::WHEEL_MOVED_UP,
mouseInput.getButton(),
mouseInput.getX(),
mouseInput.getY());
}
示例12: simulateMouseClick
void SDLInput::simulateMouseClick(const int x, const int y,
const MouseButton::Type button)
{
MouseInput mouseInput;
mouseInput.setX(x);
mouseInput.setY(y);
mouseInput.setReal(x, y);
mouseInput.setButton(button);
mouseInput.setType(MouseEventType::PRESSED);
mouseInput.setTimeStamp(SDL_GetTicks());
mMouseInputQueue.push(mouseInput);
mouseInput.setType(MouseEventType::RELEASED);
mouseInput.setTimeStamp(SDL_GetTicks());
mMouseInputQueue.push(mouseInput);
}
示例13: handleMousePressed
void Gui::handleMousePressed(const MouseInput& mouseInput)
{
WidgetPtr sourceWidget = GetMouseEventSource(mouseInput.getX(), mouseInput.getY());
if (mFocusHandler->GetDraggedWidget())
{
sourceWidget = mFocusHandler->GetDraggedWidget();
}
int sourceWidgetX, sourceWidgetY;
sourceWidget->getAbsolutePosition(sourceWidgetX, sourceWidgetY);
if ((mFocusHandler->GetModalFocused() != NULL
&& sourceWidget->isModalFocused())
|| mFocusHandler->GetModalFocused() == NULL)
{
sourceWidget->requestFocus();
}
if (mouseInput.getTimeStamp() - mLastMousePressTimeStamp < 250
&& mLastMousePressButton == mouseInput.getButton())
{
mClickCount++;
}
else
{
mClickCount = 1;
}
distributeMouseEvent(sourceWidget,
MouseEvent::PRESSED,
mouseInput.getButton(),
mouseInput.getX(),
mouseInput.getY());
mFocusHandler->SetLastWidgetPressed(sourceWidget);
mFocusHandler->SetDraggedWidget(sourceWidget);
mLastMouseDragButton = mouseInput.getButton();
mLastMousePressButton = mouseInput.getButton();
mLastMousePressTimeStamp = mouseInput.getTimeStamp();
}
示例14: mouseInputMotion
void mouseInputMotion(int x, int y)
{
g_MouseInput.LastLocation.X = x;
g_MouseInput.LastLocation.Y = y;
if (g_MouseInput.pCursorCallback != NULL)
g_MouseInput.pCursorCallback(g_MouseInput.LastLocation);
if (g_MouseInput.nSelectionState == SELECTION_ACTIVE)
mouseInputCallSelection();
}
示例15: handleMouseReleased
void Gui::handleMouseReleased(const MouseInput& mouseInput)
{
WidgetPtr sourceWidget = GetMouseEventSource(mouseInput.getX(), mouseInput.getY());
if (mFocusHandler->GetDraggedWidget())
{
if (sourceWidget != mFocusHandler->GetLastWidgetPressed())
{
mFocusHandler->SetLastWidgetPressed(WidgetPtr());
}
sourceWidget = mFocusHandler->GetDraggedWidget();
}
int sourceWidgetX, sourceWidgetY;
sourceWidget->getAbsolutePosition(sourceWidgetX, sourceWidgetY);
distributeMouseEvent(sourceWidget,
MouseEvent::RELEASED,
mouseInput.getButton(),
mouseInput.getX(),
mouseInput.getY());
if (mouseInput.getButton() == mLastMousePressButton
&& mFocusHandler->GetLastWidgetPressed() == sourceWidget)
{
distributeMouseEvent(sourceWidget,
MouseEvent::CLICKED,
mouseInput.getButton(),
mouseInput.getX(),
mouseInput.getY());
mFocusHandler->SetLastWidgetPressed(WidgetPtr());
}
else
{
mLastMousePressButton = 0;
mClickCount = 0;
}
if (mFocusHandler->GetDraggedWidget())
{
mFocusHandler->SetDraggedWidget(WidgetPtr());
}
}