Hey Ryan,
The relevant snippets are attached. Looking over this code I realized old touches are not removed from the table, and that touch positions are floats (as they are in their native CGPoint representation). I think the UITouch pointer cast to int is OK, but I am not sure, IIRC this technique was gleaned from Apple example code. Finally don't forget to enable multi-touch property on your view object, you can do this through Interface Builder's inspector.
On Jul 12, 2009, at 5:00 PM, Ryan Spangler wrote:
Andrew:
Aha! I was wondering how to keep track of which touch is which, did not realize you could get the id of the object as an integer and use that as a key (I've programmed in scheme forever, but learning objective-c now). I was just passing the x and y of a single touch across, and ignoring multiple touches. Thanks! I would be curious to see the code.
James:
That sounds great. I am wondering what your strategy is for exposing an objective-c object to scheme like that, as so far I have only been able to send basic data types (int, double etc) between c and scheme. Something like keeping some reference to the c object and implementing the various methods in scheme?
In particular, I would like to make a list of x,y pairs that get sent from the c event handler to the corresponding scheme function, is that possible? I imagine there could be some way to construct scheme lists from c, but not sure how that could be done at the moment. As I say, I am still learning the ropes around here.
Thanks for the replies!
- Ryan
--- On Sun, 7/12/09, James Long longster@gmail.com wrote:
From: James Long longster@gmail.com Subject: Re: [Gambit-iphone] Touch Translation To: "Andrew Andkjar" andkjar@obtech.net Cc: "Ryan Spangler" patch_work8848@yahoo.com, "gambit-iphone@iro.umontreal.ca " gambit-iphone@iro.umontreal.ca Date: Sunday, July 12, 2009, 11:54 AM
Hey Ryan,
I have not worked much on access to Touch events yet, and you're probably looking for specific FFI code as an example. Andrew, it would be great if you could share your code!
I was thinking of exposing access to the UITouch and other event objects so that you could benefit from the normal Cocoa API. When I do this, I will share this code.
Thanks, James
On Sun, Jul 12, 2009 at 1:30 PM, Andrew Andkjarandkjar@obtech.net wrote:
In the iPhone app I'm developing I am currently traversing the set
of touch
events in Objective-C and calling into touch-<began | moved | ended> Gambit-C callbacks I've defined that take an integer touch id and
x,y
coordinates. Active touches are tracked in Scheme in a hash table
keyed on
touch id. This has been suiting my multi-touch tracking needs so
far. I'd
be happy to share some code if there's interest. 'AA On Jul 11, 2009, at 6:03 PM, Ryan Spangler
patch_work8848@yahoo.com wrote:
Hey all,
I was looking into porting the touch events into gambit, but I am
pretty new
to gambit and the c ffi specifically. The touch events are somewhat complex, taking an NSSet * and a UIEvent *. From what I can tell,
the NSSet
contains all current touch points (so if you have three fingers
down, the
NSSet contains three touch points) and the UIEvent has a history
of all the
touch points and where they have been since the first
"touchesBegan" event,
though I am not sure of the specific structure of these objects
yet. I am
wondering what is the best way to translate these into scheme data structures?
Thanks for any guidance on this, and I also noticed that James was
talking
about working on touch facilities as well. Maybe we could join
forces on
this? Or maybe you are already done?
- Ryan
Gambit-iphone mailing list Gambit-iphone@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-iphone
Gambit-iphone mailing list Gambit-iphone@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-iphone