From 276a44441d8795cd29a215dff35ab6aefcdc6557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 21 Oct 2015 03:41:03 +0200 Subject: Add sdl_hints:add_callback/3 function This also sets up esdl2 to start accepting callbacks. The module/process esdl2_callbacks must always be running for that purpose, so esdl2 was made an OTP application instead of a simple library. Implementation of the rest of SDL_hints will follow in subsequent commits. --- src/esdl2.erl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/esdl2.erl') diff --git a/src/esdl2.erl b/src/esdl2.erl index 3e0db38..7bacb71 100644 --- a/src/esdl2.erl +++ b/src/esdl2.erl @@ -14,6 +14,9 @@ -module(esdl2). +%% internal +-export([register_callback_process/0]). + %% sdl -export([init/1]). -export([init_subsystem/1]). @@ -53,6 +56,9 @@ -export([gl_create_context/1]). -export([gl_swap_window/1]). +%% sdl_hints +-export([add_hint_callback/3]). + %% sdl_keyboard -export([is_text_input_active/0]). -export([start_text_input/0]). @@ -137,6 +143,8 @@ -export([set_window_title/2]). -export([show_window/1]). +%% internal + %% @todo We probably want to accept an env variable or somthing for the location. -on_load(on_load/0). on_load() -> @@ -149,6 +157,9 @@ on_load() -> end, erlang:load_nif(filename:join(PrivDir, atom_to_list(?MODULE)), 0). +register_callback_process() -> + erlang:nif_error({not_loaded, ?MODULE}). + %% sdl init(_) -> @@ -242,6 +253,11 @@ gl_create_context(_) -> gl_swap_window(_) -> erlang:nif_error({not_loaded, ?MODULE}). +%% sdl_hints + +add_hint_callback(_, _, _) -> + erlang:nif_error({not_loaded, ?MODULE}). + %% sdl_keyboard is_text_input_active() -> -- cgit v1.2.3