diff options
| author | Tom Black <[email protected]> | 2016-10-09 15:43:13 -0400 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2016-10-09 15:43:13 -0400 |
| commit | 96bdd3584cb3818474fc01b50444dadbe5e85fbe (patch) | |
| tree | 9a1b1bc52d29aceae6959d3f5b2f042eb47983ed /ext | |
| parent | 4a4234d6e85dcda9a6b25ebf88f60693aded6177 (diff) | |
| download | ruby2d-96bdd3584cb3818474fc01b50444dadbe5e85fbe.tar.gz ruby2d-96bdd3584cb3818474fc01b50444dadbe5e85fbe.zip | |
Add `on_key_up` callback
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/ruby2d/ruby2d.c | 9 |
1 files changed, 9 insertions, 0 deletions
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 @@ -108,6 +108,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 */ static void on_key_down(const char *key) { @@ -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; |
