locked
Checking touch pressing on screen.

    Question

  • Hello.

    I use a Xinput to checking press from keyboard and mouse in my game, and it works with touch screen also, but I want to know, when the pressing is a type of "touch press" not mouse press. What is the best solution to do it? Thanks for help.

    Wednesday, November 26, 2014 2:18 AM

Answers

All replies

  • What event are you listening for?  There should be a parameter passed in that describes the input type.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, November 26, 2014 1:47 PM
    Moderator
  • I use for example PointerExited and I have code:
    PointerPoint^ point = args->CurrentPoint;
    Point pointerPosition = point->Position;
    PointerPointProperties^ pointProperties = point->Properties;
    
    movePointerPosition = XMFLOAT2(pointerPosition.X, pointerPosition.Y); 
    
    mouseLeftInUse = pointProperties->IsLeftButtonPressed;
    mouseRightInUse = pointProperties->IsRightButtonPressed;

    Is there any option to check, when I touch screen, not press the button?

    • Edited by MiXenXd Wednesday, November 26, 2014 4:41 PM
    Wednesday, November 26, 2014 4:40 PM
  • Wouldn't it make more sense to use a Tapped event rather than PointerExited?
    http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.uielement.tapped.aspx

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, November 26, 2014 5:45 PM
    Moderator
  • It looks what I want, but I cannot use it because i use a a CoreWindow class and is any function event that control touch?
    Thursday, November 27, 2014 2:19 AM
  • Touch, pen, and mouse input all come through the same Pointer* events.

    You can check the PointerPoint->PointerDevice->PointerDeviceType property to see if a specific event originated from touch, pen, or mouse.

    Wednesday, December 3, 2014 12:34 AM
    Owner