From 8846dbcaa47bf4c8ec504e515e78957bc0c7205c Mon Sep 17 00:00:00 2001 From: babelshift Date: Sat, 1 Mar 2014 22:41:26 -0500 Subject: [PATCH 1/9] Added suo files to ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7ee19fb..0a37a27 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ bin/ obj/ *.userprefs +*.suo \ No newline at end of file From a74f245fe64045e250d361cbb2c13ca7f7bcaf6e Mon Sep 17 00:00:00 2001 From: babelshift Date: Sat, 1 Mar 2014 22:46:13 -0500 Subject: [PATCH 2/9] From libsdl 2.0.2 RC1 notes - Added a hint SDL_HINT_MOUSE_RELATIVE_MODE_WARP to specify whether mouse relative mode should be emulated using mouse warping. --- src/SDL2.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SDL2.cs b/src/SDL2.cs index c4657e7..5494366 100644 --- a/src/SDL2.cs +++ b/src/SDL2.cs @@ -225,6 +225,8 @@ namespace SDL2 "SDL_VIDEO_HIGHDPI_DISABLED"; public const string SDL_HINT_RENDER_SCALE_QUALITY = "SDL_HINT_RENDER_SCALE_QUALITY"; + public const string SDL_HINT_MOUSE_RELATIVE_MODE_WARP = + "SDL_HINT_MOUSE_RELATIVE_MODE_WARP"; public enum SDL_HintPriority { From 60454e88787c656a7c39c348f5567b9400251b51 Mon Sep 17 00:00:00 2001 From: babelshift Date: Sat, 1 Mar 2014 22:51:30 -0500 Subject: [PATCH 3/9] From libsdl 2.0.2 RC1 notes - The screensaver is now disabled by default, and there is a hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER that can change that behavior. --- src/SDL2.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SDL2.cs b/src/SDL2.cs index 5494366..36d6e5d 100644 --- a/src/SDL2.cs +++ b/src/SDL2.cs @@ -227,6 +227,8 @@ namespace SDL2 "SDL_HINT_RENDER_SCALE_QUALITY"; public const string SDL_HINT_MOUSE_RELATIVE_MODE_WARP = "SDL_HINT_MOUSE_RELATIVE_MODE_WARP"; + public const string SDL_HINT_VIDEO_ALLOW_SCREENSAVER = + "SDL_HINT_VIDEO_ALLOW_SCREENSAVER"; public enum SDL_HintPriority { From 2e719b0650863ded945493a951698b6cda64d161 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Sun, 2 Mar 2014 07:36:30 -0500 Subject: [PATCH 4/9] SDL 2.0.2 update. Includes some extras as well. --- src/SDL2.cs | 53 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/src/SDL2.cs b/src/SDL2.cs index 36d6e5d..e5ce0a1 100644 --- a/src/SDL2.cs +++ b/src/SDL2.cs @@ -208,7 +208,7 @@ namespace SDL2 public const string SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS = "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"; public const string SDL_HINT_IDLE_TIMER_DISABLED = - "SDL_IOS_DLE_TIMER_DISABLED"; + "SDL_IOS_IDLE_TIMER_DISABLED"; public const string SDL_HINT_ORIENTATIONS = "SDL_IOS_ORIENTATIONS"; public const string SDL_HINT_XINPUT_ENABLED = @@ -221,14 +221,28 @@ namespace SDL2 "SDL_ALLOW_TOPMOST"; public const string SDL_HINT_TIMER_RESOLUTION = "SDL_TIMER_RESOLUTION"; + public const string SDL_HINT_RENDER_SCALE_QUALITY = + "SDL_RENDER_SCALE_QUALITY"; + + /* Only available in SDL 2.0.1 or higher */ public const string SDL_HINT_VIDEO_HIGHDPI_DISABLED = "SDL_VIDEO_HIGHDPI_DISABLED"; - public const string SDL_HINT_RENDER_SCALE_QUALITY = - "SDL_HINT_RENDER_SCALE_QUALITY"; + + /* Only available in SDL 2.0.2 or higher */ + public const string SDL_HINT_CTRL_CLICK_EMULATE_RIGHT_CLICK = + "SDL_CTRL_CLICK_EMULATE_RIGHT_CLICK"; + public const string SDL_HINT_VIDEO_FULLSCREEN_SPACES = + "SDL_VIDEO_FULLSCREEN_SPACES"; + public const string SDL_HINT_VIDEO_WIN_D3DCOMPILER = + "SDL_VIDEO_WIN_D3DCOMPILER"; public const string SDL_HINT_MOUSE_RELATIVE_MODE_WARP = - "SDL_HINT_MOUSE_RELATIVE_MODE_WARP"; + "SDL_MOUSE_RELATIVE_MODE_WARP"; + public const string SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT = + "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT"; public const string SDL_HINT_VIDEO_ALLOW_SCREENSAVER = - "SDL_HINT_VIDEO_ALLOW_SCREENSAVER"; + "SDL_VIDEO_ALLOW_SCREENSAVER"; + public const string SDL_HINT_ACCELEROMETER_AS_JOYSTICK = + "SDL_ACCELEROMETER_AS_JOYSTICK"; public enum SDL_HintPriority { @@ -1377,6 +1391,10 @@ namespace SDL2 string extension ); + /* Only available in SDL 2.0.2 or higher */ + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void SDL_GL_ResetAttributes(); + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_GL_GetAttribute( SDL_GLattr attr, @@ -3072,6 +3090,10 @@ namespace SDL2 /* Drag and drop events */ SDL_DROPFILE = 0x1000, + /* Render events */ + /* Only available in SDL 2.0.2 or higher */ + SDL_RENDER_TARGETS_RESET = 0x2000, + /* Events SDL_USEREVENT through SDL_LASTEVENT are for * your use, and should be allocated with * SDL_RegisterEvents() @@ -4610,7 +4632,19 @@ namespace SDL2 string mappingString ); - [DllImport(nativeLibName, EntryPoint = "SDL_GameControllerMappingForGUID", CallingConvention = CallingConvention.Cdecl)] + /* THIS IS AN RWops FUNCTION! */ + [DllImport(nativeLibName, EntryPoint = "SDL_GameControllerAddMappingsFromRW", CallingConvention = CallingConvention.Cdecl)] + private static extern int INTERNAL_SDL_GameControllerAddMappingsFromRW( + IntPtr rw, + int freerw + ); + public static int SDL_GameControllerAddMappingsFromFile(string file) + { + IntPtr rwops = INTERNAL_SDL_RWFromFile(file, "rb"); + return INTERNAL_SDL_GameControllerAddMappingsFromRW(rwops, 1); + } + + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [return : MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler), MarshalCookie = LPUtf8StrMarshaler.LeaveAllocated)] public static extern string SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid @@ -5472,6 +5506,13 @@ namespace SDL2 #region SDL_cpuinfo.h + /// + /// This function returns the number of CPU cores available. + /// + /// The number of CPU cores available. + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern int SDL_GetCPUCount(); + /// /// This function returns the amount of RAM configured in the system, in MB. /// From 6d0456c99e0c1971cffa9a3cbc65bb5fa22e5c34 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Sun, 2 Mar 2014 07:42:17 -0500 Subject: [PATCH 5/9] Double click support from SDL 2.0.2 --- src/SDL2.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SDL2.cs b/src/SDL2.cs index e5ce0a1..321bf92 100644 --- a/src/SDL2.cs +++ b/src/SDL2.cs @@ -3200,8 +3200,8 @@ namespace SDL2 public UInt32 which; public byte button; /* button id */ public byte state; /* SDL_PRESSED or SDL_RELEASED */ + public byte clicks; /* 1 for single-click, 2 for double-click, etc. */ private byte padding1; - private byte padding2; public Int32 x; public Int32 y; } From a7b2d3de69599ae44d64be5d6978ae298a31796e Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Sun, 2 Mar 2014 17:41:21 -0500 Subject: [PATCH 6/9] Whuh, we already got rid of this... --- src/SDL2.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/SDL2.cs b/src/SDL2.cs index 321bf92..41966c4 100644 --- a/src/SDL2.cs +++ b/src/SDL2.cs @@ -231,8 +231,6 @@ namespace SDL2 /* Only available in SDL 2.0.2 or higher */ public const string SDL_HINT_CTRL_CLICK_EMULATE_RIGHT_CLICK = "SDL_CTRL_CLICK_EMULATE_RIGHT_CLICK"; - public const string SDL_HINT_VIDEO_FULLSCREEN_SPACES = - "SDL_VIDEO_FULLSCREEN_SPACES"; public const string SDL_HINT_VIDEO_WIN_D3DCOMPILER = "SDL_VIDEO_WIN_D3DCOMPILER"; public const string SDL_HINT_MOUSE_RELATIVE_MODE_WARP = From f7ba9ab3b7ae0a5d73b8be1c36ac95523aaf9996 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Tue, 4 Mar 2014 11:21:04 -0500 Subject: [PATCH 7/9] Ryan added this back. --- src/SDL2.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SDL2.cs b/src/SDL2.cs index 41966c4..70614ee 100644 --- a/src/SDL2.cs +++ b/src/SDL2.cs @@ -241,6 +241,8 @@ namespace SDL2 "SDL_VIDEO_ALLOW_SCREENSAVER"; public const string SDL_HINT_ACCELEROMETER_AS_JOYSTICK = "SDL_ACCELEROMETER_AS_JOYSTICK"; + public const string SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES = + "SDL_VIDEO_MAC_FULLSCREEN_SPACES"; public enum SDL_HintPriority { From 404c4d583d804843ff7b7e80f66daf3f37f5e117 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Wed, 5 Mar 2014 10:06:01 -0500 Subject: [PATCH 8/9] AL_SOFT_MSADPCM is now a thing. --- src/MiniTK/Audio/OpenAL/AL/AL.cs | 4 ++- src/MiniTK/Audio/OpenAL/AL/ALEnums.cs | 39 ++++++++------------------- 2 files changed, 14 insertions(+), 29 deletions(-) diff --git a/src/MiniTK/Audio/OpenAL/AL/AL.cs b/src/MiniTK/Audio/OpenAL/AL/AL.cs index b0351d6..397e99f 100644 --- a/src/MiniTK/Audio/OpenAL/AL/AL.cs +++ b/src/MiniTK/Audio/OpenAL/AL/AL.cs @@ -1492,7 +1492,6 @@ namespace OpenTK.Audio.OpenAL // AL_API void AL_APIENTRY alBufferf( ALuint bid, ALenum param, ALfloat value ); // AL_API void AL_APIENTRY alBufferfv( ALuint bid, ALenum param, const ALfloat* values ); - // AL_API void AL_APIENTRY alBufferi( ALuint bid, ALenum param, ALint value ); // AL_API void AL_APIENTRY alBuffer3i( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 ); // AL_API void AL_APIENTRY alBuffer3f( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); */ @@ -1506,6 +1505,9 @@ namespace OpenTK.Audio.OpenAL Buffer3f( bid, param, values.X, values.Y, values.Z ); }*/ + [CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alBufferi", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()] + public static extern void Buffer(int bid, ALBufferi param, uint value); + [CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alBufferiv", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()] public static extern void Buffer(int bid, ALBufferiv param, uint[] value); diff --git a/src/MiniTK/Audio/OpenAL/AL/ALEnums.cs b/src/MiniTK/Audio/OpenAL/AL/ALEnums.cs index ba653e2..ffdb364 100644 --- a/src/MiniTK/Audio/OpenAL/AL/ALEnums.cs +++ b/src/MiniTK/Audio/OpenAL/AL/ALEnums.cs @@ -46,6 +46,13 @@ namespace OpenTK.Audio.OpenAL Orientation = 0x100F, } + ///A list of valid Integer Buffer parameters + public enum ALBufferi : int + { + UnpackBlockAlignmentSoft = 0x200C, + PackBlockAlignmentSoft = 0x200D + } + //A list of valid Integer Vector Buffer/GetBuffer parameters public enum ALBufferiv : int { @@ -258,35 +265,11 @@ namespace OpenTK.Audio.OpenAL /// 2 Channels, IMA4 ADPCM encoded data. Requires Extension: AL_EXT_IMA4 StereoIma4Ext = 0x1301, - /// 1 Channel, 32-sample MSADPCM encoded data. Requires Extension: AL_EXT_MSADPCM - MonoMsadpcm32Ext = 0x1302, + /// 1 Channel, MSADPCM encoded data. Requires Extension: AL_SOFT_MSADPCM + MonoMsadpcmSoft = 0x1302, - /// 2 Channels, 32-sample MSADPCM encoded data. Requires Extension: AL_EXT_MSADPCM - StereoMsadpcm32Ext = 0x1303, - - /// 1 Channel, 64-sample MSADPCM encoded data. Requires Extension: AL_EXT_MSADPCM - MonoMsadpcm64Ext = 0x1304, - - /// 2 Channels, 64-sample MSADPCM encoded data. Requires Extension: AL_EXT_MSADPCM - StereoMsadpcm64Ext = 0x1305, - - /// 1 Channel, 128-sample MSADPCM encoded data. Requires Extension: AL_EXT_MSADPCM - MonoMsadpcm128Ext = 0x1306, - - /// 2 Channels, 128-sample MSADPCM encoded data. Requires Extension: AL_EXT_MSADPCM - StereoMsadpcm128Ext = 0x1307, - - /// 1 Channel, 256-sample MSADPCM encoded data. Requires Extension: AL_EXT_MSADPCM - MonoMsadpcm256Ext = 0x1308, - - /// 2 Channels, 256-sample MSADPCM encoded data. Requires Extension: AL_EXT_MSADPCM - StereoMsadpcm256Ext = 0x1309, - - /// 1 Channel, 512-sample MSADPCM encoded data. Requires Extension: AL_EXT_MSADPCM - MonoMsadpcm512Ext = 0x130A, - - /// 2 Channels, 512-sample MSADPCM encoded data. Requires Extension: AL_EXT_MSADPCM - StereoMsadpcm512Ext = 0x130B, + /// 2 Channels, MSADPCM encoded data. Requires Extension: AL_SOFT_MSADPCM + StereoMsadpcmSoft = 0x1303, /// 1 Channel, single-precision floating-point data. Requires Extension: AL_EXT_float32 MonoFloat32Ext = 0x10010, From 21ab9a5d6975f90a8e79a1fe15ec2387d1464331 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Fri, 7 Mar 2014 11:02:24 -0500 Subject: [PATCH 9/9] 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 70614ee..3c42fb5 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 } }