summaryrefslogtreecommitdiffhomepage
path: root/ext
diff options
context:
space:
mode:
authorTom Black <[email protected]>2016-10-09 16:27:13 -0400
committerTom Black <[email protected]>2016-10-09 16:27:13 -0400
commitfa8ceec20f04fcdfe14189aa415ad1b5f8c32728 (patch)
tree66ff45b6325f98df840441bda250583c1978e6c7 /ext
parent11ef2c4992ad87c6d73d4357970f8a3a64abedcf (diff)
downloadruby2d-fa8ceec20f04fcdfe14189aa415ad1b5f8c32728.tar.gz
ruby2d-fa8ceec20f04fcdfe14189aa415ad1b5f8c32728.zip
Add `on_controller` input block
Also add `which` to the controller callback
Diffstat (limited to 'ext')
-rw-r--r--ext/ruby2d/ruby2d.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/ruby2d/ruby2d.c b/ext/ruby2d/ruby2d.c
index 06a35ad..c97b739 100644
--- a/ext/ruby2d/ruby2d.c
+++ b/ext/ruby2d/ruby2d.c
@@ -127,7 +127,8 @@ static void on_key_down(const char *key) {
* Simple 2D `on_controller` input callback function
*/
static void on_controller(int which, bool is_axis, int axis, int val, bool is_btn, int btn) {
- rb_funcall(self, rb_intern("controller_callback"), 5,
+ rb_funcall(self, rb_intern("controller_callback"), 6,
+ INT2NUM(which),
is_axis ? Qtrue : Qfalse, INT2NUM(axis), INT2NUM(val),
is_btn ? Qtrue : Qfalse, INT2NUM(btn)
);