summaryrefslogtreecommitdiffhomepage
path: root/ext
diff options
context:
space:
mode:
authorTom Black <[email protected]>2018-09-26 20:01:42 -0700
committerTom Black <[email protected]>2018-09-26 20:01:42 -0700
commit344016aeab5f24edcb30fdcf23701ba12bc226a9 (patch)
treef8fbc3cad3bd48b173b8da8c4c88cc1c5129d871 /ext
parent26129e7143a4dfc68b705feabf595660e7b2256e (diff)
downloadruby2d-344016aeab5f24edcb30fdcf23701ba12bc226a9.tar.gz
ruby2d-344016aeab5f24edcb30fdcf23701ba12bc226a9.zip
Add ability to set the window icon
Diffstat (limited to 'ext')
-rw-r--r--ext/ruby2d/ruby2d.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/ruby2d/ruby2d.c b/ext/ruby2d/ruby2d.c
index 1dcafa1..cf89990 100644
--- a/ext/ruby2d/ruby2d.c
+++ b/ext/ruby2d/ruby2d.c
@@ -965,9 +965,14 @@ static R_VAL ruby2d_window_ext_show(R_VAL self) {
int width = NUM2INT(r_iv_get(self, "@width"));
int height = NUM2INT(r_iv_get(self, "@height"));
int fps_cap = NUM2INT(r_iv_get(self, "@fps_cap"));
- int flags = 0;
+
+ // Get the window icon
+ char *icon = NULL;
+ R_VAL iv_icon = r_iv_get(self, "@icon");
+ if (r_test(iv_icon)) icon = RSTRING_PTR(iv_icon);
// Get window flags
+ int flags = 0;
if (r_test(r_iv_get(self, "@resizable"))) {
flags = flags | S2D_RESIZABLE;
}
@@ -998,6 +1003,7 @@ static R_VAL ruby2d_window_ext_show(R_VAL self) {
window->viewport.width = viewport_width;
window->viewport.height = viewport_height;
window->fps_cap = fps_cap;
+ window->icon = icon;
window->on_key = on_key;
window->on_mouse = on_mouse;
window->on_controller = on_controller;