aboutsummaryrefslogtreecommitdiffstats
path: root/c_src/sdl_window.c
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-04-03 15:32:42 +0200
committerLoïc Hoguin <[email protected]>2014-04-03 16:50:41 +0200
commitfa5e7eca92e37289138f78ffff131d7a2cf735ec (patch)
tree7947eed5fe50f17dd24a5f1d6866e759b87927f8 /c_src/sdl_window.c
parent971a0b4ee13fef8ffd3d1cd0e1f359c75b08bb50 (diff)
downloadesdl2-fa5e7eca92e37289138f78ffff131d7a2cf735ec.tar.gz
esdl2-fa5e7eca92e37289138f78ffff131d7a2cf735ec.tar.bz2
esdl2-fa5e7eca92e37289138f78ffff131d7a2cf735ec.zip
Add sdl_window:set_bordered/2
Diffstat (limited to 'c_src/sdl_window.c')
-rw-r--r--c_src/sdl_window.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/c_src/sdl_window.c b/c_src/sdl_window.c
index 936792b..adaa9eb 100644
--- a/c_src/sdl_window.c
+++ b/c_src/sdl_window.c
@@ -428,3 +428,30 @@ NIF_FUNCTION(restore_window)
return nif_thread_cast(env, thread_restore_window, 1,
NIF_RES_GET(Window, window_res));
}
+
+// set_window_bordered
+
+NIF_CAST_HANDLER(thread_set_window_bordered)
+{
+ SDL_SetWindowBordered(args[0], (long)args[1]);
+}
+
+NIF_FUNCTION(set_window_bordered)
+{
+ void* window_res;
+ char buf[MAX_ATOM_LENGTH];
+ SDL_bool b;
+
+ BADARG_IF(!enif_get_resource(env, argv[0], res_Window, &window_res));
+ BADARG_IF(!enif_get_atom(env, argv[1], buf, MAX_ATOM_LENGTH, ERL_NIF_LATIN1));
+
+ if (!strcmp(buf, "true"))
+ b = SDL_TRUE;
+ else {
+ BADARG_IF(0 != strcmp(buf, "false"));
+ b = SDL_FALSE;
+ }
+
+ return nif_thread_cast(env, thread_set_window_bordered, 2,
+ NIF_RES_GET(Window, window_res), b);
+}