From 3026b4860fd3a1436a59bf2d26792fbbf6b60917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 3 Apr 2014 19:13:04 +0200 Subject: Add sdl_window:set_icon/2 The surface needs to be kept around and not GC otherwise it crashes. --- src/esdl2.erl | 4 ++++ src/sdl_window.erl | 5 +++++ 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/esdl2.erl b/src/esdl2.erl index 4abc20b..e383e58 100644 --- a/src/esdl2.erl +++ b/src/esdl2.erl @@ -92,6 +92,7 @@ -export([set_window_brightness/2]). -export([set_window_fullscreen/2]). -export([set_window_grab/2]). +-export([set_window_icon/2]). %% @todo We probably want to accept an env variable or somthing for the location. -on_load(on_load/0). @@ -297,3 +298,6 @@ set_window_fullscreen(_, _) -> set_window_grab(_, _) -> erlang:nif_error({not_loaded, ?MODULE}). + +set_window_icon(_, _) -> + erlang:nif_error({not_loaded, ?MODULE}). diff --git a/src/sdl_window.erl b/src/sdl_window.erl index 0da1e57..0232fc0 100644 --- a/src/sdl_window.erl +++ b/src/sdl_window.erl @@ -35,6 +35,7 @@ -export([set_brightness/2]). -export([set_fullscreen/2]). -export([grab_input/2]). +-export([set_icon/2]). create(Title, X, Y, W, H, Flags) -> esdl2:create_window(Title, X, Y, W, H, Flags), @@ -115,3 +116,7 @@ set_fullscreen(Window, Flag) -> grab_input(Window, Grab) -> esdl2:set_window_grab(Window, Grab). + +set_icon(Window, Surface) -> + esdl2:set_window_icon(Window, Surface), + receive {'_nif_thread_ret_', Ret} -> Ret end. -- cgit v1.2.3