Suppressing touch points in Silverlight WP7 - c#

I'm writing a hybrid XNA + Silverlight app for WP7 and I'm trying to work out the touch splitting between them. I've got this halfway worked out: I can suppress XNA TouchPanel touches when the user clicks a Silverlight button. However I have not figured out how to throw out game-only touches for Silverlight. So if you're holding a touch point in the game space (say, for moving the player around), a second touch on a button won't work. It think it's picking it up as a multi-touch gesture and only allowing the first touch point to click buttons.
My question is: how can you suppress this touch point in Silverlight processing?

The simplest way woudl be to design your app so that you don't use both types of control in an interactive way on the same page.
Or, if you must, when you detect the first XNA touch disable touch on the Silverlight controls.

Related

Mouse hover detection in .NET MAUI

I want to detect mouse hovering over visual elements in .NET MAUI ( like buttons ). I cannot find any "onmouseover"/"ismouseover" events for this. How can I implement this.
All requests for "desktop" style control of keyboard and mouse have been consolidated under Maui issue: Desktop platforms: Mouse and Keyboard.
jfversluis' comment (at that issue or a related issue) indicates that no work in this area has yet been planned.
That issue is the place to discuss the topic (express interest in, or add any specific requirements or use cases), until there is a plan.
Until then, the work-around is generally to write Windows-only code in the Windows folder of your Maui project.
Unfortunately for mouse, that only gives window or desktop-relative mouse information. AFAIK, There currently is no easy way to interact with individual UI elements while the mouse moves. (Because Maui started as Xamarin started as mobile cross-platform code; touch devices don't have concept of cursor being moved around screen.)
A crude hack is to use AbsoluteLayout: position UI elements at exact positions, so you know where they are, then write (Windows-only) code that does your own "detection".
The next level of sophistication would be to write code that traverses a window's "visual tree" of UI elements, to detect what control the mouse is over. Maui must have such logic internally somewhere, to handle touch events. Unless it relies on each platform's UI code to decide that. TBD.
For now, Maui makes sense for apps that can live with a "touch" paradigm, rather than a "desktop" paradigm.
This isn't an answer per say, but as a suggestion you could try and determine when the mouse would be over the VisualElement and then use StateTriggers to actively apply a VisualState.
MAUI Triggers

Unity C# TouchScript - Overlapped collider detection issue

I'm working on a 2D non-game application. I used TouchScript to have all the multitouch gesture but I have an issue.
In the application, i have the ability to open a lot of popup that are draggable, pinch resizable and we can rotate them.
These popup are made with UIPanel. I add a collider2D on them
The issue is that when 2 popup are overlapping, if i want to move the one on top, i will randomly hit the one on the back or the top one.
It i like the touch goes through the first collider to hit the one behind...
First answering to the comment on your question suggesting to use the UI event system:
If you just use unity's UI events, you won't get advanced gestures such as swipe, pinch, etc and will have to code it yourself.
If you need these gestures, Touchscript is working fine and is a good choice.
Now to your question: I had the same problem and solved it by putting the script "UILayer" on the camera, instead of "CameraLayer2D"

C# WinForms Multitouch

Hi I have been lurking for awhile and could not find an answer to my question. I am wondering if it is possible to use multitouch with C# and WinForms.
What I am trying to accomplish is being able to use one finger to move around and detect coordinates and with my other finger when it touches the screen to change a label to saying "You Clicked".
Currently I am using global hook to detect where the mouse is and I have a button on in the form that I am trying to press with the second touch.
This is a picture to better explain:
http://postimg.org/image/o2n49xtit/
I am hoping there is a way to do this with WinForms because I would like to create a on screen game pad that can have a joystick and buttons to press.

WPF - touch gestures - suppressed mouse click if scrolling

I have multiple videos in ScrollViewer and when I click on one of these videos It plays and I got movie on fullscreen and where I moved with scroll bar It's moving with videos. This is okay. I have implemented this by adding mouse click to media element and now I am testing this on touch screen and it's working.
But I want to differentiate between click on video and moving in that area. That user don't want to "select" video but he is just moving with area but not in scroll bar but in area with videos. For better understanding I added image:
To have WPF make difference between click and move (to have both but still calling just one). What is the best way to do this? Thanks
It is very hard to handle touch events on your own, especially when you have to handle nested controls.
I think the easiest way to solve this, is for you to use the Microsoft Surface Touch Pack
Replace your ScrollView with a SurfaceScrollView and place a transparent SurfaceButton above your MediaElements and react on the Click-event (or handle it via the a command).
This way, Microsoft does the tricky panning (scrolling) or tapping (clicking) for you. And as a nice side effect, you get things like bouncing and interia of the ScrollViewer for free.

Creating a Windows Game Overlay Application?

After playing quite a bit of Bad Company 2 over the last month, I'm getting kind of tired of Alt+Tabbing out of my game to change the song on iTunes. I've got a fairly good iTunes controller library already built for a previous project I was working on, and I'd like to create a WPF application mimicking the BC2 UI that would overlay the game when pressing a shortcut key, much the same way as the Steam Community overlay.
The only problem I foresee is getting my application to overlay BC2 when the user presses a specified shortcut key in-game. Is there a way to intercept a keypress from BC2 (or, really, any Win32 application) and use it to bring my app to the foreground?
In order to have a global keyboard shortcut, you need to use a Hook.
Here is a tutorial showing how to do Keyboard Hooks in C#.
That being said, doing the overlay may be difficult, depending on how the game is written. Many full screen games cannot (easily) have other programs run in front of them. I'd play with making sure that works correctly in your specific game first.

Categories