diff options
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 390d771..c7deb41 100644 --- a/c_src/esdl2.h +++ b/c_src/esdl2.h @@ -151,6 +151,7 @@ /* sdl_window */ \ F(create_window, 6) \ F(create_window_and_renderer, 3) \ + F(get_window_brightness, 1) \ // Generated declarations for the NIF. diff --git a/c_src/sdl_window.c b/c_src/sdl_window.c index aed5b8b..bc8221b 100644 --- a/c_src/sdl_window.c +++ b/c_src/sdl_window.c @@ -109,3 +109,20 @@ NIF_FUNCTION(create_window_and_renderer) return nif_thread_call(env, thread_create_window_and_renderer, 3, w, h, flags); } + +// get_window_brightness + +NIF_CALL_HANDLER(thread_get_window_brightness) +{ + return enif_make_double(env, SDL_GetWindowBrightness(args[0])); +} + +NIF_FUNCTION(get_window_brightness) +{ + void* window_res; + + BADARG_IF(!enif_get_resource(env, argv[0], res_Window, &window_res)); + + return nif_thread_call(env, thread_get_window_brightness, 1, + NIF_RES_GET(Window, window_res)); +} |