From 96bdd3584cb3818474fc01b50444dadbe5e85fbe Mon Sep 17 00:00:00 2001 From: Tom Black Date: Sun, 9 Oct 2016 15:43:13 -0400 Subject: Add `on_key_up` callback --- ext/ruby2d/ruby2d.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ext') diff --git a/ext/ruby2d/ruby2d.c b/ext/ruby2d/ruby2d.c index 784ca7c..06a35ad 100644 --- a/ext/ruby2d/ruby2d.c +++ b/ext/ruby2d/ruby2d.c @@ -107,6 +107,14 @@ static void on_key(const char *key) { } +/* + * Simple 2D `on_key_up` input callback function + */ +static void on_key_up(const char *key) { + rb_funcall(self, rb_intern("key_up_callback"), 1, rb_str_new2(key)); +} + + /* * Simple 2D `on_key_down` input callback function */ @@ -350,6 +358,7 @@ static VALUE ruby2d_show(VALUE s) { window->viewport.width = viewport_width; window->viewport.height = viewport_height; window->on_key = on_key; + window->on_key_up = on_key_up; window->on_key_down = on_key_down; window->on_controller = on_controller; -- cgit v1.2.3