From 1055efcc343f436b2309cf213856d1205bec0387 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Fri, 7 Mar 2014 11:02:24 -0500 Subject: [PATCH] Added some public RWops entry points. --- src/SDL2.cs | 10 +++++++++- src/SDL2_image.cs | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/SDL2.cs b/src/SDL2.cs index c4657e7..f327842 100644 --- a/src/SDL2.cs +++ b/src/SDL2.cs @@ -64,7 +64,7 @@ namespace SDL2 #region SDL_rwops.h - /* Note about SDL2# and RWops: + /* Note about SDL2# and Internal RWops: * These functions are currently not supported for public use. * They are only meant to be used internally in functions marked with * the phrase "THIS IS AN RWops FUNCTION!" @@ -84,6 +84,14 @@ namespace SDL2 string mode ); + /* These are the public RWops functions. They should be used by + * functions marked with the phrase "THIS IS A PUBLIC RWops FUNCTION!" + */ + + /* IntPtr refers to an SDL_RWops */ + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr SDL_RWFromMem(byte[] mem, int size); + #endregion #region SDL_main.h diff --git a/src/SDL2_image.cs b/src/SDL2_image.cs index 90d09af..13308b4 100644 --- a/src/SDL2_image.cs +++ b/src/SDL2_image.cs @@ -94,6 +94,14 @@ namespace SDL2 string file ); + /* src refers to an SDL_RWops*, IntPtr to an SDL_Surface* */ + /* THIS IS A PUBLIC RWops FUNCTION! */ + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr IMG_Load_RW( + IntPtr src, + int freesrc + ); + /* IntPtr refers to an SDL_Texture*, renderer to an SDL_Renderer* */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr IMG_LoadTexture( @@ -120,6 +128,15 @@ namespace SDL2 string file ); + /* surface refers to an SDL_Surface*, dst to an SDL_RWops* */ + /* THIS IS A PUBLIC RWops FUNCTION! */ + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern int IMG_SavePNG_RW( + IntPtr surface, + IntPtr dst, + int freedst + ); + #endregion } }