diff options
author | Loïc Hoguin <[email protected]> | 2014-04-03 19:50:59 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-04-03 19:50:59 +0200 |
commit | a1afe564f1b5a3e8b91e3f706fbd5d7d66a9978c (patch) | |
tree | 1b1e0e8662ab8fe8b8ad20b2ef456a0f71292483 /c_src | |
parent | 89b594e3a86da6cc6d08009bfe0fb26a18ce8365 (diff) | |
download | esdl2-a1afe564f1b5a3e8b91e3f706fbd5d7d66a9978c.tar.gz esdl2-a1afe564f1b5a3e8b91e3f706fbd5d7d66a9978c.tar.bz2 esdl2-a1afe564f1b5a3e8b91e3f706fbd5d7d66a9978c.zip |
Add sdl_window:set_pos/3
Diffstat (limited to 'c_src')
-rw-r--r-- | c_src/esdl2.h | 1 | ||||
-rw-r--r-- | c_src/sdl_window.c | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/c_src/esdl2.h b/c_src/esdl2.h index 3b69a87..c7817b2 100644 --- a/c_src/esdl2.h +++ b/c_src/esdl2.h @@ -183,6 +183,7 @@ F(set_window_icon, 2) \ F(set_window_maximum_size, 3) \ F(set_window_minimum_size, 3) \ + F(set_window_position, 3) \ // Generated declarations for the NIF. diff --git a/c_src/sdl_window.c b/c_src/sdl_window.c index 7fe4198..fea00cc 100644 --- a/c_src/sdl_window.c +++ b/c_src/sdl_window.c @@ -583,3 +583,23 @@ NIF_FUNCTION(set_window_minimum_size) return nif_thread_cast(env, thread_set_window_minimum_size, 3, NIF_RES_GET(Window, window_res), w, h); } + +// set_window_position + +NIF_CAST_HANDLER(thread_set_window_position) +{ + SDL_SetWindowPosition(args[0], (long)args[1], (long)args[2]); +} + +NIF_FUNCTION(set_window_position) +{ + void* window_res; + int x, y; + + BADARG_IF(!enif_get_resource(env, argv[0], res_Window, &window_res)); + BADARG_IF(!enif_get_int(env, argv[1], &x)); + BADARG_IF(!enif_get_int(env, argv[2], &y)); + + return nif_thread_cast(env, thread_set_window_position, 3, + NIF_RES_GET(Window, window_res), x, y); +} |