diff options
author | Loïc Hoguin <[email protected]> | 2018-02-06 00:05:12 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-02-06 00:05:12 +0100 |
commit | 0e6c291c64e77181851b8a3255a3da8827124080 (patch) | |
tree | 825bc984cf63b24ad8437cc0bbc27760ea95dfef /c_src/sdl_surface.c | |
parent | 251a2457fe10910b357e33609a59545684294bc3 (diff) | |
download | esdl2-0e6c291c64e77181851b8a3255a3da8827124080.tar.gz esdl2-0e6c291c64e77181851b8a3255a3da8827124080.tar.bz2 esdl2-0e6c291c64e77181851b8a3255a3da8827124080.zip |
Initial work on the SDL_ttf functions
Diffstat (limited to 'c_src/sdl_surface.c')
-rw-r--r-- | c_src/sdl_surface.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/c_src/sdl_surface.c b/c_src/sdl_surface.c index 22f75ab..a915fec 100644 --- a/c_src/sdl_surface.c +++ b/c_src/sdl_surface.c @@ -20,7 +20,26 @@ void dtor_Surface(ErlNifEnv* env, void* obj) SDL_FreeSurface(NIF_RES_GET(Surface, obj)); } +// get_surface_dimensions + +NIF_FUNCTION(get_surface_dimensions) +{ + void* surface_res; + SDL_Surface* surface; + + BADARG_IF(!enif_get_resource(env, argv[0], res_Surface, &surface_res)); + surface = NIF_RES_GET(Surface, surface_res); + + return enif_make_tuple2(env, + enif_make_int(env, surface->w), + enif_make_int(env, surface->h) + ); +} + // img_load +// @todo We should accept file:filename_all() and convert to binary +// before passing it to the NIF. Then we can support UTF-8 paths. +// @todo This function probably doesn't need to be a call. NIF_CALL_HANDLER(thread_img_load) { |