From 2377195ecc538b8ba824b4c740192822f4f47e10 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Tue, 9 Apr 2013 12:55:01 -0400 Subject: [PATCH] SDL_Log[Get|Set]OutputFunction --- src/SDL2.cs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/SDL2.cs b/src/SDL2.cs index 9be59af..445cad8 100644 --- a/src/SDL2.cs +++ b/src/SDL2.cs @@ -250,6 +250,13 @@ namespace SDL2 SDL_NUM_LOG_PRIORITIES } + public delegate void SDL_LogOutputFunction( + IntPtr userdata, // void* + int category, + SDL_LogPriority priority, + IntPtr message // const char* + ); + [DllImport(nativeLibName)] public static extern void SDL_Log( [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] @@ -342,8 +349,19 @@ namespace SDL2 [DllImport(nativeLibName)] public static extern void SDL_LogResetPriorities(); - // TODO: SDL_LogGetOutputFunction - // TODO: SDL_LogSetOutputFunction + /* userdata refers to a void* */ + [DllImport(nativeLibName)] + public static extern void SDL_LogGetOutputFunction( + ref SDL_LogOutputFunction callback, + ref IntPtr userdata + ); + + /* userdata refers to a void* */ + [DllImport(nativeLibName)] + public static extern void SDL_LogSetOutputFunction( + SDL_LogOutputFunction callback, + IntPtr userdata + ); #endregion