Old 10-18-2009, 08:01 PM   #1 (permalink)
MDP
Zewbie
 
Join Date: Oct 2009
Posts: 2
MDP is on a distinguished road
Exclamation Capacitive touch screens....

I'm new to the whole idea of programming buttons for the causative touch screen, yes I have google'd so don't freak out and tell me to go read the ****ing manual. I'd like to know how to do this. I'm almost done with my game, just adding a menu and the whole capacitive touch screen thing is f---ing me up.

I'm using this method to get the touch, but its tracking every change (Yes, I know the ZHD's screen is multi touch). I really can't figure this out, if someone could explain how to get around this (I don't need source code) it'd be greatly appreciated. Thank you in advanced.

Method:

Code:
IEnumerator<TouchLocation> touches = TouchPanel.GetState().GetEnumerator();
                while (touches.MoveNext())
                {
 if (
                             (touches.Current.Position.X >= 39 && touches.Current.Position.Y >= 120)
                             &&
                             (touches.Current.Position.X <= 218 && touches.Current.Position.Y <= 181)
                            )
                    {
                        // DO STUFF 
                    }
}



MDP is offline   Reply With Quote

Advertisement [Remove Advertisement]
Old 10-18-2009, 10:23 PM   #2 (permalink)
zB Programmer
Experienced Zuner
 
Join Date: Sep 2009
Posts: 117
roguemat is on a distinguished road
Default

To just react to the first finger:
TouchCollection tc = TouchPanel.GetState();
if (tc.count >0)
{
if ((tc.Location.X >= 39.... //your if statements go here
}
__________________
Visit my blog of awesomeness! Lots of little zune apps with source code for you to download!



roguemat is offline   Reply With Quote
Old 10-20-2009, 09:08 PM   #3 (permalink)
Zuner
 
Cobalthex's Avatar
 
Join Date: Sep 2009
Posts: 97
Cobalthex is on a distinguished road
Default

basically a touch collection is an array/list of TouchLocations
each TouchLocation has position(x & y on screen), state (pressed, released, etc.), pressure (how hard you're pressing), and theres also a TryGetPreviousLocation(out touchCollection) where you can get (as long as theres a previous state) the previous touch positions

just read the docs some
on TouchCollection methods/properties
and TouchLocation

Last edited by Red Sky; 10-21-2009 at 03:28 AM. Reason: double post... ffr use edit.



Cobalthex is offline   Reply With Quote
Reply

Bookmarks

Thread Tools