andrew / node-xbox-controller

:video_game: [UNMAINTAINED] Interface for Xbox 360 game controller into Node.js
http://libraries.io/npm/xbox-controller
MIT License
270 stars 49 forks source link

"within" range events #10

Closed rwaldron closed 10 years ago

rwaldron commented 10 years ago

In Johnny-Five I've implemented a "within" method that looks something like:

sensor.within([low, high], function() {
  ... invoked whenever the sensor's reading is within the low/high boundary
});

If this seems useful for node-xbox-controller, I will gladly implement support

andrew commented 10 years ago

Yeah that would be great.

andrew commented 10 years ago

@divanvisagie did you ever get round to investigating using the within mixin with the xbox controller?

divanvisagie commented 10 years ago

Nope , would you like me to get around to it?

andrew commented 10 years ago

Yeah that would be awesome

divanvisagie commented 10 years ago

On it!

divanvisagie commented 10 years ago

So here would we be looking for something like this?

sensor.within('righttrigger', [low, high], function() {
  ... invoked whenever the sensor's reading is within the low/high boundary
});
andrew commented 10 years ago

I've published this as part of v0.4.3: https://github.com/andrew/node-xbox-controller/releases/tag/v0.4.3