From 5785d3d464f2a917c57acc2114cf03d05546e487 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Thu, 19 Oct 2017 10:13:23 -0400 Subject: [PATCH] Strip out the XML docs, replace with the basic IntPtr docs where appropriate. Honestly this just got in the way and people know to refer to SDL's docs anyway. --- src/SDL2.cs | 606 +++------------------------------------------------- 1 file changed, 31 insertions(+), 575 deletions(-) diff --git a/src/SDL2.cs b/src/SDL2.cs index bd55906..1e7be39 100644 --- a/src/SDL2.cs +++ b/src/SDL2.cs @@ -33,16 +33,10 @@ using System.Runtime.InteropServices; namespace SDL2 { - /// - /// Entry point for all SDL-related (non-extension) types and methods - /// public static class SDL { #region SDL2# Variables - /// - /// Used by DllImport to load the native library. - /// private const string nativeLibName = "SDL2.dll"; #endregion @@ -78,12 +72,7 @@ namespace SDL2 * the phrase "THIS IS AN RWops FUNCTION!" */ - /// - /// Use this function to create a new SDL_RWops structure for reading from and/or writing to a named file. - /// - /// a UTF-8 string representing the filename to open - /// an ASCII string representing the mode to be used for opening the file; see Remarks for details - /// Returns a pointer to the SDL_RWops structure that is created, or NULL on failure; call SDL_GetError() for more information. + /* IntPtr refers to an SDL_RWops* */ [DllImport(nativeLibName, EntryPoint = "SDL_RWFromFile", CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr INTERNAL_SDL_RWFromFile( [In()] [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler))] @@ -96,7 +85,7 @@ namespace SDL2 * functions marked with the phrase "THIS IS A PUBLIC RWops FUNCTION!" */ - /* IntPtr refers to an SDL_RWops */ + /* IntPtr refers to an SDL_RWops* */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr SDL_RWFromMem(byte[] mem, int size); @@ -104,20 +93,13 @@ namespace SDL2 #region SDL_main.h - /// - /// Use this function to circumvent failure of SDL_Init() when not using SDL_main() as an entry point. - /// [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_SetMainReady(); - /// - /// This is used as a function pointer to a C-style main() function for SDL_WinRTRunApp(). - /// + /* This is used as a function pointer to a C main() function for SDL_WinRTRunApp() */ public delegate int SDL_WinRT_mainFunction(int argc, IntPtr[] argv); - /// - /// Initializes and launches an SDL/WinRT application. Use with UWP! - /// + /* Use this function with UWP to call your C# Main() function! */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_WinRTRunApp( SDL_WinRT_mainFunction mainFunction, @@ -141,67 +123,18 @@ namespace SDL2 SDL_INIT_GAMECONTROLLER ); - /// - /// Use this function to initialize the SDL library. - /// This must be called before using any other SDL function. - /// - /// subsystem initialization flags; see Remarks for details - /// Returns 0 on success or a negative error code on failure. - /// Call for more information. - /// The Event Handling, File I/O, and Threading subsystems are initialized by default. - /// You must specifically initialize other subsystems if you use them in your application. - /// Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup signal handlers - /// for some commonly ignored fatal signals (like SIGSEGV). [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_Init(uint flags); - /// - /// Use this function to initialize specific SDL subsystems. - /// - /// any of the flags used by SDL_Init(); see Remarks for details - /// Returns 0 on success or a negative error code on failure. - /// Call for more information. - /// After SDL has been initialized with you may initialize - /// uninitialized subsystems with . - /// If you want to initialize subsystems separately you would call - /// followed by with the desired subsystem flag. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_InitSubSystem(uint flags); - /// - /// Use this function to clean up all initialized subsystems. - /// You should call it upon all exit conditions. - /// - /// You should call this function even if you have already shutdown each initialized - /// subsystem with . - /// If you start a subsystem using a call to that subsystem's init function (for example - /// ) instead of or , - /// then you must use that subsystem's quit function () to shut it down - /// before calling . - /// You can use this function with atexit() to ensure that it is run when your application is - /// shutdown, but it is not wise to do this from a library or other dynamically loaded code. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_Quit(); - /// - /// Use this function to shut down specific SDL subsystems. - /// - /// any of the flags used by ; see Remarks for details - /// If you start a subsystem using a call to that subsystem's init function (for example - /// ) instead of or , - /// then you must use that subsystem's quit function () to shut it down - /// before calling . - /// You can use this function with atexit() to en - /// You still need to call even if you close all open subsystems with SDL_QuitSubSystem(). [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_QuitSubSystem(uint flags); - /// - /// Use this function to return a mask of the specified subsystems which have previously been initialized. - /// - /// any of the flags used by ; see Remarks for details - /// If flags is 0 it returns a mask of all initialized subsystems, otherwise it returns the - /// initialization status of the specified subsystems. The return value does not include SDL_INIT_NOPARACHUTE. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern uint SDL_WasInit(uint flags); @@ -335,19 +268,9 @@ namespace SDL2 SDL_HINT_OVERRIDE } - /// - /// Use this function to clear all hints. - /// - /// This function is automatically called during . [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_ClearHints(); - /// - /// Use this function to get the value of a hint. - /// - /// the hint to query; see the list of hints on - /// CategoryHints for details - /// Returns the string value of a hint or NULL if the hint isn't set. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [return : MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler), MarshalCookie = LPUtf8StrMarshaler.LeaveAllocated)] public static extern string SDL_GetHint( @@ -355,16 +278,6 @@ namespace SDL2 string name ); - /// - /// Use this function to set a hint with normal priority. - /// - /// the hint to query; see the list of hints on - /// CategoryHints for details - /// the value of the hint variable - /// Returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. - /// Hints will not be set if there is an existing override hint or environment - /// variable that takes precedence. You can use to set the hint with - /// override priority instead. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern SDL_bool SDL_SetHint( [In()] [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler))] @@ -373,17 +286,6 @@ namespace SDL2 string value ); - /// - /// Use this function to set a hint with a specific priority. - /// - /// the hint to query; see the list of hints on - /// CategoryHints for details - /// the value of the hint variable - /// the level for the hint - /// Returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. - /// The priority controls the behavior when setting a hint that already has a value. - /// Hints will replace existing hints of their priority and lower. Environment variables are - /// considered to have override priority. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern SDL_bool SDL_SetHintWithPriority( [In()] [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler))] @@ -405,32 +307,13 @@ namespace SDL2 #region SDL_error.h - /// - /// Use this function to clear any previous error message. - /// [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_ClearError(); - /// - /// Use this function to retrieve a message about the last error that occurred. - /// - /// Returns a message with information about the specific error that occurred, - /// or an empty string if there hasn't been an error since the last call to . - /// Without calling , the message is only applicable when an SDL function - /// has signaled an error. You must check the return values of SDL function calls to determine - /// when to appropriately call . - /// This string is statically allocated and must not be freed by the application. - /// It is possible for multiple errors to occur before calling SDL_GetError(). Only the last error is returned. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [return : MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler), MarshalCookie = LPUtf8StrMarshaler.LeaveAllocated)] public static extern string SDL_GetError(); - /// - /// Use this function to set the SDL error string. - /// - /// a printf() style message format string - /// additional parameters matching % tokens in the fmt string, if any - /// Calling this function will replace any previous error message that was set. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_SetError( [In()] [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler))] @@ -476,9 +359,6 @@ namespace SDL2 public const int SDL_LOG_CATEGORY_CUSTOM = 19; /* End nameless enum SDL_LOG_CATEGORY */ - /// - /// An enumeration of the predefined log priorities. - /// public enum SDL_LogPriority { SDL_LOG_PRIORITY_VERBOSE = 1, @@ -490,28 +370,15 @@ namespace SDL2 SDL_NUM_LOG_PRIORITIES } - /// - /// Used as a callback for and - /// - /// what was passed as userdata to - /// the category of the message; see Remarks for details - /// the priority of the message; see Remarks for details - /// the message being output - /// The category can be one of SDL_LOG_CATEGORY* - /// The priority can be one of SDL_LOG_PRIORITY* + /* userdata refers to a void*, message to a const char* */ [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void SDL_LogOutputFunction( - IntPtr userdata, // void* + IntPtr userdata, int category, SDL_LogPriority priority, - IntPtr message // const char* + IntPtr message ); - /// - /// Use this function to log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO. - /// - /// a printf() style message format string - /// additional parameters matching % tokens in the fmt string, if any [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_Log( [In()] [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler))] @@ -519,13 +386,6 @@ namespace SDL2 __arglist ); - /// - /// Use this function to log a message with SDL_LOG_PRIORITY_VERBOSE. - /// - /// the category of the message; see Remarks for details - /// a printf() style message format string - /// additional parameters matching % tokens in the fmt string, if any - /// The category can be one of SDL_LOG_CATEGORY* [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_LogVerbose( int category, @@ -534,13 +394,6 @@ namespace SDL2 __arglist ); - /// - /// Use this function to log a message with SDL_LOG_PRIORITY_DEBUG. - /// - /// the category of the message; see Remarks for details - /// a printf() style message format string - /// additional parameters matching % tokens in the fmt string, if any - /// The category can be one of SDL_LOG_CATEGORY* [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_LogDebug( int category, @@ -549,13 +402,6 @@ namespace SDL2 __arglist ); - /// - /// Use this function to log a message with SDL_LOG_PRIORITY_INFO. - /// - /// the category of the message; see Remarks for details - /// a printf() style message format string - /// additional parameters matching % tokens in the fmt string, if any - /// The category can be one of SDL_LOG_CATEGORY* [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_LogInfo( int category, @@ -564,13 +410,6 @@ namespace SDL2 __arglist ); - /// - /// Use this function to log a message with SDL_LOG_PRIORITY_WARN. - /// - /// the category of the message; see Remarks for details - /// a printf() style message format string - /// additional parameters matching % tokens in the fmt string, if any - /// The category can be one of SDL_LOG_CATEGORY* [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_LogWarn( int category, @@ -579,13 +418,6 @@ namespace SDL2 __arglist ); - /// - /// Use this function to log a message with SDL_LOG_PRIORITY_ERROR. - /// - /// the category of the message; see Remarks for details - /// a printf() style message format string - /// additional parameters matching % tokens in the fmt string, if any - /// The category can be one of SDL_LOG_CATEGORY* [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_LogError( int category, @@ -594,13 +426,6 @@ namespace SDL2 __arglist ); - /// - /// Use this function to log a message with SDL_LOG_PRIORITY_CRITICAL. - /// - /// the category of the message; see Remarks for details - /// a printf() style message format string - /// additional parameters matching % tokens in the fmt string, if any - /// The category can be one of SDL_LOG_CATEGORY* [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_LogCritical( int category, @@ -609,15 +434,6 @@ namespace SDL2 __arglist ); - /// - /// Use this function to log a message with the specified category and priority. - /// - /// the category of the message; see Remarks for details - /// the priority of the message; see Remarks for details - /// a printf() style message format string - /// additional parameters matching % tokens in the fmt string, if any - /// The category can be one of SDL_LOG_CATEGORY* - /// The priority can be one of SDL_LOG_PRIORITY* [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_LogMessage( int category, @@ -627,14 +443,6 @@ namespace SDL2 __arglist ); - /// - /// Use this function to log a message with the specified category and priority. - /// This version of uses a stdarg variadic argument list. - /// - /// the category of the message; see Remarks for details - /// the priority of the message; see Remarks for details - /// a printf() style message format string - /// additional parameters matching % tokens in the fmt string, if any [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_LogMessageV( int category, @@ -644,53 +452,26 @@ namespace SDL2 __arglist ); - /// - /// Use this function to get the priority of a particular log category. - /// - /// the category to query; see Remarks for details - /// Returns the for the requested category; see Remarks for details. - /// The category can be one of SDL_LOG_CATEGORY* - /// The returned priority will be one of SDL_LOG_PRIORITY* [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern SDL_LogPriority SDL_LogGetPriority( int category ); - /// - /// Use this function to set the priority of a particular log category. - /// - /// the category to query; see Remarks for details - /// the of the message; see Remarks for details - /// The category can be one of SDL_LOG_CATEGORY* - /// The priority can be one of SDL_LOG_PRIORITY* [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_LogSetPriority( int category, SDL_LogPriority priority ); - /// - /// Use this function to set the priority of all log categories. - /// - /// the of the message; see Remarks for details - /// The priority can be one of SDL_LOG_PRIORITY* [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_LogSetAllPriority( SDL_LogPriority priority ); - /// - /// Use this function to reset all priorities to default. - /// - /// This is called in . [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_LogResetPriorities(); - /// - /// Use this function to get the current log output function. - /// - /// a pointer filled in with the current log callback; see Remarks for details - /// a pointer filled in with the pointer that is passed to callback (refers to void*) + /* userdata refers to a void* */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_LogGetOutputFunction( out SDL_LogOutputFunction callback, @@ -698,11 +479,6 @@ namespace SDL2 ); /* userdata refers to a void* */ - /// - /// Use this function to replace the default log output function with one of your own. - /// - /// the function to call instead of the default; see Remarks for details - /// a pointer that is passed to callback (refers to void*) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_LogSetOutputFunction( SDL_LogOutputFunction callback, @@ -791,21 +567,9 @@ namespace SDL2 public SDL_MessageBoxColorScheme? colorScheme; /* Can be NULL to use system settings */ } - /// - /// - /// - /// - /// - /// [DllImport(nativeLibName, EntryPoint = "SDL_ShowMessageBox", CallingConvention = CallingConvention.Cdecl)] private static extern int INTERNAL_SDL_ShowMessageBox([In()] ref INTERNAL_SDL_MessageBoxData messageboxdata, out int buttonid); - /// - /// - /// - /// - /// - /// public static unsafe int SDL_ShowMessageBox([In()] ref SDL_MessageBoxData messageboxdata, out int buttonid) { var utf8 = LPUtf8StrMarshaler.GetInstance(null); @@ -854,14 +618,7 @@ namespace SDL2 return result; } - /// - /// Use this function to display a simple message box. - /// - /// An ; see Remarks for details; - /// UTF-8 title text - /// UTF-8 message text - /// the parent window, or NULL for no parent (refers to a - /// 0 on success or a negative error code on failure; call SDL_GetError() for more information. + /* window refers to an SDL_Window* */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_ShowSimpleMessageBox( SDL_MessageBoxFlags flags, @@ -890,14 +647,6 @@ namespace SDL2 SDL_PATCHLEVEL ); - /// - /// A structure that contains information about the version of SDL in use. - /// - /// Represents the library's version as three levels: - /// major revision (increments with massive changes, additions, and enhancements) - /// minor revision (increments with backwards-compatible changes to the major revision), and - /// patchlevel (increments with fixes to the minor revision) - /// can be used to populate this structure with information [StructLayout(LayoutKind.Sequential)] public struct SDL_version { @@ -906,10 +655,6 @@ namespace SDL2 public byte patch; } - /// - /// Use this macro to determine the SDL version your program was compiled against. - /// - /// an structure to initialize public static void SDL_VERSION(out SDL_version x) { x.major = SDL_MAJOR_VERSION; @@ -917,59 +662,23 @@ namespace SDL2 x.patch = SDL_PATCHLEVEL; } - /// - /// Use this macro to convert separate version components into a single numeric value. - /// - /// major version; reported in thousands place - /// minor version; reported in hundreds place - /// update version (patchlevel); reported in tens and ones places - /// - /// This assumes that there will never be more than 100 patchlevels. - /// Example: SDL_VERSIONNUM(1,2,3) -> (1203) public static int SDL_VERSIONNUM(int X, int Y, int Z) { return (X * 1000) + (Y * 100) + Z; } - /// - /// Use this macro to determine whether the SDL version compiled against is at least as new as the specified version. - /// - /// major version - /// minor version - /// update version (patchlevel) - /// This macro will evaluate to true if compiled with SDL version at least X.Y.Z. public static bool SDL_VERSION_ATLEAST(int X, int Y, int Z) { return (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)); } - /// - /// Use this function to get the version of SDL that is linked against your program. - /// - /// the structure that contains the version information - /// This function may be called safely at any time, even before SDL_Init(). [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_GetVersion(out SDL_version ver); - /// - /// Use this function to get the code revision of SDL that is linked against your program. - /// - /// Returns an arbitrary string, uniquely identifying the exact revision - /// of the SDL library in use. - /// The revision is a string including sequential revision number that is - /// incremented with each commit, and a hash of the last code change. - /// Example: hg-5344:94189aa89b54 - /// This value is the revision of the code you are linked with and may be - /// different from the code you are compiling with, which is found in the constant SDL_REVISION. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [return : MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler), MarshalCookie = LPUtf8StrMarshaler.LeaveAllocated)] public static extern string SDL_GetRevision(); - /// - /// Use this function to get the revision number of SDL that is linked against your program. - /// - /// Returns a number uniquely identifying the exact revision of the SDL library in use. - /// This is an incrementing number based on commits to hg.libsdl.org. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_GetRevisionNumber(); @@ -977,9 +686,6 @@ namespace SDL2 #region SDL_video.h - /// - /// An enumeration of OpenGL configuration attributes. - /// public enum SDL_GLattr { SDL_GL_RED_SIZE, @@ -1011,9 +717,6 @@ namespace SDL2 SDL_GL_CONTEXT_NO_ERROR, /* Only available in 2.0.6 */ } - /// - /// An enumeration of OpenGL profiles. - /// [Flags] public enum SDL_GLprofile { @@ -1022,10 +725,6 @@ namespace SDL2 SDL_GL_CONTEXT_PROFILE_ES = 0x0004 } - /// - /// This enumeration is used in conjunction with SDL_GL_SetAttribute - /// and SDL_GL_CONTEXT_FLAGS. Multiple flags can be OR'd together. - /// [Flags] public enum SDL_GLcontext { @@ -1035,9 +734,6 @@ namespace SDL2 SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008 } - /// - /// An enumeration of window events. - /// public enum SDL_WindowEventID : byte { SDL_WINDOWEVENT_NONE, @@ -1060,9 +756,6 @@ namespace SDL2 SDL_WINDOWEVENT_HIT_TEST } - /// - /// An enumeration of window states. - /// [Flags] public enum SDL_WindowFlags : uint { @@ -1090,10 +783,7 @@ namespace SDL2 SDL_WINDOW_VULKAN = 0x10000000, /* Only available in 2.0.6 */ } - /// - /// Possible return values from the SDL_HitTest callback. - /// This is only available in 2.0.4. - /// + /* Only available in 2.0.4 */ public enum SDL_HitTestResult { SDL_HITTEST_NORMAL, /* Region is normal. No special properties. */ @@ -1110,8 +800,8 @@ namespace SDL2 public const int SDL_WINDOWPOS_UNDEFINED_MASK = 0x1FFF0000; public const int SDL_WINDOWPOS_CENTERED_MASK = 0x2FFF0000; - public const int SDL_WINDOWPOS_UNDEFINED = 0x1FFF0000; - public const int SDL_WINDOWPOS_CENTERED = 0x2FFF0000; + public const int SDL_WINDOWPOS_UNDEFINED = 0x1FFF0000; + public const int SDL_WINDOWPOS_CENTERED = 0x2FFF0000; public static int SDL_WINDOWPOS_UNDEFINED_DISPLAY(int X) { @@ -1133,9 +823,6 @@ namespace SDL2 return (X & 0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK; } - /// - /// A structure that describes a display mode. - /// [StructLayout(LayoutKind.Sequential)] public struct SDL_DisplayMode { @@ -1150,18 +837,7 @@ namespace SDL2 /* Only available in 2.0.4 */ public delegate SDL_HitTestResult SDL_HitTest(IntPtr win, IntPtr area, IntPtr data); - /// - /// Use this function to create a window with the specified position, dimensions, and flags. - /// - /// the title of the window, in UTF-8 encoding - /// the x position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED - /// the y position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED - /// the width of the window - /// the height of the window - /// 0, or one or more OR'd together; - /// see Remarks for details - /// Returns the window that was created or NULL on failure; call - /// for more information. (refers to an ) + /* IntPtr refers to an SDL_Window* */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr SDL_CreateWindow( [In()] [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler))] @@ -1173,15 +849,7 @@ namespace SDL2 SDL_WindowFlags flags ); - /// - /// Use this function to create a window and default renderer. - /// - /// The width of the window - /// The height of the window - /// The flags used to create the window (see ) - /// A pointer filled with the window, or NULL on error () - /// A pointer filled with the renderer, or NULL on error - /// Returns 0 on success, or -1 on error; call for more information. + /* window refers to an SDL_Window*, renderer to an SDL_Renderer* */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_CreateWindowAndRenderer( int width, @@ -1191,51 +859,21 @@ namespace SDL2 out IntPtr renderer ); - /// - /// Use this function to create an SDL window from an existing native window. - /// - /// a pointer to driver-dependent window creation data, typically your native window cast to a void* - /// Returns the window () that was created or NULL on failure; - /// call for more information. + /* data refers to some native window type, IntPtr to an SDL_Window* */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr SDL_CreateWindowFrom(IntPtr data); - /// - /// Use this function to destroy a window. - /// - /// the window to destroy () + /* window refers to an SDL_Window* */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_DestroyWindow(IntPtr window); - /// - /// Use this function to prevent the screen from being blanked by a screen saver. - /// - /// If you disable the screensaver, it is automatically re-enabled when SDL quits. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_DisableScreenSaver(); - /// - /// Use this function to allow the screen to be blanked by a screen saver. - /// [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SDL_EnableScreenSaver(); /* IntPtr refers to an SDL_DisplayMode. Just use closest. */ - /// - /// Use this function to get the closest match to the requested display mode. - /// - /// the index of the display to query - /// an structure containing the desired display mode - /// an structure filled in with - /// the closest match of the available display modes - /// Returns the passed in value closest or NULL if no matching video mode was available; - /// (refers to a ) - /// call for more information. - /// The available display modes are scanned and closest is filled in with the closest mode - /// matching the requested mode and returned. The mode format and refresh rate default to the desktop - /// mode if they are set to 0. The modes are scanned with size being first priority, format being - /// second priority, and finally checking the refresh rate. If all the available modes are too small, - /// then NULL is returned. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr SDL_GetClosestDisplayMode( int displayIndex, @@ -1243,43 +881,16 @@ namespace SDL2 out SDL_DisplayMode closest ); - /// - /// Use this function to get information about the current display mode. - /// - /// the index of the display to query - /// an structure filled in with the current display mode - /// Returns 0 on success or a negative error code on failure; - /// call for more information. - /// There's a difference between this function and when SDL - /// runs fullscreen and has changed the resolution. In that case this function will return the - /// current display mode, and not the previous native display mode. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_GetCurrentDisplayMode( int displayIndex, out SDL_DisplayMode mode ); - /// - /// Use this function to return the name of the currently initialized video driver. - /// - /// Returns the name of the current video driver or NULL if no driver has been initialized. - /// There's a difference between this function and when SDL - /// runs fullscreen and has changed the resolution. In that case this function will return the - /// previous native display mode, and not the current display mode. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [return : MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler), MarshalCookie = LPUtf8StrMarshaler.LeaveAllocated)] public static extern string SDL_GetCurrentVideoDriver(); - /// - /// Use this function to get information about the desktop display mode. - /// - /// the index of the display to query - /// an structure filled in with the current display mode - /// Returns 0 on success or a negative error code on failure; - /// call for more information. - /// There's a difference between this function and when SDL - /// runs fullscreen and has changed the resolution. In that case this function will return the - /// previous native display mode, and not the current display mode. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_GetDesktopDisplayMode( int displayIndex, @@ -1290,13 +901,6 @@ namespace SDL2 [return : MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler), MarshalCookie = LPUtf8StrMarshaler.LeaveAllocated)] public static extern string SDL_GetDisplayName(int index); - /// - /// Use this function to get the desktop area represented by a display, with the primary display located at 0,0. - /// - /// the index of the display to query - /// the structure filled in with the display bounds - /// Returns 0 on success or a negative error code on failure; - /// call for more information. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_GetDisplayBounds( int displayIndex, @@ -1312,19 +916,6 @@ namespace SDL2 out float vdpi ); - /// - /// Use this function to get information about a specific display mode. - /// - /// the index of the display to query - /// the index of the display mode to query - /// an structure filled in with the mode at modeIndex - /// Returns 0 on success or a negative error code on failure; - /// call for more information. - /// The display modes are sorted in this priority: - /// bits per pixel -> more colors to fewer colors - /// width -> largest to smallest - /// height -> largest to smallest - /// refresh rate -> highest to lowest [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_GetDisplayMode( int displayIndex, @@ -1339,50 +930,24 @@ namespace SDL2 out SDL_Rect rect ); - /// - /// Use this function to return the number of available display modes. - /// - /// the index of the display to query - /// Returns a number >= 1 on success or a negative error code on failure; - /// call for more information. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_GetNumDisplayModes( int displayIndex ); - /// - /// Use this function to return the number of available video displays. - /// - /// Returns a number >= 1 or a negative error code on failure; - /// call for more information. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_GetNumVideoDisplays(); - /// - /// Use this function to get the number of video drivers compiled into SDL. - /// - /// Returns a number >= 1 on success or a negative error code on failure; - /// call for more information. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_GetNumVideoDrivers(); - /// - /// Use this function to get the name of a built in video driver. - /// - /// the index of a video driver - /// Returns the name of the video driver with the given index. - /// The video drivers are presented in the order in which they are normally checked during initialization. [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [return : MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler), MarshalCookie = LPUtf8StrMarshaler.LeaveAllocated)] public static extern string SDL_GetVideoDriver( int index ); - /// - /// Use this function to get the brightness (gamma correction) for a window. - /// - /// the window to query () - /// Returns the brightness for the window where 0.0 is completely dark and 1.0 is normal brightness. + /* window refers to an SDL_Window* */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern float SDL_GetWindowBrightness( IntPtr window @@ -1417,12 +982,7 @@ namespace SDL2 [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_SetWindowInputFocus(IntPtr window); - /// - /// Use this function to retrieve the data pointer associated with a window. - /// - /// the window to query () - /// the name of the pointer - /// Returns the value associated with name. (void*) + /* window refers to an SDL_Window*, IntPtr to a void* */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr SDL_GetWindowData( IntPtr window, @@ -1430,45 +990,24 @@ namespace SDL2 string name ); - /// - /// Use this function to get the index of the display associated with a window. - /// - /// the window to query () - /// Returns the index of the display containing the center of the window - /// on success or a negative error code on failure; - /// call for more information. + /* window refers to an SDL_Window* */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_GetWindowDisplayIndex( IntPtr window ); - /// - /// Use this function to fill in information about the display mode to use when a window is visible at fullscreen. - /// - /// the window to query () - /// an structure filled in with the fullscreen display mode - /// Returns 0 on success or a negative error code on failure; - /// call for more information. + /* window refers to an SDL_Window* */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_GetWindowDisplayMode( IntPtr window, out SDL_DisplayMode mode ); - /// - /// Use this function to get the window flags. - /// - /// the window to query () - /// Returns a mask of the associated with window; see Remarks for details. + /* window refers to an SDL_Window* */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern uint SDL_GetWindowFlags(IntPtr window); - /// - /// Use this function to get a window from a stored ID. - /// - /// the ID of the window - /// Returns the window associated with id or NULL if it doesn't exist (); - /// call for more information. + /* IntPtr refers to an SDL_Window* */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr SDL_GetWindowFromID(uint id); @@ -1811,9 +1350,6 @@ namespace SDL2 #region SDL_blendmode.h - /// - /// An enumeration of blend modes used in SDL_RenderCopy() and drawing operations. - /// [Flags] public enum SDL_BlendMode { @@ -2064,18 +1600,7 @@ namespace SDL2 out byte b ); - /// - /// Use this function to lock a portion of the texture for write-only pixel access. - /// - /// the texture to lock for access, which was created with - /// SDL_TEXTUREACCESS_STREAMING (refers to a SDL_Texture*) - /// an SDL_Rect structure representing the area to lock for access; - /// NULL to lock the entire texture - /// this is filled in with a pointer to the locked pixels, appropriately - /// offset by the locked area (refers to a void*) - /// this is filled in with the pitch of the locked pixels - /// Returns 0 on success or a negative error code if the texture is not valid or - /// was not created with SDL_TEXTUREACCESS_STREAMING; call for more information. + /* texture refers to an SDL_Texture*, pixels to a void* */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_LockTexture( IntPtr texture, @@ -2084,19 +1609,11 @@ namespace SDL2 out int pitch ); - /// - /// Use this function to lock a portion of the texture for write-only pixel access. This overload - /// allows for passing an IntPtr.Zero (null) rect value to lock the entire texture. - /// - /// the texture to lock for access, which was created with - /// SDL_TEXTUREACCESS_STREAMING (refers to a SDL_Texture*) - /// an SDL_Rect structure representing the area to lock for access; - /// NULL to lock the entire texture - /// this is filled in with a pointer to the locked pixels, appropriately - /// offset by the locked area (refers to a void*) - /// this is filled in with the pitch of the locked pixels - /// Returns 0 on success or a negative error code if the texture is not valid or - /// was not created with SDL_TEXTUREACCESS_STREAMING; call for more information. + /* texture refers to an SDL_Texture*, pixels to a void*. + * Internally, this function contains logic to use default values when + * the rectangle is passed as NULL. + * This overload allows for IntPtr.Zero to be passed for rect. + */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_LockTexture( IntPtr texture, @@ -6320,50 +5837,12 @@ namespace SDL2 #region SDL_filesystem.h - /// - /// Get the path where the application resides. - /// - /// Get the "base path". This is the directory where the application was run - /// from, which is probably the installation directory, and may or may not - /// be the process's current working directory. - /// - /// This returns an absolute path in UTF-8 encoding, and is garunteed to - /// end with a path separator ('\\' on Windows, '/' most other places). - /// - /// string of base dir in UTF-8 encoding - /// The underlying C string is owned by the application, - /// and can be NULL on some platforms. - /// - /// This function is not necessarily fast, so you should only - /// call it once and save the string if you need it. - /// - /// This function is only available in SDL 2.0.1 and later. + /* Only available in 2.0.1 */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [return : MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler))] public static extern string SDL_GetBasePath(); - /// - /// Get the user-and-app-specific path where files can be written. - /// - /// Get the "pref dir". This is meant to be where users can write personal - /// files (preferences and save games, etc) that are specific to your - /// application. This directory is unique per user, per application. - /// - /// This function will decide the appropriate location in the native filesystem¸ - /// create the directory if necessary, and return a string of the absolute - /// path to the directory in UTF-8 encoding. - /// - /// The name of your organization. - /// The name of your application. - /// UTF-8 string of user dir in platform-dependent notation. NULL - /// if there's a problem (creating directory failed, etc). - /// The underlying C string is owned by the application, - /// and can be NULL on some platforms. .NET provides some similar functions. - /// - /// This function is not necessarily fast, so you should only - /// call it once and save the string if you need it. - /// - /// This function is only available in SDL 2.0.1 and later. + /* Only available in 2.0.1 */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [return : MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler))] public static extern string SDL_GetPrefPath( @@ -6377,9 +5856,6 @@ namespace SDL2 #region SDL_power.h - /// - /// The basic state for the system's power supply. - /// public enum SDL_PowerState { SDL_POWERSTATE_UNKNOWN = 0, @@ -6389,16 +5865,6 @@ namespace SDL2 SDL_POWERSTATE_CHARGED } - /// - /// Get the current power supply details. - /// - /// Seconds of battery life left. You can pass a NULL here if - /// you don't care. Will return -1 if we can't determine a - /// value, or we're not running on a battery. - /// Percentage of battery life left, between 0 and 100. You can - /// pass a NULL here if you don't care. Will return -1 if we - /// can't determine a value, or we're not running on a battery. - /// The state of the battery (if any). [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern SDL_PowerState SDL_GetPowerInfo( out int secs, @@ -6409,20 +5875,10 @@ 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. - /// - /// The amount of RAM configured in the system, in MB. - /// - /// This function is only available in SDL 2.0.1 and later. - /// + /* Only available in 2.0.1 */ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int SDL_GetSystemRAM();