InternalButton based on axis inputs

I remember seeing a team’s nice InternalButton implementation that would take a GenericHID (or Joystick?), an exis specification, and a threshold, and produce a couple of InternalButton objects ; the idea being that commands could be trigger off the joystick (or DPAD) position.

I thought I had it safely squirreled away, but it’s not coming up.

Has anyone else seen this? Don’t want to write something that’s already out in the wild…

Here it is in C++ http://www.chiefdelphi.com/forums/showpost.php?p=1235329&postcount=6

Here’s a not-quite-generic version in Java, but could easily be modified to be generic to your needs:

edit: looking at it again, this is such a short class that “modifying it to your needs” is basically rewriting the class, haha. I also looked at the javadoc for InternalButton, and we didn’t use this as one, but I’m pretty sure it could just extend InternalButton instead if you wanted access to setPressed().

Thanks!

and the third answer from team 2168,very similar to both the above.

comments are not quite right around the description of the constructor, but it’s also nice to use.