TapStream: usable in place of CurrentTouch, and more

I was told a while ago that accessing CurrentTouch from inside draw() was kind of a no-no, so I made this as a small stand-alone class that can stand in for CurrentTouch.

It has a few extra capabilities too: it can easily fetch the most recent n touches for you, and objects can subscribe to it and unsubscribe to it in order to have their own touched(touch) functions called, or not, at will.

Right now it caches all touches starting from program launch, and never clears the cache, I don’t know if that might spell trouble later on.

@UberGoober looks interesting. I’ve found touches quite challenging to use in the past - here is a basic framework I’ve used in a few of my programs. Not updated in a while and I think some of the new functions have probably superseded this

@West I love it! Very useful for analyzing touch behavior.

I intended my code for a very specific purpose, because a criticism of my SimpleButtons UI system was that it relies on using CurrentTouch in its draw() functions, and I wanted to make something that would serve the same purpose but be kosher, so to speak.

Another intended use of TapStream is to help people avoid having so much code in the Main tab’s touched(touch) function; it’s probably a pipe dream that anyone will use it, but at lest it’s there to be used now.

@UberGoober great - I can see it being useful

@UberGoober I can add it as our first library project on WebRepo if you want? :slight_smile:

@Steppers i’ll leave it in your hands as to whether or not it’s worth posting. It does run on its own, though, so does that still mean it should be classified as library?

@West - tried to load touch tracker but found no icon whilst sharing and can’t find it in my project page.

Edit: Ignore that worked when I shut down and restarted Codea.