diff options
author | Loïc Hoguin <[email protected]> | 2014-04-03 13:57:22 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-04-03 14:37:15 +0200 |
commit | e35b49595320a4e29037b9cf3a11ff81a9984d87 (patch) | |
tree | 38fad10b173a71ae38d86cc709fb74ba5f42abc9 /c_src | |
parent | 9e38925e829fd635f6f3339770f3ebdf49ad906f (diff) | |
download | esdl2-e35b49595320a4e29037b9cf3a11ff81a9984d87.tar.gz esdl2-e35b49595320a4e29037b9cf3a11ff81a9984d87.tar.bz2 esdl2-e35b49595320a4e29037b9cf3a11ff81a9984d87.zip |
Add sdl_window:hide/1
Diffstat (limited to 'c_src')
-rw-r--r-- | c_src/esdl2.h | 1 | ||||
-rw-r--r-- | c_src/sdl_window.c | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/c_src/esdl2.h b/c_src/esdl2.h index f165056..2ffed3d 100644 --- a/c_src/esdl2.h +++ b/c_src/esdl2.h @@ -171,6 +171,7 @@ F(get_window_position, 1) \ F(get_window_size, 1) \ F(get_window_title, 1) \ + F(hide_window, 1) \ // Generated declarations for the NIF. diff --git a/c_src/sdl_window.c b/c_src/sdl_window.c index 62d6993..887d84a 100644 --- a/c_src/sdl_window.c +++ b/c_src/sdl_window.c @@ -343,3 +343,20 @@ NIF_FUNCTION(get_window_title) return nif_thread_call(env, thread_get_window_title, 1, NIF_RES_GET(Window, window_res)); } + +// hide_window + +NIF_CAST_HANDLER(thread_hide_window) +{ + SDL_HideWindow(args[0]); +} + +NIF_FUNCTION(hide_window) +{ + void* window_res; + + BADARG_IF(!enif_get_resource(env, argv[0], res_Window, &window_res)); + + return nif_thread_cast(env, thread_hide_window, 1, + NIF_RES_GET(Window, window_res)); +} |