[
  {
    "path": ".gitignore",
    "content": ".vs/\nBuilds/\n"
  },
  {
    "path": "Assets/INSTRUCTIONS.txt",
    "content": "Place your assets (textures, sounds, and fonts) in this directory and they will be automatically copied when making builds."
  },
  {
    "path": "Engine/Audio.cs",
    "content": "﻿using SDL2;\nusing System;\nusing System.Collections.Generic;\n\nstatic partial class Engine\n{\n    private static readonly int AudioChannelCount = 64;\n\n    private static Dictionary<SoundInstance, int> SoundInstances = new Dictionary<SoundInstance, int>();\n\n    private static int GetFadeTimeMs(float fadeTime)\n    {\n        return (int)(fadeTime * 1000);\n    }\n\n    /// <summary>\n    /// Plays a sound. Returns an instance handle that can be passed to StopSound() to stop playback of the sound.\n    /// </summary>\n    /// <param name=\"sound\">The sound to play.</param>\n    /// <param name=\"repeat\">Whether or not the sound should repeat until stopped.</param>\n    /// <param name=\"fadeTime\">The amount of time (in seconds) to fade in the sound's volume.</param>\n    public static SoundInstance PlaySound(Sound sound, bool repeat = false, float fadeTime = 0)\n    {\n        // Start playing the new sound:\n        int channel = SDL_mixer.Mix_FadeInChannel(-1, sound.Handle, repeat ? -1 : 0, GetFadeTimeMs(fadeTime));\n\n        // Silently fail when we run out of channels:\n        if (channel == -1)\n        {\n            return new SoundInstance();\n        }\n\n        // Invalidate old sound instances using this channel:\n        foreach (var instanceAndChannel in SoundInstances)\n        {\n            if (instanceAndChannel.Value == channel)\n            {\n                SoundInstances.Remove(instanceAndChannel.Key);\n                break;\n            }\n        }\n\n        // Return a new sound instance for this channel:\n        SoundInstance instance = new SoundInstance();\n        SoundInstances[instance] = channel;\n        return instance;\n    }\n\n    /// <summary>\n    /// Stops a playing sound.\n    /// </summary>\n    /// <param name=\"instance\">An instance handle from a prior call to PlaySound().</param>\n    /// <param name=\"fadeTime\">The amount of time (in seconds) to fade out the sound's volume.</param>\n    public static void StopSound(SoundInstance instance, float fadeTime = 0)\n    {\n        int channel;\n        if (SoundInstances.TryGetValue(instance, out channel))\n        {\n            SDL_mixer.Mix_FadeOutChannel(channel, GetFadeTimeMs(fadeTime));\n        }\n    }\n\n    /// <summary>\n    /// Plays music, stopping any currently playing music first.\n    /// </summary>\n    /// <param name=\"music\">The music to play.</param>\n    /// <param name=\"looping\">Whether or not the music should repeat until stopped.</param>\n    /// <param name=\"fadeTime\">The amount of time (in seconds) to fade in the music's volume.</param>\n    public static void PlayMusic(Music music, bool looping = true, float fadeTime = 0)\n    {\n        SDL_mixer.Mix_FadeInMusic(music.Handle, looping ? -1 : 0, GetFadeTimeMs(fadeTime));\n    }\n\n    /// <summary>\n    /// Stops the current music.\n    /// </summary>\n    /// <param name=\"fadeTime\">The amount of time (in seconds) to fade out the music's volume.</param>\n    public static void StopMusic(float fadeTime = 0)\n    {\n        SDL_mixer.Mix_FadeOutMusic(GetFadeTimeMs(fadeTime));\n    }\n}\n\nclass SoundInstance\n{\n}\n"
  },
  {
    "path": "Engine/Content.cs",
    "content": "﻿using SDL2;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nstatic partial class Engine\n{\n    private static string GetAssetPath(string path)\n    {\n        return Path.Combine(\"Assets\", path);\n    }\n\n    /// <summary>\n    /// Loads a texture from the Assets directory. Supports the following formats: BMP, GIF, JPEG, PNG, SVG, TGA, TIFF, WEBP.\n    /// </summary>\n    /// <param name=\"path\">The path to the texture file, relative to the Assets directory.</param>\n    public static Texture LoadTexture(string path)\n    {\n        IntPtr handle = SDL_image.IMG_LoadTexture(Renderer, GetAssetPath(path));\n        if (handle == IntPtr.Zero)\n        {\n            throw new Exception(\"Failed to load texture.\");\n        }\n\n        uint format;\n        int access, width, height;\n        SDL.SDL_QueryTexture(handle, out format, out access, out width, out height);\n\n        return new Texture(handle, width, height);\n    }\n\n    /// <summary>\n    /// Loads a resizable texture from the Assets directory. Supports the following formats: BMP, GIF, JPEG, PNG, SVG, TGA, TIFF, WEBP.\n    /// See the documentation for an explanation of what these parameters _actually_ mean.\n    /// </summary>\n    /// <param name=\"path\">The path to the texture file, relative to the Assets directory.</param>\n    /// <param name=\"leftOffset\">The resize offset from the left of the texture (in pixels).</param>\n    /// <param name=\"rightOffset\">The resize offset from the right of the texture (in pixels).</param>\n    /// <param name=\"topOffset\">The resize offset from the top of the texture (in pixels).</param>\n    /// <param name=\"bottomOffset\">The resize offset from the bottom of the texture (in pixels).</param>\n    public static ResizableTexture LoadResizableTexture(string path, int leftOffset, int rightOffset, int topOffset, int bottomOffset)\n    {\n        IntPtr handle = SDL_image.IMG_LoadTexture(Renderer, GetAssetPath(path));\n        if (handle == IntPtr.Zero)\n        {\n            throw new Exception(\"Failed to load texture.\");\n        }\n\n        uint format;\n        int access, width, height;\n        SDL.SDL_QueryTexture(handle, out format, out access, out width, out height);\n\n        // Convert the relative offsets (from the edges) into absolute offsets (from the origin):\n        rightOffset = width - rightOffset - 1;\n        bottomOffset = height - bottomOffset - 1;\n\n        if (leftOffset < 0 || rightOffset >= width || topOffset < 0 || bottomOffset >= height || leftOffset > rightOffset || topOffset > bottomOffset)\n        {\n            throw new Exception(\"Invalid offset parameter.\");\n        }\n\n        return new ResizableTexture(handle, width, height, leftOffset, rightOffset, topOffset, bottomOffset);\n    }\n\n    /// <summary>\n    /// Loads a font from the Assets directory for a single text size. Supports the following formats: TTF, FON.\n    /// </summary>\n    /// <param name=\"path\">The path to the font file, relative to the Assets directory.</param>\n    /// <param name=\"pointSize\">The size of the text that will be rendered by this font (in points).</param>\n    public static Font LoadFont(string path, int pointSize)\n    {\n        IntPtr handle = SDL_ttf.TTF_OpenFont(GetAssetPath(path), pointSize);\n        if (handle == IntPtr.Zero)\n        {\n            throw new Exception(\"Failed to load font.\");\n        }\n\n        return new Font(handle);\n    }\n\n    /// <summary>\n    /// Loads a sound file from the Assets directory. Supports the following formats: WAV, OGG.\n    /// </summary>\n    /// <param name=\"path\">The path to the sound file, relative to the Assets directory.</param>\n    public static Sound LoadSound(string path)\n    {\n        IntPtr handle = SDL_mixer.Mix_LoadWAV(GetAssetPath(path));\n        if (handle == IntPtr.Zero)\n        {\n            throw new Exception(\"Failed to load sound.\");\n        }\n\n        return new Sound(handle);\n    }\n\n    /// <summary>\n    /// Loads a music file from the Assets directory. Supports the following formats: WAV, OGG, MP3, FLAC.\n    /// </summary>\n    /// <param name=\"path\">The path to the music file, relative to the Assets directory.</param>\n    public static Music LoadMusic(string path)\n    {\n        IntPtr handle = SDL_mixer.Mix_LoadMUS(GetAssetPath(path));\n        if (handle == IntPtr.Zero)\n        {\n            throw new Exception(\"Failed to load music.\");\n        }\n\n        return new Music(handle);\n    }\n}\n\n/// <summary>\n/// A handle to a texture. These should only be created by calling LoadTexture().\n/// </summary>\nclass Texture\n{\n    public readonly IntPtr Handle;\n    public readonly int Width;\n    public readonly int Height;\n    public readonly Vector2 Size;\n\n    public Texture(IntPtr handle, int width, int height)\n    {\n        Handle = handle;\n        Width = width;\n        Height = height;\n        Size = new Vector2(width, height);\n    }\n}\n\n/// <summary>\n/// A handle to a resizable texture. These should only be created by calling LoadResizableTexture().\n/// </summary>\nclass ResizableTexture\n{\n    public readonly IntPtr Handle;\n    public readonly int Width;\n    public readonly int Height;\n    public readonly int LeftOffset;\n    public readonly int RightOffset;\n    public readonly int TopOffset;\n    public readonly int BottomOffset;\n\n    public ResizableTexture(IntPtr handle, int width, int height, int leftOffset, int rightOffset, int topOffset, int bottomOffset)\n    {\n        Handle = handle;\n        Width = width;\n        Height = height;\n        LeftOffset = leftOffset;\n        RightOffset = rightOffset;\n        TopOffset = topOffset;\n        BottomOffset = bottomOffset;\n    }\n}\n\n/// <summary>\n/// A handle to a font. These should only be created by calling LoadFont().\n/// </summary>\nclass Font\n{\n    public readonly IntPtr Handle;\n\n    public Font(IntPtr handle)\n    {\n        Handle = handle;\n    }\n}\n\n/// <summary>\n/// A handle to a sound file. These should only be created by calling LoadSound().\n/// </summary>\nclass Sound\n{\n    public readonly IntPtr Handle;\n\n    public Sound(IntPtr handle)\n    {\n        Handle = handle;\n    }\n}\n\n/// <summary>\n/// A handle to a music file. These should only be created by calling LoadMusic().\n/// </summary>\nclass Music\n{\n    public readonly IntPtr Handle;\n\n    public Music(IntPtr handle)\n    {\n        Handle = handle;\n    }\n}\n"
  },
  {
    "path": "Engine/Engine.cs",
    "content": "﻿using SDL2;\nusing System;\nusing System.Collections.Generic;\n\nstatic partial class Engine\n{\n    private static IntPtr Window;\n    private static bool Fullscreen;\n    private static Texture RenderTarget;\n    private static Game Game;\n\n    /// <summary>\n    /// The amount of time (in seconds) since the last frame.\n    /// </summary>\n    public static float TimeDelta { get; private set; }\n\n    private static void Main(string[] args)\n    {\n        Start();\n        Run();\n    }\n\n    private static void Start()\n    {\n        // ======================================================================================\n        // Initialize SDL\n        // ======================================================================================\n\n        if (SDL.SDL_Init(SDL.SDL_INIT_EVERYTHING) != 0)\n        {\n            throw new Exception(\"Failed to initialize SDL.\");\n        }\n\n        if (SDL_ttf.TTF_Init() != 0)\n        {\n            throw new Exception(\"Failed to initialize SDL_ttf.\");\n        }\n\n        SDL_mixer.MIX_InitFlags mixInitFlags = SDL_mixer.MIX_InitFlags.MIX_INIT_MP3 | SDL_mixer.MIX_InitFlags.MIX_INIT_OGG | SDL_mixer.MIX_InitFlags.MIX_INIT_FLAC;\n        if (((SDL_mixer.MIX_InitFlags)SDL_mixer.Mix_Init(mixInitFlags) & mixInitFlags) != mixInitFlags)\n        {\n            throw new Exception(\"Failed to initialize SDL_mixer.\");\n        }\n\n        if (SDL_mixer.Mix_OpenAudio(44100, SDL_mixer.MIX_DEFAULT_FORMAT, 2, 1024) != 0)\n        {\n            throw new Exception(\"Failed to initialize SDL_mixer.\");\n        }\n\n        SDL_mixer.Mix_AllocateChannels(AudioChannelCount);\n\n        Window = SDL.SDL_CreateWindow(\n            Game.Title,\n            SDL.SDL_WINDOWPOS_CENTERED_DISPLAY(0),\n            SDL.SDL_WINDOWPOS_CENTERED_DISPLAY(0),\n            (int)Game.Resolution.X,\n            (int)Game.Resolution.Y,\n            0);\n\n        if (Window == IntPtr.Zero)\n        {\n            throw new Exception(\"Failed to create window.\");\n        }\n\n        Renderer = SDL.SDL_CreateRenderer(Window, -1, SDL.SDL_RendererFlags.SDL_RENDERER_ACCELERATED | SDL.SDL_RendererFlags.SDL_RENDERER_PRESENTVSYNC | SDL.SDL_RendererFlags.SDL_RENDERER_TARGETTEXTURE);\n\n        if (Renderer == IntPtr.Zero)\n        {\n            throw new Exception(\"Failed to create renderer.\");\n        }\n\n        IntPtr renderTargetHandle = SDL.SDL_CreateTexture(Renderer, SDL.SDL_PIXELFORMAT_RGBA8888, (int)SDL.SDL_TextureAccess.SDL_TEXTUREACCESS_TARGET, (int)Game.Resolution.X, (int)Game.Resolution.Y);\n        RenderTarget = new Texture(renderTargetHandle, (int)Game.Resolution.X, (int)Game.Resolution.Y);\n\n        // ======================================================================================\n        // Instantiate the game object\n        // ======================================================================================\n\n        Game = new Game();\n    }\n\n    private static void Run()\n    {\n        ulong lastFrameStartTime = SDL.SDL_GetPerformanceCounter();\n\n        while (true)\n        {\n            // Measure the time elapsed between one frame and the next:\n            ulong now = SDL.SDL_GetPerformanceCounter();\n            TimeDelta = (now - lastFrameStartTime) / (float)SDL.SDL_GetPerformanceFrequency();\n            lastFrameStartTime = now;\n\n            // Process pre-update engine logic:\n            PollEvents();\n\n            // Toggle between windowed and fullscreen mode when Alt+Enter is pressed:\n            if (GetKeyDown(Key.Return) && (GetKeyHeld(Key.LeftAlt) || GetKeyHeld(Key.RightAlt)))\n            {\n                Fullscreen = !Fullscreen;\n                SDL.SDL_SetWindowFullscreen(Window, Fullscreen ? (uint)SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN_DESKTOP : 0);\n            }\n\n            // Clear and start drawing into the render target:\n            SDL.SDL_SetRenderTarget(Renderer, RenderTarget.Handle);\n            SDL.SDL_SetRenderDrawColor(Renderer, 0, 0, 0, 255);\n            SDL.SDL_RenderClear(Renderer);\n\n            // Update game logic:\n            Game.Update();\n\n            // Figure out how to scale our render target to fill the window:\n            int windowWidth, windowHeight;\n            SDL.SDL_GetWindowSize(Window, out windowWidth, out windowHeight);\n            float renderTargetScale = ((float)windowWidth / windowHeight > Game.Resolution.X / Game.Resolution.Y)\n                ? windowHeight / Game.Resolution.Y\n                : windowWidth / Game.Resolution.X;\n\n            // Copy the render target to the screen:\n            SDL.SDL_SetRenderTarget(Renderer, IntPtr.Zero);\n            SDL.SDL_SetRenderDrawColor(Renderer, 0, 0, 0, 255);\n            SDL.SDL_RenderClear(Renderer);\n            Vector2 renderTargetSize = Game.Resolution * renderTargetScale;\n            Vector2 renderTargetPos = 0.5f * (new Vector2(windowWidth, windowHeight) - renderTargetSize);\n            DrawTexture(RenderTarget, renderTargetPos, size: renderTargetSize, scaleMode: TextureScaleMode.Nearest);\n\n            // Present the screen:\n            SDL.SDL_RenderPresent(Renderer);\n\n            // Process post-update engine logic:\n            FreeUnusedTextCacheEntries();\n        }\n    }\n}\n"
  },
  {
    "path": "Engine/Graphics.cs",
    "content": "﻿using SDL2;\nusing System;\nusing System.Collections.Generic;\n\nstatic partial class Engine\n{\n    private static IntPtr Renderer;\n    private static Dictionary<Tuple<Font, string>, TextCacheEntry> TextCache = new Dictionary<Tuple<Font, string>, TextCacheEntry>();\n\n    // ======================================================================================\n    // Primitive drawing\n    // ======================================================================================\n\n    private static void DrawPrimitiveSetup(Color color)\n    {\n        SDL.SDL_SetRenderDrawColor(Renderer, color.R, color.G, color.B, color.A);\n        SDL.SDL_SetRenderDrawBlendMode(Renderer, SDL.SDL_BlendMode.SDL_BLENDMODE_BLEND);\n    }\n\n    /// <summary>\n    /// Draws a line.\n    /// </summary>\n    /// <param name=\"start\">The start of the line.</param>\n    /// <param name=\"end\">The end of the line.</param>\n    /// <param name=\"color\">The color of the line.</param>\n    public static void DrawLine(Vector2 start, Vector2 end, Color color)\n    {\n        DrawPrimitiveSetup(color);\n\n        SDL.SDL_RenderDrawLine(Renderer, (int)start.X, (int)start.Y, (int)end.X, (int)end.Y);\n    }\n\n    /// <summary>\n    /// Draws an empty rectangle.\n    /// </summary>\n    /// <param name=\"bounds\">The bounds of the rectangle.</param>\n    /// <param name=\"color\">The color of the rectangle.</param>\n    public static void DrawRectEmpty(Bounds2 bounds, Color color)\n    {\n        DrawPrimitiveSetup(color);\n\n        SDL.SDL_Rect rect = new SDL.SDL_Rect();\n        rect.x = (int)bounds.Position.X;\n        rect.y = (int)bounds.Position.Y;\n        rect.w = (int)bounds.Size.X;\n        rect.h = (int)bounds.Size.Y;\n        SDL.SDL_RenderDrawRect(Renderer, ref rect);\n    }\n\n    /// <summary>\n    /// Draws a solid rectangle.\n    /// </summary>\n    /// <param name=\"bounds\">The bounds of the rectangle.</param>\n    /// <param name=\"color\">The color of the rectangle.</param>\n    public static void DrawRectSolid(Bounds2 bounds, Color color)\n    {\n        DrawPrimitiveSetup(color);\n\n        SDL.SDL_Rect rect = new SDL.SDL_Rect();\n        rect.x = (int)bounds.Position.X;\n        rect.y = (int)bounds.Position.Y;\n        rect.w = (int)bounds.Size.X;\n        rect.h = (int)bounds.Size.Y;\n        SDL.SDL_RenderFillRect(Renderer, ref rect);\n    }\n\n    // ======================================================================================\n    // Texture drawing\n    // ======================================================================================\n\n    private static void DrawTextureSetup(IntPtr textureHandle, Color? color, TextureBlendMode blendMode, TextureScaleMode scaleMode)\n    {\n        Color finalColor = color ?? Color.White;\n        SDL.SDL_SetTextureColorMod(textureHandle, finalColor.R, finalColor.G, finalColor.B);\n        SDL.SDL_SetTextureAlphaMod(textureHandle, finalColor.A);\n        SDL.SDL_SetTextureBlendMode(textureHandle, (SDL.SDL_BlendMode)blendMode);\n        SDL.SDL_SetTextureScaleMode(textureHandle, (SDL.SDL_ScaleMode)scaleMode);\n    }\n\n    /// <summary>\n    /// Draws a texture.\n    /// </summary>\n    /// <param name=\"texture\">The texture to draw.</param>\n    /// <param name=\"position\">The position where the texture will be drawn.</param>\n    /// <param name=\"color\">The color to multiply with the colors of the texture. If unspecified the colors of the texture will be unchanged.</param>\n    /// <param name=\"size\">The destination size of the texture. If unspecified the original texture size will be used.</param>\n    /// <param name=\"rotation\">The amount the texture will be rotated clockwise (in degrees). If unspecified the texture will not be rotated.</param>\n    /// <param name=\"pivot\">The offset from position to the pivot that the texture will be rotated about. If unspecified the center of the destination bounds will be used.</param>\n    /// <param name=\"mirror\">The mirroring to apply to the texture. If unspecified the texture will not be mirrored.</param>\n    /// <param name=\"source\">The source bounds of the texture to draw. If unspecified the entire texture will be drawn.</param>\n    /// <param name=\"blendMode\">The blend mode to use when drawing the texture. If unspecified the texture will be drawn using the standard alpha-based blend mode.</param>\n    /// <param name=\"scaleMode\">The scale mode to use when drawing the texture. If unspecified the texture will be linearly interpolated.</param>\n    public static void DrawTexture(Texture texture, Vector2 position, Color? color = null, Vector2? size = null, float rotation = 0, Vector2? pivot = null, TextureMirror mirror = TextureMirror.None, Bounds2? source = null, TextureBlendMode blendMode = TextureBlendMode.Normal, TextureScaleMode scaleMode = TextureScaleMode.Linear)\n    {\n        DrawTextureSetup(texture.Handle, color, blendMode, scaleMode);\n\n        SDL.SDL_Rect src;\n        SDL.SDL_Rect dest;\n        if (source.HasValue)\n        {\n            // Use the specified source coordinates:\n            src.x = (int)source.Value.Position.X;\n            src.y = (int)source.Value.Position.Y;\n            src.w = (int)source.Value.Size.X;\n            src.h = (int)source.Value.Size.Y;\n            dest.x = (int)position.X;\n            dest.y = (int)position.Y;\n            dest.w = src.w;\n            dest.h = src.h;\n        }\n        else\n        {\n            // Use the full texture as the source:\n            src.x = 0;\n            src.y = 0;\n            src.w = texture.Width;\n            src.h = texture.Height;\n            dest.x = (int)position.X;\n            dest.y = (int)position.Y;\n            dest.w = texture.Width;\n            dest.h = texture.Height;\n        }\n\n        // Apply the size override, if specified:\n        if (size.HasValue)\n        {\n            dest.w = (int)size.Value.X;\n            dest.h = (int)size.Value.Y;\n        }\n\n        // Apply the pivot override, if specified:\n        SDL.SDL_Point center;\n        if (pivot.HasValue)\n        {\n            center.x = (int)pivot.Value.X;\n            center.y = (int)pivot.Value.Y;\n        }\n        else\n        {\n            center.x = dest.w / 2;\n            center.y = dest.h / 2;\n        }\n\n        SDL.SDL_RenderCopyEx(Renderer, texture.Handle, ref src, ref dest, rotation, ref center, (SDL.SDL_RendererFlip)mirror);\n    }\n\n    /// <summary>\n    /// Draws a resizable texture.\n    /// See the documentation for an explanation of how resizable textures work.\n    /// </summary>\n    /// <param name=\"texture\">The resizable texture to draw.</param>\n    /// <param name=\"bounds\">The bounds that the texture should be resized to.</param>\n    /// <param name=\"color\">The color to multiply with the colors of the texture. If unspecified the colors of the texture will be unchanged.</param>\n    /// <param name=\"blendMode\">The blend mode to use when drawing the texture. If unspecified the texture will be drawn using the standard alpha-based blend mode.</param>\n    /// <param name=\"scaleMode\">The scale mode to use when drawing the texture. If unspecified the texture will be linearly interpolated.</param>\n    public static void DrawResizableTexture(ResizableTexture texture, Bounds2 bounds, Color? color = null, TextureBlendMode blendMode = TextureBlendMode.Normal, TextureScaleMode scaleMode = TextureScaleMode.Linear)\n    {\n        DrawTextureSetup(texture.Handle, color, blendMode, scaleMode);\n\n        /*    \n         *   0    bxmin     bxmax    txmax\n         *   v    v             v    v\n         *   +----|-------------|----+ < tymax\n         *   | 1  |      5      | 2  |\n         *   -----+-------------+----- < bymax\n         *   |    |             |    |\n         *   |    |             |    |\n         *   | 6  |      9      | 7  |\n         *   |    |             |    |\n         *   |    |             |    |\n         *   -----+-------------+----- < bymin\n         *   | 3  |      8      | 4  |\n         *   +----|-------------|----+ < 0\n         */\n\n        int bxmin = texture.LeftOffset;\n        int bxmax = texture.RightOffset;\n        int bymin = texture.TopOffset;\n        int bymax = texture.BottomOffset;\n        int txmax = texture.Width;\n        int tymax = texture.Height;\n        int px = (int)bounds.Position.X;\n        int py = (int)bounds.Position.Y;\n        \n        // Don't let the overall size be so small that segment 9 has a negative size in either dimension:\n        int sx = Math.Max((int)bounds.Size.X, txmax - bxmax + bxmin);\n        int sy = Math.Max((int)bounds.Size.Y, tymax - bymax + bymin);\n\n        // Draw each of the nine segments:\n        DrawResizableTextureSegment(texture, 0, 0, bxmin, bymin, px, py, bxmin, bymin);\n        DrawResizableTextureSegment(texture, bxmax, 0, txmax - bxmax, bymin, px + sx - (txmax - bxmax), py, txmax - bxmax, bymin);\n        DrawResizableTextureSegment(texture, 0, bymax, bxmin, tymax - bymax, px, py + sy - (tymax - bymax), bxmin, tymax - bymax);\n        DrawResizableTextureSegment(texture, bxmax, bymax, txmax - bxmax, tymax - bymax, px + sx - (txmax - bxmax), py + sy - (tymax - bymax), txmax - bxmax, tymax - bymax);\n        DrawResizableTextureSegment(texture, bxmin, 0, bxmax - bxmin, bymin, px + bxmin, py, sx - bxmin - (txmax - bxmax), bymin);\n        DrawResizableTextureSegment(texture, 0, bymin, bxmin, bymax - bymin, px, py + bymin, bxmin, sy - bymin - (tymax - bymax));\n        DrawResizableTextureSegment(texture, bxmax, bymin, txmax - bxmax, bymax - bymin, px + sx - (txmax - bxmax), py + bymin, txmax - bxmax, sy - bymin - (tymax - bymax));\n        DrawResizableTextureSegment(texture, bxmin, bymax, bxmax - bxmin, tymax - bymax, px + bxmin, py + sy - (tymax - bymax), sx - bxmin - (txmax - bxmax), tymax - bymax);\n        DrawResizableTextureSegment(texture, bxmin, bymin, bxmax - bxmin, bymax - bymin, px + bxmin, py + bymin, sx - bxmin - (txmax - bxmax), sy - bymin - (tymax - bymax));\n    }\n\n    private static void DrawResizableTextureSegment(ResizableTexture texture, int subtextureX, int subtextureY, int subtextureW, int subtextureH, int destX, int destY, int destW, int destH)\n    {\n        // Don't draw invisible segments:\n        if (subtextureW <= 0 || subtextureH <= 0)\n        {\n            return;\n        }\n\n        SDL.SDL_Rect src;\n        src.x = subtextureX;\n        src.y = subtextureY;\n        src.w = subtextureW;\n        src.h = subtextureH;\n\n        SDL.SDL_Rect dest;\n        dest.x = destX;\n        dest.y = destY;\n        dest.w = destW;\n        dest.h = destH;\n\n        SDL.SDL_RenderCopy(Renderer, texture.Handle, ref src, ref dest);\n    }\n\n    // ======================================================================================\n    // Text drawing\n    // ======================================================================================\n\n    /// <summary>\n    /// Draws a text string. Returns the bounds of the drawn text.\n    /// </summary>\n    /// <param name=\"text\">The text to draw.</param>\n    /// <param name=\"position\">The position where the text will be drawn.</param>\n    /// <param name=\"color\">The color of the text.</param>\n    /// <param name=\"font\">The font to use to draw the text.</param>\n    /// <param name=\"alignment\">The alignment of the text relative to the position. If unspecified the text will be drawn left-aligned.</param>\n    /// <param name=\"measureOnly\">If true the text will only be measured and not actually drawn to the screen.</param>\n    public static Bounds2 DrawString(string text, Vector2 position, Color color, Font font, TextAlignment alignment = TextAlignment.Left, bool measureOnly = false)\n    {\n        // Every time we draw a string we have to render it into a texture, which isn't the fastest thing in the world.\n        // To make this faster we keep a cache of recently rendered strings and reuse them when possible.\n\n        Tuple<Font, string> textCacheKey = Tuple.Create(font, text);\n        TextCacheEntry entry;\n        if (TextCache.TryGetValue(textCacheKey, out entry))\n        {\n            // We found the text in the cache, so use it and reset its age so that it doesn't get freed this frame:\n            entry.Age = 0;\n        }\n        else\n        {\n            // We were unable to find the text in the cache, so render it to a texture and cache it for later:\n            SDL.SDL_Color white = new SDL.SDL_Color() { r = 255, g = 255, b = 255, a = 255 };\n            IntPtr surface = SDL_ttf.TTF_RenderText_Blended(font.Handle, text, white);\n            IntPtr handle = SDL.SDL_CreateTextureFromSurface(Renderer, surface);\n            SDL.SDL_FreeSurface(surface);\n            entry = new TextCacheEntry(handle);\n            TextCache[textCacheKey] = entry;\n        }\n\n        // Query the texture dimensions:\n        uint format;\n        int access, width, height;\n        SDL.SDL_QueryTexture(entry.Handle, out format, out access, out width, out height);\n\n        // Apply text alignment relative to the draw position:\n        if (alignment == TextAlignment.Center)\n        {\n            position.X -= width / 2;\n        }\n        else if (alignment == TextAlignment.Right)\n        {\n            position.X -= width;\n        }\n\n        // If we're not only measuring the text, draw it:\n        if (!measureOnly)\n        {\n            Texture texture = new Texture(entry.Handle, width, height);\n            DrawTexture(texture, position, color);\n        }\n\n        // Return the bounds of the text:\n        return new Bounds2(position, new Vector2(width, height));\n    }\n\n    private static void FreeUnusedTextCacheEntries()\n    {\n        // Cache entries are aggressively purged, and will essentially only stick around when the same text is drawn every frame.\n\n        List<Tuple<Font, string>> expiredEntryKeys = new List<Tuple<Font, string>>();\n        foreach (var keyAndEntry in TextCache)\n        {\n            keyAndEntry.Value.Age += 1;\n            if (keyAndEntry.Value.Age > 2)\n            {\n                SDL.SDL_DestroyTexture(keyAndEntry.Value.Handle);\n                expiredEntryKeys.Add(keyAndEntry.Key);\n            }\n        }\n\n        foreach (Tuple<Font, string> key in expiredEntryKeys)\n        {\n            TextCache.Remove(key);\n        }\n    }\n\n    private class TextCacheEntry\n    {\n        public readonly IntPtr Handle;\n        public int Age;\n\n        public TextCacheEntry(IntPtr handle)\n        {\n            Handle = handle;\n            Age = 0;\n        }\n    }\n}\n\nenum TextAlignment\n{\n    /// <summary>\n    /// Left-align the text.\n    /// </summary>\n    Left,\n\n    /// <summary>\n    /// Center the text.\n    /// </summary>\n    Center,\n\n    /// <summary>\n    /// Right-align the text.\n    /// </summary>\n    Right,\n}\n\n[Flags]\nenum TextureMirror\n{\n    /// <summary>\n    /// Do not mirror the texture.\n    /// </summary>\n    None = SDL.SDL_RendererFlip.SDL_FLIP_NONE,\n\n    /// <summary>\n    /// Mirror the texture horizontally.\n    /// </summary>\n    Horizontal = SDL.SDL_RendererFlip.SDL_FLIP_HORIZONTAL,\n\n    /// <summary>\n    /// Mirror the texture vertically.\n    /// </summary>\n    Vertical = SDL.SDL_RendererFlip.SDL_FLIP_VERTICAL,\n\n    /// <summary>\n    /// Mirror the texture horizontally and vertically. Equivalent to rotating it 180 degrees.\n    /// </summary>\n    Both = Horizontal | Vertical,\n}\n\nenum TextureBlendMode\n{\n    /// <summary>\n    /// Use a normal blend mode where new colors replace old colors based on the alpha of the new color.\n    /// </summary>\n    Normal = SDL.SDL_BlendMode.SDL_BLENDMODE_BLEND,\n\n    /// <summary>\n    /// Use an additive blend mode where new colors are simply added to old colors and get brighter.\n    /// </summary>\n    Additive = SDL.SDL_BlendMode.SDL_BLENDMODE_ADD,\n}\n\nenum TextureScaleMode\n{\n    /// <summary>\n    /// Use a linear scale mode that interpolates between pixels for a smooth but blurry image.\n    /// </summary>\n    Nearest = SDL.SDL_ScaleMode.SDL_ScaleModeNearest,\n\n    /// <summary>\n    /// Use a nearest neighbor scale mode that interpolates between pixels for a sharp but pixelated image.\n    /// </summary>\n    Linear = SDL.SDL_ScaleMode.SDL_ScaleModeLinear,\n}\n"
  },
  {
    "path": "Engine/Input.cs",
    "content": "﻿using SDL2;\nusing System;\nusing System.Collections.Generic;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nstatic partial class Engine\n{\n    private static HashSet<MouseButton> MouseButtonsDown = new HashSet<MouseButton>();\n    private static HashSet<MouseButton> MouseButtonsHeld = new HashSet<MouseButton>();\n    private static HashSet<MouseButton> MouseButtonsUp = new HashSet<MouseButton>();\n    private static HashSet<Key> KeysDown = new HashSet<Key>();\n    private static HashSet<Key> KeysDownAutorepeat = new HashSet<Key>();\n    private static HashSet<Key> KeysHeld = new HashSet<Key>();\n    private static HashSet<Key> KeysUp = new HashSet<Key>();\n    private static Dictionary<int, Gamepad> GamepadsByID = new Dictionary<int, Gamepad>();\n    private static Gamepad[] GamepadsByPlayer = new Gamepad[64];\n\n    /// <summary>\n    /// The current position of the mouse cursor (in pixels).\n    /// </summary>\n    public static Vector2 MousePosition { get; private set; }\n\n    /// <summary>\n    /// The change in position of the mouse cursor this frame (in pixels).\n    /// </summary>\n    public static Vector2 MouseMotion { get; private set; }\n\n    /// <summary>\n    /// The amount the mouse wheel has been scrolled this frame (in scroll units).\n    /// </summary>\n    public static float MouseScroll { get; private set; }\n\n    /// <summary>\n    /// The textual representation of the keys that were pressed this frame.\n    /// </summary>\n    public static string TypedText { get; private set; }\n\n    private static void PollEvents()\n    {\n        // ======================================================================================\n        // Reset per-frame input flags\n        // ======================================================================================\n\n        MouseButtonsDown.Clear();\n        MouseButtonsUp.Clear();\n        MouseScroll = 0;\n\n        KeysDown.Clear();\n        KeysDownAutorepeat.Clear();\n        KeysUp.Clear();\n        TypedText = \"\";\n        \n        foreach (Gamepad gamepad in GamepadsByID.Values)\n        {\n            gamepad.ButtonsDown.Clear();\n            gamepad.ButtonsUp.Clear();\n        }\n\n        // ======================================================================================\n        // Poll for new events from SDL\n        // ======================================================================================\n\n        SDL.SDL_Event evt;\n        while (SDL.SDL_PollEvent(out evt) != 0)\n        {\n            if (evt.type == SDL.SDL_EventType.SDL_MOUSEMOTION)\n            {\n                MousePosition = new Vector2(evt.motion.x, evt.motion.y);\n                MouseMotion = new Vector2(evt.motion.xrel, evt.motion.yrel);\n            }\n            else if (evt.type == SDL.SDL_EventType.SDL_MOUSEBUTTONDOWN)\n            {\n                MouseButton button = (MouseButton)evt.button.button;\n                MouseButtonsDown.Add(button);\n                MouseButtonsHeld.Add(button);\n            }\n            else if (evt.type == SDL.SDL_EventType.SDL_MOUSEBUTTONUP)\n            {\n                MouseButton button = (MouseButton)evt.button.button;\n                MouseButtonsUp.Add(button);\n                MouseButtonsHeld.Remove(button);\n            }\n            else if (evt.type == SDL.SDL_EventType.SDL_MOUSEWHEEL)\n            {\n                MouseScroll = evt.wheel.y;\n            }\n            else if (evt.type == SDL.SDL_EventType.SDL_KEYDOWN)\n            {\n                if (evt.key.repeat == 0)\n                {\n                    KeysDown.Add((Key)evt.key.keysym.sym);\n                    KeysHeld.Add((Key)evt.key.keysym.sym);\n                }\n                else\n                {\n                    KeysDownAutorepeat.Add((Key)evt.key.keysym.sym);\n                }\n            }\n            else if (evt.type == SDL.SDL_EventType.SDL_KEYUP)\n            {\n                KeysUp.Add((Key)evt.key.keysym.sym);\n                KeysHeld.Remove((Key)evt.key.keysym.sym);\n            }\n            else if (evt.type == SDL.SDL_EventType.SDL_TEXTINPUT)\n            {\n                // Convert the byte array into a C# string:\n                string text = null;\n                unsafe\n                {\n                    byte[] bufferCopy = new byte[SDL.SDL_TEXTINPUTEVENT_TEXT_SIZE];\n                    Marshal.Copy((IntPtr)evt.text.text, bufferCopy, 0, bufferCopy.Length);\n                    text = Encoding.UTF8.GetString(bufferCopy);\n                }\n\n                TypedText += text[0];\n            }\n            else if (evt.type == SDL.SDL_EventType.SDL_CONTROLLERDEVICEADDED)\n            {\n                // Create the gamepad object:\n                IntPtr handle = SDL.SDL_GameControllerOpen(evt.cdevice.which);\n                Gamepad gamepad = new Gamepad(handle);\n\n                // All other gamepad events use the \"joystick instance ID\" to identify the gamepad:\n                int id = SDL.SDL_JoystickInstanceID(SDL.SDL_GameControllerGetJoystick(handle));\n                GamepadsByID[id] = gamepad;\n\n                // Use the lowest available player number for this gamepad:\n                for (int i = 0; i < GamepadsByPlayer.Length; i++)\n                {\n                    if (GamepadsByPlayer[i] == null)\n                    {\n                        GamepadsByPlayer[i] = gamepad;\n                        break;\n                    }\n                }\n            }\n            else if (evt.type == SDL.SDL_EventType.SDL_CONTROLLERDEVICEREMOVED)\n            {\n                Gamepad gamepad;\n                if (GamepadsByID.TryGetValue(evt.cdevice.which, out gamepad))\n                {\n                    // Destroy the gamepad:\n                    SDL.SDL_GameControllerClose(gamepad.Handle);\n                    GamepadsByID.Remove(evt.cdevice.which);\n\n                    // Free up this player number for use by the next gamepad attached:\n                    for (int i = 0; i < GamepadsByPlayer.Length; i++)\n                    {\n                        if (GamepadsByPlayer[i] == gamepad)\n                        {\n                            GamepadsByPlayer[i] = null;\n                            break;\n                        }\n                    }\n                }\n            }\n            else if (evt.type == SDL.SDL_EventType.SDL_CONTROLLERAXISMOTION)\n            {\n                Gamepad gamepad;\n                if (GamepadsByID.TryGetValue(evt.caxis.which, out gamepad))\n                {\n                    float value = ((float)evt.caxis.axisValue) / short.MaxValue;\n                    switch ((SDL.SDL_GameControllerAxis)evt.caxis.axis)\n                    {\n                        case SDL.SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_LEFTX: gamepad.LeftStick.X = value; break;\n                        case SDL.SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_LEFTY: gamepad.LeftStick.Y = value; break;\n                        case SDL.SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_RIGHTX: gamepad.RightStick.X = value; break;\n                        case SDL.SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_RIGHTY: gamepad.RightStick.Y = value; break;\n                        case SDL.SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_TRIGGERLEFT: gamepad.Triggers.X = value; break;\n                        case SDL.SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_TRIGGERRIGHT: gamepad.Triggers.Y = value; break;\n                    }\n                }\n            }\n            else if (evt.type == SDL.SDL_EventType.SDL_CONTROLLERBUTTONDOWN)\n            {\n                Gamepad gamepad;\n                if (GamepadsByID.TryGetValue(evt.cbutton.which, out gamepad))\n                {\n                    GamepadButton button = (GamepadButton)evt.cbutton.button;\n                    gamepad.ButtonsDown.Add(button);\n                    gamepad.ButtonsHeld.Add(button);\n                }\n            }\n            else if (evt.type == SDL.SDL_EventType.SDL_CONTROLLERBUTTONUP)\n            {\n                Gamepad gamepad;\n                if (GamepadsByID.TryGetValue(evt.cbutton.which, out gamepad))\n                {\n                    GamepadButton button = (GamepadButton)evt.cbutton.button;\n                    gamepad.ButtonsUp.Add(button);\n                    gamepad.ButtonsHeld.Remove(button);\n                }\n            }\n            else if (evt.type == SDL.SDL_EventType.SDL_QUIT)\n            {\n                Environment.Exit(0);\n            }\n        }\n    }\n\n    // ======================================================================================\n    // Mouse input\n    // ======================================================================================\n\n    /// <summary>\n    /// Sets the mouse mode, which controls the visibility and lock state of the cursor.\n    /// </summary>\n    /// <param name=\"mode\">The mouse mode to set.</param>\n    public static void SetMouseMode(MouseMode mode)\n    {\n        switch (mode)\n        {\n            case MouseMode.Visible:\n                SDL.SDL_SetRelativeMouseMode(SDL.SDL_bool.SDL_FALSE);\n                SDL.SDL_ShowCursor(1);\n                break;\n            case MouseMode.Hidden:\n                SDL.SDL_SetRelativeMouseMode(SDL.SDL_bool.SDL_FALSE);\n                SDL.SDL_ShowCursor(0);\n                break;\n            case MouseMode.Locked:\n                SDL.SDL_SetRelativeMouseMode(SDL.SDL_bool.SDL_TRUE);\n                break;\n        }\n    }\n\n    /// <summary>\n    /// Returns true if a mouse button was pressed down this frame.\n    /// </summary>\n    /// <param name=\"button\">The mouse button to query.</param>\n    public static bool GetMouseButtonDown(MouseButton button)\n    {\n        return MouseButtonsDown.Contains(button);\n    }\n\n    /// <summary>\n    /// Returns true if a mouse button was held during this frame.\n    /// </summary>\n    /// <param name=\"button\">The mouse button to query.</param>\n    public static bool GetMouseButtonHeld(MouseButton button)\n    {\n        return MouseButtonsHeld.Contains(button);\n    }\n\n    /// <summary>\n    /// Returns true if a mouse button was released this frame.\n    /// </summary>\n    /// <param name=\"button\"></param>\n    public static bool GetMouseButtonUp(MouseButton button)\n    {\n        return MouseButtonsUp.Contains(button);\n    }\n\n    // ======================================================================================\n    // Keyboard input\n    // ======================================================================================\n\n    /// <summary>\n    /// Returns true if a key was pressed down this frame.\n    /// </summary>\n    /// <param name=\"key\">The key to query.</param>\n    /// <param name=\"allowAutorepeat\">Whether or not key-down events generated by autorepeat will be included.</param>\n    public static bool GetKeyDown(Key key, bool allowAutorepeat = false)\n    {\n        if (allowAutorepeat && KeysDownAutorepeat.Contains(key))\n        {\n            return true;\n        }\n\n        return KeysDown.Contains(key);\n    }\n\n    /// <summary>\n    /// Returns true if a key was held during this frame.\n    /// </summary>\n    /// <param name=\"key\">The key to query.</param>\n    public static bool GetKeyHeld(Key key)\n    {\n        return KeysHeld.Contains(key);\n    }\n\n    /// <summary>\n    /// Returns true if a key was released this frame.\n    /// </summary>\n    /// <param name=\"key\">The key to query.</param>\n    public static bool GetKeyUp(Key key)\n    {\n        return KeysUp.Contains(key);\n    }\n\n    // ======================================================================================\n    // Gamepad input\n    // ======================================================================================\n\n    /// <summary>\n    /// Returns true if a player's gamepad is connected.\n    /// </summary>\n    /// <param name=\"player\">The player to query, starting with 0.</param>\n    public static bool GetGamepadConnected(int player)\n    {\n        return player >= 0 && player < GamepadsByPlayer.Length && GamepadsByPlayer[player] != null;\n    }\n\n    /// <summary>\n    /// Reads the analog values of the specified axis on a player's gamepad.\n    /// </summary>\n    /// <param name=\"player\">The player to query, starting with 0.</param>\n    /// <param name=\"axis\">The gamepad axis to query.</param>\n    public static Vector2 GetGamepadAxis(int player, GamepadAxis axis)\n    {\n        if (GetGamepadConnected(player))\n        {\n            switch (axis)\n            {\n                case GamepadAxis.LeftStick: return GamepadsByPlayer[player].LeftStick;\n                case GamepadAxis.RightStick: return GamepadsByPlayer[player].RightStick;\n                case GamepadAxis.Triggers: return GamepadsByPlayer[player].Triggers;\n                default: throw new Exception(\"Unhandled case.\");\n            }\n        }\n        else\n        {\n            return Vector2.Zero;\n        }\n    }\n\n    /// <summary>\n    /// Returns true if a gamepad button was pressed down this frame.\n    /// </summary>\n    /// <param name=\"player\">The player to query, starting with 0.</param>\n    /// <param name=\"button\">The gamepad button to query.</param>\n    /// <returns></returns>\n    public static bool GetGamepadButtonDown(int player, GamepadButton button)\n    {\n        if (GetGamepadConnected(player))\n        {\n            return GamepadsByPlayer[player].ButtonsDown.Contains(button);\n        }\n        else\n        {\n            return false;\n        }\n    }\n\n    /// <summary>\n    /// Returns true if a gamepad button was held during this frame.\n    /// </summary>\n    /// <param name=\"player\">The player to query, starting with 0.</param>\n    /// <param name=\"button\">The gamepad button to query.</param>\n    /// <returns></returns>\n    public static bool GetGamepadButtonHeld(int player, GamepadButton button)\n    {\n        if (GetGamepadConnected(player))\n        {\n            return GamepadsByPlayer[player].ButtonsHeld.Contains(button);\n        }\n        else\n        {\n            return false;\n        }\n    }\n\n    /// <summary>\n    /// Returns true if a gamepad button was released this frame.\n    /// </summary>\n    /// <param name=\"player\">The player to query, starting with 0.</param>\n    /// <param name=\"button\">The gamepad button to query.</param>\n    /// <returns></returns>\n    public static bool GetGamepadButtonUp(int player, GamepadButton button)\n    {\n        if (GetGamepadConnected(player))\n        {\n            return GamepadsByPlayer[player].ButtonsUp.Contains(button);\n        }\n        else\n        {\n            return false;\n        }\n    }\n\n    private class Gamepad\n    {\n        public readonly IntPtr Handle;\n        public readonly HashSet<GamepadButton> ButtonsDown = new HashSet<GamepadButton>();\n        public readonly HashSet<GamepadButton> ButtonsHeld = new HashSet<GamepadButton>();\n        public readonly HashSet<GamepadButton> ButtonsUp = new HashSet<GamepadButton>();\n        public Vector2 LeftStick = Vector2.Zero;\n        public Vector2 RightStick = Vector2.Zero;\n        public Vector2 Triggers = Vector2.Zero;\n\n        public Gamepad(IntPtr handle)\n        {\n            Handle = handle;\n        }\n    }\n}\n\npublic enum Key\n{\n    Return = '\\r',\n    Escape = 27,\n    Backspace = '\\b',\n    Tab = '\\t',\n    Space = ' ',\n    Exclamation = '!',\n    DoubleQuote = '\"',\n    Hash = '#',\n    Percent = '%',\n    Dollar = '$',\n    Ampersand = '&',\n    SingleQuote = '\\'',\n    LeftParen = '(',\n    RightParen = ')',\n    Asterisk = '*',\n    Plus = '+',\n    Comma = ',',\n    Minus = '-',\n    Period = '.',\n    Slash = '/',\n    NumRow0 = '0',\n    NumRow1 = '1',\n    NumRow2 = '2',\n    NumRow3 = '3',\n    NumRow4 = '4',\n    NumRow5 = '5',\n    NumRow6 = '6',\n    NumRow7 = '7',\n    NumRow8 = '8',\n    NumRow9 = '9',\n    Colon = ':',\n    Semicolon = ';',\n    Less = '<',\n    Equals = '=',\n    Greater = '>',\n    Question = '?',\n    At = '@',\n    LeftBracket = '[',\n    Backslash = '\\\\',\n    RightBracket = ']',\n    Caret = '^',\n    Underscore = '_',\n    Backquote = '`',\n    A = 'a',\n    B = 'b',\n    C = 'c',\n    D = 'd',\n    E = 'e',\n    F = 'f',\n    G = 'g',\n    H = 'h',\n    I = 'i',\n    J = 'j',\n    K = 'k',\n    L = 'l',\n    M = 'm',\n    N = 'n',\n    O = 'o',\n    P = 'p',\n    Q = 'q',\n    R = 'r',\n    S = 's',\n    T = 't',\n    U = 'u',\n    V = 'v',\n    W = 'w',\n    X = 'x',\n    Y = 'y',\n    Z = 'z',\n    CapsLock = SDL.SDL_Scancode.SDL_SCANCODE_CAPSLOCK | SDL.SDLK_SCANCODE_MASK,\n    F1 = SDL.SDL_Scancode.SDL_SCANCODE_F1 | SDL.SDLK_SCANCODE_MASK,\n    F2 = SDL.SDL_Scancode.SDL_SCANCODE_F2 | SDL.SDLK_SCANCODE_MASK,\n    F3 = SDL.SDL_Scancode.SDL_SCANCODE_F3 | SDL.SDLK_SCANCODE_MASK,\n    F4 = SDL.SDL_Scancode.SDL_SCANCODE_F4 | SDL.SDLK_SCANCODE_MASK,\n    F5 = SDL.SDL_Scancode.SDL_SCANCODE_F5 | SDL.SDLK_SCANCODE_MASK,\n    F6 = SDL.SDL_Scancode.SDL_SCANCODE_F6 | SDL.SDLK_SCANCODE_MASK,\n    F7 = SDL.SDL_Scancode.SDL_SCANCODE_F7 | SDL.SDLK_SCANCODE_MASK,\n    F8 = SDL.SDL_Scancode.SDL_SCANCODE_F8 | SDL.SDLK_SCANCODE_MASK,\n    F9 = SDL.SDL_Scancode.SDL_SCANCODE_F9 | SDL.SDLK_SCANCODE_MASK,\n    F10 = SDL.SDL_Scancode.SDL_SCANCODE_F10 | SDL.SDLK_SCANCODE_MASK,\n    F11 = SDL.SDL_Scancode.SDL_SCANCODE_F11 | SDL.SDLK_SCANCODE_MASK,\n    F12 = SDL.SDL_Scancode.SDL_SCANCODE_F12 | SDL.SDLK_SCANCODE_MASK,\n    PrintScreen = SDL.SDL_Scancode.SDL_SCANCODE_PRINTSCREEN | SDL.SDLK_SCANCODE_MASK,\n    ScrollLock = SDL.SDL_Scancode.SDL_SCANCODE_SCROLLLOCK | SDL.SDLK_SCANCODE_MASK,\n    Pause = SDL.SDL_Scancode.SDL_SCANCODE_PAUSE | SDL.SDLK_SCANCODE_MASK,\n    Insert = SDL.SDL_Scancode.SDL_SCANCODE_INSERT | SDL.SDLK_SCANCODE_MASK,\n    Home = SDL.SDL_Scancode.SDL_SCANCODE_HOME | SDL.SDLK_SCANCODE_MASK,\n    PageUp = SDL.SDL_Scancode.SDL_SCANCODE_PAGEUP | SDL.SDLK_SCANCODE_MASK,\n    Delete = 127,\n    End = SDL.SDL_Scancode.SDL_SCANCODE_END | SDL.SDLK_SCANCODE_MASK,\n    PageDown = SDL.SDL_Scancode.SDL_SCANCODE_PAGEDOWN | SDL.SDLK_SCANCODE_MASK,\n    Right = SDL.SDL_Scancode.SDL_SCANCODE_RIGHT | SDL.SDLK_SCANCODE_MASK,\n    Left = SDL.SDL_Scancode.SDL_SCANCODE_LEFT | SDL.SDLK_SCANCODE_MASK,\n    Down = SDL.SDL_Scancode.SDL_SCANCODE_DOWN | SDL.SDLK_SCANCODE_MASK,\n    Up = SDL.SDL_Scancode.SDL_SCANCODE_UP | SDL.SDLK_SCANCODE_MASK,\n    NumpadDivide = SDL.SDL_Scancode.SDL_SCANCODE_KP_DIVIDE | SDL.SDLK_SCANCODE_MASK,\n    NumpadMultiply = SDL.SDL_Scancode.SDL_SCANCODE_KP_MULTIPLY | SDL.SDLK_SCANCODE_MASK,\n    NumpadMinus = SDL.SDL_Scancode.SDL_SCANCODE_KP_MINUS | SDL.SDLK_SCANCODE_MASK,\n    NumpadPlus = SDL.SDL_Scancode.SDL_SCANCODE_KP_PLUS | SDL.SDLK_SCANCODE_MASK,\n    NumpadEnter = SDL.SDL_Scancode.SDL_SCANCODE_KP_ENTER | SDL.SDLK_SCANCODE_MASK,\n    Numpad1 = SDL.SDL_Scancode.SDL_SCANCODE_KP_1 | SDL.SDLK_SCANCODE_MASK,\n    Numpad2 = SDL.SDL_Scancode.SDL_SCANCODE_KP_2 | SDL.SDLK_SCANCODE_MASK,\n    Numpad3 = SDL.SDL_Scancode.SDL_SCANCODE_KP_3 | SDL.SDLK_SCANCODE_MASK,\n    Numpad4 = SDL.SDL_Scancode.SDL_SCANCODE_KP_4 | SDL.SDLK_SCANCODE_MASK,\n    Numpad5 = SDL.SDL_Scancode.SDL_SCANCODE_KP_5 | SDL.SDLK_SCANCODE_MASK,\n    Numpad6 = SDL.SDL_Scancode.SDL_SCANCODE_KP_6 | SDL.SDLK_SCANCODE_MASK,\n    Numpad7 = SDL.SDL_Scancode.SDL_SCANCODE_KP_7 | SDL.SDLK_SCANCODE_MASK,\n    Numpad8 = SDL.SDL_Scancode.SDL_SCANCODE_KP_8 | SDL.SDLK_SCANCODE_MASK,\n    Numpad9 = SDL.SDL_Scancode.SDL_SCANCODE_KP_9 | SDL.SDLK_SCANCODE_MASK,\n    Numpad0 = SDL.SDL_Scancode.SDL_SCANCODE_KP_0 | SDL.SDLK_SCANCODE_MASK,\n    NumpadPeriod = SDL.SDL_Scancode.SDL_SCANCODE_KP_PERIOD | SDL.SDLK_SCANCODE_MASK,\n    LeftControl = SDL.SDL_Scancode.SDL_SCANCODE_LCTRL | SDL.SDLK_SCANCODE_MASK,\n    LeftShift = SDL.SDL_Scancode.SDL_SCANCODE_LSHIFT | SDL.SDLK_SCANCODE_MASK,\n    LeftAlt = SDL.SDL_Scancode.SDL_SCANCODE_LALT | SDL.SDLK_SCANCODE_MASK,\n    RightControl = SDL.SDL_Scancode.SDL_SCANCODE_RCTRL | SDL.SDLK_SCANCODE_MASK,\n    RightShift = SDL.SDL_Scancode.SDL_SCANCODE_RSHIFT | SDL.SDLK_SCANCODE_MASK,\n    RightAlt = SDL.SDL_Scancode.SDL_SCANCODE_RALT | SDL.SDLK_SCANCODE_MASK,\n}\n\npublic enum MouseMode\n{\n    /// <summary>\n    /// Show the cursor and allow it to move freely. The default mode.\n    /// </summary>\n    Visible,\n\n    /// <summary>\n    /// Hide the cursor and allow it to move freely. Useful for when you want to draw your own mouse cursor.\n    /// </summary>\n    Hidden,\n\n    /// <summary>\n    /// Hide the cursor and lock it to the center of the screen so that only MouseMotion is relevant. Useful for games like first-person shooters.\n    /// </summary>\n    Locked,\n}\n\npublic enum MouseButton\n{\n    Left = 1,\n    Middle = 2,\n    Right = 3,\n}\n\npublic enum GamepadButton\n{\n    A = 0,\n    B,\n    X,\n    Y,\n    Back,\n    Guide,\n    Start,\n    LeftStick,\n    RightStick,\n    LeftShoulder,\n    RightShoulder,\n    Up,\n    Down,\n    Left,\n    Right,\n}\n\npublic enum GamepadAxis\n{\n    /// <summary>\n    /// The left analog stick, with values from -1 to 1.\n    /// </summary>\n    LeftStick,\n\n    /// <summary>\n    /// The right analog stick, with values from -1 to 1. \n    /// </summary>\n    RightStick,\n\n    /// <summary>\n    /// The analog triggers, with the left trigger in X, the right trigger in Y, and values from 0 to 1.\n    /// </summary>\n    Triggers,\n}\n"
  },
  {
    "path": "Engine/SDL2/SDL2.cs",
    "content": "#region License\n/* SDL2# - C# Wrapper for SDL2\n *\n * Copyright (c) 2013-2020 Ethan Lee.\n *\n * This software is provided 'as-is', without any express or implied warranty.\n * In no event will the authors be held liable for any damages arising from\n * the use of this software.\n *\n * Permission is granted to anyone to use this software for any purpose,\n * including commercial applications, and to alter it and redistribute it\n * freely, subject to the following restrictions:\n *\n * 1. The origin of this software must not be misrepresented; you must not\n * claim that you wrote the original software. If you use this software in a\n * product, an acknowledgment in the product documentation would be\n * appreciated but is not required.\n *\n * 2. Altered source versions must be plainly marked as such, and must not be\n * misrepresented as being the original software.\n *\n * 3. This notice may not be removed or altered from any source distribution.\n *\n * Ethan \"flibitijibibo\" Lee <flibitijibibo@flibitijibibo.com>\n *\n */\n#endregion\n\n#region Using Statements\nusing System;\nusing System.Diagnostics;\nusing System.Runtime.InteropServices;\nusing System.Text;\n#endregion\n\nnamespace SDL2\n{\n\tpublic static class SDL\n\t{\n\t\t#region SDL2# Variables\n\n\t\tprivate const string nativeLibName = \"SDL2\";\n\n\t\t#endregion\n\n\t\t#region UTF8 Marshaling\n\n\t\t/* Used for stack allocated string marshaling. */\n\t\tinternal static int Utf8Size(string str)\n\t\t{\n\t\t\tDebug.Assert(str != null);\n\t\t\treturn (str.Length * 4) + 1;\n\t\t}\n\t\tinternal static int Utf8SizeNullable(string str)\n\t\t{\n\t\t\treturn str != null ? (str.Length * 4) + 1 : 0;\n\t\t}\n\t\tinternal static unsafe byte* Utf8Encode(string str, byte* buffer, int bufferSize)\n\t\t{\n\t\t\tDebug.Assert(str != null);\n\t\t\tfixed (char* strPtr = str)\n\t\t\t{\n\t\t\t\tEncoding.UTF8.GetBytes(strPtr, str.Length + 1, buffer, bufferSize);\n\t\t\t}\n\t\t\treturn buffer;\n\t\t}\n\t\tinternal static unsafe byte* Utf8EncodeNullable(string str, byte* buffer, int bufferSize)\n\t\t{\n\t\t\tif (str == null)\n\t\t\t{\n\t\t\t\treturn (byte*) 0;\n\t\t\t}\n\t\t\tfixed (char* strPtr = str)\n\t\t\t{\n\t\t\t\tEncoding.UTF8.GetBytes(strPtr, str.Length + 1, buffer, bufferSize);\n\t\t\t}\n\t\t\treturn buffer;\n\t\t}\n\n\t\t/* Used for heap allocated string marshaling.\n\t\t * Returned byte* must be free'd with FreeHGlobal.\n\t\t */\n\t\tinternal static unsafe byte* Utf8Encode(string str)\n\t\t{\n\t\t\tDebug.Assert(str != null);\n\t\t\tint bufferSize = Utf8Size(str);\n\t\t\tbyte* buffer = (byte*) Marshal.AllocHGlobal(bufferSize);\n\t\t\tfixed (char* strPtr = str)\n\t\t\t{\n\t\t\t\tEncoding.UTF8.GetBytes(strPtr, str.Length + 1, buffer, bufferSize);\n\t\t\t}\n\t\t\treturn buffer;\n\t\t}\n\t\tinternal static unsafe byte* Utf8EncodeNullable(string str)\n\t\t{\n\t\t\tif (str == null)\n\t\t\t{\n\t\t\t\treturn (byte*) 0;\n\t\t\t}\n\t\t\tint bufferSize = Utf8Size(str);\n\t\t\tbyte* buffer = (byte*) Marshal.AllocHGlobal(bufferSize);\n\t\t\tfixed (char* strPtr = str)\n\t\t\t{\n\t\t\t\tEncoding.UTF8.GetBytes(\n\t\t\t\t\tstrPtr,\n\t\t\t\t\t(str != null) ? (str.Length + 1) : 0,\n\t\t\t\t\tbuffer,\n\t\t\t\t\tbufferSize\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn buffer;\n\t\t}\n\n\t\t/* This is public because SDL_DropEvent needs it! */\n\t\tpublic static unsafe string UTF8_ToManaged(IntPtr s, bool freePtr = false)\n\t\t{\n\t\t\tif (s == IntPtr.Zero)\n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t/* We get to do strlen ourselves! */\n\t\t\tbyte* ptr = (byte*) s;\n\t\t\twhile (*ptr != 0)\n\t\t\t{\n\t\t\t\tptr++;\n\t\t\t}\n\n\t\t\t/* TODO: This #ifdef is only here because the equivalent\n\t\t\t * .NET 2.0 constructor appears to be less efficient?\n\t\t\t * Here's the pretty version, maybe steal this instead:\n\t\t\t *\n\t\t\tstring result = new string(\n\t\t\t\t(sbyte*) s, // Also, why sbyte???\n\t\t\t\t0,\n\t\t\t\t(int) (ptr - (byte*) s),\n\t\t\t\tSystem.Text.Encoding.UTF8\n\t\t\t);\n\t\t\t * See the CoreCLR source for more info.\n\t\t\t * -flibit\n\t\t\t */\n#if NETSTANDARD2_0\n\t\t\t/* Modern C# lets you just send the byte*, nice! */\n\t\t\tstring result = System.Text.Encoding.UTF8.GetString(\n\t\t\t\t(byte*) s,\n\t\t\t\t(int) (ptr - (byte*) s)\n\t\t\t);\n#else\n\t\t\t/* Old C# requires an extra memcpy, bleh! */\n\t\t\tint len = (int) (ptr - (byte*) s);\n\t\t\tif (len == 0)\n\t\t\t{\n\t\t\t\treturn string.Empty;\n\t\t\t}\n\t\t\tchar* chars = stackalloc char[len];\n\t\t\tint strLen = System.Text.Encoding.UTF8.GetChars((byte*) s, len, chars, len);\n\t\t\tstring result = new string(chars, 0, strLen);\n#endif\n\n\t\t\t/* Some SDL functions will malloc, we have to free! */\n\t\t\tif (freePtr)\n\t\t\t{\n\t\t\t\tSDL_free(s);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\t#endregion\n\n\t\t#region SDL_stdinc.h\n\n\t\tpublic static uint SDL_FOURCC(byte A, byte B, byte C, byte D)\n\t\t{\n\t\t\treturn (uint) (A | (B << 8) | (C << 16) | (D << 24));\n\t\t}\n\n\t\tpublic enum SDL_bool\n\t\t{\n\t\t\tSDL_FALSE = 0,\n\t\t\tSDL_TRUE = 1\n\t\t}\n\n\t\t/* malloc/free are used by the marshaler! -flibit */\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tinternal static extern IntPtr SDL_malloc(IntPtr size);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tinternal static extern void SDL_free(IntPtr memblock);\n\n\t\t/* Buffer.BlockCopy is not available in every runtime yet. Also,\n\t\t * using memcpy directly can be a compatibility issue in other\n\t\t * strange ways. So, we expose this to get around all that.\n\t\t * -flibit\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_memcpy(IntPtr dst, IntPtr src, IntPtr len);\n\n\t\t#endregion\n\n\t\t#region SDL_rwops.h\n\n\t\tpublic const int RW_SEEK_SET = 0;\n\t\tpublic const int RW_SEEK_CUR = 1;\n\t\tpublic const int RW_SEEK_END = 2;\n\n\t\tpublic const UInt32 SDL_RWOPS_UNKNOWN\t= 0; /* Unknown stream type */\n\t\tpublic const UInt32 SDL_RWOPS_WINFILE\t= 1; /* Win32 file */\n\t\tpublic const UInt32 SDL_RWOPS_STDFILE\t= 2; /* Stdio file */\n\t\tpublic const UInt32 SDL_RWOPS_JNIFILE\t= 3; /* Android asset */\n\t\tpublic const UInt32 SDL_RWOPS_MEMORY\t= 4; /* Memory stream */\n\t\tpublic const UInt32 SDL_RWOPS_MEMORY_RO = 5; /* Read-Only memory stream */\n\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate long SDLRWopsSizeCallback(IntPtr context);\n\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate long SDLRWopsSeekCallback(\n\t\t\tIntPtr context,\n\t\t\tlong offset,\n\t\t\tint whence\n\t\t);\n\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate IntPtr SDLRWopsReadCallback(\n\t\t\tIntPtr context,\n\t\t\tIntPtr ptr,\n\t\t\tIntPtr size,\n\t\t\tIntPtr maxnum\n\t\t);\n\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate IntPtr SDLRWopsWriteCallback(\n\t\t\tIntPtr context,\n\t\t\tIntPtr ptr,\n\t\t\tIntPtr size,\n\t\t\tIntPtr num\n\t\t);\n\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate int SDLRWopsCloseCallback(\n\t\t\tIntPtr context\n\t\t);\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_RWops\n\t\t{\n\t\t\tpublic IntPtr size;\n\t\t\tpublic IntPtr seek;\n\t\t\tpublic IntPtr read;\n\t\t\tpublic IntPtr write;\n\t\t\tpublic IntPtr close;\n\n\t\t\tpublic UInt32 type;\n\n\t\t\t/* NOTE: This isn't the full structure since\n\t\t\t * the native SDL_RWops contains a hidden union full of\n\t\t\t * internal information and platform-specific stuff depending\n\t\t\t * on what conditions the native library was built with\n\t\t\t */\n\t\t}\n\n\t\t/* IntPtr refers to an SDL_RWops* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_RWFromFile\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe IntPtr INTERNAL_SDL_RWFromFile(\n\t\t\tbyte* file,\n\t\t\tbyte* mode\n\t\t);\n\t\tpublic static unsafe IntPtr SDL_RWFromFile(\n\t\t\tstring file,\n\t\t\tstring mode\n\t\t) {\n\t\t\tbyte* utf8File = Utf8Encode(file);\n\t\t\tbyte* utf8Mode = Utf8Encode(mode);\n\t\t\tIntPtr rwOps = INTERNAL_SDL_RWFromFile(\n\t\t\t\tutf8File,\n\t\t\t\tutf8Mode\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8Mode);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8File);\n\t\t\treturn rwOps;\n\t\t}\n\n\t\t/* IntPtr refers to an SDL_RWops* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_AllocRW();\n\n\t\t/* area refers to an SDL_RWops* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_FreeRW(IntPtr area);\n\n\t\t/* fp refers to a void* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_RWFromFP(IntPtr fp, SDL_bool autoclose);\n\n\t\t/* mem refers to a void*, IntPtr to an SDL_RWops* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_RWFromMem(IntPtr mem, int size);\n\n\t\t/* mem refers to a const void*, IntPtr to an SDL_RWops* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_RWFromConstMem(IntPtr mem, int size);\n\n\t\t/* context refers to an SDL_RWops*.\n\t\t * Only available in SDL 2.0.10 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern long SDL_RWsize(IntPtr context);\n\n\t\t/* context refers to an SDL_RWops*.\n\t\t * Only available in SDL 2.0.10 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern long SDL_RWseek(\n\t\t\tIntPtr context,\n\t\t\tlong offset,\n\t\t\tint whence\n\t\t);\n\n\t\t/* context refers to an SDL_RWops*.\n\t\t * Only available in SDL 2.0.10 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern long SDL_RWtell(IntPtr context);\n\n\t\t/* context refers to an SDL_RWops*, ptr refers to a void*.\n\t\t * Only available in SDL 2.0.10 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern long SDL_RWread(\n\t\t\tIntPtr context,\n\t\t\tIntPtr ptr,\n\t\t\tIntPtr size,\n\t\t\tIntPtr maxnum\n\t\t);\n\n\t\t/* context refers to an SDL_RWops*, ptr refers to a const void*.\n\t\t * Only available in SDL 2.0.10 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern long SDL_RWwrite(\n\t\t\tIntPtr context,\n\t\t\tIntPtr ptr,\n\t\t\tIntPtr size,\n\t\t\tIntPtr maxnum\n\t\t);\n\n\t\t/* Read endian functions */\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern byte SDL_ReadU8(IntPtr src);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt16 SDL_ReadLE16(IntPtr src);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt16 SDL_ReadBE16(IntPtr src);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt32 SDL_ReadLE32(IntPtr src);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt32 SDL_ReadBE32(IntPtr src);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt64 SDL_ReadLE64(IntPtr src);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt64 SDL_ReadBE64(IntPtr src);\n\n\t\t/* Write endian functions */\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern uint SDL_WriteU8(IntPtr dst, byte value);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern uint SDL_WriteLE16(IntPtr dst, UInt16 value);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern uint SDL_WriteBE16(IntPtr dst, UInt16 value);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern uint SDL_WriteLE32(IntPtr dst, UInt32 value);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern uint SDL_WriteBE32(IntPtr dst, UInt32 value);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern uint SDL_WriteLE64(IntPtr dst, UInt64 value);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern uint SDL_WriteBE64(IntPtr dst, UInt64 value);\n\n\t\t/* context refers to an SDL_RWops*\n\t\t * Only available in SDL 2.0.10 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern long SDL_RWclose(IntPtr context);\n\n\t\t/* file refers to a const char*, datasize to a size_t*\n\t\t * IntPtr refers to a void*\n\t\t * Only available in SDL 2.0.10 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_LoadFile(IntPtr file, IntPtr datasize);\n\n\t\t#endregion\n\n\t\t#region SDL_main.h\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_SetMainReady();\n\n\t\t/* This is used as a function pointer to a C main() function */\n\t\tpublic delegate int SDL_main_func(int argc, IntPtr argv);\n\n\t\t/* Use this function with UWP to call your C# Main() function! */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_WinRTRunApp(\n\t\t\tSDL_main_func mainFunction,\n\t\t\tIntPtr reserved\n\t\t);\n\n\t\t/* Use this function with iOS to call your C# Main() function!\n\t\t * Only available in SDL 2.0.10 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_UIKitRunApp(\n\t\t\tint argc,\n\t\t\tIntPtr argv,\n\t\t\tSDL_main_func mainFunction\n\t\t);\n\n\t\t#endregion\n\n\t\t#region SDL.h\n\n\t\tpublic const uint SDL_INIT_TIMER =\t\t0x00000001;\n\t\tpublic const uint SDL_INIT_AUDIO =\t\t0x00000010;\n\t\tpublic const uint SDL_INIT_VIDEO =\t\t0x00000020;\n\t\tpublic const uint SDL_INIT_JOYSTICK =\t\t0x00000200;\n\t\tpublic const uint SDL_INIT_HAPTIC =\t\t0x00001000;\n\t\tpublic const uint SDL_INIT_GAMECONTROLLER =\t0x00002000;\n\t\tpublic const uint SDL_INIT_EVENTS =\t\t0x00004000;\n\t\tpublic const uint SDL_INIT_SENSOR =\t\t0x00008000;\n\t\tpublic const uint SDL_INIT_NOPARACHUTE =\t0x00100000;\n\t\tpublic const uint SDL_INIT_EVERYTHING = (\n\t\t\tSDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO |\n\t\t\tSDL_INIT_EVENTS | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC |\n\t\t\tSDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_Init(uint flags);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_InitSubSystem(uint flags);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_Quit();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_QuitSubSystem(uint flags);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern uint SDL_WasInit(uint flags);\n\n\t\t#endregion\n\n\t\t#region SDL_platform.h\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetPlatform\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GetPlatform();\n\t\tpublic static string SDL_GetPlatform()\n\t\t{\n\t\t\treturn UTF8_ToManaged(INTERNAL_SDL_GetPlatform());\n\t\t}\n\n\t\t#endregion\n\n\t\t#region SDL_hints.h\n\n\t\tpublic const string SDL_HINT_FRAMEBUFFER_ACCELERATION =\n\t\t\t\"SDL_FRAMEBUFFER_ACCELERATION\";\n\t\tpublic const string SDL_HINT_RENDER_DRIVER =\n\t\t\t\"SDL_RENDER_DRIVER\";\n\t\tpublic const string SDL_HINT_RENDER_OPENGL_SHADERS =\n\t\t\t\"SDL_RENDER_OPENGL_SHADERS\";\n\t\tpublic const string SDL_HINT_RENDER_DIRECT3D_THREADSAFE =\n\t\t\t\"SDL_RENDER_DIRECT3D_THREADSAFE\";\n\t\tpublic const string SDL_HINT_RENDER_VSYNC =\n\t\t\t\"SDL_RENDER_VSYNC\";\n\t\tpublic const string SDL_HINT_VIDEO_X11_XVIDMODE =\n\t\t\t\"SDL_VIDEO_X11_XVIDMODE\";\n\t\tpublic const string SDL_HINT_VIDEO_X11_XINERAMA =\n\t\t\t\"SDL_VIDEO_X11_XINERAMA\";\n\t\tpublic const string SDL_HINT_VIDEO_X11_XRANDR =\n\t\t\t\"SDL_VIDEO_X11_XRANDR\";\n\t\tpublic const string SDL_HINT_GRAB_KEYBOARD =\n\t\t\t\"SDL_GRAB_KEYBOARD\";\n\t\tpublic const string SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS =\n\t\t\t\"SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS\";\n\t\tpublic const string SDL_HINT_IDLE_TIMER_DISABLED =\n\t\t\t\"SDL_IOS_IDLE_TIMER_DISABLED\";\n\t\tpublic const string SDL_HINT_ORIENTATIONS =\n\t\t\t\"SDL_IOS_ORIENTATIONS\";\n\t\tpublic const string SDL_HINT_XINPUT_ENABLED =\n\t\t\t\"SDL_XINPUT_ENABLED\";\n\t\tpublic const string SDL_HINT_GAMECONTROLLERCONFIG =\n\t\t\t\"SDL_GAMECONTROLLERCONFIG\";\n\t\tpublic const string SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS =\n\t\t\t\"SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS\";\n\t\tpublic const string SDL_HINT_ALLOW_TOPMOST =\n\t\t\t\"SDL_ALLOW_TOPMOST\";\n\t\tpublic const string SDL_HINT_TIMER_RESOLUTION =\n\t\t\t\"SDL_TIMER_RESOLUTION\";\n\t\tpublic const string SDL_HINT_RENDER_SCALE_QUALITY =\n\t\t\t\"SDL_RENDER_SCALE_QUALITY\";\n\n\t\t/* Only available in SDL 2.0.1 or higher. */\n\t\tpublic const string SDL_HINT_VIDEO_HIGHDPI_DISABLED =\n\t\t\t\"SDL_VIDEO_HIGHDPI_DISABLED\";\n\n\t\t/* Only available in SDL 2.0.2 or higher. */\n\t\tpublic const string SDL_HINT_CTRL_CLICK_EMULATE_RIGHT_CLICK =\n\t\t\t\"SDL_CTRL_CLICK_EMULATE_RIGHT_CLICK\";\n\t\tpublic const string SDL_HINT_VIDEO_WIN_D3DCOMPILER =\n\t\t\t\"SDL_VIDEO_WIN_D3DCOMPILER\";\n\t\tpublic const string SDL_HINT_MOUSE_RELATIVE_MODE_WARP =\n\t\t\t\"SDL_MOUSE_RELATIVE_MODE_WARP\";\n\t\tpublic const string SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT =\n\t\t\t\"SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT\";\n\t\tpublic const string SDL_HINT_VIDEO_ALLOW_SCREENSAVER =\n\t\t\t\"SDL_VIDEO_ALLOW_SCREENSAVER\";\n\t\tpublic const string SDL_HINT_ACCELEROMETER_AS_JOYSTICK =\n\t\t\t\"SDL_ACCELEROMETER_AS_JOYSTICK\";\n\t\tpublic const string SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES =\n\t\t\t\"SDL_VIDEO_MAC_FULLSCREEN_SPACES\";\n\n\t\t/* Only available in SDL 2.0.3 or higher. */\n\t\tpublic const string SDL_HINT_WINRT_PRIVACY_POLICY_URL =\n\t\t\t\"SDL_WINRT_PRIVACY_POLICY_URL\";\n\t\tpublic const string SDL_HINT_WINRT_PRIVACY_POLICY_LABEL =\n\t\t\t\"SDL_WINRT_PRIVACY_POLICY_LABEL\";\n\t\tpublic const string SDL_HINT_WINRT_HANDLE_BACK_BUTTON =\n\t\t\t\"SDL_WINRT_HANDLE_BACK_BUTTON\";\n\n\t\t/* Only available in SDL 2.0.4 or higher. */\n\t\tpublic const string SDL_HINT_NO_SIGNAL_HANDLERS =\n\t\t\t\"SDL_NO_SIGNAL_HANDLERS\";\n\t\tpublic const string SDL_HINT_IME_INTERNAL_EDITING =\n\t\t\t\"SDL_IME_INTERNAL_EDITING\";\n\t\tpublic const string SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH =\n\t\t\t\"SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH\";\n\t\tpublic const string SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT =\n\t\t\t\"SDL_EMSCRIPTEN_KEYBOARD_ELEMENT\";\n\t\tpublic const string SDL_HINT_THREAD_STACK_SIZE =\n\t\t\t\"SDL_THREAD_STACK_SIZE\";\n\t\tpublic const string SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN =\n\t\t\t\"SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN\";\n\t\tpublic const string SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP =\n\t\t\t\"SDL_WINDOWS_ENABLE_MESSAGELOOP\";\n\t\tpublic const string SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 =\n\t\t\t\"SDL_WINDOWS_NO_CLOSE_ON_ALT_F4\";\n\t\tpublic const string SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING =\n\t\t\t\"SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING\";\n\t\tpublic const string SDL_HINT_MAC_BACKGROUND_APP =\n\t\t\t\"SDL_MAC_BACKGROUND_APP\";\n\t\tpublic const string SDL_HINT_VIDEO_X11_NET_WM_PING =\n\t\t\t\"SDL_VIDEO_X11_NET_WM_PING\";\n\t\tpublic const string SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION =\n\t\t\t\"SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION\";\n\t\tpublic const string SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION =\n\t\t\t\"SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION\";\n\n\t\t/* Only available in 2.0.5 or higher. */\n\t\tpublic const string SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH =\n\t\t\t\"SDL_MOUSE_FOCUS_CLICKTHROUGH\";\n\t\tpublic const string SDL_HINT_BMP_SAVE_LEGACY_FORMAT =\n\t\t\t\"SDL_BMP_SAVE_LEGACY_FORMAT\";\n\t\tpublic const string SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING =\n\t\t\t\"SDL_WINDOWS_DISABLE_THREAD_NAMING\";\n\t\tpublic const string SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION =\n\t\t\t\"SDL_APPLE_TV_REMOTE_ALLOW_ROTATION\";\n\n\t\t/* Only available in 2.0.6 or higher. */\n\t\tpublic const string SDL_HINT_AUDIO_RESAMPLING_MODE =\n\t\t\t\"SDL_AUDIO_RESAMPLING_MODE\";\n\t\tpublic const string SDL_HINT_RENDER_LOGICAL_SIZE_MODE =\n\t\t\t\"SDL_RENDER_LOGICAL_SIZE_MODE\";\n\t\tpublic const string SDL_HINT_MOUSE_NORMAL_SPEED_SCALE =\n\t\t\t\"SDL_MOUSE_NORMAL_SPEED_SCALE\";\n\t\tpublic const string SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE =\n\t\t\t\"SDL_MOUSE_RELATIVE_SPEED_SCALE\";\n\t\tpublic const string SDL_HINT_TOUCH_MOUSE_EVENTS =\n\t\t\t\"SDL_TOUCH_MOUSE_EVENTS\";\n\t\tpublic const string SDL_HINT_WINDOWS_INTRESOURCE_ICON =\n\t\t\t\"SDL_WINDOWS_INTRESOURCE_ICON\";\n\t\tpublic const string SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL =\n\t\t\t\"SDL_WINDOWS_INTRESOURCE_ICON_SMALL\";\n\n\t\t/* Only available in 2.0.8 or higher. */\n\t\tpublic const string SDL_HINT_IOS_HIDE_HOME_INDICATOR =\n\t\t\t\"SDL_IOS_HIDE_HOME_INDICATOR\";\n\t\tpublic const string SDL_HINT_TV_REMOTE_AS_JOYSTICK =\n\t\t\t\"SDL_TV_REMOTE_AS_JOYSTICK\";\n\n\t\t/* Only available in 2.0.9 or higher. */\n\t\tpublic const string SDL_HINT_MOUSE_DOUBLE_CLICK_TIME =\n\t\t\t\"SDL_MOUSE_DOUBLE_CLICK_TIME\";\n\t\tpublic const string SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS =\n\t\t\t\"SDL_MOUSE_DOUBLE_CLICK_RADIUS\";\n\t\tpublic const string SDL_HINT_JOYSTICK_HIDAPI =\n\t\t\t\"SDL_JOYSTICK_HIDAPI\";\n\t\tpublic const string SDL_HINT_JOYSTICK_HIDAPI_PS4 =\n\t\t\t\"SDL_JOYSTICK_HIDAPI_PS4\";\n\t\tpublic const string SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE =\n\t\t\t\"SDL_JOYSTICK_HIDAPI_PS4_RUMBLE\";\n\t\tpublic const string SDL_HINT_JOYSTICK_HIDAPI_STEAM =\n\t\t\t\"SDL_JOYSTICK_HIDAPI_STEAM\";\n\t\tpublic const string SDL_HINT_JOYSTICK_HIDAPI_SWITCH =\n\t\t\t\"SDL_JOYSTICK_HIDAPI_SWITCH\";\n\t\tpublic const string SDL_HINT_JOYSTICK_HIDAPI_XBOX =\n\t\t\t\"SDL_JOYSTICK_HIDAPI_XBOX\";\n\t\tpublic const string SDL_HINT_ENABLE_STEAM_CONTROLLERS =\n\t\t\t\"SDL_ENABLE_STEAM_CONTROLLERS\";\n\t\tpublic const string SDL_HINT_ANDROID_TRAP_BACK_BUTTON =\n\t\t\t\"SDL_ANDROID_TRAP_BACK_BUTTON\";\n\n\t\t/* Only available in 2.0.10 or higher. */\n\t\tpublic const string SDL_HINT_MOUSE_TOUCH_EVENTS =\n\t\t\t\"SDL_MOUSE_TOUCH_EVENTS\";\n\t\tpublic const string SDL_HINT_GAMECONTROLLERCONFIG_FILE =\n\t\t\t\"SDL_GAMECONTROLLERCONFIG_FILE\";\n\t\tpublic const string SDL_HINT_ANDROID_BLOCK_ON_PAUSE =\n\t\t\t\"SDL_ANDROID_BLOCK_ON_PAUSE\";\n\t\tpublic const string SDL_HINT_RENDER_BATCHING =\n\t\t\t\"SDL_RENDER_BATCHING\";\n\t\tpublic const string SDL_HINT_EVENT_LOGGING =\n\t\t\t\"SDL_EVENT_LOGGING\";\n\t\tpublic const string SDL_HINT_WAVE_RIFF_CHUNK_SIZE =\n\t\t\t\"SDL_WAVE_RIFF_CHUNK_SIZE\";\n\t\tpublic const string SDL_HINT_WAVE_TRUNCATION =\n\t\t\t\"SDL_WAVE_TRUNCATION\";\n\t\tpublic const string SDL_HINT_WAVE_FACT_CHUNK =\n\t\t\t\"SDL_WAVE_FACT_CHUNK\";\n\n\t\t/* Only available in 2.0.11 or higher. */\n\t\tpublic const string SDL_HINT_VIDO_X11_WINDOW_VISUALID =\n\t\t\t\"SDL_VIDEO_X11_WINDOW_VISUALID\";\n\t\tpublic const string SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS =\n\t\t\t\"SDL_GAMECONTROLLER_USE_BUTTON_LABELS\";\n\t\tpublic const string SDL_HINT_VIDEO_EXTERNAL_CONTEXT =\n\t\t\t\"SDL_VIDEO_EXTERNAL_CONTEXT\";\n\t\tpublic const string SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE =\n\t\t\t\"SDL_JOYSTICK_HIDAPI_GAMECUBE\";\n\t\tpublic const string SDL_HINT_DISPLAY_USABLE_BOUNDS =\n\t\t\t\"SDL_DISPLAY_USABLE_BOUNDS\";\n\t\tpublic const string SDL_HINT_VIDEO_X11_FORCE_EGL =\n\t\t\t\"SDL_VIDEO_X11_FORCE_EGL\";\n\t\tpublic const string SDL_HINT_GAMECONTROLLERTYPE =\n\t\t\t\"SDL_GAMECONTROLLERTYPE\";\n\n\t\tpublic enum SDL_HintPriority\n\t\t{\n\t\t\tSDL_HINT_DEFAULT,\n\t\t\tSDL_HINT_NORMAL,\n\t\t\tSDL_HINT_OVERRIDE\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_ClearHints();\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetHint\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe IntPtr INTERNAL_SDL_GetHint(byte* name);\n\t\tpublic static unsafe string SDL_GetHint(string name)\n\t\t{\n\t\t\tint utf8NameBufSize = Utf8Size(name);\n\t\t\tbyte* utf8Name = stackalloc byte[utf8NameBufSize];\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_GetHint(\n\t\t\t\t\tUtf8Encode(name, utf8Name, utf8NameBufSize)\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_SetHint\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe SDL_bool INTERNAL_SDL_SetHint(\n\t\t\tbyte* name,\n\t\t\tbyte* value\n\t\t);\n\t\tpublic static unsafe SDL_bool SDL_SetHint(string name, string value)\n\t\t{\n\t\t\tint utf8NameBufSize = Utf8Size(name);\n\t\t\tbyte* utf8Name = stackalloc byte[utf8NameBufSize];\n\n\t\t\tint utf8ValueBufSize = Utf8Size(value);\n\t\t\tbyte* utf8Value = stackalloc byte[utf8ValueBufSize];\n\n\t\t\treturn INTERNAL_SDL_SetHint(\n\t\t\t\tUtf8Encode(name, utf8Name, utf8NameBufSize),\n\t\t\t\tUtf8Encode(value, utf8Value, utf8ValueBufSize)\n\t\t\t);\n\t\t}\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_SetHintWithPriority\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe SDL_bool INTERNAL_SDL_SetHintWithPriority(\n\t\t\tbyte* name,\n\t\t\tbyte* value,\n\t\t\tSDL_HintPriority priority\n\t\t);\n\t\tpublic static unsafe SDL_bool SDL_SetHintWithPriority(\n\t\t\tstring name,\n\t\t\tstring value,\n\t\t\tSDL_HintPriority priority\n\t\t) {\n\t\t\tint utf8NameBufSize = Utf8Size(name);\n\t\t\tbyte* utf8Name = stackalloc byte[utf8NameBufSize];\n\n\t\t\tint utf8ValueBufSize = Utf8Size(value);\n\t\t\tbyte* utf8Value = stackalloc byte[utf8ValueBufSize];\n\n\t\t\treturn INTERNAL_SDL_SetHintWithPriority(\n\t\t\t\tUtf8Encode(name, utf8Name, utf8NameBufSize),\n\t\t\t\tUtf8Encode(value, utf8Value, utf8ValueBufSize),\n\t\t\t\tpriority\n\t\t\t);\n\t\t}\n\n\t\t/* Only available in 2.0.5 or higher. */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetHintBoolean\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe SDL_bool INTERNAL_SDL_GetHintBoolean(\n\t\t\tbyte* name,\n\t\t\tSDL_bool default_value\n\t\t);\n\t\tpublic static unsafe SDL_bool SDL_GetHintBoolean(\n\t\t\tstring name,\n\t\t\tSDL_bool default_value\n\t\t) {\n\t\t\tint utf8NameBufSize = Utf8Size(name);\n\t\t\tbyte* utf8Name = stackalloc byte[utf8NameBufSize];\n\t\t\treturn INTERNAL_SDL_GetHintBoolean(\n\t\t\t\tUtf8Encode(name, utf8Name, utf8NameBufSize),\n\t\t\t\tdefault_value\n\t\t\t);\n\t\t}\n\n\t\t#endregion\n\n\t\t#region SDL_error.h\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_ClearError();\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetError\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GetError();\n\t\tpublic static string SDL_GetError()\n\t\t{\n\t\t\treturn UTF8_ToManaged(INTERNAL_SDL_GetError());\n\t\t}\n\n\t\t/* Use string.Format for arglists */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_SetError\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe void INTERNAL_SDL_SetError(byte* fmtAndArglist);\n\t\tpublic static unsafe void SDL_SetError(string fmtAndArglist)\n\t\t{\n\t\t\tint utf8FmtAndArglistBufSize = Utf8Size(fmtAndArglist);\n\t\t\tbyte* utf8FmtAndArglist = stackalloc byte[utf8FmtAndArglistBufSize];\n\t\t\tINTERNAL_SDL_SetError(\n\t\t\t\tUtf8Encode(fmtAndArglist, utf8FmtAndArglist, utf8FmtAndArglistBufSize)\n\t\t\t);\n\t\t}\n\n\t\t#endregion\n\n\t\t#region SDL_log.h\n\n\t\tpublic enum SDL_LogCategory\n\t\t{\n\t\t\tSDL_LOG_CATEGORY_APPLICATION,\n\t\t\tSDL_LOG_CATEGORY_ERROR,\n\t\t\tSDL_LOG_CATEGORY_ASSERT,\n\t\t\tSDL_LOG_CATEGORY_SYSTEM,\n\t\t\tSDL_LOG_CATEGORY_AUDIO,\n\t\t\tSDL_LOG_CATEGORY_VIDEO,\n\t\t\tSDL_LOG_CATEGORY_RENDER,\n\t\t\tSDL_LOG_CATEGORY_INPUT,\n\t\t\tSDL_LOG_CATEGORY_TEST,\n\n\t\t\t/* Reserved for future SDL library use */\n\t\t\tSDL_LOG_CATEGORY_RESERVED1,\n\t\t\tSDL_LOG_CATEGORY_RESERVED2,\n\t\t\tSDL_LOG_CATEGORY_RESERVED3,\n\t\t\tSDL_LOG_CATEGORY_RESERVED4,\n\t\t\tSDL_LOG_CATEGORY_RESERVED5,\n\t\t\tSDL_LOG_CATEGORY_RESERVED6,\n\t\t\tSDL_LOG_CATEGORY_RESERVED7,\n\t\t\tSDL_LOG_CATEGORY_RESERVED8,\n\t\t\tSDL_LOG_CATEGORY_RESERVED9,\n\t\t\tSDL_LOG_CATEGORY_RESERVED10,\n\n\t\t\t/* Beyond this point is reserved for application use, e.g.\n\t\t\tenum {\n\t\t\t\tMYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,\n\t\t\t\tMYAPP_CATEGORY_AWESOME2,\n\t\t\t\tMYAPP_CATEGORY_AWESOME3,\n\t\t\t\t...\n\t\t\t};\n\t\t\t*/\n\t\t\tSDL_LOG_CATEGORY_CUSTOM\n\t\t}\n\n\t\tpublic enum SDL_LogPriority\n\t\t{\n\t\t\tSDL_LOG_PRIORITY_VERBOSE = 1,\n\t\t\tSDL_LOG_PRIORITY_DEBUG,\n\t\t\tSDL_LOG_PRIORITY_INFO,\n\t\t\tSDL_LOG_PRIORITY_WARN,\n\t\t\tSDL_LOG_PRIORITY_ERROR,\n\t\t\tSDL_LOG_PRIORITY_CRITICAL,\n\t\t\tSDL_NUM_LOG_PRIORITIES\n\t\t}\n\n\t\t/* userdata refers to a void*, message to a const char* */\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate void SDL_LogOutputFunction(\n\t\t\tIntPtr userdata,\n\t\t\tint category,\n\t\t\tSDL_LogPriority priority,\n\t\t\tIntPtr message\n\t\t);\n\n\t\t/* Use string.Format for arglists */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_Log\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe void INTERNAL_SDL_Log(byte* fmtAndArglist);\n\t\tpublic static unsafe void SDL_Log(string fmtAndArglist)\n\t\t{\n\t\t\tint utf8FmtAndArglistBufSize = Utf8Size(fmtAndArglist);\n\t\t\tbyte* utf8FmtAndArglist = stackalloc byte[utf8FmtAndArglistBufSize];\n\t\t\tINTERNAL_SDL_Log(\n\t\t\t\tUtf8Encode(fmtAndArglist, utf8FmtAndArglist, utf8FmtAndArglistBufSize)\n\t\t\t);\n\t\t}\n\n\t\t/* Use string.Format for arglists */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_LogVerbose\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe void INTERNAL_SDL_LogVerbose(\n\t\t\tint category,\n\t\t\tbyte* fmtAndArglist\n\t\t);\n\t\tpublic static unsafe void SDL_LogVerbose(\n\t\t\tint category,\n\t\t\tstring fmtAndArglist\n\t\t) {\n\t\t\tint utf8FmtAndArglistBufSize = Utf8Size(fmtAndArglist);\n\t\t\tbyte* utf8FmtAndArglist = stackalloc byte[utf8FmtAndArglistBufSize];\n\t\t\tINTERNAL_SDL_LogVerbose(\n\t\t\t\tcategory,\n\t\t\t\tUtf8Encode(fmtAndArglist, utf8FmtAndArglist, utf8FmtAndArglistBufSize)\n\t\t\t);\n\t\t}\n\n\t\t/* Use string.Format for arglists */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_LogDebug\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe void INTERNAL_SDL_LogDebug(\n\t\t\tint category,\n\t\t\tbyte* fmtAndArglist\n\t\t);\n\t\tpublic static unsafe void SDL_LogDebug(\n\t\t\tint category,\n\t\t\tstring fmtAndArglist\n\t\t) {\n\t\t\tint utf8FmtAndArglistBufSize = Utf8Size(fmtAndArglist);\n\t\t\tbyte* utf8FmtAndArglist = stackalloc byte[utf8FmtAndArglistBufSize];\n\t\t\tINTERNAL_SDL_LogDebug(\n\t\t\t\tcategory,\n\t\t\t\tUtf8Encode(fmtAndArglist, utf8FmtAndArglist, utf8FmtAndArglistBufSize)\n\t\t\t);\n\t\t}\n\n\t\t/* Use string.Format for arglists */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_LogInfo\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe void INTERNAL_SDL_LogInfo(\n\t\t\tint category,\n\t\t\tbyte* fmtAndArglist\n\t\t);\n\t\tpublic static unsafe void SDL_LogInfo(\n\t\t\tint category,\n\t\t\tstring fmtAndArglist\n\t\t) {\n\t\t\tint utf8FmtAndArglistBufSize = Utf8Size(fmtAndArglist);\n\t\t\tbyte* utf8FmtAndArglist = stackalloc byte[utf8FmtAndArglistBufSize];\n\t\t\tINTERNAL_SDL_LogInfo(\n\t\t\t\tcategory,\n\t\t\t\tUtf8Encode(fmtAndArglist, utf8FmtAndArglist, utf8FmtAndArglistBufSize)\n\t\t\t);\n\t\t}\n\n\t\t/* Use string.Format for arglists */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_LogWarn\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe void INTERNAL_SDL_LogWarn(\n\t\t\tint category,\n\t\t\tbyte* fmtAndArglist\n\t\t);\n\t\tpublic static unsafe void SDL_LogWarn(\n\t\t\tint category,\n\t\t\tstring fmtAndArglist\n\t\t) {\n\t\t\tint utf8FmtAndArglistBufSize = Utf8Size(fmtAndArglist);\n\t\t\tbyte* utf8FmtAndArglist = stackalloc byte[utf8FmtAndArglistBufSize];\n\t\t\tINTERNAL_SDL_LogWarn(\n\t\t\t\tcategory,\n\t\t\t\tUtf8Encode(fmtAndArglist, utf8FmtAndArglist, utf8FmtAndArglistBufSize)\n\t\t\t);\n\t\t}\n\n\t\t/* Use string.Format for arglists */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_LogError\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe void INTERNAL_SDL_LogError(\n\t\t\tint category,\n\t\t\tbyte* fmtAndArglist\n\t\t);\n\t\tpublic static unsafe void SDL_LogError(\n\t\t\tint category,\n\t\t\tstring fmtAndArglist\n\t\t) {\n\t\t\tint utf8FmtAndArglistBufSize = Utf8Size(fmtAndArglist);\n\t\t\tbyte* utf8FmtAndArglist = stackalloc byte[utf8FmtAndArglistBufSize];\n\t\t\tINTERNAL_SDL_LogError(\n\t\t\t\tcategory,\n\t\t\t\tUtf8Encode(fmtAndArglist, utf8FmtAndArglist, utf8FmtAndArglistBufSize)\n\t\t\t);\n\t\t}\n\n\t\t/* Use string.Format for arglists */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_LogCritical\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe void INTERNAL_SDL_LogCritical(\n\t\t\tint category,\n\t\t\tbyte* fmtAndArglist\n\t\t);\n\t\tpublic static unsafe void SDL_LogCritical(\n\t\t\tint category,\n\t\t\tstring fmtAndArglist\n\t\t) {\n\t\t\tint utf8FmtAndArglistBufSize = Utf8Size(fmtAndArglist);\n\t\t\tbyte* utf8FmtAndArglist = stackalloc byte[utf8FmtAndArglistBufSize];\n\t\t\tINTERNAL_SDL_LogCritical(\n\t\t\t\tcategory,\n\t\t\t\tUtf8Encode(fmtAndArglist, utf8FmtAndArglist, utf8FmtAndArglistBufSize)\n\t\t\t);\n\t\t}\n\n\t\t/* Use string.Format for arglists */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_LogMessage\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe void INTERNAL_SDL_LogMessage(\n\t\t\tint category,\n\t\t\tSDL_LogPriority priority,\n\t\t\tbyte* fmtAndArglist\n\t\t);\n\t\tpublic static unsafe void SDL_LogMessage(\n\t\t\tint category,\n\t\t\tSDL_LogPriority priority,\n\t\t\tstring fmtAndArglist\n\t\t) {\n\t\t\tint utf8FmtAndArglistBufSize = Utf8Size(fmtAndArglist);\n\t\t\tbyte* utf8FmtAndArglist = stackalloc byte[utf8FmtAndArglistBufSize];\n\t\t\tINTERNAL_SDL_LogMessage(\n\t\t\t\tcategory,\n\t\t\t\tpriority,\n\t\t\t\tUtf8Encode(fmtAndArglist, utf8FmtAndArglist, utf8FmtAndArglistBufSize)\n\t\t\t);\n\t\t}\n\n\t\t/* Use string.Format for arglists */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_LogMessageV\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe void INTERNAL_SDL_LogMessageV(\n\t\t\tint category,\n\t\t\tSDL_LogPriority priority,\n\t\t\tbyte* fmtAndArglist\n\t\t);\n\t\tpublic static unsafe void SDL_LogMessageV(\n\t\t\tint category,\n\t\t\tSDL_LogPriority priority,\n\t\t\tstring fmtAndArglist\n\t\t) {\n\t\t\tint utf8FmtAndArglistBufSize = Utf8Size(fmtAndArglist);\n\t\t\tbyte* utf8FmtAndArglist = stackalloc byte[utf8FmtAndArglistBufSize];\n\t\t\tINTERNAL_SDL_LogMessageV(\n\t\t\t\tcategory,\n\t\t\t\tpriority,\n\t\t\t\tUtf8Encode(fmtAndArglist, utf8FmtAndArglist, utf8FmtAndArglistBufSize)\n\t\t\t);\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_LogPriority SDL_LogGetPriority(\n\t\t\tint category\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_LogSetPriority(\n\t\t\tint category,\n\t\t\tSDL_LogPriority priority\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_LogSetAllPriority(\n\t\t\tSDL_LogPriority priority\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_LogResetPriorities();\n\n\t\t/* userdata refers to a void* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern void SDL_LogGetOutputFunction(\n\t\t\tout IntPtr callback,\n\t\t\tout IntPtr userdata\n\t\t);\n\t\tpublic static void SDL_LogGetOutputFunction(\n\t\t\tout SDL_LogOutputFunction callback,\n\t\t\tout IntPtr userdata\n\t\t) {\n\t\t\tIntPtr result = IntPtr.Zero;\n\t\t\tSDL_LogGetOutputFunction(\n\t\t\t\tout result,\n\t\t\t\tout userdata\n\t\t\t);\n\t\t\tif (result != IntPtr.Zero)\n\t\t\t{\n\t\t\t\tcallback = (SDL_LogOutputFunction) Marshal.GetDelegateForFunctionPointer(\n\t\t\t\t\tresult,\n\t\t\t\t\ttypeof(SDL_LogOutputFunction)\n\t\t\t\t);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcallback = null;\n\t\t\t}\n\t\t}\n\n\t\t/* userdata refers to a void* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_LogSetOutputFunction(\n\t\t\tSDL_LogOutputFunction callback,\n\t\t\tIntPtr userdata\n\t\t);\n\n\t\t#endregion\n\n\t\t#region SDL_messagebox.h\n\n\t\t[Flags]\n\t\tpublic enum SDL_MessageBoxFlags : uint\n\t\t{\n\t\t\tSDL_MESSAGEBOX_ERROR =\t\t0x00000010,\n\t\t\tSDL_MESSAGEBOX_WARNING =\t0x00000020,\n\t\t\tSDL_MESSAGEBOX_INFORMATION =\t0x00000040\n\t\t}\n\n\t\t[Flags]\n\t\tpublic enum SDL_MessageBoxButtonFlags : uint\n\t\t{\n\t\t\tSDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001,\n\t\t\tSDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tprivate struct INTERNAL_SDL_MessageBoxButtonData\n\t\t{\n\t\t\tpublic SDL_MessageBoxButtonFlags flags;\n\t\t\tpublic int buttonid;\n\t\t\tpublic IntPtr text; /* The UTF-8 button text */\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_MessageBoxButtonData\n\t\t{\n\t\t\tpublic SDL_MessageBoxButtonFlags flags;\n\t\t\tpublic int buttonid;\n\t\t\tpublic string text; /* The UTF-8 button text */\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_MessageBoxColor\n\t\t{\n\t\t\tpublic byte r, g, b;\n\t\t}\n\n\t\tpublic enum SDL_MessageBoxColorType\n\t\t{\n\t\t\tSDL_MESSAGEBOX_COLOR_BACKGROUND,\n\t\t\tSDL_MESSAGEBOX_COLOR_TEXT,\n\t\t\tSDL_MESSAGEBOX_COLOR_BUTTON_BORDER,\n\t\t\tSDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,\n\t\t\tSDL_MESSAGEBOX_COLOR_BUTTON_SELECTED,\n\t\t\tSDL_MESSAGEBOX_COLOR_MAX\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_MessageBoxColorScheme\n\t\t{\n\t\t\t[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.Struct, SizeConst = (int)SDL_MessageBoxColorType.SDL_MESSAGEBOX_COLOR_MAX)]\n\t\t\t\tpublic SDL_MessageBoxColor[] colors;\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tprivate struct INTERNAL_SDL_MessageBoxData\n\t\t{\n\t\t\tpublic SDL_MessageBoxFlags flags;\n\t\t\tpublic IntPtr window;\t\t\t\t/* Parent window, can be NULL */\n\t\t\tpublic IntPtr title;\t\t\t\t/* UTF-8 title */\n\t\t\tpublic IntPtr message;\t\t\t\t/* UTF-8 message text */\n\t\t\tpublic int numbuttons;\n\t\t\tpublic IntPtr buttons;\n\t\t\tpublic IntPtr colorScheme;\t\t\t/* Can be NULL to use system settings */\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_MessageBoxData\n\t\t{\n\t\t\tpublic SDL_MessageBoxFlags flags;\n\t\t\tpublic IntPtr window;\t\t\t\t/* Parent window, can be NULL */\n\t\t\tpublic string title;\t\t\t\t/* UTF-8 title */\n\t\t\tpublic string message;\t\t\t\t/* UTF-8 message text */\n\t\t\tpublic int numbuttons;\n\t\t\tpublic SDL_MessageBoxButtonData[] buttons;\n\t\t\tpublic SDL_MessageBoxColorScheme? colorScheme;\t/* Can be NULL to use system settings */\n\t\t}\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_ShowMessageBox\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern int INTERNAL_SDL_ShowMessageBox([In()] ref INTERNAL_SDL_MessageBoxData messageboxdata, out int buttonid);\n\n\t\t/* Ripped from Jameson's LpUtf8StrMarshaler */\n\t\tprivate static IntPtr INTERNAL_AllocUTF8(string str)\n\t\t{\n\t\t\tif (string.IsNullOrEmpty(str))\n\t\t\t{\n\t\t\t\treturn IntPtr.Zero;\n\t\t\t}\n\t\t\tbyte[] bytes = System.Text.Encoding.UTF8.GetBytes(str + '\\0');\n\t\t\tIntPtr mem = SDL.SDL_malloc((IntPtr) bytes.Length);\n\t\t\tMarshal.Copy(bytes, 0, mem, bytes.Length);\n\t\t\treturn mem;\n\t\t}\n\n\t\tpublic static unsafe int SDL_ShowMessageBox([In()] ref SDL_MessageBoxData messageboxdata, out int buttonid)\n\t\t{\n\t\t\tvar data = new INTERNAL_SDL_MessageBoxData()\n\t\t\t{\n\t\t\t\tflags = messageboxdata.flags,\n\t\t\t\twindow = messageboxdata.window,\n\t\t\t\ttitle = INTERNAL_AllocUTF8(messageboxdata.title),\n\t\t\t\tmessage = INTERNAL_AllocUTF8(messageboxdata.message),\n\t\t\t\tnumbuttons = messageboxdata.numbuttons,\n\t\t\t};\n\n\t\t\tvar buttons = new INTERNAL_SDL_MessageBoxButtonData[messageboxdata.numbuttons];\n\t\t\tfor (int i = 0; i < messageboxdata.numbuttons; i++)\n\t\t\t{\n\t\t\t\tbuttons[i] = new INTERNAL_SDL_MessageBoxButtonData()\n\t\t\t\t{\n\t\t\t\t\tflags = messageboxdata.buttons[i].flags,\n\t\t\t\t\tbuttonid = messageboxdata.buttons[i].buttonid,\n\t\t\t\t\ttext = INTERNAL_AllocUTF8(messageboxdata.buttons[i].text),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (messageboxdata.colorScheme != null)\n\t\t\t{\n\t\t\t\tdata.colorScheme = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(SDL_MessageBoxColorScheme)));\n\t\t\t\tMarshal.StructureToPtr(messageboxdata.colorScheme.Value, data.colorScheme, false);\n\t\t\t}\n\n\t\t\tint result;\n\t\t\tfixed (INTERNAL_SDL_MessageBoxButtonData* buttonsPtr = &buttons[0])\n\t\t\t{\n\t\t\t\tdata.buttons = (IntPtr)buttonsPtr;\n\t\t\t\tresult = INTERNAL_SDL_ShowMessageBox(ref data, out buttonid);\n\t\t\t}\n\n\t\t\tMarshal.FreeHGlobal(data.colorScheme);\n\t\t\tfor (int i = 0; i < messageboxdata.numbuttons; i++)\n\t\t\t{\n\t\t\t\tSDL_free(buttons[i].text);\n\t\t\t}\n\t\t\tSDL_free(data.message);\n\t\t\tSDL_free(data.title);\n\n\t\t\treturn result;\n\t\t}\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_ShowSimpleMessageBox\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe int INTERNAL_SDL_ShowSimpleMessageBox(\n\t\t\tSDL_MessageBoxFlags flags,\n\t\t\tbyte* title,\n\t\t\tbyte* message,\n\t\t\tIntPtr window\n\t\t);\n\t\tpublic static unsafe int SDL_ShowSimpleMessageBox(\n\t\t\tSDL_MessageBoxFlags flags,\n\t\t\tstring title,\n\t\t\tstring message,\n\t\t\tIntPtr window\n\t\t) {\n\t\t\tint utf8TitleBufSize = Utf8SizeNullable(title);\n\t\t\tbyte* utf8Title = stackalloc byte[utf8TitleBufSize];\n\n\t\t\tint utf8MessageBufSize = Utf8SizeNullable(message);\n\t\t\tbyte* utf8Message = stackalloc byte[utf8MessageBufSize];\n\n\t\t\treturn INTERNAL_SDL_ShowSimpleMessageBox(\n\t\t\t\tflags,\n\t\t\t\tUtf8EncodeNullable(title, utf8Title, utf8TitleBufSize),\n\t\t\t\tUtf8EncodeNullable(message, utf8Message, utf8MessageBufSize),\n\t\t\t\twindow\n\t\t\t);\n\t\t}\n\n\t\t#endregion\n\n\t\t#region SDL_version.h, SDL_revision.h\n\n\t\t/* Similar to the headers, this is the version we're expecting to be\n\t\t * running with. You will likely want to check this somewhere in your\n\t\t * program!\n\t\t */\n\t\tpublic const int SDL_MAJOR_VERSION =\t2;\n\t\tpublic const int SDL_MINOR_VERSION =\t0;\n\t\tpublic const int SDL_PATCHLEVEL =\t12;\n\n\t\tpublic static readonly int SDL_COMPILEDVERSION = SDL_VERSIONNUM(\n\t\t\tSDL_MAJOR_VERSION,\n\t\t\tSDL_MINOR_VERSION,\n\t\t\tSDL_PATCHLEVEL\n\t\t);\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_version\n\t\t{\n\t\t\tpublic byte major;\n\t\t\tpublic byte minor;\n\t\t\tpublic byte patch;\n\t\t}\n\n\t\tpublic static void SDL_VERSION(out SDL_version x)\n\t\t{\n\t\t\tx.major = SDL_MAJOR_VERSION;\n\t\t\tx.minor = SDL_MINOR_VERSION;\n\t\t\tx.patch = SDL_PATCHLEVEL;\n\t\t}\n\n\t\tpublic static int SDL_VERSIONNUM(int X, int Y, int Z)\n\t\t{\n\t\t\treturn (X * 1000) + (Y * 100) + Z;\n\t\t}\n\n\t\tpublic static bool SDL_VERSION_ATLEAST(int X, int Y, int Z)\n\t\t{\n\t\t\treturn (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z));\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_GetVersion(out SDL_version ver);\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetRevision\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GetRevision();\n\t\tpublic static string SDL_GetRevision()\n\t\t{\n\t\t\treturn UTF8_ToManaged(INTERNAL_SDL_GetRevision());\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetRevisionNumber();\n\n\t\t#endregion\n\n\t\t#region SDL_video.h\n\n\t\tpublic enum SDL_GLattr\n\t\t{\n\t\t\tSDL_GL_RED_SIZE,\n\t\t\tSDL_GL_GREEN_SIZE,\n\t\t\tSDL_GL_BLUE_SIZE,\n\t\t\tSDL_GL_ALPHA_SIZE,\n\t\t\tSDL_GL_BUFFER_SIZE,\n\t\t\tSDL_GL_DOUBLEBUFFER,\n\t\t\tSDL_GL_DEPTH_SIZE,\n\t\t\tSDL_GL_STENCIL_SIZE,\n\t\t\tSDL_GL_ACCUM_RED_SIZE,\n\t\t\tSDL_GL_ACCUM_GREEN_SIZE,\n\t\t\tSDL_GL_ACCUM_BLUE_SIZE,\n\t\t\tSDL_GL_ACCUM_ALPHA_SIZE,\n\t\t\tSDL_GL_STEREO,\n\t\t\tSDL_GL_MULTISAMPLEBUFFERS,\n\t\t\tSDL_GL_MULTISAMPLESAMPLES,\n\t\t\tSDL_GL_ACCELERATED_VISUAL,\n\t\t\tSDL_GL_RETAINED_BACKING,\n\t\t\tSDL_GL_CONTEXT_MAJOR_VERSION,\n\t\t\tSDL_GL_CONTEXT_MINOR_VERSION,\n\t\t\tSDL_GL_CONTEXT_EGL,\n\t\t\tSDL_GL_CONTEXT_FLAGS,\n\t\t\tSDL_GL_CONTEXT_PROFILE_MASK,\n\t\t\tSDL_GL_SHARE_WITH_CURRENT_CONTEXT,\n\t\t\tSDL_GL_FRAMEBUFFER_SRGB_CAPABLE,\n\t\t\tSDL_GL_CONTEXT_RELEASE_BEHAVIOR,\n\t\t\tSDL_GL_CONTEXT_RESET_NOTIFICATION,\t/* Requires >= 2.0.6 */\n\t\t\tSDL_GL_CONTEXT_NO_ERROR,\t\t/* Requires >= 2.0.6 */\n\t\t}\n\n\t\t[Flags]\n\t\tpublic enum SDL_GLprofile\n\t\t{\n\t\t\tSDL_GL_CONTEXT_PROFILE_CORE\t\t\t\t= 0x0001,\n\t\t\tSDL_GL_CONTEXT_PROFILE_COMPATIBILITY\t= 0x0002,\n\t\t\tSDL_GL_CONTEXT_PROFILE_ES\t\t\t\t= 0x0004\n\t\t}\n\n\t\t[Flags]\n\t\tpublic enum SDL_GLcontext\n\t\t{\n\t\t\tSDL_GL_CONTEXT_DEBUG_FLAG\t\t\t\t= 0x0001,\n\t\t\tSDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG\t= 0x0002,\n\t\t\tSDL_GL_CONTEXT_ROBUST_ACCESS_FLAG\t\t= 0x0004,\n\t\t\tSDL_GL_CONTEXT_RESET_ISOLATION_FLAG\t\t= 0x0008\n\t\t}\n\n\t\tpublic enum SDL_WindowEventID : byte\n\t\t{\n\t\t\tSDL_WINDOWEVENT_NONE,\n\t\t\tSDL_WINDOWEVENT_SHOWN,\n\t\t\tSDL_WINDOWEVENT_HIDDEN,\n\t\t\tSDL_WINDOWEVENT_EXPOSED,\n\t\t\tSDL_WINDOWEVENT_MOVED,\n\t\t\tSDL_WINDOWEVENT_RESIZED,\n\t\t\tSDL_WINDOWEVENT_SIZE_CHANGED,\n\t\t\tSDL_WINDOWEVENT_MINIMIZED,\n\t\t\tSDL_WINDOWEVENT_MAXIMIZED,\n\t\t\tSDL_WINDOWEVENT_RESTORED,\n\t\t\tSDL_WINDOWEVENT_ENTER,\n\t\t\tSDL_WINDOWEVENT_LEAVE,\n\t\t\tSDL_WINDOWEVENT_FOCUS_GAINED,\n\t\t\tSDL_WINDOWEVENT_FOCUS_LOST,\n\t\t\tSDL_WINDOWEVENT_CLOSE,\n\t\t\t/* Only available in 2.0.5 or higher. */\n\t\t\tSDL_WINDOWEVENT_TAKE_FOCUS,\n\t\t\tSDL_WINDOWEVENT_HIT_TEST\n\t\t}\n\n\t\tpublic enum SDL_DisplayEventID : byte\n\t\t{\n\t\t\tSDL_DISPLAYEVENT_NONE,\n\t\t\tSDL_DISPLAYEVENT_ORIENTATION\n\t\t}\n\n\t\tpublic enum SDL_DisplayOrientation\n\t\t{\n\t\t\tSDL_ORIENTATION_UNKNOWN,\n\t\t\tSDL_ORIENTATION_LANDSCAPE,\n\t\t\tSDL_ORIENTATION_LANDSCAPE_FLIPPED,\n\t\t\tSDL_ORIENTATION_PORTRAIT,\n\t\t\tSDL_ORIENTATION_PORTRAIT_FLIPPED\n\t\t}\n\n\t\t[Flags]\n\t\tpublic enum SDL_WindowFlags : uint\n\t\t{\n\t\t\tSDL_WINDOW_FULLSCREEN =\t\t0x00000001,\n\t\t\tSDL_WINDOW_OPENGL =\t\t0x00000002,\n\t\t\tSDL_WINDOW_SHOWN =\t\t0x00000004,\n\t\t\tSDL_WINDOW_HIDDEN =\t\t0x00000008,\n\t\t\tSDL_WINDOW_BORDERLESS =\t\t0x00000010,\n\t\t\tSDL_WINDOW_RESIZABLE =\t\t0x00000020,\n\t\t\tSDL_WINDOW_MINIMIZED =\t\t0x00000040,\n\t\t\tSDL_WINDOW_MAXIMIZED =\t\t0x00000080,\n\t\t\tSDL_WINDOW_INPUT_GRABBED =\t0x00000100,\n\t\t\tSDL_WINDOW_INPUT_FOCUS =\t0x00000200,\n\t\t\tSDL_WINDOW_MOUSE_FOCUS =\t0x00000400,\n\t\t\tSDL_WINDOW_FULLSCREEN_DESKTOP =\n\t\t\t\t(SDL_WINDOW_FULLSCREEN | 0x00001000),\n\t\t\tSDL_WINDOW_FOREIGN =\t\t0x00000800,\n\t\t\tSDL_WINDOW_ALLOW_HIGHDPI =\t0x00002000,\t/* Requires >= 2.0.1 */\n\t\t\tSDL_WINDOW_MOUSE_CAPTURE =\t0x00004000,\t/* Requires >= 2.0.4 */\n\t\t\tSDL_WINDOW_ALWAYS_ON_TOP =\t0x00008000,\t/* Requires >= 2.0.5 */\n\t\t\tSDL_WINDOW_SKIP_TASKBAR =\t0x00010000,\t/* Requires >= 2.0.5 */\n\t\t\tSDL_WINDOW_UTILITY =\t\t0x00020000,\t/* Requires >= 2.0.5 */\n\t\t\tSDL_WINDOW_TOOLTIP =\t\t0x00040000,\t/* Requires >= 2.0.5 */\n\t\t\tSDL_WINDOW_POPUP_MENU =\t\t0x00080000,\t/* Requires >= 2.0.5 */\n\t\t\tSDL_WINDOW_VULKAN =\t\t0x10000000,\t/* Requires >= 2.0.6 */\n\t\t}\n\n\t\t/* Only available in 2.0.4 or higher. */\n\t\tpublic enum SDL_HitTestResult\n\t\t{\n\t\t\tSDL_HITTEST_NORMAL,\t\t/* Region is normal. No special properties. */\n\t\t\tSDL_HITTEST_DRAGGABLE,\t\t/* Region can drag entire window. */\n\t\t\tSDL_HITTEST_RESIZE_TOPLEFT,\n\t\t\tSDL_HITTEST_RESIZE_TOP,\n\t\t\tSDL_HITTEST_RESIZE_TOPRIGHT,\n\t\t\tSDL_HITTEST_RESIZE_RIGHT,\n\t\t\tSDL_HITTEST_RESIZE_BOTTOMRIGHT,\n\t\t\tSDL_HITTEST_RESIZE_BOTTOM,\n\t\t\tSDL_HITTEST_RESIZE_BOTTOMLEFT,\n\t\t\tSDL_HITTEST_RESIZE_LEFT\n\t\t}\n\n\t\tpublic const int SDL_WINDOWPOS_UNDEFINED_MASK =\t0x1FFF0000;\n\t\tpublic const int SDL_WINDOWPOS_CENTERED_MASK =\t0x2FFF0000;\n\t\tpublic const int SDL_WINDOWPOS_UNDEFINED =\t0x1FFF0000;\n\t\tpublic const int SDL_WINDOWPOS_CENTERED =\t0x2FFF0000;\n\n\t\tpublic static int SDL_WINDOWPOS_UNDEFINED_DISPLAY(int X)\n\t\t{\n\t\t\treturn (SDL_WINDOWPOS_UNDEFINED_MASK | X);\n\t\t}\n\n\t\tpublic static bool SDL_WINDOWPOS_ISUNDEFINED(int X)\n\t\t{\n\t\t\treturn (X & 0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK;\n\t\t}\n\n\t\tpublic static int SDL_WINDOWPOS_CENTERED_DISPLAY(int X)\n\t\t{\n\t\t\treturn (SDL_WINDOWPOS_CENTERED_MASK | X);\n\t\t}\n\n\t\tpublic static bool SDL_WINDOWPOS_ISCENTERED(int X)\n\t\t{\n\t\t\treturn (X & 0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK;\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_DisplayMode\n\t\t{\n\t\t\tpublic uint format;\n\t\t\tpublic int w;\n\t\t\tpublic int h;\n\t\t\tpublic int refresh_rate;\n\t\t\tpublic IntPtr driverdata; // void*\n\t\t}\n\n\t\t/* win refers to an SDL_Window*, area to a const SDL_Point*, data to a void*.\n\t\t * Only available in 2.0.4 or higher.\n\t\t */\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate SDL_HitTestResult SDL_HitTest(IntPtr win, IntPtr area, IntPtr data);\n\n\t\t/* IntPtr refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_CreateWindow\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe IntPtr INTERNAL_SDL_CreateWindow(\n\t\t\tbyte* title,\n\t\t\tint x,\n\t\t\tint y,\n\t\t\tint w,\n\t\t\tint h,\n\t\t\tSDL_WindowFlags flags\n\t\t);\n\t\tpublic static unsafe IntPtr SDL_CreateWindow(\n\t\t\tstring title,\n\t\t\tint x,\n\t\t\tint y,\n\t\t\tint w,\n\t\t\tint h,\n\t\t\tSDL_WindowFlags flags\n\t\t) {\n\t\t\tint utf8TitleBufSize = Utf8SizeNullable(title);\n\t\t\tbyte* utf8Title = stackalloc byte[utf8TitleBufSize];\n\t\t\treturn INTERNAL_SDL_CreateWindow(\n\t\t\t\tUtf8EncodeNullable(title, utf8Title, utf8TitleBufSize),\n\t\t\t\tx, y, w, h,\n\t\t\t\tflags\n\t\t\t);\n\t\t}\n\n\t\t/* window refers to an SDL_Window*, renderer to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_CreateWindowAndRenderer(\n\t\t\tint width,\n\t\t\tint height,\n\t\t\tSDL_WindowFlags window_flags,\n\t\t\tout IntPtr window,\n\t\t\tout IntPtr renderer\n\t\t);\n\n\t\t/* data refers to some native window type, IntPtr to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_CreateWindowFrom(IntPtr data);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_DestroyWindow(IntPtr window);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_DisableScreenSaver();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_EnableScreenSaver();\n\n\t\t/* IntPtr refers to an SDL_DisplayMode. Just use closest. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GetClosestDisplayMode(\n\t\t\tint displayIndex,\n\t\t\tref SDL_DisplayMode mode,\n\t\t\tout SDL_DisplayMode closest\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetCurrentDisplayMode(\n\t\t\tint displayIndex,\n\t\t\tout SDL_DisplayMode mode\n\t\t);\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetCurrentVideoDriver\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GetCurrentVideoDriver();\n\t\tpublic static string SDL_GetCurrentVideoDriver()\n\t\t{\n\t\t\treturn UTF8_ToManaged(INTERNAL_SDL_GetCurrentVideoDriver());\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetDesktopDisplayMode(\n\t\t\tint displayIndex,\n\t\t\tout SDL_DisplayMode mode\n\t\t);\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetDisplayName\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GetDisplayName(int index);\n\t\tpublic static string SDL_GetDisplayName(int index)\n\t\t{\n\t\t\treturn UTF8_ToManaged(INTERNAL_SDL_GetDisplayName(index));\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetDisplayBounds(\n\t\t\tint displayIndex,\n\t\t\tout SDL_Rect rect\n\t\t);\n\n\t\t/* Only available in 2.0.4 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetDisplayDPI(\n\t\t\tint displayIndex,\n\t\t\tout float ddpi,\n\t\t\tout float hdpi,\n\t\t\tout float vdpi\n\t\t);\n\n\t\t/* Only available in 2.0.9 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_DisplayOrientation SDL_GetDisplayOrientation(\n\t\t\tint displayIndex\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetDisplayMode(\n\t\t\tint displayIndex,\n\t\t\tint modeIndex,\n\t\t\tout SDL_DisplayMode mode\n\t\t);\n\n\t\t/* Only available in 2.0.5 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetDisplayUsableBounds(\n\t\t\tint displayIndex,\n\t\t\tout SDL_Rect rect\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetNumDisplayModes(\n\t\t\tint displayIndex\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetNumVideoDisplays();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetNumVideoDrivers();\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetVideoDriver\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GetVideoDriver(\n\t\t\tint index\n\t\t);\n\t\tpublic static string SDL_GetVideoDriver(int index)\n\t\t{\n\t\t\treturn UTF8_ToManaged(INTERNAL_SDL_GetVideoDriver(index));\n\t\t}\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern float SDL_GetWindowBrightness(\n\t\t\tIntPtr window\n\t\t);\n\n\t\t/* window refers to an SDL_Window*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetWindowOpacity(\n\t\t\tIntPtr window,\n\t\t\tfloat opacity\n\t\t);\n\n\t\t/* window refers to an SDL_Window*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetWindowOpacity(\n\t\t\tIntPtr window,\n\t\t\tout float out_opacity\n\t\t);\n\n\t\t/* modal_window and parent_window refer to an SDL_Window*s\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetWindowModalFor(\n\t\t\tIntPtr modal_window,\n\t\t\tIntPtr parent_window\n\t\t);\n\n\t\t/* window refers to an SDL_Window*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetWindowInputFocus(IntPtr window);\n\n\t\t/* window refers to an SDL_Window*, IntPtr to a void* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetWindowData\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe IntPtr INTERNAL_SDL_GetWindowData(\n\t\t\tIntPtr window,\n\t\t\tbyte* name\n\t\t);\n\t\tpublic static unsafe IntPtr SDL_GetWindowData(\n\t\t\tIntPtr window,\n\t\t\tstring name\n\t\t) {\n\t\t\tint utf8NameBufSize = Utf8Size(name);\n\t\t\tbyte* utf8Name = stackalloc byte[utf8NameBufSize];\n\t\t\treturn INTERNAL_SDL_GetWindowData(\n\t\t\t\twindow,\n\t\t\t\tUtf8Encode(name, utf8Name, utf8NameBufSize)\n\t\t\t);\n\t\t}\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetWindowDisplayIndex(\n\t\t\tIntPtr window\n\t\t);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetWindowDisplayMode(\n\t\t\tIntPtr window,\n\t\t\tout SDL_DisplayMode mode\n\t\t);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern uint SDL_GetWindowFlags(IntPtr window);\n\n\t\t/* IntPtr refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GetWindowFromID(uint id);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetWindowGammaRamp(\n\t\t\tIntPtr window,\n\t\t\t[Out()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeConst = 256)]\n\t\t\t\tushort[] red,\n\t\t\t[Out()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeConst = 256)]\n\t\t\t\tushort[] green,\n\t\t\t[Out()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeConst = 256)]\n\t\t\t\tushort[] blue\n\t\t);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_GetWindowGrab(IntPtr window);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern uint SDL_GetWindowID(IntPtr window);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern uint SDL_GetWindowPixelFormat(\n\t\t\tIntPtr window\n\t\t);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_GetWindowMaximumSize(\n\t\t\tIntPtr window,\n\t\t\tout int max_w,\n\t\t\tout int max_h\n\t\t);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_GetWindowMinimumSize(\n\t\t\tIntPtr window,\n\t\t\tout int min_w,\n\t\t\tout int min_h\n\t\t);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_GetWindowPosition(\n\t\t\tIntPtr window,\n\t\t\tout int x,\n\t\t\tout int y\n\t\t);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_GetWindowSize(\n\t\t\tIntPtr window,\n\t\t\tout int w,\n\t\t\tout int h\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, window to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GetWindowSurface(IntPtr window);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetWindowTitle\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GetWindowTitle(\n\t\t\tIntPtr window\n\t\t);\n\t\tpublic static string SDL_GetWindowTitle(IntPtr window)\n\t\t{\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_GetWindowTitle(window)\n\t\t\t);\n\t\t}\n\n\t\t/* texture refers to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GL_BindTexture(\n\t\t\tIntPtr texture,\n\t\t\tout float texw,\n\t\t\tout float texh\n\t\t);\n\n\t\t/* IntPtr and window refer to an SDL_GLContext and SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GL_CreateContext(IntPtr window);\n\n\t\t/* context refers to an SDL_GLContext */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_GL_DeleteContext(IntPtr context);\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GL_LoadLibrary\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe int INTERNAL_SDL_GL_LoadLibrary(byte* path);\n\t\tpublic static unsafe int SDL_GL_LoadLibrary(string path)\n\t\t{\n\t\t\tbyte* utf8Path = Utf8Encode(path);\n\t\t\tint result = INTERNAL_SDL_GL_LoadLibrary(\n\t\t\t\tutf8Path\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8Path);\n\t\t\treturn result;\n\t\t}\n\n\t\t/* IntPtr refers to a function pointer, proc to a const char* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GL_GetProcAddress(IntPtr proc);\n\n\t\t/* IntPtr refers to a function pointer */\n\t\tpublic static unsafe IntPtr SDL_GL_GetProcAddress(string proc)\n\t\t{\n\t\t\tint utf8ProcBufSize = Utf8Size(proc);\n\t\t\tbyte* utf8Proc = stackalloc byte[utf8ProcBufSize];\n\t\t\treturn SDL_GL_GetProcAddress(\n\t\t\t\t(IntPtr) Utf8Encode(proc, utf8Proc, utf8ProcBufSize)\n\t\t\t);\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_GL_UnloadLibrary();\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GL_ExtensionSupported\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe SDL_bool INTERNAL_SDL_GL_ExtensionSupported(\n\t\t\tbyte* extension\n\t\t);\n\t\tpublic static unsafe SDL_bool SDL_GL_ExtensionSupported(string extension)\n\t\t{\n\t\t\tint utf8ExtensionBufSize = Utf8SizeNullable(extension);\n\t\t\tbyte* utf8Extension = stackalloc byte[utf8ExtensionBufSize];\n\t\t\treturn INTERNAL_SDL_GL_ExtensionSupported(\n\t\t\t\tUtf8Encode(extension, utf8Extension, utf8ExtensionBufSize)\n\t\t\t);\n\t\t}\n\n\t\t/* Only available in SDL 2.0.2 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_GL_ResetAttributes();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GL_GetAttribute(\n\t\t\tSDL_GLattr attr,\n\t\t\tout int value\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GL_GetSwapInterval();\n\n\t\t/* window and context refer to an SDL_Window* and SDL_GLContext */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GL_MakeCurrent(\n\t\t\tIntPtr window,\n\t\t\tIntPtr context\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GL_GetCurrentWindow();\n\n\t\t/* IntPtr refers to an SDL_Context */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GL_GetCurrentContext();\n\n\t\t/* window refers to an SDL_Window*.\n\t\t * Only available in SDL 2.0.1 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_GL_GetDrawableSize(\n\t\t\tIntPtr window,\n\t\t\tout int w,\n\t\t\tout int h\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GL_SetAttribute(\n\t\t\tSDL_GLattr attr,\n\t\t\tint value\n\t\t);\n\n\t\tpublic static int SDL_GL_SetAttribute(\n\t\t\tSDL_GLattr attr,\n\t\t\tSDL_GLprofile profile\n\t\t) {\n\t\t\treturn SDL_GL_SetAttribute(attr, (int)profile);\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GL_SetSwapInterval(int interval);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_GL_SwapWindow(IntPtr window);\n\n\t\t/* texture refers to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GL_UnbindTexture(IntPtr texture);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_HideWindow(IntPtr window);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_IsScreenSaverEnabled();\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_MaximizeWindow(IntPtr window);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_MinimizeWindow(IntPtr window);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_RaiseWindow(IntPtr window);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_RestoreWindow(IntPtr window);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetWindowBrightness(\n\t\t\tIntPtr window,\n\t\t\tfloat brightness\n\t\t);\n\n\t\t/* IntPtr and userdata are void*, window is an SDL_Window* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_SetWindowData\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe IntPtr INTERNAL_SDL_SetWindowData(\n\t\t\tIntPtr window,\n\t\t\tbyte* name,\n\t\t\tIntPtr userdata\n\t\t);\n\t\tpublic static unsafe IntPtr SDL_SetWindowData(\n\t\t\tIntPtr window,\n\t\t\tstring name,\n\t\t\tIntPtr userdata\n\t\t) {\n\t\t\tint utf8NameBufSize = Utf8Size(name);\n\t\t\tbyte* utf8Name = stackalloc byte[utf8NameBufSize];\n\t\t\treturn INTERNAL_SDL_SetWindowData(\n\t\t\t\twindow,\n\t\t\t\tUtf8Encode(name, utf8Name, utf8NameBufSize),\n\t\t\t\tuserdata\n\t\t\t);\n\t\t}\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetWindowDisplayMode(\n\t\t\tIntPtr window,\n\t\t\tref SDL_DisplayMode mode\n\t\t);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetWindowFullscreen(\n\t\t\tIntPtr window,\n\t\t\tuint flags\n\t\t);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetWindowGammaRamp(\n\t\t\tIntPtr window,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeConst = 256)]\n\t\t\t\tushort[] red,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeConst = 256)]\n\t\t\t\tushort[] green,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeConst = 256)]\n\t\t\t\tushort[] blue\n\t\t);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_SetWindowGrab(\n\t\t\tIntPtr window,\n\t\t\tSDL_bool grabbed\n\t\t);\n\n\t\t/* window refers to an SDL_Window*, icon to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_SetWindowIcon(\n\t\t\tIntPtr window,\n\t\t\tIntPtr icon\n\t\t);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_SetWindowMaximumSize(\n\t\t\tIntPtr window,\n\t\t\tint max_w,\n\t\t\tint max_h\n\t\t);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_SetWindowMinimumSize(\n\t\t\tIntPtr window,\n\t\t\tint min_w,\n\t\t\tint min_h\n\t\t);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_SetWindowPosition(\n\t\t\tIntPtr window,\n\t\t\tint x,\n\t\t\tint y\n\t\t);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_SetWindowSize(\n\t\t\tIntPtr window,\n\t\t\tint w,\n\t\t\tint h\n\t\t);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_SetWindowBordered(\n\t\t\tIntPtr window,\n\t\t\tSDL_bool bordered\n\t\t);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetWindowBordersSize(\n\t\t\tIntPtr window,\n\t\t\tout int top,\n\t\t\tout int left,\n\t\t\tout int bottom,\n\t\t\tout int right\n\t\t);\n\n\t\t/* window refers to an SDL_Window*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_SetWindowResizable(\n\t\t\tIntPtr window,\n\t\t\tSDL_bool resizable\n\t\t);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_SetWindowTitle\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe void INTERNAL_SDL_SetWindowTitle(\n\t\t\tIntPtr window,\n\t\t\tbyte* title\n\t\t);\n\t\tpublic static unsafe void SDL_SetWindowTitle(\n\t\t\tIntPtr window,\n\t\t\tstring title\n\t\t) {\n\t\t\tint utf8TitleBufSize = Utf8Size(title);\n\t\t\tbyte* utf8Title = stackalloc byte[utf8TitleBufSize];\n\t\t\tINTERNAL_SDL_SetWindowTitle(\n\t\t\t\twindow,\n\t\t\t\tUtf8Encode(title, utf8Title, utf8TitleBufSize)\n\t\t\t);\n\t\t}\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_ShowWindow(IntPtr window);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_UpdateWindowSurface(IntPtr window);\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_UpdateWindowSurfaceRects(\n\t\t\tIntPtr window,\n\t\t\t[In] SDL_Rect[] rects,\n\t\t\tint numrects\n\t\t);\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_VideoInit\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe int INTERNAL_SDL_VideoInit(\n\t\t\tbyte* driver_name\n\t\t);\n\t\tpublic static unsafe int SDL_VideoInit(string driver_name)\n\t\t{\n\t\t\tint utf8DriverNameBufSize = Utf8Size(driver_name);\n\t\t\tbyte* utf8DriverName = stackalloc byte[utf8DriverNameBufSize];\n\t\t\treturn INTERNAL_SDL_VideoInit(\n\t\t\t\tUtf8Encode(driver_name, utf8DriverName, utf8DriverNameBufSize)\n\t\t\t);\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_VideoQuit();\n\n\t\t/* window refers to an SDL_Window*, callback_data to a void*\n\t\t * Only available in 2.0.4 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetWindowHitTest(\n\t\t\tIntPtr window,\n\t\t\tSDL_HitTest callback,\n\t\t\tIntPtr callback_data\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Window*\n\t\t * Only available in 2.0.4 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GetGrabbedWindow();\n\n\t\t#endregion\n\n\t\t#region SDL_blendmode.h\n\n\t\t[Flags]\n\t\tpublic enum SDL_BlendMode\n\t\t{\n\t\t\tSDL_BLENDMODE_NONE =\t0x00000000,\n\t\t\tSDL_BLENDMODE_BLEND =\t0x00000001,\n\t\t\tSDL_BLENDMODE_ADD =\t0x00000002,\n\t\t\tSDL_BLENDMODE_MOD =\t0x00000004,\n\t\t\tSDL_BLENDMODE_MUL =\t0x00000008,\t/* >= 2.0.11 */\n\t\t\tSDL_BLENDMODE_INVALID =\t0x7FFFFFFF\n\t\t}\n\n\t\tpublic enum SDL_BlendOperation\n\t\t{\n\t\t\tSDL_BLENDOPERATION_ADD\t\t= 0x1,\n\t\t\tSDL_BLENDOPERATION_SUBTRACT\t= 0x2,\n\t\t\tSDL_BLENDOPERATION_REV_SUBTRACT\t= 0x3,\n\t\t\tSDL_BLENDOPERATION_MINIMUM\t= 0x4,\n\t\t\tSDL_BLENDOPERATION_MAXIMUM\t= 0x5\n\t\t}\n\n\t\tpublic enum SDL_BlendFactor\n\t\t{\n\t\t\tSDL_BLENDFACTOR_ZERO\t\t\t= 0x1,\n\t\t\tSDL_BLENDFACTOR_ONE\t\t\t= 0x2,\n\t\t\tSDL_BLENDFACTOR_SRC_COLOR\t\t= 0x3,\n\t\t\tSDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR\t= 0x4,\n\t\t\tSDL_BLENDFACTOR_SRC_ALPHA\t\t= 0x5,\n\t\t\tSDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA\t= 0x6,\n\t\t\tSDL_BLENDFACTOR_DST_COLOR\t\t= 0x7,\n\t\t\tSDL_BLENDFACTOR_ONE_MINUS_DST_COLOR\t= 0x8,\n\t\t\tSDL_BLENDFACTOR_DST_ALPHA\t\t= 0x9,\n\t\t\tSDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA\t= 0xA\n\t\t}\n\n\t\t/* Only available in 2.0.6 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_BlendMode SDL_ComposeCustomBlendMode(\n\t\t\tSDL_BlendFactor srcColorFactor,\n\t\t\tSDL_BlendFactor dstColorFactor,\n\t\t\tSDL_BlendOperation colorOperation,\n\t\t\tSDL_BlendFactor srcAlphaFactor,\n\t\t\tSDL_BlendFactor dstAlphaFactor,\n\t\t\tSDL_BlendOperation alphaOperation\n\t\t);\n\n\t\t#endregion\n\n\t\t#region SDL_vulkan.h\n\n\t\t/* Only available in 2.0.6 or higher. */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_Vulkan_LoadLibrary\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe int INTERNAL_SDL_Vulkan_LoadLibrary(\n\t\t\tbyte* path\n\t\t);\n\t\tpublic static unsafe int SDL_Vulkan_LoadLibrary(string path)\n\t\t{\n\t\t\tbyte* utf8Path = Utf8Encode(path);\n\t\t\tint result = INTERNAL_SDL_Vulkan_LoadLibrary(\n\t\t\t\tutf8Path\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8Path);\n\t\t\treturn result;\n\t\t}\n\n\t\t/* Only available in 2.0.6 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_Vulkan_GetVkGetInstanceProcAddr();\n\n\t\t/* Only available in 2.0.6 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_Vulkan_UnloadLibrary();\n\n\t\t/* window refers to an SDL_Window*, pNames to a const char**.\n\t\t * Only available in 2.0.6 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_Vulkan_GetInstanceExtensions(\n\t\t\tIntPtr window,\n\t\t\tout uint pCount,\n\t\t\tIntPtr[] pNames\n\t\t);\n\n\t\t/* window refers to an SDL_Window.\n\t\t * instance refers to a VkInstance.\n\t\t * surface refers to a VkSurfaceKHR.\n\t\t * Only available in 2.0.6 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_Vulkan_CreateSurface(\n\t\t\tIntPtr window,\n\t\t\tIntPtr instance,\n\t\t\tout ulong surface\n\t\t);\n\n\t\t/* window refers to an SDL_Window*.\n\t\t * Only available in 2.0.6 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_Vulkan_GetDrawableSize(\n\t\t\tIntPtr window,\n\t\t\tout int w,\n\t\t\tout int h\n\t\t);\n\n\t\t#endregion\n\n\t\t#region SDL_metal.h\n\n\t\t/* Only available in 2.0.11 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_Metal_CreateView(\n\t\t\tIntPtr window\n\t\t);\n\n\t\t/* Only available in 2.0.11 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_Metal_DestroyView(\n\t\t\tIntPtr view\n\t\t);\n\n\t\t#endregion\n\n\t\t#region SDL_render.h\n\n\t\t[Flags]\n\t\tpublic enum SDL_RendererFlags : uint\n\t\t{\n\t\t\tSDL_RENDERER_SOFTWARE =\t\t0x00000001,\n\t\t\tSDL_RENDERER_ACCELERATED =\t0x00000002,\n\t\t\tSDL_RENDERER_PRESENTVSYNC =\t0x00000004,\n\t\t\tSDL_RENDERER_TARGETTEXTURE =\t0x00000008\n\t\t}\n\n\t\t[Flags]\n\t\tpublic enum SDL_RendererFlip\n\t\t{\n\t\t\tSDL_FLIP_NONE =\t\t0x00000000,\n\t\t\tSDL_FLIP_HORIZONTAL =\t0x00000001,\n\t\t\tSDL_FLIP_VERTICAL =\t0x00000002\n\t\t}\n\n\t\tpublic enum SDL_TextureAccess\n\t\t{\n\t\t\tSDL_TEXTUREACCESS_STATIC,\n\t\t\tSDL_TEXTUREACCESS_STREAMING,\n\t\t\tSDL_TEXTUREACCESS_TARGET\n\t\t}\n\n\t\t[Flags]\n\t\tpublic enum SDL_TextureModulate\n\t\t{\n\t\t\tSDL_TEXTUREMODULATE_NONE =\t\t0x00000000,\n\t\t\tSDL_TEXTUREMODULATE_HORIZONTAL =\t0x00000001,\n\t\t\tSDL_TEXTUREMODULATE_VERTICAL =\t\t0x00000002\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic unsafe struct SDL_RendererInfo\n\t\t{\n\t\t\tpublic IntPtr name; // const char*\n\t\t\tpublic uint flags;\n\t\t\tpublic uint num_texture_formats;\n\t\t\tpublic fixed uint texture_formats[16];\n\t\t\tpublic int max_texture_width;\n\t\t\tpublic int max_texture_height;\n\t\t}\n\n\t\t/* Only available in 2.0.11 or higher. */\n\t\tpublic enum SDL_ScaleMode\n\t\t{\n\t\t\tSDL_ScaleModeNearest,\n\t\t\tSDL_ScaleModeLinear,\n\t\t\tSDL_ScaleModeBest\n\t\t}\n\n\t\t/* IntPtr refers to an SDL_Renderer*, window to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_CreateRenderer(\n\t\t\tIntPtr window,\n\t\t\tint index,\n\t\t\tSDL_RendererFlags flags\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Renderer*, surface to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_CreateSoftwareRenderer(IntPtr surface);\n\n\t\t/* IntPtr refers to an SDL_Texture*, renderer to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_CreateTexture(\n\t\t\tIntPtr renderer,\n\t\t\tuint format,\n\t\t\tint access,\n\t\t\tint w,\n\t\t\tint h\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Texture*\n\t\t * renderer refers to an SDL_Renderer*\n\t\t * surface refers to an SDL_Surface*\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_CreateTextureFromSurface(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr surface\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_DestroyRenderer(IntPtr renderer);\n\n\t\t/* texture refers to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_DestroyTexture(IntPtr texture);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetNumRenderDrivers();\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetRenderDrawBlendMode(\n\t\t\tIntPtr renderer,\n\t\t\tout SDL_BlendMode blendMode\n\t\t);\n\n\t\t/* texture refers to an SDL_Texture*\n\t\t * Only available in 2.0.11 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetTextureScaleMode(\n\t\t\tIntPtr texture,\n\t\t\tSDL_ScaleMode scaleMode\n\t\t);\n\n\t\t/* texture refers to an SDL_Texture*\n\t\t * Only available in 2.0.11 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetTextureScaleMode(\n\t\t\tIntPtr texture,\n\t\t\tout SDL_ScaleMode scaleMode\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetRenderDrawColor(\n\t\t\tIntPtr renderer,\n\t\t\tout byte r,\n\t\t\tout byte g,\n\t\t\tout byte b,\n\t\t\tout byte a\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetRenderDriverInfo(\n\t\t\tint index,\n\t\t\tout SDL_RendererInfo info\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Renderer*, window to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GetRenderer(IntPtr window);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetRendererInfo(\n\t\t\tIntPtr renderer,\n\t\t\tout SDL_RendererInfo info\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetRendererOutputSize(\n\t\t\tIntPtr renderer,\n\t\t\tout int w,\n\t\t\tout int h\n\t\t);\n\n\t\t/* texture refers to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetTextureAlphaMod(\n\t\t\tIntPtr texture,\n\t\t\tout byte alpha\n\t\t);\n\n\t\t/* texture refers to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetTextureBlendMode(\n\t\t\tIntPtr texture,\n\t\t\tout SDL_BlendMode blendMode\n\t\t);\n\n\t\t/* texture refers to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetTextureColorMod(\n\t\t\tIntPtr texture,\n\t\t\tout byte r,\n\t\t\tout byte g,\n\t\t\tout byte b\n\t\t);\n\n\t\t/* texture refers to an SDL_Texture*, pixels to a void* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_LockTexture(\n\t\t\tIntPtr texture,\n\t\t\tref SDL_Rect rect,\n\t\t\tout IntPtr pixels,\n\t\t\tout int pitch\n\t\t);\n\n\t\t/* texture refers to an SDL_Texture*, pixels to a void*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * the rectangle is passed as NULL.\n\t\t * This overload allows for IntPtr.Zero to be passed for rect.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_LockTexture(\n\t\t\tIntPtr texture,\n\t\t\tIntPtr rect,\n\t\t\tout IntPtr pixels,\n\t\t\tout int pitch\n\t\t);\n\n\t\t/* texture refers to an SDL_Texture*, surface to an SDL_Surface*\n\t\t * Only available in 2.0.11 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_LockTextureToSurface(\n\t\t\tIntPtr texture,\n\t\t\tref SDL_Rect rect,\n\t\t\tout IntPtr surface\n\t\t);\n\n\t\t/* texture refers to an SDL_Texture*, surface to an SDL_Surface*\n\t\t * Internally, this function contains logic to use default values when\n\t\t * the rectangle is passed as NULL.\n\t\t * This overload allows for IntPtr.Zero to be passed for rect.\n\t\t * Only available in 2.0.11 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_LockTextureToSurface(\n\t\t\tIntPtr texture,\n\t\t\tIntPtr rect,\n\t\t\tout IntPtr surface\n\t\t);\n\n\t\t/* texture refers to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_QueryTexture(\n\t\t\tIntPtr texture,\n\t\t\tout uint format,\n\t\t\tout int access,\n\t\t\tout int w,\n\t\t\tout int h\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderClear(IntPtr renderer);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopy(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tref SDL_Rect dstrect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source and destination rectangles are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for srcrect.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopy(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tIntPtr srcrect,\n\t\t\tref SDL_Rect dstrect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source and destination rectangles are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for dstrect.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopy(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tIntPtr dstrect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source and destination rectangles are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for both SDL_Rects.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopy(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tIntPtr srcrect,\n\t\t\tIntPtr dstrect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyEx(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tref SDL_Rect dstrect,\n\t\t\tdouble angle,\n\t\t\tref SDL_Point center,\n\t\t\tSDL_RendererFlip flip\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source, destination, and/or center are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for srcrect.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyEx(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tIntPtr srcrect,\n\t\t\tref SDL_Rect dstrect,\n\t\t\tdouble angle,\n\t\t\tref SDL_Point center,\n\t\t\tSDL_RendererFlip flip\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source, destination, and/or center are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for dstrect.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyEx(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tIntPtr dstrect,\n\t\t\tdouble angle,\n\t\t\tref SDL_Point center,\n\t\t\tSDL_RendererFlip flip\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source, destination, and/or center are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for center.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyEx(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tref SDL_Rect dstrect,\n\t\t\tdouble angle,\n\t\t\tIntPtr center,\n\t\t\tSDL_RendererFlip flip\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source, destination, and/or center are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for both\n\t\t * srcrect and dstrect.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyEx(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tIntPtr srcrect,\n\t\t\tIntPtr dstrect,\n\t\t\tdouble angle,\n\t\t\tref SDL_Point center,\n\t\t\tSDL_RendererFlip flip\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source, destination, and/or center are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for both\n\t\t * srcrect and center.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyEx(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tIntPtr srcrect,\n\t\t\tref SDL_Rect dstrect,\n\t\t\tdouble angle,\n\t\t\tIntPtr center,\n\t\t\tSDL_RendererFlip flip\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source, destination, and/or center are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for both\n\t\t * dstrect and center.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyEx(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tIntPtr dstrect,\n\t\t\tdouble angle,\n\t\t\tIntPtr center,\n\t\t\tSDL_RendererFlip flip\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source, destination, and/or center are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for all\n\t\t * three parameters.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyEx(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tIntPtr srcrect,\n\t\t\tIntPtr dstrect,\n\t\t\tdouble angle,\n\t\t\tIntPtr center,\n\t\t\tSDL_RendererFlip flip\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderDrawLine(\n\t\t\tIntPtr renderer,\n\t\t\tint x1,\n\t\t\tint y1,\n\t\t\tint x2,\n\t\t\tint y2\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderDrawLines(\n\t\t\tIntPtr renderer,\n\t\t\t[In] SDL_Point[] points,\n\t\t\tint count\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderDrawPoint(\n\t\t\tIntPtr renderer,\n\t\t\tint x,\n\t\t\tint y\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderDrawPoints(\n\t\t\tIntPtr renderer,\n\t\t\t[In] SDL_Point[] points,\n\t\t\tint count\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderDrawRect(\n\t\t\tIntPtr renderer,\n\t\t\tref SDL_Rect rect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, rect to an SDL_Rect*.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for rect.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderDrawRect(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr rect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderDrawRects(\n\t\t\tIntPtr renderer,\n\t\t\t[In] SDL_Rect[] rects,\n\t\t\tint count\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderFillRect(\n\t\t\tIntPtr renderer,\n\t\t\tref SDL_Rect rect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, rect to an SDL_Rect*.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for rect.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderFillRect(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr rect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderFillRects(\n\t\t\tIntPtr renderer,\n\t\t\t[In] SDL_Rect[] rects,\n\t\t\tint count\n\t\t);\n\n\t\t#region Floating Point Render Functions\n\n\t\t/* This region only available in SDL 2.0.10 or higher. */\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyF(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tref SDL_FRect dstrect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source and destination rectangles are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for srcrect.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyF(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tIntPtr srcrect,\n\t\t\tref SDL_FRect dstrect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source and destination rectangles are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for dstrect.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyF(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tIntPtr dstrect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source and destination rectangles are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for both SDL_Rects.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyF(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tIntPtr srcrect,\n\t\t\tIntPtr dstrect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyEx(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tref SDL_FRect dstrect,\n\t\t\tdouble angle,\n\t\t\tref SDL_FPoint center,\n\t\t\tSDL_RendererFlip flip\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source, destination, and/or center are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for srcrect.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyEx(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tIntPtr srcrect,\n\t\t\tref SDL_FRect dstrect,\n\t\t\tdouble angle,\n\t\t\tref SDL_FPoint center,\n\t\t\tSDL_RendererFlip flip\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source, destination, and/or center are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for dstrect.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyExF(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tIntPtr dstrect,\n\t\t\tdouble angle,\n\t\t\tref SDL_FPoint center,\n\t\t\tSDL_RendererFlip flip\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source, destination, and/or center are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for center.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyExF(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tref SDL_FRect dstrect,\n\t\t\tdouble angle,\n\t\t\tIntPtr center,\n\t\t\tSDL_RendererFlip flip\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source, destination, and/or center are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for both\n\t\t * srcrect and dstrect.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyExF(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tIntPtr srcrect,\n\t\t\tIntPtr dstrect,\n\t\t\tdouble angle,\n\t\t\tref SDL_FPoint center,\n\t\t\tSDL_RendererFlip flip\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source, destination, and/or center are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for both\n\t\t * srcrect and center.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyExF(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tIntPtr srcrect,\n\t\t\tref SDL_FRect dstrect,\n\t\t\tdouble angle,\n\t\t\tIntPtr center,\n\t\t\tSDL_RendererFlip flip\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source, destination, and/or center are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for both\n\t\t * dstrect and center.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyExF(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tIntPtr dstrect,\n\t\t\tdouble angle,\n\t\t\tIntPtr center,\n\t\t\tSDL_RendererFlip flip\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture*.\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source, destination, and/or center are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for all\n\t\t * three parameters.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderCopyExF(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture,\n\t\t\tIntPtr srcrect,\n\t\t\tIntPtr dstrect,\n\t\t\tdouble angle,\n\t\t\tIntPtr center,\n\t\t\tSDL_RendererFlip flip\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderDrawPointF(\n\t\t\tIntPtr renderer,\n\t\t\tfloat x,\n\t\t\tfloat y\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderDrawPointsF(\n\t\t\tIntPtr renderer,\n\t\t\t[In] SDL_FPoint[] points,\n\t\t\tint count\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderDrawLineF(\n\t\t\tIntPtr renderer,\n\t\t\tfloat x1,\n\t\t\tfloat y1,\n\t\t\tfloat x2,\n\t\t\tfloat y2\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderDrawLinesF(\n\t\t\tIntPtr renderer,\n\t\t\t[In] SDL_FPoint[] points,\n\t\t\tint count\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderDrawRectF(\n\t\t\tIntPtr renderer,\n\t\t\tref SDL_FRect rect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, rect to an SDL_Rect*.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for rect.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderDrawRectF(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr rect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderDrawRectsF(\n\t\t\tIntPtr renderer,\n\t\t\t[In] SDL_FRect[] rects,\n\t\t\tint count\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderFillRectF(\n\t\t\tIntPtr renderer,\n\t\t\tref SDL_FRect rect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, rect to an SDL_Rect*.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for rect.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderFillRectF(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr rect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderFillRectsF(\n\t\t\tIntPtr renderer,\n\t\t\t[In] SDL_FRect[] rects,\n\t\t\tint count\n\t\t);\n\n\t\t#endregion\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_RenderGetClipRect(\n\t\t\tIntPtr renderer,\n\t\t\tout SDL_Rect rect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_RenderGetLogicalSize(\n\t\t\tIntPtr renderer,\n\t\t\tout int w,\n\t\t\tout int h\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_RenderGetScale(\n\t\t\tIntPtr renderer,\n\t\t\tout float scaleX,\n\t\t\tout float scaleY\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderGetViewport(\n\t\t\tIntPtr renderer,\n\t\t\tout SDL_Rect rect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_RenderPresent(IntPtr renderer);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderReadPixels(\n\t\t\tIntPtr renderer,\n\t\t\tref SDL_Rect rect,\n\t\t\tuint format,\n\t\t\tIntPtr pixels,\n\t\t\tint pitch\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderSetClipRect(\n\t\t\tIntPtr renderer,\n\t\t\tref SDL_Rect rect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for rect.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderSetClipRect(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr rect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderSetLogicalSize(\n\t\t\tIntPtr renderer,\n\t\t\tint w,\n\t\t\tint h\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderSetScale(\n\t\t\tIntPtr renderer,\n\t\t\tfloat scaleX,\n\t\t\tfloat scaleY\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderSetIntegerScale(\n\t\t\tIntPtr renderer,\n\t\t\tSDL_bool enable\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderSetViewport(\n\t\t\tIntPtr renderer,\n\t\t\tref SDL_Rect rect\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetRenderDrawBlendMode(\n\t\t\tIntPtr renderer,\n\t\t\tSDL_BlendMode blendMode\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetRenderDrawColor(\n\t\t\tIntPtr renderer,\n\t\t\tbyte r,\n\t\t\tbyte g,\n\t\t\tbyte b,\n\t\t\tbyte a\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*, texture to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetRenderTarget(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr texture\n\t\t);\n\n\t\t/* texture refers to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetTextureAlphaMod(\n\t\t\tIntPtr texture,\n\t\t\tbyte alpha\n\t\t);\n\n\t\t/* texture refers to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetTextureBlendMode(\n\t\t\tIntPtr texture,\n\t\t\tSDL_BlendMode blendMode\n\t\t);\n\n\t\t/* texture refers to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetTextureColorMod(\n\t\t\tIntPtr texture,\n\t\t\tbyte r,\n\t\t\tbyte g,\n\t\t\tbyte b\n\t\t);\n\n\t\t/* texture refers to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_UnlockTexture(IntPtr texture);\n\n\t\t/* texture refers to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_UpdateTexture(\n\t\t\tIntPtr texture,\n\t\t\tref SDL_Rect rect,\n\t\t\tIntPtr pixels,\n\t\t\tint pitch\n\t\t);\n\n\t\t/* texture refers to an SDL_Texture* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_UpdateTexture(\n\t\t\tIntPtr texture,\n\t\t\tIntPtr rect,\n\t\t\tIntPtr pixels,\n\t\t\tint pitch\n\t\t);\n\n\t\t/* texture refers to an SDL_Texture*\n\t\t * Only available in 2.0.1 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_UpdateYUVTexture(\n\t\t\tIntPtr texture,\n\t\t\tref SDL_Rect rect,\n\t\t\tIntPtr yPlane,\n\t\t\tint yPitch,\n\t\t\tIntPtr uPlane,\n\t\t\tint uPitch,\n\t\t\tIntPtr vPlane,\n\t\t\tint vPitch\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_RenderTargetSupported(\n\t\t\tIntPtr renderer\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Texture*, renderer to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GetRenderTarget(IntPtr renderer);\n\n\t\t/* renderer refers to an SDL_Renderer*\n\t\t * Only available in 2.0.8 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_RenderGetMetalLayer(\n\t\t\tIntPtr renderer\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*\n\t\t * Only available in 2.0.8 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_RenderGetMetalCommandEncoder(\n\t\t\tIntPtr renderer\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*\n\t\t * Only available in 2.0.4 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_RenderIsClipEnabled(IntPtr renderer);\n\n\t\t/* renderer refers to an SDL_Renderer*\n\t\t * Only available in 2.0.10 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_RenderFlush(IntPtr renderer);\n\n\t\t#endregion\n\n\t\t#region SDL_pixels.h\n\n\t\tpublic static uint SDL_DEFINE_PIXELFOURCC(byte A, byte B, byte C, byte D)\n\t\t{\n\t\t\treturn SDL_FOURCC(A, B, C, D);\n\t\t}\n\n\t\tpublic static uint SDL_DEFINE_PIXELFORMAT(\n\t\t\tSDL_PixelType type,\n\t\t\tuint order,\n\t\t\tSDL_PackedLayout layout,\n\t\t\tbyte bits,\n\t\t\tbyte bytes\n\t\t) {\n\t\t\treturn (uint) (\n\t\t\t\t(1 << 28) |\n\t\t\t\t(((byte) type) << 24) |\n\t\t\t\t(((byte) order) << 20) |\n\t\t\t\t(((byte) layout) << 16) |\n\t\t\t\t(bits << 8) |\n\t\t\t\t(bytes)\n\t\t\t);\n\t\t}\n\n\t\tpublic static byte SDL_PIXELFLAG(uint X)\n\t\t{\n\t\t\treturn (byte) ((X >> 28) & 0x0F);\n\t\t}\n\n\t\tpublic static byte SDL_PIXELTYPE(uint X)\n\t\t{\n\t\t\treturn (byte) ((X >> 24) & 0x0F);\n\t\t}\n\n\t\tpublic static byte SDL_PIXELORDER(uint X)\n\t\t{\n\t\t\treturn (byte) ((X >> 20) & 0x0F);\n\t\t}\n\n\t\tpublic static byte SDL_PIXELLAYOUT(uint X)\n\t\t{\n\t\t\treturn (byte) ((X >> 16) & 0x0F);\n\t\t}\n\n\t\tpublic static byte SDL_BITSPERPIXEL(uint X)\n\t\t{\n\t\t\treturn (byte) ((X >> 8) & 0xFF);\n\t\t}\n\n\t\tpublic static byte SDL_BYTESPERPIXEL(uint X)\n\t\t{\n\t\t\tif (SDL_ISPIXELFORMAT_FOURCC(X))\n\t\t\t{\n\t\t\t\tif (\t(X == SDL_PIXELFORMAT_YUY2) ||\n\t\t\t\t\t\t(X == SDL_PIXELFORMAT_UYVY) ||\n\t\t\t\t\t\t(X == SDL_PIXELFORMAT_YVYU)\t)\n\t\t\t\t{\n\t\t\t\t\treturn 2;\n\t\t\t\t}\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\treturn (byte) (X & 0xFF);\n\t\t}\n\n\t\tpublic static bool SDL_ISPIXELFORMAT_INDEXED(uint format)\n\t\t{\n\t\t\tif (SDL_ISPIXELFORMAT_FOURCC(format))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tSDL_PixelType pType =\n\t\t\t\t(SDL_PixelType) SDL_PIXELTYPE(format);\n\t\t\treturn (\n\t\t\t\tpType == SDL_PixelType.SDL_PIXELTYPE_INDEX1 ||\n\t\t\t\tpType == SDL_PixelType.SDL_PIXELTYPE_INDEX4 ||\n\t\t\t\tpType == SDL_PixelType.SDL_PIXELTYPE_INDEX8\n\t\t\t);\n\t\t}\n\n\t\tpublic static bool SDL_ISPIXELFORMAT_PACKED(uint format)\n\t\t{\n\t\t\tif (SDL_ISPIXELFORMAT_FOURCC(format))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tSDL_PixelType pType =\n\t\t\t\t(SDL_PixelType) SDL_PIXELTYPE(format);\n\t\t\treturn (\n\t\t\t\tpType == SDL_PixelType.SDL_PIXELTYPE_PACKED8 ||\n\t\t\t\tpType == SDL_PixelType.SDL_PIXELTYPE_PACKED16 ||\n\t\t\t\tpType == SDL_PixelType.SDL_PIXELTYPE_PACKED32\n\t\t\t);\n\t\t}\n\n\t\tpublic static bool SDL_ISPIXELFORMAT_ARRAY(uint format)\n\t\t{\n\t\t\tif (SDL_ISPIXELFORMAT_FOURCC(format))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tSDL_PixelType pType =\n\t\t\t\t(SDL_PixelType) SDL_PIXELTYPE(format);\n\t\t\treturn (\n\t\t\t\tpType == SDL_PixelType.SDL_PIXELTYPE_ARRAYU8 ||\n\t\t\t\tpType == SDL_PixelType.SDL_PIXELTYPE_ARRAYU16 ||\n\t\t\t\tpType == SDL_PixelType.SDL_PIXELTYPE_ARRAYU32 ||\n\t\t\t\tpType == SDL_PixelType.SDL_PIXELTYPE_ARRAYF16 ||\n\t\t\t\tpType == SDL_PixelType.SDL_PIXELTYPE_ARRAYF32\n\t\t\t);\n\t\t}\n\n\t\tpublic static bool SDL_ISPIXELFORMAT_ALPHA(uint format)\n\t\t{\n\t\t\tif (SDL_ISPIXELFORMAT_PACKED(format))\n\t\t\t{\n\t\t\t\tSDL_PackedOrder pOrder =\n\t\t\t\t\t(SDL_PackedOrder) SDL_PIXELORDER(format);\n\t\t\t\treturn (\n\t\t\t\t\tpOrder == SDL_PackedOrder.SDL_PACKEDORDER_ARGB ||\n\t\t\t\t\tpOrder == SDL_PackedOrder.SDL_PACKEDORDER_RGBA ||\n\t\t\t\t\tpOrder == SDL_PackedOrder.SDL_PACKEDORDER_ABGR ||\n\t\t\t\t\tpOrder == SDL_PackedOrder.SDL_PACKEDORDER_BGRA\n\t\t\t\t);\n\t\t\t}\n\t\t\telse if (SDL_ISPIXELFORMAT_ARRAY(format))\n\t\t\t{\n\t\t\t\tSDL_ArrayOrder aOrder =\n\t\t\t\t\t(SDL_ArrayOrder) SDL_PIXELORDER(format);\n\t\t\t\treturn (\n\t\t\t\t\taOrder == SDL_ArrayOrder.SDL_ARRAYORDER_ARGB ||\n\t\t\t\t\taOrder == SDL_ArrayOrder.SDL_ARRAYORDER_RGBA ||\n\t\t\t\t\taOrder == SDL_ArrayOrder.SDL_ARRAYORDER_ABGR ||\n\t\t\t\t\taOrder == SDL_ArrayOrder.SDL_ARRAYORDER_BGRA\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool SDL_ISPIXELFORMAT_FOURCC(uint format)\n\t\t{\n\t\t\treturn (format == 0) && (SDL_PIXELFLAG(format) != 1);\n\t\t}\n\n\t\tpublic enum SDL_PixelType\n\t\t{\n\t\t\tSDL_PIXELTYPE_UNKNOWN,\n\t\t\tSDL_PIXELTYPE_INDEX1,\n\t\t\tSDL_PIXELTYPE_INDEX4,\n\t\t\tSDL_PIXELTYPE_INDEX8,\n\t\t\tSDL_PIXELTYPE_PACKED8,\n\t\t\tSDL_PIXELTYPE_PACKED16,\n\t\t\tSDL_PIXELTYPE_PACKED32,\n\t\t\tSDL_PIXELTYPE_ARRAYU8,\n\t\t\tSDL_PIXELTYPE_ARRAYU16,\n\t\t\tSDL_PIXELTYPE_ARRAYU32,\n\t\t\tSDL_PIXELTYPE_ARRAYF16,\n\t\t\tSDL_PIXELTYPE_ARRAYF32\n\t\t}\n\n\t\tpublic enum SDL_BitmapOrder\n\t\t{\n\t\t\tSDL_BITMAPORDER_NONE,\n\t\t\tSDL_BITMAPORDER_4321,\n\t\t\tSDL_BITMAPORDER_1234\n\t\t}\n\n\t\tpublic enum SDL_PackedOrder\n\t\t{\n\t\t\tSDL_PACKEDORDER_NONE,\n\t\t\tSDL_PACKEDORDER_XRGB,\n\t\t\tSDL_PACKEDORDER_RGBX,\n\t\t\tSDL_PACKEDORDER_ARGB,\n\t\t\tSDL_PACKEDORDER_RGBA,\n\t\t\tSDL_PACKEDORDER_XBGR,\n\t\t\tSDL_PACKEDORDER_BGRX,\n\t\t\tSDL_PACKEDORDER_ABGR,\n\t\t\tSDL_PACKEDORDER_BGRA\n\t\t}\n\n\t\tpublic enum SDL_ArrayOrder\n\t\t{\n\t\t\tSDL_ARRAYORDER_NONE,\n\t\t\tSDL_ARRAYORDER_RGB,\n\t\t\tSDL_ARRAYORDER_RGBA,\n\t\t\tSDL_ARRAYORDER_ARGB,\n\t\t\tSDL_ARRAYORDER_BGR,\n\t\t\tSDL_ARRAYORDER_BGRA,\n\t\t\tSDL_ARRAYORDER_ABGR\n\t\t}\n\n\t\tpublic enum SDL_PackedLayout\n\t\t{\n\t\t\tSDL_PACKEDLAYOUT_NONE,\n\t\t\tSDL_PACKEDLAYOUT_332,\n\t\t\tSDL_PACKEDLAYOUT_4444,\n\t\t\tSDL_PACKEDLAYOUT_1555,\n\t\t\tSDL_PACKEDLAYOUT_5551,\n\t\t\tSDL_PACKEDLAYOUT_565,\n\t\t\tSDL_PACKEDLAYOUT_8888,\n\t\t\tSDL_PACKEDLAYOUT_2101010,\n\t\t\tSDL_PACKEDLAYOUT_1010102\n\t\t}\n\n\t\tpublic static readonly uint SDL_PIXELFORMAT_UNKNOWN = 0;\n\t\tpublic static readonly uint SDL_PIXELFORMAT_INDEX1LSB =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_INDEX1,\n\t\t\t\t(uint) SDL_BitmapOrder.SDL_BITMAPORDER_4321,\n\t\t\t\t0,\n\t\t\t\t1, 0\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_INDEX1MSB =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_INDEX1,\n\t\t\t\t(uint) SDL_BitmapOrder.SDL_BITMAPORDER_1234,\n\t\t\t\t0,\n\t\t\t\t1, 0\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_INDEX4LSB =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_INDEX4,\n\t\t\t\t(uint) SDL_BitmapOrder.SDL_BITMAPORDER_4321,\n\t\t\t\t0,\n\t\t\t\t4, 0\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_INDEX4MSB =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_INDEX4,\n\t\t\t\t(uint) SDL_BitmapOrder.SDL_BITMAPORDER_1234,\n\t\t\t\t0,\n\t\t\t\t4, 0\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_INDEX8 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_INDEX8,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t\t8, 1\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_RGB332 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED8,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_XRGB,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_332,\n\t\t\t\t8, 1\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_RGB444 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED16,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_XRGB,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_4444,\n\t\t\t\t12, 2\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_BGR444 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED16,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_XBGR,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_4444,\n\t\t\t\t12, 2\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_RGB555 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED16,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_XRGB,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_1555,\n\t\t\t\t15, 2\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_BGR555 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_INDEX1,\n\t\t\t\t(uint) SDL_BitmapOrder.SDL_BITMAPORDER_4321,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_1555,\n\t\t\t\t15, 2\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_ARGB4444 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED16,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_ARGB,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_4444,\n\t\t\t\t16, 2\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_RGBA4444 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED16,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_RGBA,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_4444,\n\t\t\t\t16, 2\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_ABGR4444 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED16,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_ABGR,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_4444,\n\t\t\t\t16, 2\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_BGRA4444 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED16,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_BGRA,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_4444,\n\t\t\t\t16, 2\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_ARGB1555 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED16,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_ARGB,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_1555,\n\t\t\t\t16, 2\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_RGBA5551 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED16,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_RGBA,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_5551,\n\t\t\t\t16, 2\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_ABGR1555 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED16,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_ABGR,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_1555,\n\t\t\t\t16, 2\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_BGRA5551 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED16,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_BGRA,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_5551,\n\t\t\t\t16, 2\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_RGB565 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED16,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_XRGB,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_565,\n\t\t\t\t16, 2\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_BGR565 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED16,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_XBGR,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_565,\n\t\t\t\t16, 2\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_RGB24 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_ARRAYU8,\n\t\t\t\t(uint) SDL_ArrayOrder.SDL_ARRAYORDER_RGB,\n\t\t\t\t0,\n\t\t\t\t24, 3\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_BGR24 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_ARRAYU8,\n\t\t\t\t(uint) SDL_ArrayOrder.SDL_ARRAYORDER_BGR,\n\t\t\t\t0,\n\t\t\t\t24, 3\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_RGB888 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED32,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_XRGB,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_8888,\n\t\t\t\t24, 4\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_RGBX8888 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED32,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_RGBX,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_8888,\n\t\t\t\t24, 4\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_BGR888 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED32,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_XBGR,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_8888,\n\t\t\t\t24, 4\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_BGRX8888 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED32,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_BGRX,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_8888,\n\t\t\t\t24, 4\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_ARGB8888 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED32,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_ARGB,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_8888,\n\t\t\t\t32, 4\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_RGBA8888 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED32,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_RGBA,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_8888,\n\t\t\t\t32, 4\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_ABGR8888 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED32,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_ABGR,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_8888,\n\t\t\t\t32, 4\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_BGRA8888 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED32,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_BGRA,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_8888,\n\t\t\t\t32, 4\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_ARGB2101010 =\n\t\t\tSDL_DEFINE_PIXELFORMAT(\n\t\t\t\tSDL_PixelType.SDL_PIXELTYPE_PACKED32,\n\t\t\t\t(uint) SDL_PackedOrder.SDL_PACKEDORDER_ARGB,\n\t\t\t\tSDL_PackedLayout.SDL_PACKEDLAYOUT_2101010,\n\t\t\t\t32, 4\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_YV12 =\n\t\t\tSDL_DEFINE_PIXELFOURCC(\n\t\t\t\t(byte) 'Y', (byte) 'V', (byte) '1', (byte) '2'\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_IYUV =\n\t\t\tSDL_DEFINE_PIXELFOURCC(\n\t\t\t\t(byte) 'I', (byte) 'Y', (byte) 'U', (byte) 'V'\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_YUY2 =\n\t\t\tSDL_DEFINE_PIXELFOURCC(\n\t\t\t\t(byte) 'Y', (byte) 'U', (byte) 'Y', (byte) '2'\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_UYVY =\n\t\t\tSDL_DEFINE_PIXELFOURCC(\n\t\t\t\t(byte) 'U', (byte) 'Y', (byte) 'V', (byte) 'Y'\n\t\t\t);\n\t\tpublic static readonly uint SDL_PIXELFORMAT_YVYU =\n\t\t\tSDL_DEFINE_PIXELFOURCC(\n\t\t\t\t(byte) 'Y', (byte) 'V', (byte) 'Y', (byte) 'U'\n\t\t\t);\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_Color\n\t\t{\n\t\t\tpublic byte r;\n\t\t\tpublic byte g;\n\t\t\tpublic byte b;\n\t\t\tpublic byte a;\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_Palette\n\t\t{\n\t\t\tpublic int ncolors;\n\t\t\tpublic IntPtr colors;\n\t\t\tpublic int version;\n\t\t\tpublic int refcount;\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_PixelFormat\n\t\t{\n\t\t\tpublic uint format;\n\t\t\tpublic IntPtr palette; // SDL_Palette*\n\t\t\tpublic byte BitsPerPixel;\n\t\t\tpublic byte BytesPerPixel;\n\t\t\tpublic uint Rmask;\n\t\t\tpublic uint Gmask;\n\t\t\tpublic uint Bmask;\n\t\t\tpublic uint Amask;\n\t\t\tpublic byte Rloss;\n\t\t\tpublic byte Gloss;\n\t\t\tpublic byte Bloss;\n\t\t\tpublic byte Aloss;\n\t\t\tpublic byte Rshift;\n\t\t\tpublic byte Gshift;\n\t\t\tpublic byte Bshift;\n\t\t\tpublic byte Ashift;\n\t\t\tpublic int refcount;\n\t\t\tpublic IntPtr next; // SDL_PixelFormat*\n\t\t}\n\n\t\t/* IntPtr refers to an SDL_PixelFormat* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_AllocFormat(uint pixel_format);\n\n\t\t/* IntPtr refers to an SDL_Palette* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_AllocPalette(int ncolors);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_CalculateGammaRamp(\n\t\t\tfloat gamma,\n\t\t\t[Out()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U2, SizeConst = 256)]\n\t\t\t\tushort[] ramp\n\t\t);\n\n\t\t/* format refers to an SDL_PixelFormat* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_FreeFormat(IntPtr format);\n\n\t\t/* palette refers to an SDL_Palette* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_FreePalette(IntPtr palette);\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetPixelFormatName\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GetPixelFormatName(\n\t\t\tuint format\n\t\t);\n\t\tpublic static string SDL_GetPixelFormatName(uint format)\n\t\t{\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_GetPixelFormatName(format)\n\t\t\t);\n\t\t}\n\n\t\t/* format refers to an SDL_PixelFormat* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_GetRGB(\n\t\t\tuint pixel,\n\t\t\tIntPtr format,\n\t\t\tout byte r,\n\t\t\tout byte g,\n\t\t\tout byte b\n\t\t);\n\n\t\t/* format refers to an SDL_PixelFormat* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_GetRGBA(\n\t\t\tuint pixel,\n\t\t\tIntPtr format,\n\t\t\tout byte r,\n\t\t\tout byte g,\n\t\t\tout byte b,\n\t\t\tout byte a\n\t\t);\n\n\t\t/* format refers to an SDL_PixelFormat* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern uint SDL_MapRGB(\n\t\t\tIntPtr format,\n\t\t\tbyte r,\n\t\t\tbyte g,\n\t\t\tbyte b\n\t\t);\n\n\t\t/* format refers to an SDL_PixelFormat* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern uint SDL_MapRGBA(\n\t\t\tIntPtr format,\n\t\t\tbyte r,\n\t\t\tbyte g,\n\t\t\tbyte b,\n\t\t\tbyte a\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern uint SDL_MasksToPixelFormatEnum(\n\t\t\tint bpp,\n\t\t\tuint Rmask,\n\t\t\tuint Gmask,\n\t\t\tuint Bmask,\n\t\t\tuint Amask\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_PixelFormatEnumToMasks(\n\t\t\tuint format,\n\t\t\tout int bpp,\n\t\t\tout uint Rmask,\n\t\t\tout uint Gmask,\n\t\t\tout uint Bmask,\n\t\t\tout uint Amask\n\t\t);\n\n\t\t/* palette refers to an SDL_Palette* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetPaletteColors(\n\t\t\tIntPtr palette,\n\t\t\t[In] SDL_Color[] colors,\n\t\t\tint firstcolor,\n\t\t\tint ncolors\n\t\t);\n\n\t\t/* format and palette refer to an SDL_PixelFormat* and SDL_Palette* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetPixelFormatPalette(\n\t\t\tIntPtr format,\n\t\t\tIntPtr palette\n\t\t);\n\n\t\t#endregion\n\n\t\t#region SDL_rect.h\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_Point\n\t\t{\n\t\t\tpublic int x;\n\t\t\tpublic int y;\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_Rect\n\t\t{\n\t\t\tpublic int x;\n\t\t\tpublic int y;\n\t\t\tpublic int w;\n\t\t\tpublic int h;\n\t\t}\n\n\t\t/* Only available in 2.0.10 or higher. */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_FPoint\n\t\t{\n\t\t\tpublic float x;\n\t\t\tpublic float y;\n\t\t}\n\n\t\t/* Only available in 2.0.10 or higher. */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_FRect\n\t\t{\n\t\t\tpublic float x;\n\t\t\tpublic float y;\n\t\t\tpublic float w;\n\t\t\tpublic float h;\n\t\t}\n\n\t\t/* Only available in 2.0.4 or higher. */\n\t\tpublic static SDL_bool SDL_PointInRect(ref SDL_Point p, ref SDL_Rect r)\n\t\t{\n\t\t\treturn (\t(p.x >= r.x) &&\n\t\t\t\t\t(p.x < (r.x + r.w)) &&\n\t\t\t\t\t(p.y >= r.y) &&\n\t\t\t\t\t(p.y < (r.y + r.h))\t) ?\n\t\t\t\tSDL_bool.SDL_TRUE :\n\t\t\t\tSDL_bool.SDL_FALSE;\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_EnclosePoints(\n\t\t\t[In] SDL_Point[] points,\n\t\t\tint count,\n\t\t\tref SDL_Rect clip,\n\t\t\tout SDL_Rect result\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasIntersection(\n\t\t\tref SDL_Rect A,\n\t\t\tref SDL_Rect B\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_IntersectRect(\n\t\t\tref SDL_Rect A,\n\t\t\tref SDL_Rect B,\n\t\t\tout SDL_Rect result\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_IntersectRectAndLine(\n\t\t\tref SDL_Rect rect,\n\t\t\tref int X1,\n\t\t\tref int Y1,\n\t\t\tref int X2,\n\t\t\tref int Y2\n\t\t);\n\n\t\tpublic static SDL_bool SDL_RectEmpty(ref SDL_Rect r)\n\t\t{\n\t\t\treturn ((r.w <= 0) || (r.h <= 0)) ?\n\t\t\t\tSDL_bool.SDL_TRUE :\n\t\t\t\tSDL_bool.SDL_FALSE;\n\t\t}\n\n\t\tpublic static SDL_bool SDL_RectEquals(\n\t\t\tref SDL_Rect a,\n\t\t\tref SDL_Rect b\n\t\t) {\n\t\t\treturn (\t(a.x == b.x) &&\n\t\t\t\t\t(a.y == b.y) &&\n\t\t\t\t\t(a.w == b.w) &&\n\t\t\t\t\t(a.h == b.h)\t) ?\n\t\t\t\tSDL_bool.SDL_TRUE :\n\t\t\t\tSDL_bool.SDL_FALSE;\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_UnionRect(\n\t\t\tref SDL_Rect A,\n\t\t\tref SDL_Rect B,\n\t\t\tout SDL_Rect result\n\t\t);\n\n\t\t#endregion\n\n\t\t#region SDL_surface.h\n\n\t\tpublic const uint SDL_SWSURFACE =\t0x00000000;\n\t\tpublic const uint SDL_PREALLOC =\t0x00000001;\n\t\tpublic const uint SDL_RLEACCEL =\t0x00000002;\n\t\tpublic const uint SDL_DONTFREE =\t0x00000004;\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_Surface\n\t\t{\n\t\t\tpublic uint flags;\n\t\t\tpublic IntPtr format; // SDL_PixelFormat*\n\t\t\tpublic int w;\n\t\t\tpublic int h;\n\t\t\tpublic int pitch;\n\t\t\tpublic IntPtr pixels; // void*\n\t\t\tpublic IntPtr userdata; // void*\n\t\t\tpublic int locked;\n\t\t\tpublic IntPtr lock_data; // void*\n\t\t\tpublic SDL_Rect clip_rect;\n\t\t\tpublic IntPtr map; // SDL_BlitMap*\n\t\t\tpublic int refcount;\n\t\t}\n\n\t\t/* surface refers to an SDL_Surface* */\n\t\tpublic static bool SDL_MUSTLOCK(IntPtr surface)\n\t\t{\n\t\t\tSDL_Surface sur;\n\t\t\tsur = (SDL_Surface) Marshal.PtrToStructure(\n\t\t\t\tsurface,\n\t\t\t\ttypeof(SDL_Surface)\n\t\t\t);\n\t\t\treturn (sur.flags & SDL_RLEACCEL) != 0;\n\t\t}\n\n\t\t/* src and dst refer to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_UpperBlit\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_BlitSurface(\n\t\t\tIntPtr src,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tIntPtr dst,\n\t\t\tref SDL_Rect dstrect\n\t\t);\n\n\t\t/* src and dst refer to an SDL_Surface*\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source and destination rectangles are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for srcrect.\n\t\t */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_UpperBlit\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_BlitSurface(\n\t\t\tIntPtr src,\n\t\t\tIntPtr srcrect,\n\t\t\tIntPtr dst,\n\t\t\tref SDL_Rect dstrect\n\t\t);\n\n\t\t/* src and dst refer to an SDL_Surface*\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source and destination rectangles are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for dstrect.\n\t\t */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_UpperBlit\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_BlitSurface(\n\t\t\tIntPtr src,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tIntPtr dst,\n\t\t\tIntPtr dstrect\n\t\t);\n\n\t\t/* src and dst refer to an SDL_Surface*\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source and destination rectangles are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for both SDL_Rects.\n\t\t */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_UpperBlit\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_BlitSurface(\n\t\t\tIntPtr src,\n\t\t\tIntPtr srcrect,\n\t\t\tIntPtr dst,\n\t\t\tIntPtr dstrect\n\t\t);\n\n\t\t/* src and dst refer to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_UpperBlitScaled\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_BlitScaled(\n\t\t\tIntPtr src,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tIntPtr dst,\n\t\t\tref SDL_Rect dstrect\n\t\t);\n\n\t\t/* src and dst refer to an SDL_Surface*\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source and destination rectangles are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for srcrect.\n\t\t */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_UpperBlitScaled\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_BlitScaled(\n\t\t\tIntPtr src,\n\t\t\tIntPtr srcrect,\n\t\t\tIntPtr dst,\n\t\t\tref SDL_Rect dstrect\n\t\t);\n\n\t\t/* src and dst refer to an SDL_Surface*\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source and destination rectangles are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for dstrect.\n\t\t */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_UpperBlitScaled\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_BlitScaled(\n\t\t\tIntPtr src,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tIntPtr dst,\n\t\t\tIntPtr dstrect\n\t\t);\n\n\t\t/* src and dst refer to an SDL_Surface*\n\t\t * Internally, this function contains logic to use default values when\n\t\t * source and destination rectangles are passed as NULL.\n\t\t * This overload allows for IntPtr.Zero (null) to be passed for both SDL_Rects.\n\t\t */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_UpperBlitScaled\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_BlitScaled(\n\t\t\tIntPtr src,\n\t\t\tIntPtr srcrect,\n\t\t\tIntPtr dst,\n\t\t\tIntPtr dstrect\n\t\t);\n\n\t\t/* src and dst are void* pointers */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_ConvertPixels(\n\t\t\tint width,\n\t\t\tint height,\n\t\t\tuint src_format,\n\t\t\tIntPtr src,\n\t\t\tint src_pitch,\n\t\t\tuint dst_format,\n\t\t\tIntPtr dst,\n\t\t\tint dst_pitch\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*\n\t\t * src refers to an SDL_Surface*\n\t\t * fmt refers to an SDL_PixelFormat*\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_ConvertSurface(\n\t\t\tIntPtr src,\n\t\t\tIntPtr fmt,\n\t\t\tuint flags\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, src to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_ConvertSurfaceFormat(\n\t\t\tIntPtr src,\n\t\t\tuint pixel_format,\n\t\t\tuint flags\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_CreateRGBSurface(\n\t\t\tuint flags,\n\t\t\tint width,\n\t\t\tint height,\n\t\t\tint depth,\n\t\t\tuint Rmask,\n\t\t\tuint Gmask,\n\t\t\tuint Bmask,\n\t\t\tuint Amask\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, pixels to a void* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_CreateRGBSurfaceFrom(\n\t\t\tIntPtr pixels,\n\t\t\tint width,\n\t\t\tint height,\n\t\t\tint depth,\n\t\t\tint pitch,\n\t\t\tuint Rmask,\n\t\t\tuint Gmask,\n\t\t\tuint Bmask,\n\t\t\tuint Amask\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_CreateRGBSurfaceWithFormat(\n\t\t\tuint flags,\n\t\t\tint width,\n\t\t\tint height,\n\t\t\tint depth,\n\t\t\tuint format\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, pixels to a void*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_CreateRGBSurfaceWithFormatFrom(\n\t\t\tIntPtr pixels,\n\t\t\tint width,\n\t\t\tint height,\n\t\t\tint depth,\n\t\t\tint pitch,\n\t\t\tuint format\n\t\t);\n\n\t\t/* dst refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_FillRect(\n\t\t\tIntPtr dst,\n\t\t\tref SDL_Rect rect,\n\t\t\tuint color\n\t\t);\n\n\t\t/* dst refers to an SDL_Surface*.\n\t\t * This overload allows passing NULL to rect.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_FillRect(\n\t\t\tIntPtr dst,\n\t\t\tIntPtr rect,\n\t\t\tuint color\n\t\t);\n\n\t\t/* dst refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_FillRects(\n\t\t\tIntPtr dst,\n\t\t\t[In] SDL_Rect[] rects,\n\t\t\tint count,\n\t\t\tuint color\n\t\t);\n\n\t\t/* surface refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_FreeSurface(IntPtr surface);\n\n\t\t/* surface refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_GetClipRect(\n\t\t\tIntPtr surface,\n\t\t\tout SDL_Rect rect\n\t\t);\n\n\t\t/* surface refers to an SDL_Surface*.\n\t\t * Only available in 2.0.9 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasColorKey(IntPtr surface);\n\n\t\t/* surface refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetColorKey(\n\t\t\tIntPtr surface,\n\t\t\tout uint key\n\t\t);\n\n\t\t/* surface refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetSurfaceAlphaMod(\n\t\t\tIntPtr surface,\n\t\t\tout byte alpha\n\t\t);\n\n\t\t/* surface refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetSurfaceBlendMode(\n\t\t\tIntPtr surface,\n\t\t\tout SDL_BlendMode blendMode\n\t\t);\n\n\t\t/* surface refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetSurfaceColorMod(\n\t\t\tIntPtr surface,\n\t\t\tout byte r,\n\t\t\tout byte g,\n\t\t\tout byte b\n\t\t);\n\n\t\t/* These are for SDL_LoadBMP, which is a macro in the SDL headers. */\n\t\t/* IntPtr refers to an SDL_Surface* */\n\t\t/* THIS IS AN RWops FUNCTION! */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_LoadBMP_RW\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_LoadBMP_RW(\n\t\t\tIntPtr src,\n\t\t\tint freesrc\n\t\t);\n\t\tpublic static IntPtr SDL_LoadBMP(string file)\n\t\t{\n\t\t\tIntPtr rwops = SDL_RWFromFile(file, \"rb\");\n\t\t\treturn INTERNAL_SDL_LoadBMP_RW(rwops, 1);\n\t\t}\n\n\t\t/* surface refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_LockSurface(IntPtr surface);\n\n\t\t/* src and dst refer to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_LowerBlit(\n\t\t\tIntPtr src,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tIntPtr dst,\n\t\t\tref SDL_Rect dstrect\n\t\t);\n\n\t\t/* src and dst refer to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_LowerBlitScaled(\n\t\t\tIntPtr src,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tIntPtr dst,\n\t\t\tref SDL_Rect dstrect\n\t\t);\n\n\t\t/* These are for SDL_SaveBMP, which is a macro in the SDL headers. */\n\t\t/* IntPtr refers to an SDL_Surface* */\n\t\t/* THIS IS AN RWops FUNCTION! */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_SaveBMP_RW\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern int INTERNAL_SDL_SaveBMP_RW(\n\t\t\tIntPtr surface,\n\t\t\tIntPtr src,\n\t\t\tint freesrc\n\t\t);\n\t\tpublic static int SDL_SaveBMP(IntPtr surface, string file)\n\t\t{\n\t\t\tIntPtr rwops = SDL_RWFromFile(file, \"wb\");\n\t\t\treturn INTERNAL_SDL_SaveBMP_RW(surface, rwops, 1);\n\t\t}\n\n\t\t/* surface refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_SetClipRect(\n\t\t\tIntPtr surface,\n\t\t\tref SDL_Rect rect\n\t\t);\n\n\t\t/* surface refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetColorKey(\n\t\t\tIntPtr surface,\n\t\t\tint flag,\n\t\t\tuint key\n\t\t);\n\n\t\t/* surface refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetSurfaceAlphaMod(\n\t\t\tIntPtr surface,\n\t\t\tbyte alpha\n\t\t);\n\n\t\t/* surface refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetSurfaceBlendMode(\n\t\t\tIntPtr surface,\n\t\t\tSDL_BlendMode blendMode\n\t\t);\n\n\t\t/* surface refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetSurfaceColorMod(\n\t\t\tIntPtr surface,\n\t\t\tbyte r,\n\t\t\tbyte g,\n\t\t\tbyte b\n\t\t);\n\n\t\t/* surface refers to an SDL_Surface*, palette to an SDL_Palette* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetSurfacePalette(\n\t\t\tIntPtr surface,\n\t\t\tIntPtr palette\n\t\t);\n\n\t\t/* surface refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetSurfaceRLE(\n\t\t\tIntPtr surface,\n\t\t\tint flag\n\t\t);\n\n\t\t/* src and dst refer to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SoftStretch(\n\t\t\tIntPtr src,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tIntPtr dst,\n\t\t\tref SDL_Rect dstrect\n\t\t);\n\n\t\t/* surface refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_UnlockSurface(IntPtr surface);\n\n\t\t/* src and dst refer to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_UpperBlit(\n\t\t\tIntPtr src,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tIntPtr dst,\n\t\t\tref SDL_Rect dstrect\n\t\t);\n\n\t\t/* src and dst refer to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_UpperBlitScaled(\n\t\t\tIntPtr src,\n\t\t\tref SDL_Rect srcrect,\n\t\t\tIntPtr dst,\n\t\t\tref SDL_Rect dstrect\n\t\t);\n\n\t\t/* surface and IntPtr refer to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_DuplicateSurface(IntPtr surface);\n\n\t\t#endregion\n\n\t\t#region SDL_clipboard.h\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasClipboardText();\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetClipboardText\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GetClipboardText();\n\t\tpublic static string SDL_GetClipboardText()\n\t\t{\n\t\t\treturn UTF8_ToManaged(INTERNAL_SDL_GetClipboardText(), true);\n\t\t}\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_SetClipboardText\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe int INTERNAL_SDL_SetClipboardText(\n\t\t\tbyte* text\n\t\t);\n\t\tpublic static unsafe int SDL_SetClipboardText(\n\t\t\tstring text\n\t\t) {\n\t\t\tbyte* utf8Text = Utf8Encode(text);\n\t\t\tint result = INTERNAL_SDL_SetClipboardText(\n\t\t\t\tutf8Text\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8Text);\n\t\t\treturn result;\n\t\t}\n\n\t\t#endregion\n\n\t\t#region SDL_events.h\n\n\t\t/* General keyboard/mouse state definitions. */\n\t\tpublic const byte SDL_PRESSED =\t\t1;\n\t\tpublic const byte SDL_RELEASED =\t0;\n\n\t\t/* Default size is according to SDL2 default. */\n\t\tpublic const int SDL_TEXTEDITINGEVENT_TEXT_SIZE = 32;\n\t\tpublic const int SDL_TEXTINPUTEVENT_TEXT_SIZE = 32;\n\n\t\t/* The types of events that can be delivered. */\n\t\tpublic enum SDL_EventType : uint\n\t\t{\n\t\t\tSDL_FIRSTEVENT =\t\t0,\n\n\t\t\t/* Application events */\n\t\t\tSDL_QUIT = \t\t\t0x100,\n\n\t\t\t/* iOS/Android/WinRT app events */\n\t\t\tSDL_APP_TERMINATING,\n\t\t\tSDL_APP_LOWMEMORY,\n\t\t\tSDL_APP_WILLENTERBACKGROUND,\n\t\t\tSDL_APP_DIDENTERBACKGROUND,\n\t\t\tSDL_APP_WILLENTERFOREGROUND,\n\t\t\tSDL_APP_DIDENTERFOREGROUND,\n\n\t\t\t/* Display events */\n\t\t\t/* Only available in SDL 2.0.9 or higher. */\n\t\t\tSDL_DISPLAYEVENT =\t\t0x150,\n\n\t\t\t/* Window events */\n\t\t\tSDL_WINDOWEVENT = \t\t0x200,\n\t\t\tSDL_SYSWMEVENT,\n\n\t\t\t/* Keyboard events */\n\t\t\tSDL_KEYDOWN = \t\t\t0x300,\n\t\t\tSDL_KEYUP,\n\t\t\tSDL_TEXTEDITING,\n\t\t\tSDL_TEXTINPUT,\n\t\t\tSDL_KEYMAPCHANGED,\n\n\t\t\t/* Mouse events */\n\t\t\tSDL_MOUSEMOTION = \t\t0x400,\n\t\t\tSDL_MOUSEBUTTONDOWN,\n\t\t\tSDL_MOUSEBUTTONUP,\n\t\t\tSDL_MOUSEWHEEL,\n\n\t\t\t/* Joystick events */\n\t\t\tSDL_JOYAXISMOTION =\t\t0x600,\n\t\t\tSDL_JOYBALLMOTION,\n\t\t\tSDL_JOYHATMOTION,\n\t\t\tSDL_JOYBUTTONDOWN,\n\t\t\tSDL_JOYBUTTONUP,\n\t\t\tSDL_JOYDEVICEADDED,\n\t\t\tSDL_JOYDEVICEREMOVED,\n\n\t\t\t/* Game controller events */\n\t\t\tSDL_CONTROLLERAXISMOTION = \t0x650,\n\t\t\tSDL_CONTROLLERBUTTONDOWN,\n\t\t\tSDL_CONTROLLERBUTTONUP,\n\t\t\tSDL_CONTROLLERDEVICEADDED,\n\t\t\tSDL_CONTROLLERDEVICEREMOVED,\n\t\t\tSDL_CONTROLLERDEVICEREMAPPED,\n\n\t\t\t/* Touch events */\n\t\t\tSDL_FINGERDOWN = \t\t0x700,\n\t\t\tSDL_FINGERUP,\n\t\t\tSDL_FINGERMOTION,\n\n\t\t\t/* Gesture events */\n\t\t\tSDL_DOLLARGESTURE =\t\t0x800,\n\t\t\tSDL_DOLLARRECORD,\n\t\t\tSDL_MULTIGESTURE,\n\n\t\t\t/* Clipboard events */\n\t\t\tSDL_CLIPBOARDUPDATE =\t\t0x900,\n\n\t\t\t/* Drag and drop events */\n\t\t\tSDL_DROPFILE =\t\t\t0x1000,\n\t\t\t/* Only available in 2.0.4 or higher. */\n\t\t\tSDL_DROPTEXT,\n\t\t\tSDL_DROPBEGIN,\n\t\t\tSDL_DROPCOMPLETE,\n\n\t\t\t/* Audio hotplug events */\n\t\t\t/* Only available in SDL 2.0.4 or higher. */\n\t\t\tSDL_AUDIODEVICEADDED =\t\t0x1100,\n\t\t\tSDL_AUDIODEVICEREMOVED,\n\n\t\t\t/* Sensor events */\n\t\t\t/* Only available in SDL 2.0.9 or higher. */\n\t\t\tSDL_SENSORUPDATE =\t\t0x1200,\n\n\t\t\t/* Render events */\n\t\t\t/* Only available in SDL 2.0.2 or higher. */\n\t\t\tSDL_RENDER_TARGETS_RESET =\t0x2000,\n\t\t\t/* Only available in SDL 2.0.4 or higher. */\n\t\t\tSDL_RENDER_DEVICE_RESET,\n\n\t\t\t/* Events SDL_USEREVENT through SDL_LASTEVENT are for\n\t\t\t * your use, and should be allocated with\n\t\t\t * SDL_RegisterEvents()\n\t\t\t */\n\t\t\tSDL_USEREVENT =\t\t\t0x8000,\n\n\t\t\t/* The last event, used for bouding arrays. */\n\t\t\tSDL_LASTEVENT =\t\t\t0xFFFF\n\t\t}\n\n\t\t/* Only available in 2.0.4 or higher. */\n\t\tpublic enum SDL_MouseWheelDirection : uint\n\t\t{\n\t\t\tSDL_MOUSEWHEEL_NORMAL,\n\t\t\tSDL_MOUSEWHEEL_FLIPPED\n\t\t}\n\n\t\t/* Fields shared by every event */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_GenericEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t}\n\n// Ignore private members used for padding in this struct\n#pragma warning disable 0169\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_DisplayEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic UInt32 display;\n\t\t\tpublic SDL_DisplayEventID displayEvent; // event, lolC#\n\t\t\tprivate byte padding1;\n\t\t\tprivate byte padding2;\n\t\t\tprivate byte padding3;\n\t\t\tpublic Int32 data1;\n\t\t}\n#pragma warning restore 0169\n\n// Ignore private members used for padding in this struct\n#pragma warning disable 0169\n\t\t/* Window state change event data (event.window.*) */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_WindowEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic UInt32 windowID;\n\t\t\tpublic SDL_WindowEventID windowEvent; // event, lolC#\n\t\t\tprivate byte padding1;\n\t\t\tprivate byte padding2;\n\t\t\tprivate byte padding3;\n\t\t\tpublic Int32 data1;\n\t\t\tpublic Int32 data2;\n\t\t}\n#pragma warning restore 0169\n\n// Ignore private members used for padding in this struct\n#pragma warning disable 0169\n\t\t/* Keyboard button event structure (event.key.*) */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_KeyboardEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic UInt32 windowID;\n\t\t\tpublic byte state;\n\t\t\tpublic byte repeat; /* non-zero if this is a repeat */\n\t\t\tprivate byte padding2;\n\t\t\tprivate byte padding3;\n\t\t\tpublic SDL_Keysym keysym;\n\t\t}\n#pragma warning restore 0169\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic unsafe struct SDL_TextEditingEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic UInt32 windowID;\n\t\t\tpublic fixed byte text[SDL_TEXTEDITINGEVENT_TEXT_SIZE];\n\t\t\tpublic Int32 start;\n\t\t\tpublic Int32 length;\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic unsafe struct SDL_TextInputEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic UInt32 windowID;\n\t\t\tpublic fixed byte text[SDL_TEXTINPUTEVENT_TEXT_SIZE];\n\t\t}\n\n// Ignore private members used for padding in this struct\n#pragma warning disable 0169\n\t\t/* Mouse motion event structure (event.motion.*) */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_MouseMotionEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic UInt32 windowID;\n\t\t\tpublic UInt32 which;\n\t\t\tpublic byte state; /* bitmask of buttons */\n\t\t\tprivate byte padding1;\n\t\t\tprivate byte padding2;\n\t\t\tprivate byte padding3;\n\t\t\tpublic Int32 x;\n\t\t\tpublic Int32 y;\n\t\t\tpublic Int32 xrel;\n\t\t\tpublic Int32 yrel;\n\t\t}\n#pragma warning restore 0169\n\n// Ignore private members used for padding in this struct\n#pragma warning disable 0169\n\t\t/* Mouse button event structure (event.button.*) */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_MouseButtonEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic UInt32 windowID;\n\t\t\tpublic UInt32 which;\n\t\t\tpublic byte button; /* button id */\n\t\t\tpublic byte state; /* SDL_PRESSED or SDL_RELEASED */\n\t\t\tpublic byte clicks; /* 1 for single-click, 2 for double-click, etc. */\n\t\t\tprivate byte padding1;\n\t\t\tpublic Int32 x;\n\t\t\tpublic Int32 y;\n\t\t}\n#pragma warning restore 0169\n\n\t\t/* Mouse wheel event structure (event.wheel.*) */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_MouseWheelEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic UInt32 windowID;\n\t\t\tpublic UInt32 which;\n\t\t\tpublic Int32 x; /* amount scrolled horizontally */\n\t\t\tpublic Int32 y; /* amount scrolled vertically */\n\t\t\tpublic UInt32 direction; /* Set to one of the SDL_MOUSEWHEEL_* defines */\n\t\t}\n\n// Ignore private members used for padding in this struct\n#pragma warning disable 0169\n\t\t/* Joystick axis motion event structure (event.jaxis.*) */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_JoyAxisEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic Int32 which; /* SDL_JoystickID */\n\t\t\tpublic byte axis;\n\t\t\tprivate byte padding1;\n\t\t\tprivate byte padding2;\n\t\t\tprivate byte padding3;\n\t\t\tpublic Int16 axisValue; /* value, lolC# */\n\t\t\tpublic UInt16 padding4;\n\t\t}\n#pragma warning restore 0169\n\n// Ignore private members used for padding in this struct\n#pragma warning disable 0169\n\t\t/* Joystick trackball motion event structure (event.jball.*) */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_JoyBallEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic Int32 which; /* SDL_JoystickID */\n\t\t\tpublic byte ball;\n\t\t\tprivate byte padding1;\n\t\t\tprivate byte padding2;\n\t\t\tprivate byte padding3;\n\t\t\tpublic Int16 xrel;\n\t\t\tpublic Int16 yrel;\n\t\t}\n#pragma warning restore 0169\n\n// Ignore private members used for padding in this struct\n#pragma warning disable 0169\n\t\t/* Joystick hat position change event struct (event.jhat.*) */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_JoyHatEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic Int32 which; /* SDL_JoystickID */\n\t\t\tpublic byte hat; /* index of the hat */\n\t\t\tpublic byte hatValue; /* value, lolC# */\n\t\t\tprivate byte padding1;\n\t\t\tprivate byte padding2;\n\t\t}\n#pragma warning restore 0169\n\n// Ignore private members used for padding in this struct\n#pragma warning disable 0169\n\t\t/* Joystick button event structure (event.jbutton.*) */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_JoyButtonEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic Int32 which; /* SDL_JoystickID */\n\t\t\tpublic byte button;\n\t\t\tpublic byte state; /* SDL_PRESSED or SDL_RELEASED */\n\t\t\tprivate byte padding1;\n\t\t\tprivate byte padding2;\n\t\t}\n#pragma warning restore 0169\n\n\t\t/* Joystick device event structure (event.jdevice.*) */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_JoyDeviceEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic Int32 which; /* SDL_JoystickID */\n\t\t}\n\n// Ignore private members used for padding in this struct\n#pragma warning disable 0169\n\t\t/* Game controller axis motion event (event.caxis.*) */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_ControllerAxisEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic Int32 which; /* SDL_JoystickID */\n\t\t\tpublic byte axis;\n\t\t\tprivate byte padding1;\n\t\t\tprivate byte padding2;\n\t\t\tprivate byte padding3;\n\t\t\tpublic Int16 axisValue; /* value, lolC# */\n\t\t\tprivate UInt16 padding4;\n\t\t}\n#pragma warning restore 0169\n\n// Ignore private members used for padding in this struct\n#pragma warning disable 0169\n\t\t/* Game controller button event (event.cbutton.*) */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_ControllerButtonEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic Int32 which; /* SDL_JoystickID */\n\t\t\tpublic byte button;\n\t\t\tpublic byte state;\n\t\t\tprivate byte padding1;\n\t\t\tprivate byte padding2;\n\t\t}\n#pragma warning restore 0169\n\n\t\t/* Game controller device event (event.cdevice.*) */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_ControllerDeviceEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic Int32 which;\t/* joystick id for ADDED,\n\t\t\t\t\t\t * else instance id\n\t\t\t\t\t\t */\n\t\t}\n\n// Ignore private members used for padding in this struct\n#pragma warning disable 0169\n\t\t/* Audio device event (event.adevice.*) */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_AudioDeviceEvent\n\t\t{\n\t\t\tpublic UInt32 type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic UInt32 which;\n\t\t\tpublic byte iscapture;\n\t\t\tprivate byte padding1;\n\t\t\tprivate byte padding2;\n\t\t\tprivate byte padding3;\n\t\t}\n#pragma warning restore 0169\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_TouchFingerEvent\n\t\t{\n\t\t\tpublic UInt32 type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic Int64 touchId; // SDL_TouchID\n\t\t\tpublic Int64 fingerId; // SDL_GestureID\n\t\t\tpublic float x;\n\t\t\tpublic float y;\n\t\t\tpublic float dx;\n\t\t\tpublic float dy;\n\t\t\tpublic float pressure;\n\t\t\tpublic uint windowID;\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_MultiGestureEvent\n\t\t{\n\t\t\tpublic UInt32 type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic Int64 touchId; // SDL_TouchID\n\t\t\tpublic float dTheta;\n\t\t\tpublic float dDist;\n\t\t\tpublic float x;\n\t\t\tpublic float y;\n\t\t\tpublic UInt16 numFingers;\n\t\t\tpublic UInt16 padding;\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_DollarGestureEvent\n\t\t{\n\t\t\tpublic UInt32 type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic Int64 touchId; // SDL_TouchID\n\t\t\tpublic Int64 gestureId; // SDL_GestureID\n\t\t\tpublic UInt32 numFingers;\n\t\t\tpublic float error;\n\t\t\tpublic float x;\n\t\t\tpublic float y;\n\t\t}\n\n\t\t/* File open request by system (event.drop.*), enabled by\n\t\t * default\n\t\t */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_DropEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\n\t\t\t/* char* filename, to be freed.\n\t\t\t * Access the variable EXACTLY ONCE like this:\n\t\t\t * string s = SDL.UTF8_ToManaged(evt.drop.file, true);\n\t\t\t */\n\t\t\tpublic IntPtr file;\n\t\t\tpublic UInt32 windowID;\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic unsafe struct SDL_SensorEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic Int32 which;\n\t\t\tpublic fixed float data[6];\n\t\t}\n\n\t\t/* The \"quit requested\" event */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_QuitEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t}\n\n\t\t/* A user defined event (event.user.*) */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_UserEvent\n\t\t{\n\t\t\tpublic UInt32 type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic UInt32 windowID;\n\t\t\tpublic Int32 code;\n\t\t\tpublic IntPtr data1; /* user-defined */\n\t\t\tpublic IntPtr data2; /* user-defined */\n\t\t}\n\n\t\t/* A video driver dependent event (event.syswm.*), disabled */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_SysWMEvent\n\t\t{\n\t\t\tpublic SDL_EventType type;\n\t\t\tpublic UInt32 timestamp;\n\t\t\tpublic IntPtr msg; /* SDL_SysWMmsg*, system-dependent*/\n\t\t}\n\n\t\t/* General event structure */\n\t\t// C# doesn't do unions, so we do this ugly thing. */\n\t\t[StructLayout(LayoutKind.Explicit)]\n\t\tpublic unsafe struct SDL_Event\n\t\t{\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_EventType type;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_EventType typeFSharp;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_DisplayEvent display;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_WindowEvent window;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_KeyboardEvent key;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_TextEditingEvent edit;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_TextInputEvent text;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_MouseMotionEvent motion;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_MouseButtonEvent button;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_MouseWheelEvent wheel;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_JoyAxisEvent jaxis;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_JoyBallEvent jball;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_JoyHatEvent jhat;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_JoyButtonEvent jbutton;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_JoyDeviceEvent jdevice;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_ControllerAxisEvent caxis;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_ControllerButtonEvent cbutton;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_ControllerDeviceEvent cdevice;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_AudioDeviceEvent adevice;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_SensorEvent sensor;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_QuitEvent quit;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_UserEvent user;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_SysWMEvent syswm;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_TouchFingerEvent tfinger;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_MultiGestureEvent mgesture;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_DollarGestureEvent dgesture;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_DropEvent drop;\n\t\t\t[FieldOffset(0)]\n\t\t\tprivate fixed byte padding[56];\n\t\t}\n\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate int SDL_EventFilter(\n\t\t\tIntPtr userdata, // void*\n\t\t\tIntPtr sdlevent // SDL_Event* event, lolC#\n\t\t);\n\n\t\t/* Pump the event loop, getting events from the input devices*/\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_PumpEvents();\n\n\t\tpublic enum SDL_eventaction\n\t\t{\n\t\t\tSDL_ADDEVENT,\n\t\t\tSDL_PEEKEVENT,\n\t\t\tSDL_GETEVENT\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_PeepEvents(\n\t\t\t[Out] SDL_Event[] events,\n\t\t\tint numevents,\n\t\t\tSDL_eventaction action,\n\t\t\tSDL_EventType minType,\n\t\t\tSDL_EventType maxType\n\t\t);\n\n\t\t/* Checks to see if certain events are in the event queue */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasEvent(SDL_EventType type);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasEvents(\n\t\t\tSDL_EventType minType,\n\t\t\tSDL_EventType maxType\n\t\t);\n\n\t\t/* Clears events from the event queue */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_FlushEvent(SDL_EventType type);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_FlushEvents(\n\t\t\tSDL_EventType min,\n\t\t\tSDL_EventType max\n\t\t);\n\n\t\t/* Polls for currently pending events */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_PollEvent(out SDL_Event _event);\n\n\t\t/* Waits indefinitely for the next event */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_WaitEvent(out SDL_Event _event);\n\n\t\t/* Waits until the specified timeout (in ms) for the next event\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_WaitEventTimeout(out SDL_Event _event, int timeout);\n\n\t\t/* Add an event to the event queue */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_PushEvent(ref SDL_Event _event);\n\n\t\t/* userdata refers to a void* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_SetEventFilter(\n\t\t\tSDL_EventFilter filter,\n\t\t\tIntPtr userdata\n\t\t);\n\n\t\t/* userdata refers to a void* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern SDL_bool SDL_GetEventFilter(\n\t\t\tout IntPtr filter,\n\t\t\tout IntPtr userdata\n\t\t);\n\t\tpublic static SDL_bool SDL_GetEventFilter(\n\t\t\tout SDL_EventFilter filter,\n\t\t\tout IntPtr userdata\n\t\t) {\n\t\t\tIntPtr result = IntPtr.Zero;\n\t\t\tSDL_bool retval = SDL_GetEventFilter(out result, out userdata);\n\t\t\tif (result != IntPtr.Zero)\n\t\t\t{\n\t\t\t\tfilter = (SDL_EventFilter) Marshal.GetDelegateForFunctionPointer(\n\t\t\t\t\tresult,\n\t\t\t\t\ttypeof(SDL_EventFilter)\n\t\t\t\t);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfilter = null;\n\t\t\t}\n\t\t\treturn retval;\n\t\t}\n\n\t\t/* userdata refers to a void* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_AddEventWatch(\n\t\t\tSDL_EventFilter filter,\n\t\t\tIntPtr userdata\n\t\t);\n\n\t\t/* userdata refers to a void* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_DelEventWatch(\n\t\t\tSDL_EventFilter filter,\n\t\t\tIntPtr userdata\n\t\t);\n\n\t\t/* userdata refers to a void* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_FilterEvents(\n\t\t\tSDL_EventFilter filter,\n\t\t\tIntPtr userdata\n\t\t);\n\n\t\t/* These are for SDL_EventState() */\n\t\tpublic const int SDL_QUERY = \t\t-1;\n\t\tpublic const int SDL_IGNORE = \t\t0;\n\t\tpublic const int SDL_DISABLE =\t\t0;\n\t\tpublic const int SDL_ENABLE = \t\t1;\n\n\t\t/* This function allows you to enable/disable certain events */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern byte SDL_EventState(SDL_EventType type, int state);\n\n\t\t/* Get the state of an event */\n\t\tpublic static byte SDL_GetEventState(SDL_EventType type)\n\t\t{\n\t\t\treturn SDL_EventState(type, SDL_QUERY);\n\t\t}\n\n\t\t/* Allocate a set of user-defined events */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt32 SDL_RegisterEvents(int numevents);\n\t\t#endregion\n\n\t\t#region SDL_scancode.h\n\n\t\t/* Scancodes based off USB keyboard page (0x07) */\n\t\tpublic enum SDL_Scancode\n\t\t{\n\t\t\tSDL_SCANCODE_UNKNOWN = 0,\n\n\t\t\tSDL_SCANCODE_A = 4,\n\t\t\tSDL_SCANCODE_B = 5,\n\t\t\tSDL_SCANCODE_C = 6,\n\t\t\tSDL_SCANCODE_D = 7,\n\t\t\tSDL_SCANCODE_E = 8,\n\t\t\tSDL_SCANCODE_F = 9,\n\t\t\tSDL_SCANCODE_G = 10,\n\t\t\tSDL_SCANCODE_H = 11,\n\t\t\tSDL_SCANCODE_I = 12,\n\t\t\tSDL_SCANCODE_J = 13,\n\t\t\tSDL_SCANCODE_K = 14,\n\t\t\tSDL_SCANCODE_L = 15,\n\t\t\tSDL_SCANCODE_M = 16,\n\t\t\tSDL_SCANCODE_N = 17,\n\t\t\tSDL_SCANCODE_O = 18,\n\t\t\tSDL_SCANCODE_P = 19,\n\t\t\tSDL_SCANCODE_Q = 20,\n\t\t\tSDL_SCANCODE_R = 21,\n\t\t\tSDL_SCANCODE_S = 22,\n\t\t\tSDL_SCANCODE_T = 23,\n\t\t\tSDL_SCANCODE_U = 24,\n\t\t\tSDL_SCANCODE_V = 25,\n\t\t\tSDL_SCANCODE_W = 26,\n\t\t\tSDL_SCANCODE_X = 27,\n\t\t\tSDL_SCANCODE_Y = 28,\n\t\t\tSDL_SCANCODE_Z = 29,\n\n\t\t\tSDL_SCANCODE_1 = 30,\n\t\t\tSDL_SCANCODE_2 = 31,\n\t\t\tSDL_SCANCODE_3 = 32,\n\t\t\tSDL_SCANCODE_4 = 33,\n\t\t\tSDL_SCANCODE_5 = 34,\n\t\t\tSDL_SCANCODE_6 = 35,\n\t\t\tSDL_SCANCODE_7 = 36,\n\t\t\tSDL_SCANCODE_8 = 37,\n\t\t\tSDL_SCANCODE_9 = 38,\n\t\t\tSDL_SCANCODE_0 = 39,\n\n\t\t\tSDL_SCANCODE_RETURN = 40,\n\t\t\tSDL_SCANCODE_ESCAPE = 41,\n\t\t\tSDL_SCANCODE_BACKSPACE = 42,\n\t\t\tSDL_SCANCODE_TAB = 43,\n\t\t\tSDL_SCANCODE_SPACE = 44,\n\n\t\t\tSDL_SCANCODE_MINUS = 45,\n\t\t\tSDL_SCANCODE_EQUALS = 46,\n\t\t\tSDL_SCANCODE_LEFTBRACKET = 47,\n\t\t\tSDL_SCANCODE_RIGHTBRACKET = 48,\n\t\t\tSDL_SCANCODE_BACKSLASH = 49,\n\t\t\tSDL_SCANCODE_NONUSHASH = 50,\n\t\t\tSDL_SCANCODE_SEMICOLON = 51,\n\t\t\tSDL_SCANCODE_APOSTROPHE = 52,\n\t\t\tSDL_SCANCODE_GRAVE = 53,\n\t\t\tSDL_SCANCODE_COMMA = 54,\n\t\t\tSDL_SCANCODE_PERIOD = 55,\n\t\t\tSDL_SCANCODE_SLASH = 56,\n\n\t\t\tSDL_SCANCODE_CAPSLOCK = 57,\n\n\t\t\tSDL_SCANCODE_F1 = 58,\n\t\t\tSDL_SCANCODE_F2 = 59,\n\t\t\tSDL_SCANCODE_F3 = 60,\n\t\t\tSDL_SCANCODE_F4 = 61,\n\t\t\tSDL_SCANCODE_F5 = 62,\n\t\t\tSDL_SCANCODE_F6 = 63,\n\t\t\tSDL_SCANCODE_F7 = 64,\n\t\t\tSDL_SCANCODE_F8 = 65,\n\t\t\tSDL_SCANCODE_F9 = 66,\n\t\t\tSDL_SCANCODE_F10 = 67,\n\t\t\tSDL_SCANCODE_F11 = 68,\n\t\t\tSDL_SCANCODE_F12 = 69,\n\n\t\t\tSDL_SCANCODE_PRINTSCREEN = 70,\n\t\t\tSDL_SCANCODE_SCROLLLOCK = 71,\n\t\t\tSDL_SCANCODE_PAUSE = 72,\n\t\t\tSDL_SCANCODE_INSERT = 73,\n\t\t\tSDL_SCANCODE_HOME = 74,\n\t\t\tSDL_SCANCODE_PAGEUP = 75,\n\t\t\tSDL_SCANCODE_DELETE = 76,\n\t\t\tSDL_SCANCODE_END = 77,\n\t\t\tSDL_SCANCODE_PAGEDOWN = 78,\n\t\t\tSDL_SCANCODE_RIGHT = 79,\n\t\t\tSDL_SCANCODE_LEFT = 80,\n\t\t\tSDL_SCANCODE_DOWN = 81,\n\t\t\tSDL_SCANCODE_UP = 82,\n\n\t\t\tSDL_SCANCODE_NUMLOCKCLEAR = 83,\n\t\t\tSDL_SCANCODE_KP_DIVIDE = 84,\n\t\t\tSDL_SCANCODE_KP_MULTIPLY = 85,\n\t\t\tSDL_SCANCODE_KP_MINUS = 86,\n\t\t\tSDL_SCANCODE_KP_PLUS = 87,\n\t\t\tSDL_SCANCODE_KP_ENTER = 88,\n\t\t\tSDL_SCANCODE_KP_1 = 89,\n\t\t\tSDL_SCANCODE_KP_2 = 90,\n\t\t\tSDL_SCANCODE_KP_3 = 91,\n\t\t\tSDL_SCANCODE_KP_4 = 92,\n\t\t\tSDL_SCANCODE_KP_5 = 93,\n\t\t\tSDL_SCANCODE_KP_6 = 94,\n\t\t\tSDL_SCANCODE_KP_7 = 95,\n\t\t\tSDL_SCANCODE_KP_8 = 96,\n\t\t\tSDL_SCANCODE_KP_9 = 97,\n\t\t\tSDL_SCANCODE_KP_0 = 98,\n\t\t\tSDL_SCANCODE_KP_PERIOD = 99,\n\n\t\t\tSDL_SCANCODE_NONUSBACKSLASH = 100,\n\t\t\tSDL_SCANCODE_APPLICATION = 101,\n\t\t\tSDL_SCANCODE_POWER = 102,\n\t\t\tSDL_SCANCODE_KP_EQUALS = 103,\n\t\t\tSDL_SCANCODE_F13 = 104,\n\t\t\tSDL_SCANCODE_F14 = 105,\n\t\t\tSDL_SCANCODE_F15 = 106,\n\t\t\tSDL_SCANCODE_F16 = 107,\n\t\t\tSDL_SCANCODE_F17 = 108,\n\t\t\tSDL_SCANCODE_F18 = 109,\n\t\t\tSDL_SCANCODE_F19 = 110,\n\t\t\tSDL_SCANCODE_F20 = 111,\n\t\t\tSDL_SCANCODE_F21 = 112,\n\t\t\tSDL_SCANCODE_F22 = 113,\n\t\t\tSDL_SCANCODE_F23 = 114,\n\t\t\tSDL_SCANCODE_F24 = 115,\n\t\t\tSDL_SCANCODE_EXECUTE = 116,\n\t\t\tSDL_SCANCODE_HELP = 117,\n\t\t\tSDL_SCANCODE_MENU = 118,\n\t\t\tSDL_SCANCODE_SELECT = 119,\n\t\t\tSDL_SCANCODE_STOP = 120,\n\t\t\tSDL_SCANCODE_AGAIN = 121,\n\t\t\tSDL_SCANCODE_UNDO = 122,\n\t\t\tSDL_SCANCODE_CUT = 123,\n\t\t\tSDL_SCANCODE_COPY = 124,\n\t\t\tSDL_SCANCODE_PASTE = 125,\n\t\t\tSDL_SCANCODE_FIND = 126,\n\t\t\tSDL_SCANCODE_MUTE = 127,\n\t\t\tSDL_SCANCODE_VOLUMEUP = 128,\n\t\t\tSDL_SCANCODE_VOLUMEDOWN = 129,\n\t\t\t/* not sure whether there's a reason to enable these */\n\t\t\t/*\tSDL_SCANCODE_LOCKINGCAPSLOCK = 130, */\n\t\t\t/*\tSDL_SCANCODE_LOCKINGNUMLOCK = 131, */\n\t\t\t/*\tSDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */\n\t\t\tSDL_SCANCODE_KP_COMMA = 133,\n\t\t\tSDL_SCANCODE_KP_EQUALSAS400 = 134,\n\n\t\t\tSDL_SCANCODE_INTERNATIONAL1 = 135,\n\t\t\tSDL_SCANCODE_INTERNATIONAL2 = 136,\n\t\t\tSDL_SCANCODE_INTERNATIONAL3 = 137,\n\t\t\tSDL_SCANCODE_INTERNATIONAL4 = 138,\n\t\t\tSDL_SCANCODE_INTERNATIONAL5 = 139,\n\t\t\tSDL_SCANCODE_INTERNATIONAL6 = 140,\n\t\t\tSDL_SCANCODE_INTERNATIONAL7 = 141,\n\t\t\tSDL_SCANCODE_INTERNATIONAL8 = 142,\n\t\t\tSDL_SCANCODE_INTERNATIONAL9 = 143,\n\t\t\tSDL_SCANCODE_LANG1 = 144,\n\t\t\tSDL_SCANCODE_LANG2 = 145,\n\t\t\tSDL_SCANCODE_LANG3 = 146,\n\t\t\tSDL_SCANCODE_LANG4 = 147,\n\t\t\tSDL_SCANCODE_LANG5 = 148,\n\t\t\tSDL_SCANCODE_LANG6 = 149,\n\t\t\tSDL_SCANCODE_LANG7 = 150,\n\t\t\tSDL_SCANCODE_LANG8 = 151,\n\t\t\tSDL_SCANCODE_LANG9 = 152,\n\n\t\t\tSDL_SCANCODE_ALTERASE = 153,\n\t\t\tSDL_SCANCODE_SYSREQ = 154,\n\t\t\tSDL_SCANCODE_CANCEL = 155,\n\t\t\tSDL_SCANCODE_CLEAR = 156,\n\t\t\tSDL_SCANCODE_PRIOR = 157,\n\t\t\tSDL_SCANCODE_RETURN2 = 158,\n\t\t\tSDL_SCANCODE_SEPARATOR = 159,\n\t\t\tSDL_SCANCODE_OUT = 160,\n\t\t\tSDL_SCANCODE_OPER = 161,\n\t\t\tSDL_SCANCODE_CLEARAGAIN = 162,\n\t\t\tSDL_SCANCODE_CRSEL = 163,\n\t\t\tSDL_SCANCODE_EXSEL = 164,\n\n\t\t\tSDL_SCANCODE_KP_00 = 176,\n\t\t\tSDL_SCANCODE_KP_000 = 177,\n\t\t\tSDL_SCANCODE_THOUSANDSSEPARATOR = 178,\n\t\t\tSDL_SCANCODE_DECIMALSEPARATOR = 179,\n\t\t\tSDL_SCANCODE_CURRENCYUNIT = 180,\n\t\t\tSDL_SCANCODE_CURRENCYSUBUNIT = 181,\n\t\t\tSDL_SCANCODE_KP_LEFTPAREN = 182,\n\t\t\tSDL_SCANCODE_KP_RIGHTPAREN = 183,\n\t\t\tSDL_SCANCODE_KP_LEFTBRACE = 184,\n\t\t\tSDL_SCANCODE_KP_RIGHTBRACE = 185,\n\t\t\tSDL_SCANCODE_KP_TAB = 186,\n\t\t\tSDL_SCANCODE_KP_BACKSPACE = 187,\n\t\t\tSDL_SCANCODE_KP_A = 188,\n\t\t\tSDL_SCANCODE_KP_B = 189,\n\t\t\tSDL_SCANCODE_KP_C = 190,\n\t\t\tSDL_SCANCODE_KP_D = 191,\n\t\t\tSDL_SCANCODE_KP_E = 192,\n\t\t\tSDL_SCANCODE_KP_F = 193,\n\t\t\tSDL_SCANCODE_KP_XOR = 194,\n\t\t\tSDL_SCANCODE_KP_POWER = 195,\n\t\t\tSDL_SCANCODE_KP_PERCENT = 196,\n\t\t\tSDL_SCANCODE_KP_LESS = 197,\n\t\t\tSDL_SCANCODE_KP_GREATER = 198,\n\t\t\tSDL_SCANCODE_KP_AMPERSAND = 199,\n\t\t\tSDL_SCANCODE_KP_DBLAMPERSAND = 200,\n\t\t\tSDL_SCANCODE_KP_VERTICALBAR = 201,\n\t\t\tSDL_SCANCODE_KP_DBLVERTICALBAR = 202,\n\t\t\tSDL_SCANCODE_KP_COLON = 203,\n\t\t\tSDL_SCANCODE_KP_HASH = 204,\n\t\t\tSDL_SCANCODE_KP_SPACE = 205,\n\t\t\tSDL_SCANCODE_KP_AT = 206,\n\t\t\tSDL_SCANCODE_KP_EXCLAM = 207,\n\t\t\tSDL_SCANCODE_KP_MEMSTORE = 208,\n\t\t\tSDL_SCANCODE_KP_MEMRECALL = 209,\n\t\t\tSDL_SCANCODE_KP_MEMCLEAR = 210,\n\t\t\tSDL_SCANCODE_KP_MEMADD = 211,\n\t\t\tSDL_SCANCODE_KP_MEMSUBTRACT = 212,\n\t\t\tSDL_SCANCODE_KP_MEMMULTIPLY = 213,\n\t\t\tSDL_SCANCODE_KP_MEMDIVIDE = 214,\n\t\t\tSDL_SCANCODE_KP_PLUSMINUS = 215,\n\t\t\tSDL_SCANCODE_KP_CLEAR = 216,\n\t\t\tSDL_SCANCODE_KP_CLEARENTRY = 217,\n\t\t\tSDL_SCANCODE_KP_BINARY = 218,\n\t\t\tSDL_SCANCODE_KP_OCTAL = 219,\n\t\t\tSDL_SCANCODE_KP_DECIMAL = 220,\n\t\t\tSDL_SCANCODE_KP_HEXADECIMAL = 221,\n\n\t\t\tSDL_SCANCODE_LCTRL = 224,\n\t\t\tSDL_SCANCODE_LSHIFT = 225,\n\t\t\tSDL_SCANCODE_LALT = 226,\n\t\t\tSDL_SCANCODE_LGUI = 227,\n\t\t\tSDL_SCANCODE_RCTRL = 228,\n\t\t\tSDL_SCANCODE_RSHIFT = 229,\n\t\t\tSDL_SCANCODE_RALT = 230,\n\t\t\tSDL_SCANCODE_RGUI = 231,\n\n\t\t\tSDL_SCANCODE_MODE = 257,\n\n\t\t\t/* These come from the USB consumer page (0x0C) */\n\t\t\tSDL_SCANCODE_AUDIONEXT = 258,\n\t\t\tSDL_SCANCODE_AUDIOPREV = 259,\n\t\t\tSDL_SCANCODE_AUDIOSTOP = 260,\n\t\t\tSDL_SCANCODE_AUDIOPLAY = 261,\n\t\t\tSDL_SCANCODE_AUDIOMUTE = 262,\n\t\t\tSDL_SCANCODE_MEDIASELECT = 263,\n\t\t\tSDL_SCANCODE_WWW = 264,\n\t\t\tSDL_SCANCODE_MAIL = 265,\n\t\t\tSDL_SCANCODE_CALCULATOR = 266,\n\t\t\tSDL_SCANCODE_COMPUTER = 267,\n\t\t\tSDL_SCANCODE_AC_SEARCH = 268,\n\t\t\tSDL_SCANCODE_AC_HOME = 269,\n\t\t\tSDL_SCANCODE_AC_BACK = 270,\n\t\t\tSDL_SCANCODE_AC_FORWARD = 271,\n\t\t\tSDL_SCANCODE_AC_STOP = 272,\n\t\t\tSDL_SCANCODE_AC_REFRESH = 273,\n\t\t\tSDL_SCANCODE_AC_BOOKMARKS = 274,\n\n\t\t\t/* These come from other sources, and are mostly mac related */\n\t\t\tSDL_SCANCODE_BRIGHTNESSDOWN = 275,\n\t\t\tSDL_SCANCODE_BRIGHTNESSUP = 276,\n\t\t\tSDL_SCANCODE_DISPLAYSWITCH = 277,\n\t\t\tSDL_SCANCODE_KBDILLUMTOGGLE = 278,\n\t\t\tSDL_SCANCODE_KBDILLUMDOWN = 279,\n\t\t\tSDL_SCANCODE_KBDILLUMUP = 280,\n\t\t\tSDL_SCANCODE_EJECT = 281,\n\t\t\tSDL_SCANCODE_SLEEP = 282,\n\n\t\t\tSDL_SCANCODE_APP1 = 283,\n\t\t\tSDL_SCANCODE_APP2 = 284,\n\n\t\t\t/* These come from the USB consumer page (0x0C) */\n\t\t\tSDL_SCANCODE_AUDIOREWIND = 285,\n\t\t\tSDL_SCANCODE_AUDIOFASTFORWARD = 286,\n\n\t\t\t/* This is not a key, simply marks the number of scancodes\n\t\t\t * so that you know how big to make your arrays. */\n\t\t\tSDL_NUM_SCANCODES = 512\n\t\t}\n\n\t\t#endregion\n\n\t\t#region SDL_keycode.h\n\n\t\tpublic const int SDLK_SCANCODE_MASK = (1 << 30);\n\t\tpublic static SDL_Keycode SDL_SCANCODE_TO_KEYCODE(SDL_Scancode X)\n\t\t{\n\t\t\treturn (SDL_Keycode)((int)X | SDLK_SCANCODE_MASK);\n\t\t}\n\n\t\tpublic enum SDL_Keycode\n\t\t{\n\t\t\tSDLK_UNKNOWN = 0,\n\n\t\t\tSDLK_RETURN = '\\r',\n\t\t\tSDLK_ESCAPE = 27, // '\\033'\n\t\t\tSDLK_BACKSPACE = '\\b',\n\t\t\tSDLK_TAB = '\\t',\n\t\t\tSDLK_SPACE = ' ',\n\t\t\tSDLK_EXCLAIM = '!',\n\t\t\tSDLK_QUOTEDBL = '\"',\n\t\t\tSDLK_HASH = '#',\n\t\t\tSDLK_PERCENT = '%',\n\t\t\tSDLK_DOLLAR = '$',\n\t\t\tSDLK_AMPERSAND = '&',\n\t\t\tSDLK_QUOTE = '\\'',\n\t\t\tSDLK_LEFTPAREN = '(',\n\t\t\tSDLK_RIGHTPAREN = ')',\n\t\t\tSDLK_ASTERISK = '*',\n\t\t\tSDLK_PLUS = '+',\n\t\t\tSDLK_COMMA = ',',\n\t\t\tSDLK_MINUS = '-',\n\t\t\tSDLK_PERIOD = '.',\n\t\t\tSDLK_SLASH = '/',\n\t\t\tSDLK_0 = '0',\n\t\t\tSDLK_1 = '1',\n\t\t\tSDLK_2 = '2',\n\t\t\tSDLK_3 = '3',\n\t\t\tSDLK_4 = '4',\n\t\t\tSDLK_5 = '5',\n\t\t\tSDLK_6 = '6',\n\t\t\tSDLK_7 = '7',\n\t\t\tSDLK_8 = '8',\n\t\t\tSDLK_9 = '9',\n\t\t\tSDLK_COLON = ':',\n\t\t\tSDLK_SEMICOLON = ';',\n\t\t\tSDLK_LESS = '<',\n\t\t\tSDLK_EQUALS = '=',\n\t\t\tSDLK_GREATER = '>',\n\t\t\tSDLK_QUESTION = '?',\n\t\t\tSDLK_AT = '@',\n\t\t\t/*\n\t\t\tSkip uppercase letters\n\t\t\t*/\n\t\t\tSDLK_LEFTBRACKET = '[',\n\t\t\tSDLK_BACKSLASH = '\\\\',\n\t\t\tSDLK_RIGHTBRACKET = ']',\n\t\t\tSDLK_CARET = '^',\n\t\t\tSDLK_UNDERSCORE = '_',\n\t\t\tSDLK_BACKQUOTE = '`',\n\t\t\tSDLK_a = 'a',\n\t\t\tSDLK_b = 'b',\n\t\t\tSDLK_c = 'c',\n\t\t\tSDLK_d = 'd',\n\t\t\tSDLK_e = 'e',\n\t\t\tSDLK_f = 'f',\n\t\t\tSDLK_g = 'g',\n\t\t\tSDLK_h = 'h',\n\t\t\tSDLK_i = 'i',\n\t\t\tSDLK_j = 'j',\n\t\t\tSDLK_k = 'k',\n\t\t\tSDLK_l = 'l',\n\t\t\tSDLK_m = 'm',\n\t\t\tSDLK_n = 'n',\n\t\t\tSDLK_o = 'o',\n\t\t\tSDLK_p = 'p',\n\t\t\tSDLK_q = 'q',\n\t\t\tSDLK_r = 'r',\n\t\t\tSDLK_s = 's',\n\t\t\tSDLK_t = 't',\n\t\t\tSDLK_u = 'u',\n\t\t\tSDLK_v = 'v',\n\t\t\tSDLK_w = 'w',\n\t\t\tSDLK_x = 'x',\n\t\t\tSDLK_y = 'y',\n\t\t\tSDLK_z = 'z',\n\n\t\t\tSDLK_CAPSLOCK = (int)SDL_Scancode.SDL_SCANCODE_CAPSLOCK | SDLK_SCANCODE_MASK,\n\n\t\t\tSDLK_F1 = (int)SDL_Scancode.SDL_SCANCODE_F1 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F2 = (int)SDL_Scancode.SDL_SCANCODE_F2 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F3 = (int)SDL_Scancode.SDL_SCANCODE_F3 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F4 = (int)SDL_Scancode.SDL_SCANCODE_F4 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F5 = (int)SDL_Scancode.SDL_SCANCODE_F5 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F6 = (int)SDL_Scancode.SDL_SCANCODE_F6 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F7 = (int)SDL_Scancode.SDL_SCANCODE_F7 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F8 = (int)SDL_Scancode.SDL_SCANCODE_F8 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F9 = (int)SDL_Scancode.SDL_SCANCODE_F9 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F10 = (int)SDL_Scancode.SDL_SCANCODE_F10 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F11 = (int)SDL_Scancode.SDL_SCANCODE_F11 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F12 = (int)SDL_Scancode.SDL_SCANCODE_F12 | SDLK_SCANCODE_MASK,\n\n\t\t\tSDLK_PRINTSCREEN = (int)SDL_Scancode.SDL_SCANCODE_PRINTSCREEN | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_SCROLLLOCK = (int)SDL_Scancode.SDL_SCANCODE_SCROLLLOCK | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_PAUSE = (int)SDL_Scancode.SDL_SCANCODE_PAUSE | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_INSERT = (int)SDL_Scancode.SDL_SCANCODE_INSERT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_HOME = (int)SDL_Scancode.SDL_SCANCODE_HOME | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_PAGEUP = (int)SDL_Scancode.SDL_SCANCODE_PAGEUP | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_DELETE = 127,\n\t\t\tSDLK_END = (int)SDL_Scancode.SDL_SCANCODE_END | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_PAGEDOWN = (int)SDL_Scancode.SDL_SCANCODE_PAGEDOWN | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_RIGHT = (int)SDL_Scancode.SDL_SCANCODE_RIGHT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_LEFT = (int)SDL_Scancode.SDL_SCANCODE_LEFT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_DOWN = (int)SDL_Scancode.SDL_SCANCODE_DOWN | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_UP = (int)SDL_Scancode.SDL_SCANCODE_UP | SDLK_SCANCODE_MASK,\n\n\t\t\tSDLK_NUMLOCKCLEAR = (int)SDL_Scancode.SDL_SCANCODE_NUMLOCKCLEAR | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_DIVIDE = (int)SDL_Scancode.SDL_SCANCODE_KP_DIVIDE | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_MULTIPLY = (int)SDL_Scancode.SDL_SCANCODE_KP_MULTIPLY | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_MINUS = (int)SDL_Scancode.SDL_SCANCODE_KP_MINUS | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_PLUS = (int)SDL_Scancode.SDL_SCANCODE_KP_PLUS | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_ENTER = (int)SDL_Scancode.SDL_SCANCODE_KP_ENTER | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_1 = (int)SDL_Scancode.SDL_SCANCODE_KP_1 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_2 = (int)SDL_Scancode.SDL_SCANCODE_KP_2 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_3 = (int)SDL_Scancode.SDL_SCANCODE_KP_3 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_4 = (int)SDL_Scancode.SDL_SCANCODE_KP_4 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_5 = (int)SDL_Scancode.SDL_SCANCODE_KP_5 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_6 = (int)SDL_Scancode.SDL_SCANCODE_KP_6 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_7 = (int)SDL_Scancode.SDL_SCANCODE_KP_7 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_8 = (int)SDL_Scancode.SDL_SCANCODE_KP_8 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_9 = (int)SDL_Scancode.SDL_SCANCODE_KP_9 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_0 = (int)SDL_Scancode.SDL_SCANCODE_KP_0 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_PERIOD = (int)SDL_Scancode.SDL_SCANCODE_KP_PERIOD | SDLK_SCANCODE_MASK,\n\n\t\t\tSDLK_APPLICATION = (int)SDL_Scancode.SDL_SCANCODE_APPLICATION | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_POWER = (int)SDL_Scancode.SDL_SCANCODE_POWER | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_EQUALS = (int)SDL_Scancode.SDL_SCANCODE_KP_EQUALS | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F13 = (int)SDL_Scancode.SDL_SCANCODE_F13 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F14 = (int)SDL_Scancode.SDL_SCANCODE_F14 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F15 = (int)SDL_Scancode.SDL_SCANCODE_F15 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F16 = (int)SDL_Scancode.SDL_SCANCODE_F16 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F17 = (int)SDL_Scancode.SDL_SCANCODE_F17 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F18 = (int)SDL_Scancode.SDL_SCANCODE_F18 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F19 = (int)SDL_Scancode.SDL_SCANCODE_F19 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F20 = (int)SDL_Scancode.SDL_SCANCODE_F20 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F21 = (int)SDL_Scancode.SDL_SCANCODE_F21 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F22 = (int)SDL_Scancode.SDL_SCANCODE_F22 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F23 = (int)SDL_Scancode.SDL_SCANCODE_F23 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_F24 = (int)SDL_Scancode.SDL_SCANCODE_F24 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_EXECUTE = (int)SDL_Scancode.SDL_SCANCODE_EXECUTE | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_HELP = (int)SDL_Scancode.SDL_SCANCODE_HELP | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_MENU = (int)SDL_Scancode.SDL_SCANCODE_MENU | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_SELECT = (int)SDL_Scancode.SDL_SCANCODE_SELECT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_STOP = (int)SDL_Scancode.SDL_SCANCODE_STOP | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_AGAIN = (int)SDL_Scancode.SDL_SCANCODE_AGAIN | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_UNDO = (int)SDL_Scancode.SDL_SCANCODE_UNDO | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_CUT = (int)SDL_Scancode.SDL_SCANCODE_CUT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_COPY = (int)SDL_Scancode.SDL_SCANCODE_COPY | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_PASTE = (int)SDL_Scancode.SDL_SCANCODE_PASTE | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_FIND = (int)SDL_Scancode.SDL_SCANCODE_FIND | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_MUTE = (int)SDL_Scancode.SDL_SCANCODE_MUTE | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_VOLUMEUP = (int)SDL_Scancode.SDL_SCANCODE_VOLUMEUP | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_VOLUMEDOWN = (int)SDL_Scancode.SDL_SCANCODE_VOLUMEDOWN | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_COMMA = (int)SDL_Scancode.SDL_SCANCODE_KP_COMMA | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_EQUALSAS400 =\n\t\t\t(int)SDL_Scancode.SDL_SCANCODE_KP_EQUALSAS400 | SDLK_SCANCODE_MASK,\n\n\t\t\tSDLK_ALTERASE = (int)SDL_Scancode.SDL_SCANCODE_ALTERASE | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_SYSREQ = (int)SDL_Scancode.SDL_SCANCODE_SYSREQ | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_CANCEL = (int)SDL_Scancode.SDL_SCANCODE_CANCEL | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_CLEAR = (int)SDL_Scancode.SDL_SCANCODE_CLEAR | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_PRIOR = (int)SDL_Scancode.SDL_SCANCODE_PRIOR | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_RETURN2 = (int)SDL_Scancode.SDL_SCANCODE_RETURN2 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_SEPARATOR = (int)SDL_Scancode.SDL_SCANCODE_SEPARATOR | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_OUT = (int)SDL_Scancode.SDL_SCANCODE_OUT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_OPER = (int)SDL_Scancode.SDL_SCANCODE_OPER | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_CLEARAGAIN = (int)SDL_Scancode.SDL_SCANCODE_CLEARAGAIN | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_CRSEL = (int)SDL_Scancode.SDL_SCANCODE_CRSEL | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_EXSEL = (int)SDL_Scancode.SDL_SCANCODE_EXSEL | SDLK_SCANCODE_MASK,\n\n\t\t\tSDLK_KP_00 = (int)SDL_Scancode.SDL_SCANCODE_KP_00 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_000 = (int)SDL_Scancode.SDL_SCANCODE_KP_000 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_THOUSANDSSEPARATOR =\n\t\t\t(int)SDL_Scancode.SDL_SCANCODE_THOUSANDSSEPARATOR | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_DECIMALSEPARATOR =\n\t\t\t(int)SDL_Scancode.SDL_SCANCODE_DECIMALSEPARATOR | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_CURRENCYUNIT = (int)SDL_Scancode.SDL_SCANCODE_CURRENCYUNIT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_CURRENCYSUBUNIT =\n\t\t\t(int)SDL_Scancode.SDL_SCANCODE_CURRENCYSUBUNIT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_LEFTPAREN = (int)SDL_Scancode.SDL_SCANCODE_KP_LEFTPAREN | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_RIGHTPAREN = (int)SDL_Scancode.SDL_SCANCODE_KP_RIGHTPAREN | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_LEFTBRACE = (int)SDL_Scancode.SDL_SCANCODE_KP_LEFTBRACE | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_RIGHTBRACE = (int)SDL_Scancode.SDL_SCANCODE_KP_RIGHTBRACE | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_TAB = (int)SDL_Scancode.SDL_SCANCODE_KP_TAB | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_BACKSPACE = (int)SDL_Scancode.SDL_SCANCODE_KP_BACKSPACE | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_A = (int)SDL_Scancode.SDL_SCANCODE_KP_A | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_B = (int)SDL_Scancode.SDL_SCANCODE_KP_B | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_C = (int)SDL_Scancode.SDL_SCANCODE_KP_C | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_D = (int)SDL_Scancode.SDL_SCANCODE_KP_D | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_E = (int)SDL_Scancode.SDL_SCANCODE_KP_E | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_F = (int)SDL_Scancode.SDL_SCANCODE_KP_F | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_XOR = (int)SDL_Scancode.SDL_SCANCODE_KP_XOR | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_POWER = (int)SDL_Scancode.SDL_SCANCODE_KP_POWER | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_PERCENT = (int)SDL_Scancode.SDL_SCANCODE_KP_PERCENT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_LESS = (int)SDL_Scancode.SDL_SCANCODE_KP_LESS | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_GREATER = (int)SDL_Scancode.SDL_SCANCODE_KP_GREATER | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_AMPERSAND = (int)SDL_Scancode.SDL_SCANCODE_KP_AMPERSAND | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_DBLAMPERSAND =\n\t\t\t(int)SDL_Scancode.SDL_SCANCODE_KP_DBLAMPERSAND | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_VERTICALBAR =\n\t\t\t(int)SDL_Scancode.SDL_SCANCODE_KP_VERTICALBAR | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_DBLVERTICALBAR =\n\t\t\t(int)SDL_Scancode.SDL_SCANCODE_KP_DBLVERTICALBAR | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_COLON = (int)SDL_Scancode.SDL_SCANCODE_KP_COLON | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_HASH = (int)SDL_Scancode.SDL_SCANCODE_KP_HASH | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_SPACE = (int)SDL_Scancode.SDL_SCANCODE_KP_SPACE | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_AT = (int)SDL_Scancode.SDL_SCANCODE_KP_AT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_EXCLAM = (int)SDL_Scancode.SDL_SCANCODE_KP_EXCLAM | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_MEMSTORE = (int)SDL_Scancode.SDL_SCANCODE_KP_MEMSTORE | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_MEMRECALL = (int)SDL_Scancode.SDL_SCANCODE_KP_MEMRECALL | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_MEMCLEAR = (int)SDL_Scancode.SDL_SCANCODE_KP_MEMCLEAR | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_MEMADD = (int)SDL_Scancode.SDL_SCANCODE_KP_MEMADD | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_MEMSUBTRACT =\n\t\t\t(int)SDL_Scancode.SDL_SCANCODE_KP_MEMSUBTRACT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_MEMMULTIPLY =\n\t\t\t(int)SDL_Scancode.SDL_SCANCODE_KP_MEMMULTIPLY | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_MEMDIVIDE = (int)SDL_Scancode.SDL_SCANCODE_KP_MEMDIVIDE | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_PLUSMINUS = (int)SDL_Scancode.SDL_SCANCODE_KP_PLUSMINUS | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_CLEAR = (int)SDL_Scancode.SDL_SCANCODE_KP_CLEAR | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_CLEARENTRY = (int)SDL_Scancode.SDL_SCANCODE_KP_CLEARENTRY | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_BINARY = (int)SDL_Scancode.SDL_SCANCODE_KP_BINARY | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_OCTAL = (int)SDL_Scancode.SDL_SCANCODE_KP_OCTAL | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_DECIMAL = (int)SDL_Scancode.SDL_SCANCODE_KP_DECIMAL | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KP_HEXADECIMAL =\n\t\t\t(int)SDL_Scancode.SDL_SCANCODE_KP_HEXADECIMAL | SDLK_SCANCODE_MASK,\n\n\t\t\tSDLK_LCTRL = (int)SDL_Scancode.SDL_SCANCODE_LCTRL | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_LSHIFT = (int)SDL_Scancode.SDL_SCANCODE_LSHIFT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_LALT = (int)SDL_Scancode.SDL_SCANCODE_LALT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_LGUI = (int)SDL_Scancode.SDL_SCANCODE_LGUI | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_RCTRL = (int)SDL_Scancode.SDL_SCANCODE_RCTRL | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_RSHIFT = (int)SDL_Scancode.SDL_SCANCODE_RSHIFT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_RALT = (int)SDL_Scancode.SDL_SCANCODE_RALT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_RGUI = (int)SDL_Scancode.SDL_SCANCODE_RGUI | SDLK_SCANCODE_MASK,\n\n\t\t\tSDLK_MODE = (int)SDL_Scancode.SDL_SCANCODE_MODE | SDLK_SCANCODE_MASK,\n\n\t\t\tSDLK_AUDIONEXT = (int)SDL_Scancode.SDL_SCANCODE_AUDIONEXT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_AUDIOPREV = (int)SDL_Scancode.SDL_SCANCODE_AUDIOPREV | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_AUDIOSTOP = (int)SDL_Scancode.SDL_SCANCODE_AUDIOSTOP | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_AUDIOPLAY = (int)SDL_Scancode.SDL_SCANCODE_AUDIOPLAY | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_AUDIOMUTE = (int)SDL_Scancode.SDL_SCANCODE_AUDIOMUTE | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_MEDIASELECT = (int)SDL_Scancode.SDL_SCANCODE_MEDIASELECT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_WWW = (int)SDL_Scancode.SDL_SCANCODE_WWW | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_MAIL = (int)SDL_Scancode.SDL_SCANCODE_MAIL | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_CALCULATOR = (int)SDL_Scancode.SDL_SCANCODE_CALCULATOR | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_COMPUTER = (int)SDL_Scancode.SDL_SCANCODE_COMPUTER | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_AC_SEARCH = (int)SDL_Scancode.SDL_SCANCODE_AC_SEARCH | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_AC_HOME = (int)SDL_Scancode.SDL_SCANCODE_AC_HOME | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_AC_BACK = (int)SDL_Scancode.SDL_SCANCODE_AC_BACK | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_AC_FORWARD = (int)SDL_Scancode.SDL_SCANCODE_AC_FORWARD | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_AC_STOP = (int)SDL_Scancode.SDL_SCANCODE_AC_STOP | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_AC_REFRESH = (int)SDL_Scancode.SDL_SCANCODE_AC_REFRESH | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_AC_BOOKMARKS = (int)SDL_Scancode.SDL_SCANCODE_AC_BOOKMARKS | SDLK_SCANCODE_MASK,\n\n\t\t\tSDLK_BRIGHTNESSDOWN =\n\t\t\t(int)SDL_Scancode.SDL_SCANCODE_BRIGHTNESSDOWN | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_BRIGHTNESSUP = (int)SDL_Scancode.SDL_SCANCODE_BRIGHTNESSUP | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_DISPLAYSWITCH = (int)SDL_Scancode.SDL_SCANCODE_DISPLAYSWITCH | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KBDILLUMTOGGLE =\n\t\t\t(int)SDL_Scancode.SDL_SCANCODE_KBDILLUMTOGGLE | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KBDILLUMDOWN = (int)SDL_Scancode.SDL_SCANCODE_KBDILLUMDOWN | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_KBDILLUMUP = (int)SDL_Scancode.SDL_SCANCODE_KBDILLUMUP | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_EJECT = (int)SDL_Scancode.SDL_SCANCODE_EJECT | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_SLEEP = (int)SDL_Scancode.SDL_SCANCODE_SLEEP | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_APP1 = (int)SDL_Scancode.SDL_SCANCODE_APP1 | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_APP2 = (int)SDL_Scancode.SDL_SCANCODE_APP2 | SDLK_SCANCODE_MASK,\n\n\t\t\tSDLK_AUDIOREWIND = (int)SDL_Scancode.SDL_SCANCODE_AUDIOREWIND | SDLK_SCANCODE_MASK,\n\t\t\tSDLK_AUDIOFASTFORWARD = (int)SDL_Scancode.SDL_SCANCODE_AUDIOFASTFORWARD | SDLK_SCANCODE_MASK\n\t\t}\n\n\t\t/* Key modifiers (bitfield) */\n\t\t[Flags]\n\t\tpublic enum SDL_Keymod : ushort\n\t\t{\n\t\t\tKMOD_NONE = 0x0000,\n\t\t\tKMOD_LSHIFT = 0x0001,\n\t\t\tKMOD_RSHIFT = 0x0002,\n\t\t\tKMOD_LCTRL = 0x0040,\n\t\t\tKMOD_RCTRL = 0x0080,\n\t\t\tKMOD_LALT = 0x0100,\n\t\t\tKMOD_RALT = 0x0200,\n\t\t\tKMOD_LGUI = 0x0400,\n\t\t\tKMOD_RGUI = 0x0800,\n\t\t\tKMOD_NUM = 0x1000,\n\t\t\tKMOD_CAPS = 0x2000,\n\t\t\tKMOD_MODE = 0x4000,\n\t\t\tKMOD_RESERVED = 0x8000,\n\n\t\t\t/* These are defines in the SDL headers */\n\t\t\tKMOD_CTRL = (KMOD_LCTRL | KMOD_RCTRL),\n\t\t\tKMOD_SHIFT = (KMOD_LSHIFT | KMOD_RSHIFT),\n\t\t\tKMOD_ALT = (KMOD_LALT | KMOD_RALT),\n\t\t\tKMOD_GUI = (KMOD_LGUI | KMOD_RGUI)\n\t\t}\n\n\t\t#endregion\n\n\t\t#region SDL_keyboard.h\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_Keysym\n\t\t{\n\t\t\tpublic SDL_Scancode scancode;\n\t\t\tpublic SDL_Keycode sym;\n\t\t\tpublic SDL_Keymod mod; /* UInt16 */\n\t\t\tpublic UInt32 unicode; /* Deprecated */\n\t\t}\n\n\t\t/* Get the window which has kbd focus */\n\t\t/* Return type is an SDL_Window pointer */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GetKeyboardFocus();\n\n\t\t/* Get a snapshot of the keyboard state. */\n\t\t/* Return value is a pointer to a UInt8 array */\n\t\t/* Numkeys returns the size of the array if non-null */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GetKeyboardState(out int numkeys);\n\n\t\t/* Get the current key modifier state for the keyboard. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_Keymod SDL_GetModState();\n\n\t\t/* Set the current key modifier state */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_SetModState(SDL_Keymod modstate);\n\n\t\t/* Get the key code corresponding to the given scancode\n\t\t * with the current keyboard layout.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode);\n\n\t\t/* Get the scancode for the given keycode */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key);\n\n\t\t/* Wrapper for SDL_GetScancodeName */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetScancodeName\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GetScancodeName(SDL_Scancode scancode);\n\t\tpublic static string SDL_GetScancodeName(SDL_Scancode scancode)\n\t\t{\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_GetScancodeName(scancode)\n\t\t\t);\n\t\t}\n\n\t\t/* Get a scancode from a human-readable name */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetScancodeFromName\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe SDL_Scancode INTERNAL_SDL_GetScancodeFromName(\n\t\t\tbyte* name\n\t\t);\n\t\tpublic static unsafe SDL_Scancode SDL_GetScancodeFromName(string name)\n\t\t{\n\t\t\tint utf8NameBufSize = Utf8Size(name);\n\t\t\tbyte* utf8Name = stackalloc byte[utf8NameBufSize];\n\t\t\treturn INTERNAL_SDL_GetScancodeFromName(\n\t\t\t\tUtf8Encode(name, utf8Name, utf8NameBufSize)\n\t\t\t);\n\t\t}\n\n\t\t/* Wrapper for SDL_GetKeyName */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetKeyName\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GetKeyName(SDL_Keycode key);\n\t\tpublic static string SDL_GetKeyName(SDL_Keycode key)\n\t\t{\n\t\t\treturn UTF8_ToManaged(INTERNAL_SDL_GetKeyName(key));\n\t\t}\n\n\t\t/* Get a key code from a human-readable name */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetKeyFromName\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe SDL_Keycode INTERNAL_SDL_GetKeyFromName(\n\t\t\tbyte* name\n\t\t);\n\t\tpublic static unsafe SDL_Keycode SDL_GetKeyFromName(string name)\n\t\t{\n\t\t\tint utf8NameBufSize = Utf8Size(name);\n\t\t\tbyte* utf8Name = stackalloc byte[utf8NameBufSize];\n\t\t\treturn INTERNAL_SDL_GetKeyFromName(\n\t\t\t\tUtf8Encode(name, utf8Name, utf8NameBufSize)\n\t\t\t);\n\t\t}\n\n\t\t/* Start accepting Unicode text input events, show keyboard */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_StartTextInput();\n\n\t\t/* Check if unicode input events are enabled */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_IsTextInputActive();\n\n\t\t/* Stop receiving any text input events, hide onscreen kbd */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_StopTextInput();\n\n\t\t/* Set the rectangle used for text input, hint for IME */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_SetTextInputRect(ref SDL_Rect rect);\n\n\t\t/* Does the platform support an on-screen keyboard? */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasScreenKeyboardSupport();\n\n\t\t/* Is the on-screen keyboard shown for a given window? */\n\t\t/* window is an SDL_Window pointer */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_IsScreenKeyboardShown(IntPtr window);\n\n\t\t#endregion\n\n\t\t#region SDL_mouse.c\n\n\t\t/* Note: SDL_Cursor is a typedef normally. We'll treat it as\n\t\t * an IntPtr, because C# doesn't do typedefs. Yay!\n\t\t */\n\n\t\t/* System cursor types */\n\t\tpublic enum SDL_SystemCursor\n\t\t{\n\t\t\tSDL_SYSTEM_CURSOR_ARROW,\t// Arrow\n\t\t\tSDL_SYSTEM_CURSOR_IBEAM,\t// I-beam\n\t\t\tSDL_SYSTEM_CURSOR_WAIT,\t\t// Wait\n\t\t\tSDL_SYSTEM_CURSOR_CROSSHAIR,\t// Crosshair\n\t\t\tSDL_SYSTEM_CURSOR_WAITARROW,\t// Small wait cursor (or Wait if not available)\n\t\t\tSDL_SYSTEM_CURSOR_SIZENWSE,\t// Double arrow pointing northwest and southeast\n\t\t\tSDL_SYSTEM_CURSOR_SIZENESW,\t// Double arrow pointing northeast and southwest\n\t\t\tSDL_SYSTEM_CURSOR_SIZEWE,\t// Double arrow pointing west and east\n\t\t\tSDL_SYSTEM_CURSOR_SIZENS,\t// Double arrow pointing north and south\n\t\t\tSDL_SYSTEM_CURSOR_SIZEALL,\t// Four pointed arrow pointing north, south, east, and west\n\t\t\tSDL_SYSTEM_CURSOR_NO,\t\t// Slashed circle or crossbones\n\t\t\tSDL_SYSTEM_CURSOR_HAND,\t\t// Hand\n\t\t\tSDL_NUM_SYSTEM_CURSORS\n\t\t}\n\n\t\t/* Get the window which currently has mouse focus */\n\t\t/* Return value is an SDL_Window pointer */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GetMouseFocus();\n\n\t\t/* Get the current state of the mouse */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt32 SDL_GetMouseState(out int x, out int y);\n\n\t\t/* Get the current state of the mouse */\n\t\t/* This overload allows for passing NULL to x */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt32 SDL_GetMouseState(IntPtr x, out int y);\n\n\t\t/* Get the current state of the mouse */\n\t\t/* This overload allows for passing NULL to y */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt32 SDL_GetMouseState(out int x, IntPtr y);\n\n\t\t/* Get the current state of the mouse */\n\t\t/* This overload allows for passing NULL to both x and y */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt32 SDL_GetMouseState(IntPtr x, IntPtr y);\n\n\t\t/* Get the current state of the mouse, in relation to the desktop.\n\t\t * Only available in 2.0.4 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt32 SDL_GetGlobalMouseState(out int x, out int y);\n\n\t\t/* Get the current state of the mouse, in relation to the desktop.\n\t\t * Only available in 2.0.4 or higher.\n\t\t * This overload allows for passing NULL to x.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt32 SDL_GetGlobalMouseState(IntPtr x, out int y);\n\n\t\t/* Get the current state of the mouse, in relation to the desktop.\n\t\t * Only available in 2.0.4 or higher.\n\t\t * This overload allows for passing NULL to y.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt32 SDL_GetGlobalMouseState(out int x, IntPtr y);\n\n\t\t/* Get the current state of the mouse, in relation to the desktop.\n\t\t * Only available in 2.0.4 or higher.\n\t\t * This overload allows for passing NULL to both x and y\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt32 SDL_GetGlobalMouseState(IntPtr x, IntPtr y);\n\n\t\t/* Get the mouse state with relative coords*/\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt32 SDL_GetRelativeMouseState(out int x, out int y);\n\n\t\t/* Set the mouse cursor's position (within a window) */\n\t\t/* window is an SDL_Window pointer */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_WarpMouseInWindow(IntPtr window, int x, int y);\n\n\t\t/* Set the mouse cursor's position in global screen space.\n\t\t * Only available in 2.0.4 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_WarpMouseGlobal(int x, int y);\n\n\t\t/* Enable/Disable relative mouse mode (grabs mouse, rel coords) */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SetRelativeMouseMode(SDL_bool enabled);\n\n\t\t/* Capture the mouse, to track input outside an SDL window.\n\t\t * Only available in 2.0.4 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_CaptureMouse(SDL_bool enabled);\n\n\t\t/* Query if the relative mouse mode is enabled */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_GetRelativeMouseMode();\n\n\t\t/* Create a cursor from bitmap data (amd mask) in MSB format.\n\t\t * data and mask are byte arrays, and w must be a multiple of 8.\n\t\t * return value is an SDL_Cursor pointer.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_CreateCursor(\n\t\t\tIntPtr data,\n\t\t\tIntPtr mask,\n\t\t\tint w,\n\t\t\tint h,\n\t\t\tint hot_x,\n\t\t\tint hot_y\n\t\t);\n\n\t\t/* Create a cursor from an SDL_Surface.\n\t\t * IntPtr refers to an SDL_Cursor*, surface to an SDL_Surface*\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_CreateColorCursor(\n\t\t\tIntPtr surface,\n\t\t\tint hot_x,\n\t\t\tint hot_y\n\t\t);\n\n\t\t/* Create a cursor from a system cursor id.\n\t\t * return value is an SDL_Cursor pointer\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_CreateSystemCursor(SDL_SystemCursor id);\n\n\t\t/* Set the active cursor.\n\t\t * cursor is an SDL_Cursor pointer\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_SetCursor(IntPtr cursor);\n\n\t\t/* Return the active cursor\n\t\t * return value is an SDL_Cursor pointer\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GetCursor();\n\n\t\t/* Frees a cursor created with one of the CreateCursor functions.\n\t\t * cursor in an SDL_Cursor pointer\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_FreeCursor(IntPtr cursor);\n\n\t\t/* Toggle whether or not the cursor is shown */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_ShowCursor(int toggle);\n\n\t\tpublic static uint SDL_BUTTON(uint X)\n\t\t{\n\t\t\t// If only there were a better way of doing this in C#\n\t\t\treturn (uint) (1 << ((int) X - 1));\n\t\t}\n\n\t\tpublic const uint SDL_BUTTON_LEFT =\t1;\n\t\tpublic const uint SDL_BUTTON_MIDDLE =\t2;\n\t\tpublic const uint SDL_BUTTON_RIGHT =\t3;\n\t\tpublic const uint SDL_BUTTON_X1 =\t4;\n\t\tpublic const uint SDL_BUTTON_X2 =\t5;\n\t\tpublic static readonly UInt32 SDL_BUTTON_LMASK =\tSDL_BUTTON(SDL_BUTTON_LEFT);\n\t\tpublic static readonly UInt32 SDL_BUTTON_MMASK =\tSDL_BUTTON(SDL_BUTTON_MIDDLE);\n\t\tpublic static readonly UInt32 SDL_BUTTON_RMASK =\tSDL_BUTTON(SDL_BUTTON_RIGHT);\n\t\tpublic static readonly UInt32 SDL_BUTTON_X1MASK =\tSDL_BUTTON(SDL_BUTTON_X1);\n\t\tpublic static readonly UInt32 SDL_BUTTON_X2MASK =\tSDL_BUTTON(SDL_BUTTON_X2);\n\n\t\t#endregion\n\n\t\t#region SDL_touch.h\n\n\t\tpublic const uint SDL_TOUCH_MOUSEID = uint.MaxValue;\n\n\t\tpublic struct SDL_Finger\n\t\t{\n\t\t\tpublic long id; // SDL_FingerID\n\t\t\tpublic float x;\n\t\t\tpublic float y;\n\t\t\tpublic float pressure;\n\t\t}\n\n\t\t/* Only available in 2.0.10 or higher. */\n\t\tpublic enum SDL_TouchDeviceType\n\t\t{\n\t\t\tSDL_TOUCH_DEVICE_INVALID = -1,\n\t\t\tSDL_TOUCH_DEVICE_DIRECT,            /* touch screen with window-relative coordinates */\n\t\t\tSDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, /* trackpad with absolute device coordinates */\n\t\t\tSDL_TOUCH_DEVICE_INDIRECT_RELATIVE  /* trackpad with screen cursor-relative coordinates */\n\t\t}\n\n\t\t/**\n\t\t *  \\brief Get the number of registered touch devices.\n \t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetNumTouchDevices();\n\n\t\t/**\n\t\t *  \\brief Get the touch ID with the given index, or 0 if the index is invalid.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern long SDL_GetTouchDevice(int index);\n\n\t\t/**\n\t\t *  \\brief Get the number of active fingers for a given touch device.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetNumTouchFingers(long touchID);\n\n\t\t/**\n\t\t *  \\brief Get the finger object of the given touch, with the given index.\n\t\t *  Returns pointer to SDL_Finger.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GetTouchFinger(long touchID, int index);\n\n\t\t/* Only available in 2.0.10 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_TouchDeviceType SDL_GetTouchDeviceType(Int64 touchID);\n\n\t\t#endregion\n\n\t\t#region SDL_joystick.h\n\n\t\tpublic const byte SDL_HAT_CENTERED =\t0x00;\n\t\tpublic const byte SDL_HAT_UP =\t\t0x01;\n\t\tpublic const byte SDL_HAT_RIGHT =\t0x02;\n\t\tpublic const byte SDL_HAT_DOWN =\t0x04;\n\t\tpublic const byte SDL_HAT_LEFT =\t0x08;\n\t\tpublic const byte SDL_HAT_RIGHTUP =\tSDL_HAT_RIGHT | SDL_HAT_UP;\n\t\tpublic const byte SDL_HAT_RIGHTDOWN =\tSDL_HAT_RIGHT | SDL_HAT_DOWN;\n\t\tpublic const byte SDL_HAT_LEFTUP =\tSDL_HAT_LEFT | SDL_HAT_UP;\n\t\tpublic const byte SDL_HAT_LEFTDOWN =\tSDL_HAT_LEFT | SDL_HAT_DOWN;\n\n\t\tpublic enum SDL_JoystickPowerLevel\n\t\t{\n\t\t\tSDL_JOYSTICK_POWER_UNKNOWN = -1,\n\t\t\tSDL_JOYSTICK_POWER_EMPTY,\n\t\t\tSDL_JOYSTICK_POWER_LOW,\n\t\t\tSDL_JOYSTICK_POWER_MEDIUM,\n\t\t\tSDL_JOYSTICK_POWER_FULL,\n\t\t\tSDL_JOYSTICK_POWER_WIRED,\n\t\t\tSDL_JOYSTICK_POWER_MAX\n\t\t}\n\n\t\tpublic enum SDL_JoystickType\n\t\t{\n\t\t\tSDL_JOYSTICK_TYPE_UNKNOWN,\n\t\t\tSDL_JOYSTICK_TYPE_GAMECONTROLLER,\n\t\t\tSDL_JOYSTICK_TYPE_WHEEL,\n\t\t\tSDL_JOYSTICK_TYPE_ARCADE_STICK,\n\t\t\tSDL_JOYSTICK_TYPE_FLIGHT_STICK,\n\t\t\tSDL_JOYSTICK_TYPE_DANCE_PAD,\n\t\t\tSDL_JOYSTICK_TYPE_GUITAR,\n\t\t\tSDL_JOYSTICK_TYPE_DRUM_KIT,\n\t\t\tSDL_JOYSTICK_TYPE_ARCADE_PAD\n\t\t}\n\n\t\t/* joystick refers to an SDL_Joystick*.\n\t\t * Only available in 2.0.9 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_JoystickRumble(\n\t\t\tIntPtr joystick,\n\t\t\tUInt16 low_frequency_rumble,\n\t\t\tUInt16 high_frequency_rumble,\n\t\t\tUInt32 duration_ms\n\t\t);\n\n\t\t/* joystick refers to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_JoystickClose(IntPtr joystick);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_JoystickEventState(int state);\n\n\t\t/* joystick refers to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern short SDL_JoystickGetAxis(\n\t\t\tIntPtr joystick,\n\t\t\tint axis\n\t\t);\n\n\t\t/* joystick refers to an SDL_Joystick*.\n\t\t * Only available in 2.0.6 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_JoystickGetAxisInitialState(\n\t\t\tIntPtr joystick,\n\t\t\tint axis,\n\t\t\tout ushort state\n\t\t);\n\n\t\t/* joystick refers to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_JoystickGetBall(\n\t\t\tIntPtr joystick,\n\t\t\tint ball,\n\t\t\tout int dx,\n\t\t\tout int dy\n\t\t);\n\n\t\t/* joystick refers to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern byte SDL_JoystickGetButton(\n\t\t\tIntPtr joystick,\n\t\t\tint button\n\t\t);\n\n\t\t/* joystick refers to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern byte SDL_JoystickGetHat(\n\t\t\tIntPtr joystick,\n\t\t\tint hat\n\t\t);\n\n\t\t/* joystick refers to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_JoystickName\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_JoystickName(\n\t\t\tIntPtr joystick\n\t\t);\n\t\tpublic static string SDL_JoystickName(IntPtr joystick)\n\t\t{\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_JoystickName(joystick)\n\t\t\t);\n\t\t}\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_JoystickNameForIndex\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_JoystickNameForIndex(\n\t\t\tint device_index\n\t\t);\n\t\tpublic static string SDL_JoystickNameForIndex(int device_index)\n\t\t{\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_JoystickNameForIndex(device_index)\n\t\t\t);\n\t\t}\n\n\t\t/* joystick refers to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_JoystickNumAxes(IntPtr joystick);\n\n\t\t/* joystick refers to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_JoystickNumBalls(IntPtr joystick);\n\n\t\t/* joystick refers to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_JoystickNumButtons(IntPtr joystick);\n\n\t\t/* joystick refers to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_JoystickNumHats(IntPtr joystick);\n\n\t\t/* IntPtr refers to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_JoystickOpen(int device_index);\n\n\t\t/* joystick refers to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_JoystickUpdate();\n\n\t\t/* joystick refers to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_NumJoysticks();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern Guid SDL_JoystickGetDeviceGUID(\n\t\t\tint device_index\n\t\t);\n\n\t\t/* joystick refers to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern Guid SDL_JoystickGetGUID(\n\t\t\tIntPtr joystick\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_JoystickGetGUIDString(\n\t\t\tGuid guid,\n\t\t\tbyte[] pszGUID,\n\t\t\tint cbGUID\n\t\t);\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_JoystickGetGUIDFromString\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe Guid INTERNAL_SDL_JoystickGetGUIDFromString(\n\t\t\tbyte* pchGUID\n\t\t);\n\t\tpublic static unsafe Guid SDL_JoystickGetGUIDFromString(string pchGuid)\n\t\t{\n\t\t\tint utf8PchGuidBufSize = Utf8Size(pchGuid);\n\t\t\tbyte* utf8PchGuid = stackalloc byte[utf8PchGuidBufSize];\n\t\t\treturn INTERNAL_SDL_JoystickGetGUIDFromString(\n\t\t\t\tUtf8Encode(pchGuid, utf8PchGuid, utf8PchGuidBufSize)\n\t\t\t);\n\t\t}\n\n\t\t/* Only available in 2.0.6 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern ushort SDL_JoystickGetDeviceVendor(int device_index);\n\n\t\t/* Only available in 2.0.6 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern ushort SDL_JoystickGetDeviceProduct(int device_index);\n\n\t\t/* Only available in 2.0.6 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern ushort SDL_JoystickGetDeviceProductVersion(int device_index);\n\n\t\t/* Only available in 2.0.6 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_JoystickType SDL_JoystickGetDeviceType(int device_index);\n\n\t\t/* int refers to an SDL_JoystickID.\n\t\t * Only available in 2.0.6 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_JoystickGetDeviceInstanceID(int device_index);\n\n\t\t/* joystick refers to an SDL_Joystick*.\n\t\t * Only available in 2.0.6 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern ushort SDL_JoystickGetVendor(IntPtr joystick);\n\n\t\t/* joystick refers to an SDL_Joystick*.\n\t\t * Only available in 2.0.6 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern ushort SDL_JoystickGetProduct(IntPtr joystick);\n\n\t\t/* joystick refers to an SDL_Joystick*.\n\t\t * Only available in 2.0.6 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern ushort SDL_JoystickGetProductVersion(IntPtr joystick);\n\n\t\t/* joystick refers to an SDL_Joystick*.\n\t\t * Only available in 2.0.6 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_JoystickType SDL_JoystickGetType(IntPtr joystick);\n\n\t\t/* joystick refers to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_JoystickGetAttached(IntPtr joystick);\n\n\t\t/* int refers to an SDL_JoystickID, joystick to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_JoystickInstanceID(IntPtr joystick);\n\n\t\t/* joystick refers to an SDL_Joystick*.\n\t\t * Only available in 2.0.4 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_JoystickPowerLevel SDL_JoystickCurrentPowerLevel(\n\t\t\tIntPtr joystick\n\t\t);\n\n\t\t/* int refers to an SDL_JoystickID, IntPtr to an SDL_Joystick*.\n\t\t * Only available in 2.0.4 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_JoystickFromInstanceID(int instance_id);\n\n\t\t/* Only available in 2.0.7 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_LockJoysticks();\n\n\t\t/* Only available in 2.0.7 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_UnlockJoysticks();\n\n\t\t/* IntPtr refers to an SDL_Joystick*.\n\t\t * Only available in 2.0.11 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_JoystickFromPlayerIndex(int player_index);\n\n\t\t/* IntPtr refers to an SDL_Joystick*.\n\t\t * Only available in 2.0.11 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_JoystickSetPlayerIndex(\n\t\t\tIntPtr joystick,\n\t\t\tint player_index\n\t\t);\n\n\t\t#endregion\n\n\t\t#region SDL_gamecontroller.h\n\n\t\tpublic enum SDL_GameControllerBindType\n\t\t{\n\t\t\tSDL_CONTROLLER_BINDTYPE_NONE,\n\t\t\tSDL_CONTROLLER_BINDTYPE_BUTTON,\n\t\t\tSDL_CONTROLLER_BINDTYPE_AXIS,\n\t\t\tSDL_CONTROLLER_BINDTYPE_HAT\n\t\t}\n\n\t\tpublic enum SDL_GameControllerAxis\n\t\t{\n\t\t\tSDL_CONTROLLER_AXIS_INVALID = -1,\n\t\t\tSDL_CONTROLLER_AXIS_LEFTX,\n\t\t\tSDL_CONTROLLER_AXIS_LEFTY,\n\t\t\tSDL_CONTROLLER_AXIS_RIGHTX,\n\t\t\tSDL_CONTROLLER_AXIS_RIGHTY,\n\t\t\tSDL_CONTROLLER_AXIS_TRIGGERLEFT,\n\t\t\tSDL_CONTROLLER_AXIS_TRIGGERRIGHT,\n\t\t\tSDL_CONTROLLER_AXIS_MAX\n\t\t}\n\n\t\tpublic enum SDL_GameControllerButton\n\t\t{\n\t\t\tSDL_CONTROLLER_BUTTON_INVALID = -1,\n\t\t\tSDL_CONTROLLER_BUTTON_A,\n\t\t\tSDL_CONTROLLER_BUTTON_B,\n\t\t\tSDL_CONTROLLER_BUTTON_X,\n\t\t\tSDL_CONTROLLER_BUTTON_Y,\n\t\t\tSDL_CONTROLLER_BUTTON_BACK,\n\t\t\tSDL_CONTROLLER_BUTTON_GUIDE,\n\t\t\tSDL_CONTROLLER_BUTTON_START,\n\t\t\tSDL_CONTROLLER_BUTTON_LEFTSTICK,\n\t\t\tSDL_CONTROLLER_BUTTON_RIGHTSTICK,\n\t\t\tSDL_CONTROLLER_BUTTON_LEFTSHOULDER,\n\t\t\tSDL_CONTROLLER_BUTTON_RIGHTSHOULDER,\n\t\t\tSDL_CONTROLLER_BUTTON_DPAD_UP,\n\t\t\tSDL_CONTROLLER_BUTTON_DPAD_DOWN,\n\t\t\tSDL_CONTROLLER_BUTTON_DPAD_LEFT,\n\t\t\tSDL_CONTROLLER_BUTTON_DPAD_RIGHT,\n\t\t\tSDL_CONTROLLER_BUTTON_MAX,\n\t\t}\n\n\t\tpublic enum SDL_GameControllerType\n\t\t{\n\t\t\tSDL_CONTROLLER_TYPE_UNKNOWN = 0,\n\t\t\tSDL_CONTROLLER_TYPE_XBOX360,\n\t\t\tSDL_CONTROLLER_TYPE_XBOXONE,\n\t\t\tSDL_CONTROLLER_TYPE_PS3,\n\t\t\tSDL_CONTROLLER_TYPE_PS4,\n\t\t\tSDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO\n\t\t}\n\n\t\t// FIXME: I'd rather this somehow be private...\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct INTERNAL_GameControllerButtonBind_hat\n\t\t{\n\t\t\tpublic int hat;\n\t\t\tpublic int hat_mask;\n\t\t}\n\n\t\t// FIXME: I'd rather this somehow be private...\n\t\t[StructLayout(LayoutKind.Explicit)]\n\t\tpublic struct INTERNAL_GameControllerButtonBind_union\n\t\t{\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic int button;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic int axis;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic INTERNAL_GameControllerButtonBind_hat hat;\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_GameControllerButtonBind\n\t\t{\n\t\t\tpublic SDL_GameControllerBindType bindType;\n\t\t\tpublic INTERNAL_GameControllerButtonBind_union value;\n\t\t}\n\n\t\t/* This exists to deal with C# being stupid about blittable types. */\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tprivate struct INTERNAL_SDL_GameControllerButtonBind\n\t\t{\n\t\t\tpublic int bindType;\n\t\t\t/* Largest data type in the union is two ints in size */\n\t\t\tpublic int unionVal0;\n\t\t\tpublic int unionVal1;\n\t\t}\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GameControllerAddMapping\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe int INTERNAL_SDL_GameControllerAddMapping(\n\t\t\tbyte* mappingString\n\t\t);\n\t\tpublic static unsafe int SDL_GameControllerAddMapping(\n\t\t\tstring mappingString\n\t\t) {\n\t\t\tbyte* utf8MappingString = Utf8Encode(mappingString);\n\t\t\tint result = INTERNAL_SDL_GameControllerAddMapping(\n\t\t\t\tutf8MappingString\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8MappingString);\n\t\t\treturn result;\n\t\t}\n\n\t\t/* Only available in 2.0.6 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GameControllerNumMappings();\n\n\t\t/* Only available in 2.0.6 or higher. */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GameControllerMappingForIndex\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GameControllerMappingForIndex(int mapping_index);\n\t\tpublic static string SDL_GameControllerMappingForIndex(int mapping_index)\n\t\t{\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_GameControllerMappingForIndex(\n\t\t\t\t\tmapping_index\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\t/* THIS IS AN RWops FUNCTION! */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GameControllerAddMappingsFromRW\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern int INTERNAL_SDL_GameControllerAddMappingsFromRW(\n\t\t\tIntPtr rw,\n\t\t\tint freerw\n\t\t);\n\t\tpublic static int SDL_GameControllerAddMappingsFromFile(string file)\n\t\t{\n\t\t\tIntPtr rwops = SDL_RWFromFile(file, \"rb\");\n\t\t\treturn INTERNAL_SDL_GameControllerAddMappingsFromRW(rwops, 1);\n\t\t}\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GameControllerMappingForGUID\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GameControllerMappingForGUID(\n\t\t\tGuid guid\n\t\t);\n\t\tpublic static string SDL_GameControllerMappingForGUID(Guid guid)\n\t\t{\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_GameControllerMappingForGUID(guid)\n\t\t\t);\n\t\t}\n\n\t\t/* gamecontroller refers to an SDL_GameController* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GameControllerMapping\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GameControllerMapping(\n\t\t\tIntPtr gamecontroller\n\t\t);\n\t\tpublic static string SDL_GameControllerMapping(\n\t\t\tIntPtr gamecontroller\n\t\t) {\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_GameControllerMapping(\n\t\t\t\t\tgamecontroller\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_IsGameController(int joystick_index);\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GameControllerNameForIndex\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GameControllerNameForIndex(\n\t\t\tint joystick_index\n\t\t);\n\t\tpublic static string SDL_GameControllerNameForIndex(\n\t\t\tint joystick_index\n\t\t) {\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_GameControllerNameForIndex(joystick_index)\n\t\t\t);\n\t\t}\n\n\t\t/* Only available in 2.0.9 or higher. */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GameControllerMappingForDeviceIndex\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GameControllerMappingForDeviceIndex(\n\t\t\tint joystick_index\n\t\t);\n\t\tpublic static string SDL_GameControllerMappingForDeviceIndex(\n\t\t\tint joystick_index\n\t\t) {\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_GameControllerMappingForDeviceIndex(joystick_index)\n\t\t\t);\n\t\t}\n\n\t\t/* IntPtr refers to an SDL_GameController* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GameControllerOpen(int joystick_index);\n\n\t\t/* gamecontroller refers to an SDL_GameController* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GameControllerName\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GameControllerName(\n\t\t\tIntPtr gamecontroller\n\t\t);\n\t\tpublic static string SDL_GameControllerName(\n\t\t\tIntPtr gamecontroller\n\t\t) {\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_GameControllerName(gamecontroller)\n\t\t\t);\n\t\t}\n\n\t\t/* gamecontroller refers to an SDL_GameController*.\n\t\t * Only available in 2.0.6 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern ushort SDL_GameControllerGetVendor(\n\t\t\tIntPtr gamecontroller\n\t\t);\n\n\t\t/* gamecontroller refers to an SDL_GameController*.\n\t\t * Only available in 2.0.6 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern ushort SDL_GameControllerGetProduct(\n\t\t\tIntPtr gamecontroller\n\t\t);\n\n\t\t/* gamecontroller refers to an SDL_GameController*.\n\t\t * Only available in 2.0.6 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern ushort SDL_GameControllerGetProductVersion(\n\t\t\tIntPtr gamecontroller\n\t\t);\n\n\t\t/* gamecontroller refers to an SDL_GameController* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_GameControllerGetAttached(\n\t\t\tIntPtr gamecontroller\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Joystick*\n\t\t * gamecontroller refers to an SDL_GameController*\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GameControllerGetJoystick(\n\t\t\tIntPtr gamecontroller\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GameControllerEventState(int state);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_GameControllerUpdate();\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GameControllerGetAxisFromString\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe SDL_GameControllerAxis INTERNAL_SDL_GameControllerGetAxisFromString(\n\t\t\tbyte* pchString\n\t\t);\n\t\tpublic static unsafe SDL_GameControllerAxis SDL_GameControllerGetAxisFromString(\n\t\t\tstring pchString\n\t\t) {\n\t\t\tint utf8PchStringBufSize = Utf8Size(pchString);\n\t\t\tbyte* utf8PchString = stackalloc byte[utf8PchStringBufSize];\n\t\t\treturn INTERNAL_SDL_GameControllerGetAxisFromString(\n\t\t\t\tUtf8Encode(pchString, utf8PchString, utf8PchStringBufSize)\n\t\t\t);\n\t\t}\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GameControllerGetStringForAxis\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GameControllerGetStringForAxis(\n\t\t\tSDL_GameControllerAxis axis\n\t\t);\n\t\tpublic static string SDL_GameControllerGetStringForAxis(\n\t\t\tSDL_GameControllerAxis axis\n\t\t) {\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_GameControllerGetStringForAxis(\n\t\t\t\t\taxis\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\t/* gamecontroller refers to an SDL_GameController* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GameControllerGetBindForAxis\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern INTERNAL_SDL_GameControllerButtonBind INTERNAL_SDL_GameControllerGetBindForAxis(\n\t\t\tIntPtr gamecontroller,\n\t\t\tSDL_GameControllerAxis axis\n\t\t);\n\t\tpublic static SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(\n\t\t\tIntPtr gamecontroller,\n\t\t\tSDL_GameControllerAxis axis\n\t\t) {\n\t\t\t// This is guaranteed to never be null\n\t\t\tINTERNAL_SDL_GameControllerButtonBind dumb = INTERNAL_SDL_GameControllerGetBindForAxis(\n\t\t\t\tgamecontroller,\n\t\t\t\taxis\n\t\t\t);\n\t\t\tSDL_GameControllerButtonBind result = new SDL_GameControllerButtonBind();\n\t\t\tresult.bindType = (SDL_GameControllerBindType) dumb.bindType;\n\t\t\tresult.value.hat.hat = dumb.unionVal0;\n\t\t\tresult.value.hat.hat_mask = dumb.unionVal1;\n\t\t\treturn result;\n\t\t}\n\n\t\t/* gamecontroller refers to an SDL_GameController* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern short SDL_GameControllerGetAxis(\n\t\t\tIntPtr gamecontroller,\n\t\t\tSDL_GameControllerAxis axis\n\t\t);\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GameControllerGetButtonFromString\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe SDL_GameControllerButton INTERNAL_SDL_GameControllerGetButtonFromString(\n\t\t\tbyte* pchString\n\t\t);\n\t\tpublic static unsafe SDL_GameControllerButton SDL_GameControllerGetButtonFromString(\n\t\t\tstring pchString\n\t\t) {\n\t\t\tint utf8PchStringBufSize = Utf8Size(pchString);\n\t\t\tbyte* utf8PchString = stackalloc byte[utf8PchStringBufSize];\n\t\t\treturn INTERNAL_SDL_GameControllerGetButtonFromString(\n\t\t\t\tUtf8Encode(pchString, utf8PchString, utf8PchStringBufSize)\n\t\t\t);\n\t\t}\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GameControllerGetStringForButton\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GameControllerGetStringForButton(\n\t\t\tSDL_GameControllerButton button\n\t\t);\n\t\tpublic static string SDL_GameControllerGetStringForButton(\n\t\t\tSDL_GameControllerButton button\n\t\t) {\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_GameControllerGetStringForButton(button)\n\t\t\t);\n\t\t}\n\n\t\t/* gamecontroller refers to an SDL_GameController* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GameControllerGetBindForButton\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern INTERNAL_SDL_GameControllerButtonBind INTERNAL_SDL_GameControllerGetBindForButton(\n\t\t\tIntPtr gamecontroller,\n\t\t\tSDL_GameControllerButton button\n\t\t);\n\t\tpublic static SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(\n\t\t\tIntPtr gamecontroller,\n\t\t\tSDL_GameControllerButton button\n\t\t) {\n\t\t\t// This is guaranteed to never be null\n\t\t\tINTERNAL_SDL_GameControllerButtonBind dumb = INTERNAL_SDL_GameControllerGetBindForButton(\n\t\t\t\tgamecontroller,\n\t\t\t\tbutton\n\t\t\t);\n\t\t\tSDL_GameControllerButtonBind result = new SDL_GameControllerButtonBind();\n\t\t\tresult.bindType = (SDL_GameControllerBindType) dumb.bindType;\n\t\t\tresult.value.hat.hat = dumb.unionVal0;\n\t\t\tresult.value.hat.hat_mask = dumb.unionVal1;\n\t\t\treturn result;\n\t\t}\n\n\t\t/* gamecontroller refers to an SDL_GameController* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern byte SDL_GameControllerGetButton(\n\t\t\tIntPtr gamecontroller,\n\t\t\tSDL_GameControllerButton button\n\t\t);\n\n\t\t/* gamecontroller refers to an SDL_GameController*.\n\t\t * Only available in 2.0.9 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GameControllerRumble(\n\t\t\tIntPtr gamecontroller,\n\t\t\tUInt16 low_frequency_rumble,\n\t\t\tUInt16 high_frequency_rumble,\n\t\t\tUInt32 duration_ms\n\t\t);\n\n\t\t/* gamecontroller refers to an SDL_GameController* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_GameControllerClose(\n\t\t\tIntPtr gamecontroller\n\t\t);\n\n\t\t/* int refers to an SDL_JoystickID, IntPtr to an SDL_GameController*.\n\t\t * Only available in 2.0.4 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GameControllerFromInstanceID(int joyid);\n\n\t\t/* Only available in 2.0.11 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_GameControllerType SDL_GameControllerTypeForIndex(\n\t\t\tint joystick_index\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_GameController*.\n\t\t * Only available in 2.0.11 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_GameControllerType SDL_GameControllerGetType(\n\t\t\tIntPtr gamecontroller\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_GameController*.\n\t\t * Only available in 2.0.11 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_GameControllerFromPlayerIndex(\n\t\t\tint player_index\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_GameController*.\n\t\t * Only available in 2.0.11 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_GameControllerSetPlayerIndex(\n\t\t\tIntPtr gamecontroller,\n\t\t\tint player_index\n\t\t);\n\n\t\t#endregion\n\n\t\t#region SDL_haptic.h\n\n\t\t/* SDL_HapticEffect type */\n\t\tpublic const ushort SDL_HAPTIC_CONSTANT =\t(1 << 0);\n\t\tpublic const ushort SDL_HAPTIC_SINE =\t\t(1 << 1);\n\t\tpublic const ushort SDL_HAPTIC_LEFTRIGHT =\t(1 << 2);\n\t\tpublic const ushort SDL_HAPTIC_TRIANGLE =\t(1 << 3);\n\t\tpublic const ushort SDL_HAPTIC_SAWTOOTHUP =\t(1 << 4);\n\t\tpublic const ushort SDL_HAPTIC_SAWTOOTHDOWN =\t(1 << 5);\n\t\tpublic const ushort SDL_HAPTIC_SPRING =\t\t(1 << 7);\n\t\tpublic const ushort SDL_HAPTIC_DAMPER =\t\t(1 << 8);\n\t\tpublic const ushort SDL_HAPTIC_INERTIA =\t(1 << 9);\n\t\tpublic const ushort SDL_HAPTIC_FRICTION =\t(1 << 10);\n\t\tpublic const ushort SDL_HAPTIC_CUSTOM =\t\t(1 << 11);\n\t\tpublic const ushort SDL_HAPTIC_GAIN =\t\t(1 << 12);\n\t\tpublic const ushort SDL_HAPTIC_AUTOCENTER =\t(1 << 13);\n\t\tpublic const ushort SDL_HAPTIC_STATUS =\t\t(1 << 14);\n\t\tpublic const ushort SDL_HAPTIC_PAUSE =\t\t(1 << 15);\n\n\t\t/* SDL_HapticDirection type */\n\t\tpublic const byte SDL_HAPTIC_POLAR =\t\t0;\n\t\tpublic const byte SDL_HAPTIC_CARTESIAN =\t1;\n\t\tpublic const byte SDL_HAPTIC_SPHERICAL =\t2;\n\n\t\t/* SDL_HapticRunEffect */\n\t\tpublic const uint SDL_HAPTIC_INFINITY = 4294967295U;\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic unsafe struct SDL_HapticDirection\n\t\t{\n\t\t\tpublic byte type;\n\t\t\tpublic fixed int dir[3];\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_HapticConstant\n\t\t{\n\t\t\t// Header\n\t\t\tpublic ushort type;\n\t\t\tpublic SDL_HapticDirection direction;\n\t\t\t// Replay\n\t\t\tpublic uint length;\n\t\t\tpublic ushort delay;\n\t\t\t// Trigger\n\t\t\tpublic ushort button;\n\t\t\tpublic ushort interval;\n\t\t\t// Constant\n\t\t\tpublic short level;\n\t\t\t// Envelope\n\t\t\tpublic ushort attack_length;\n\t\t\tpublic ushort attack_level;\n\t\t\tpublic ushort fade_length;\n\t\t\tpublic ushort fade_level;\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_HapticPeriodic\n\t\t{\n\t\t\t// Header\n\t\t\tpublic ushort type;\n\t\t\tpublic SDL_HapticDirection direction;\n\t\t\t// Replay\n\t\t\tpublic uint length;\n\t\t\tpublic ushort delay;\n\t\t\t// Trigger\n\t\t\tpublic ushort button;\n\t\t\tpublic ushort interval;\n\t\t\t// Periodic\n\t\t\tpublic ushort period;\n\t\t\tpublic short magnitude;\n\t\t\tpublic short offset;\n\t\t\tpublic ushort phase;\n\t\t\t// Envelope\n\t\t\tpublic ushort attack_length;\n\t\t\tpublic ushort attack_level;\n\t\t\tpublic ushort fade_length;\n\t\t\tpublic ushort fade_level;\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic unsafe struct SDL_HapticCondition\n\t\t{\n\t\t\t// Header\n\t\t\tpublic ushort type;\n\t\t\tpublic SDL_HapticDirection direction;\n\t\t\t// Replay\n\t\t\tpublic uint length;\n\t\t\tpublic ushort delay;\n\t\t\t// Trigger\n\t\t\tpublic ushort button;\n\t\t\tpublic ushort interval;\n\t\t\t// Condition\n\t\t\tpublic fixed ushort right_sat[3];\n\t\t\tpublic fixed ushort left_sat[3];\n\t\t\tpublic fixed short right_coeff[3];\n\t\t\tpublic fixed short left_coeff[3];\n\t\t\tpublic fixed ushort deadband[3];\n\t\t\tpublic fixed short center[3];\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_HapticRamp\n\t\t{\n\t\t\t// Header\n\t\t\tpublic ushort type;\n\t\t\tpublic SDL_HapticDirection direction;\n\t\t\t// Replay\n\t\t\tpublic uint length;\n\t\t\tpublic ushort delay;\n\t\t\t// Trigger\n\t\t\tpublic ushort button;\n\t\t\tpublic ushort interval;\n\t\t\t// Ramp\n\t\t\tpublic short start;\n\t\t\tpublic short end;\n\t\t\t// Envelope\n\t\t\tpublic ushort attack_length;\n\t\t\tpublic ushort attack_level;\n\t\t\tpublic ushort fade_length;\n\t\t\tpublic ushort fade_level;\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_HapticLeftRight\n\t\t{\n\t\t\t// Header\n\t\t\tpublic ushort type;\n\t\t\t// Replay\n\t\t\tpublic uint length;\n\t\t\t// Rumble\n\t\t\tpublic ushort large_magnitude;\n\t\t\tpublic ushort small_magnitude;\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_HapticCustom\n\t\t{\n\t\t\t// Header\n\t\t\tpublic ushort type;\n\t\t\tpublic SDL_HapticDirection direction;\n\t\t\t// Replay\n\t\t\tpublic uint length;\n\t\t\tpublic ushort delay;\n\t\t\t// Trigger\n\t\t\tpublic ushort button;\n\t\t\tpublic ushort interval;\n\t\t\t// Custom\n\t\t\tpublic byte channels;\n\t\t\tpublic ushort period;\n\t\t\tpublic ushort samples;\n\t\t\tpublic IntPtr data; // Uint16*\n\t\t\t// Envelope\n\t\t\tpublic ushort attack_length;\n\t\t\tpublic ushort attack_level;\n\t\t\tpublic ushort fade_length;\n\t\t\tpublic ushort fade_level;\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Explicit)]\n\t\tpublic struct SDL_HapticEffect\n\t\t{\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic ushort type;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_HapticConstant constant;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_HapticPeriodic periodic;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_HapticCondition condition;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_HapticRamp ramp;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_HapticLeftRight leftright;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic SDL_HapticCustom custom;\n\t\t}\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_HapticClose(IntPtr haptic);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_HapticDestroyEffect(\n\t\t\tIntPtr haptic,\n\t\t\tint effect\n\t\t);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticEffectSupported(\n\t\t\tIntPtr haptic,\n\t\t\tref SDL_HapticEffect effect\n\t\t);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticGetEffectStatus(\n\t\t\tIntPtr haptic,\n\t\t\tint effect\n\t\t);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticIndex(IntPtr haptic);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_HapticName\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_HapticName(int device_index);\n\t\tpublic static string SDL_HapticName(int device_index)\n\t\t{\n\t\t\treturn UTF8_ToManaged(INTERNAL_SDL_HapticName(device_index));\n\t\t}\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticNewEffect(\n\t\t\tIntPtr haptic,\n\t\t\tref SDL_HapticEffect effect\n\t\t);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticNumAxes(IntPtr haptic);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticNumEffects(IntPtr haptic);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticNumEffectsPlaying(IntPtr haptic);\n\n\t\t/* IntPtr refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_HapticOpen(int device_index);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticOpened(int device_index);\n\n\t\t/* IntPtr refers to an SDL_Haptic*, joystick to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_HapticOpenFromJoystick(\n\t\t\tIntPtr joystick\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_HapticOpenFromMouse();\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticPause(IntPtr haptic);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern uint SDL_HapticQuery(IntPtr haptic);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticRumbleInit(IntPtr haptic);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticRumblePlay(\n\t\t\tIntPtr haptic,\n\t\t\tfloat strength,\n\t\t\tuint length\n\t\t);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticRumbleStop(IntPtr haptic);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticRumbleSupported(IntPtr haptic);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticRunEffect(\n\t\t\tIntPtr haptic,\n\t\t\tint effect,\n\t\t\tuint iterations\n\t\t);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticSetAutocenter(\n\t\t\tIntPtr haptic,\n\t\t\tint autocenter\n\t\t);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticSetGain(\n\t\t\tIntPtr haptic,\n\t\t\tint gain\n\t\t);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticStopAll(IntPtr haptic);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticStopEffect(\n\t\t\tIntPtr haptic,\n\t\t\tint effect\n\t\t);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticUnpause(IntPtr haptic);\n\n\t\t/* haptic refers to an SDL_Haptic* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_HapticUpdateEffect(\n\t\t\tIntPtr haptic,\n\t\t\tint effect,\n\t\t\tref SDL_HapticEffect data\n\t\t);\n\n\t\t/* joystick refers to an SDL_Joystick* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_JoystickIsHaptic(IntPtr joystick);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_MouseIsHaptic();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_NumHaptics();\n\n\t\t#endregion\n\n\t\t#region SDL_sensor.h\n\n\t\t/* This region is only available in 2.0.9 or higher. */\n\n\t\tpublic enum SDL_SensorType\n\t\t{\n\t\t\tSDL_SENSOR_INVALID = -1,\n\t\t\tSDL_SENSOR_UNKNOWN,\n\t\t\tSDL_SENSOR_ACCEL,\n\t\t\tSDL_SENSOR_GYRO\n\t\t}\n\n\t\tpublic const float SDL_STANDARD_GRAVITY = 9.80665f;\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_NumSensors();\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_SensorGetDeviceName\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_SensorGetDeviceName(int device_index);\n\t\tpublic static string SDL_SensorGetDeviceName(int device_index)\n\t\t{\n\t\t\treturn UTF8_ToManaged(INTERNAL_SDL_SensorGetDeviceName(device_index));\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_SensorType SDL_SensorGetDeviceType(int device_index);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SensorGetDeviceNonPortableType(int device_index);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern Int32 SDL_SensorGetDeviceInstanceID(int device_index);\n\n\t\t/* IntPtr refers to an SDL_Sensor* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_SensorOpen(int device_index);\n\n\t\t/* IntPtr refers to an SDL_Sensor* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_SensorFromInstanceID(\n\t\t\tInt32 instance_id\n\t\t);\n\n\t\t/* sensor refers to an SDL_Sensor* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_SensorGetName\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_SensorGetName(IntPtr sensor);\n\t\tpublic static string SDL_SensorGetName(IntPtr sensor)\n\t\t{\n\t\t\treturn UTF8_ToManaged(INTERNAL_SDL_SensorGetName(sensor));\n\t\t}\n\n\t\t/* sensor refers to an SDL_Sensor* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_SensorType SDL_SensorGetType(IntPtr sensor);\n\n\t\t/* sensor refers to an SDL_Sensor* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SensorGetNonPortableType(IntPtr sensor);\n\n\t\t/* sensor refers to an SDL_Sensor* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern Int32 SDL_SensorGetInstanceID(IntPtr sensor);\n\n\t\t/* sensor refers to an SDL_Sensor* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_SensorGetData(\n\t\t\tIntPtr sensor,\n\t\t\tfloat[] data,\n\t\t\tint num_values\n\t\t);\n\n\t\t/* sensor refers to an SDL_Sensor* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_SensorClose(IntPtr sensor);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_SensorUpdate();\n\n\t\t#endregion\n\n\t\t#region SDL_audio.h\n\n\t\tpublic const ushort SDL_AUDIO_MASK_BITSIZE =\t0xFF;\n\t\tpublic const ushort SDL_AUDIO_MASK_DATATYPE =\t(1 << 8);\n\t\tpublic const ushort SDL_AUDIO_MASK_ENDIAN =\t(1 << 12);\n\t\tpublic const ushort SDL_AUDIO_MASK_SIGNED =\t(1 << 15);\n\n\t\tpublic static ushort SDL_AUDIO_BITSIZE(ushort x)\n\t\t{\n\t\t\treturn (ushort) (x & SDL_AUDIO_MASK_BITSIZE);\n\t\t}\n\n\t\tpublic static bool SDL_AUDIO_ISFLOAT(ushort x)\n\t\t{\n\t\t\treturn (x & SDL_AUDIO_MASK_DATATYPE) != 0;\n\t\t}\n\n\t\tpublic static bool SDL_AUDIO_ISBIGENDIAN(ushort x)\n\t\t{\n\t\t\treturn (x & SDL_AUDIO_MASK_ENDIAN) != 0;\n\t\t}\n\n\t\tpublic static bool SDL_AUDIO_ISSIGNED(ushort x)\n\t\t{\n\t\t\treturn (x & SDL_AUDIO_MASK_SIGNED) != 0;\n\t\t}\n\n\t\tpublic static bool SDL_AUDIO_ISINT(ushort x)\n\t\t{\n\t\t\treturn (x & SDL_AUDIO_MASK_DATATYPE) == 0;\n\t\t}\n\n\t\tpublic static bool SDL_AUDIO_ISLITTLEENDIAN(ushort x)\n\t\t{\n\t\t\treturn (x & SDL_AUDIO_MASK_ENDIAN) == 0;\n\t\t}\n\n\t\tpublic static bool SDL_AUDIO_ISUNSIGNED(ushort x)\n\t\t{\n\t\t\treturn (x & SDL_AUDIO_MASK_SIGNED) == 0;\n\t\t}\n\n\t\tpublic const ushort AUDIO_U8 =\t\t0x0008;\n\t\tpublic const ushort AUDIO_S8 =\t\t0x8008;\n\t\tpublic const ushort AUDIO_U16LSB =\t0x0010;\n\t\tpublic const ushort AUDIO_S16LSB =\t0x8010;\n\t\tpublic const ushort AUDIO_U16MSB =\t0x1010;\n\t\tpublic const ushort AUDIO_S16MSB =\t0x9010;\n\t\tpublic const ushort AUDIO_U16 =\t\tAUDIO_U16LSB;\n\t\tpublic const ushort AUDIO_S16 =\t\tAUDIO_S16LSB;\n\t\tpublic const ushort AUDIO_S32LSB =\t0x8020;\n\t\tpublic const ushort AUDIO_S32MSB =\t0x9020;\n\t\tpublic const ushort AUDIO_S32 =\t\tAUDIO_S32LSB;\n\t\tpublic const ushort AUDIO_F32LSB =\t0x8120;\n\t\tpublic const ushort AUDIO_F32MSB =\t0x9120;\n\t\tpublic const ushort AUDIO_F32 =\t\tAUDIO_F32LSB;\n\n\t\tpublic static readonly ushort AUDIO_U16SYS =\n\t\t\tBitConverter.IsLittleEndian ? AUDIO_U16LSB : AUDIO_U16MSB;\n\t\tpublic static readonly ushort AUDIO_S16SYS =\n\t\t\tBitConverter.IsLittleEndian ? AUDIO_S16LSB : AUDIO_S16MSB;\n\t\tpublic static readonly ushort AUDIO_S32SYS =\n\t\t\tBitConverter.IsLittleEndian ? AUDIO_S32LSB : AUDIO_S32MSB;\n\t\tpublic static readonly ushort AUDIO_F32SYS =\n\t\t\tBitConverter.IsLittleEndian ? AUDIO_F32LSB : AUDIO_F32MSB;\n\n\t\tpublic const uint SDL_AUDIO_ALLOW_FREQUENCY_CHANGE =\t0x00000001;\n\t\tpublic const uint SDL_AUDIO_ALLOW_FORMAT_CHANGE =\t0x00000002;\n\t\tpublic const uint SDL_AUDIO_ALLOW_CHANNELS_CHANGE =\t0x00000004;\n\t\tpublic const uint SDL_AUDIO_ALLOW_SAMPLES_CHANGE =\t0x00000008;\n\t\tpublic const uint SDL_AUDIO_ALLOW_ANY_CHANGE = (\n\t\t\tSDL_AUDIO_ALLOW_FREQUENCY_CHANGE |\n\t\t\tSDL_AUDIO_ALLOW_FORMAT_CHANGE |\n\t\t\tSDL_AUDIO_ALLOW_CHANNELS_CHANGE |\n\t\t\tSDL_AUDIO_ALLOW_SAMPLES_CHANGE\n\t\t);\n\n\t\tpublic const int SDL_MIX_MAXVOLUME = 128;\n\n\t\tpublic enum SDL_AudioStatus\n\t\t{\n\t\t\tSDL_AUDIO_STOPPED,\n\t\t\tSDL_AUDIO_PLAYING,\n\t\t\tSDL_AUDIO_PAUSED\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_AudioSpec\n\t\t{\n\t\t\tpublic int freq;\n\t\t\tpublic ushort format; // SDL_AudioFormat\n\t\t\tpublic byte channels;\n\t\t\tpublic byte silence;\n\t\t\tpublic ushort samples;\n\t\t\tpublic uint size;\n\t\t\tpublic SDL_AudioCallback callback;\n\t\t\tpublic IntPtr userdata; // void*\n\t\t}\n\n\t\t/* userdata refers to a void*, stream to a Uint8 */\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate void SDL_AudioCallback(\n\t\t\tIntPtr userdata,\n\t\t\tIntPtr stream,\n\t\t\tint len\n\t\t);\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_AudioInit\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe int INTERNAL_SDL_AudioInit(\n\t\t\tbyte* driver_name\n\t\t);\n\t\tpublic static unsafe int SDL_AudioInit(string driver_name)\n\t\t{\n\t\t\tint utf8DriverNameBufSize = Utf8Size(driver_name);\n\t\t\tbyte* utf8DriverName = stackalloc byte[utf8DriverNameBufSize];\n\t\t\treturn INTERNAL_SDL_AudioInit(\n\t\t\t\tUtf8Encode(driver_name, utf8DriverName, utf8DriverNameBufSize)\n\t\t\t);\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_AudioQuit();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_CloseAudio();\n\n\t\t/* dev refers to an SDL_AudioDeviceID */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_CloseAudioDevice(uint dev);\n\n\t\t/* audio_buf refers to a malloc()'d buffer from SDL_LoadWAV */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_FreeWAV(IntPtr audio_buf);\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetAudioDeviceName\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GetAudioDeviceName(\n\t\t\tint index,\n\t\t\tint iscapture\n\t\t);\n\t\tpublic static string SDL_GetAudioDeviceName(\n\t\t\tint index,\n\t\t\tint iscapture\n\t\t) {\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_GetAudioDeviceName(index, iscapture)\n\t\t\t);\n\t\t}\n\n\t\t/* dev refers to an SDL_AudioDeviceID */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_AudioStatus SDL_GetAudioDeviceStatus(\n\t\t\tuint dev\n\t\t);\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetAudioDriver\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GetAudioDriver(int index);\n\t\tpublic static string SDL_GetAudioDriver(int index)\n\t\t{\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_GetAudioDriver(index)\n\t\t\t);\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_AudioStatus SDL_GetAudioStatus();\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetCurrentAudioDriver\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GetCurrentAudioDriver();\n\t\tpublic static string SDL_GetCurrentAudioDriver()\n\t\t{\n\t\t\treturn UTF8_ToManaged(INTERNAL_SDL_GetCurrentAudioDriver());\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetNumAudioDevices(int iscapture);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetNumAudioDrivers();\n\n\t\t/* audio_buf will refer to a malloc()'d byte buffer */\n\t\t/* THIS IS AN RWops FUNCTION! */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_LoadWAV_RW\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_LoadWAV_RW(\n\t\t\tIntPtr src,\n\t\t\tint freesrc,\n\t\t\tref SDL_AudioSpec spec,\n\t\t\tout IntPtr audio_buf,\n\t\t\tout uint audio_len\n\t\t);\n\t\tpublic static SDL_AudioSpec SDL_LoadWAV(\n\t\t\tstring file,\n\t\t\tref SDL_AudioSpec spec,\n\t\t\tout IntPtr audio_buf,\n\t\t\tout uint audio_len\n\t\t) {\n\t\t\tSDL_AudioSpec result;\n\t\t\tIntPtr rwops = SDL_RWFromFile(file, \"rb\");\n\t\t\tIntPtr result_ptr = INTERNAL_SDL_LoadWAV_RW(\n\t\t\t\trwops,\n\t\t\t\t1,\n\t\t\t\tref spec,\n\t\t\t\tout audio_buf,\n\t\t\t\tout audio_len\n\t\t\t);\n\t\t\tresult = (SDL_AudioSpec) Marshal.PtrToStructure(\n\t\t\t\tresult_ptr,\n\t\t\t\ttypeof(SDL_AudioSpec)\n\t\t\t);\n\t\t\treturn result;\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_LockAudio();\n\n\t\t/* dev refers to an SDL_AudioDeviceID */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_LockAudioDevice(uint dev);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_MixAudio(\n\t\t\t[Out()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 2)]\n\t\t\t\tbyte[] dst,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 2)]\n\t\t\t\tbyte[] src,\n\t\t\tuint len,\n\t\t\tint volume\n\t\t);\n\n\t\t/* format refers to an SDL_AudioFormat */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_MixAudioFormat(\n\t\t\t[Out()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 3)]\n\t\t\t\tbyte[] dst,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 3)]\n\t\t\t\tbyte[] src,\n\t\t\tushort format,\n\t\t\tuint len,\n\t\t\tint volume\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_OpenAudio(\n\t\t\tref SDL_AudioSpec desired,\n\t\t\tout SDL_AudioSpec obtained\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_OpenAudio(\n\t\t\tref SDL_AudioSpec desired,\n\t\t\tIntPtr obtained\n\t\t);\n\n\t\t/* uint refers to an SDL_AudioDeviceID */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_OpenAudioDevice\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe uint INTERNAL_SDL_OpenAudioDevice(\n\t\t\tbyte* device,\n\t\t\tint iscapture,\n\t\t\tref SDL_AudioSpec desired,\n\t\t\tout SDL_AudioSpec obtained,\n\t\t\tint allowed_changes\n\t\t);\n\t\tpublic static unsafe uint SDL_OpenAudioDevice(\n\t\t\tstring device,\n\t\t\tint iscapture,\n\t\t\tref SDL_AudioSpec desired,\n\t\t\tout SDL_AudioSpec obtained,\n\t\t\tint allowed_changes\n\t\t) {\n\t\t\tint utf8DeviceBufSize = Utf8Size(device);\n\t\t\tbyte* utf8Device = stackalloc byte[utf8DeviceBufSize];\n\t\t\treturn INTERNAL_SDL_OpenAudioDevice(\n\t\t\t\tUtf8Encode(device, utf8Device, utf8DeviceBufSize),\n\t\t\t\tiscapture,\n\t\t\t\tref desired,\n\t\t\t\tout obtained,\n\t\t\t\tallowed_changes\n\t\t\t);\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_PauseAudio(int pause_on);\n\n\t\t/* dev refers to an SDL_AudioDeviceID */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_PauseAudioDevice(\n\t\t\tuint dev,\n\t\t\tint pause_on\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_UnlockAudio();\n\n\t\t/* dev refers to an SDL_AudioDeviceID */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_UnlockAudioDevice(uint dev);\n\n\t\t/* dev refers to an SDL_AudioDeviceID, data to a void*\n\t\t * Only available in 2.0.4 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_QueueAudio(\n\t\t\tuint dev,\n\t\t\tIntPtr data,\n\t\t\tUInt32 len\n\t\t);\n\n\t\t/* dev refers to an SDL_AudioDeviceID, data to a void*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern uint SDL_DequeueAudio(\n\t\t\tuint dev,\n\t\t\tIntPtr data,\n\t\t\tuint len\n\t\t);\n\n\t\t/* dev refers to an SDL_AudioDeviceID\n\t\t * Only available in 2.0.4 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt32 SDL_GetQueuedAudioSize(uint dev);\n\n\t\t/* dev refers to an SDL_AudioDeviceID\n\t\t * Only available in 2.0.4 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_ClearQueuedAudio(uint dev);\n\n\t\t/* src_format and dst_format refer to SDL_AudioFormats.\n\t\t * IntPtr refers to an SDL_AudioStream*.\n\t\t * Only available in 2.0.7 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_NewAudioStream(\n\t\t\tushort src_format,\n\t\t\tbyte src_channels,\n\t\t\tint src_rate,\n\t\t\tushort dst_format,\n\t\t\tbyte dst_channels,\n\t\t\tint dst_rate\n\t\t);\n\n\t\t/* stream refers to an SDL_AudioStream*, buf to a void*.\n\t\t * Only available in 2.0.7 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_AudioStreamPut(\n\t\t\tIntPtr stream,\n\t\t\tIntPtr buf,\n\t\t\tint len\n\t\t);\n\n\t\t/* stream refers to an SDL_AudioStream*, buf to a void*.\n\t\t * Only available in 2.0.7 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_AudioStreamGet(\n\t\t\tIntPtr stream,\n\t\t\tIntPtr buf,\n\t\t\tint len\n\t\t);\n\n\t\t/* stream refers to an SDL_AudioStream*.\n\t\t * Only available in 2.0.7 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_AudioStreamAvailable(IntPtr stream);\n\n\t\t/* stream refers to an SDL_AudioStream*.\n\t\t * Only available in 2.0.7 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_AudioStreamClear(IntPtr stream);\n\n\t\t/* stream refers to an SDL_AudioStream*.\n\t\t * Only available in 2.0.7 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_FreeAudioStream(IntPtr stream);\n\n\t\t#endregion\n\n\t\t#region SDL_timer.h\n\n\t\t/* System timers rely on different OS mechanisms depending on\n\t\t * which operating system SDL2 is compiled against.\n\t\t */\n\n\t\t/* Compare tick values, return true if A has passed B. Introduced in SDL 2.0.1,\n\t\t * but does not require it (it was a macro).\n\t\t */\n\t\tpublic static bool SDL_TICKS_PASSED(UInt32 A, UInt32 B)\n\t\t{\n\t\t\treturn ((Int32)(B - A) <= 0);\n\t\t}\n\n\t\t/* Delays the thread's processing based on the milliseconds parameter */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_Delay(UInt32 ms);\n\n\t\t/* Returns the milliseconds that have passed since SDL was initialized */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt32 SDL_GetTicks();\n\n\t\t/* Get the current value of the high resolution counter */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt64 SDL_GetPerformanceCounter();\n\n\t\t/* Get the count per second of the high resolution counter */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern UInt64 SDL_GetPerformanceFrequency();\n\n\t\t/* param refers to a void* */\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate UInt32 SDL_TimerCallback(UInt32 interval, IntPtr param);\n\n\t\t/* int refers to an SDL_TimerID, param to a void* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_AddTimer(\n\t\t\tUInt32 interval,\n\t\t\tSDL_TimerCallback callback,\n\t\t\tIntPtr param\n\t\t);\n\n\t\t/* id refers to an SDL_TimerID */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_RemoveTimer(int id);\n\n\t\t#endregion\n\n\t\t#region SDL_system.h\n\n\t\t/* Windows */\n\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate IntPtr SDL_WindowsMessageHook(\n\t\t\tIntPtr userdata,\n\t\t\tIntPtr hWnd,\n\t\t\tuint message,\n\t\t\tulong wParam,\n\t\t\tlong lParam\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_SetWindowsMessageHook(\n\t\t\tSDL_WindowsMessageHook callback,\n\t\t\tIntPtr userdata\n\t\t);\n\n\t\t/* iOS */\n\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate void SDL_iPhoneAnimationCallback(IntPtr p);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_iPhoneSetAnimationCallback(\n\t\t\tIntPtr window, /* SDL_Window* */\n\t\t\tint interval,\n\t\t\tSDL_iPhoneAnimationCallback callback,\n\t\t\tIntPtr callbackParam\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_iPhoneSetEventPump(SDL_bool enabled);\n\n\t\t/* Android */\n\n\t\tpublic const int SDL_ANDROID_EXTERNAL_STORAGE_READ = 0x01;\n\t\tpublic const int SDL_ANDROID_EXTERNAL_STORAGE_WRITE = 0x02;\n\n\t\t/* IntPtr refers to a JNIEnv* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_AndroidGetJNIEnv();\n\n\t\t/* IntPtr refers to a jobject */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_AndroidGetActivity();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_IsAndroidTV();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_IsChromebook();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_IsDeXMode();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_AndroidBackButton();\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_AndroidGetInternalStoragePath\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_AndroidGetInternalStoragePath();\n\n\t\tpublic static string SDL_AndroidGetInternalStoragePath()\n\t\t{\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_AndroidGetInternalStoragePath()\n\t\t\t);\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_AndroidGetExternalStorageState();\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_AndroidGetExternalStoragePath\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_AndroidGetExternalStoragePath();\n\n\t\tpublic static string SDL_AndroidGetExternalStoragePath()\n\t\t{\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_AndroidGetExternalStoragePath()\n\t\t\t);\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetAndroidSDKVersion();\n\n\t\t/* WinRT */\n\n\t\tpublic enum SDL_WinRT_DeviceFamily\n\t\t{\n\t\t\tSDL_WINRT_DEVICEFAMILY_UNKNOWN,\n\t\t\tSDL_WINRT_DEVICEFAMILY_DESKTOP,\n\t\t\tSDL_WINRT_DEVICEFAMILY_MOBILE,\n\t\t\tSDL_WINRT_DEVICEFAMILY_XBOX\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_WinRT_DeviceFamily SDL_WinRTGetDeviceFamily();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_IsTablet();\n\n\t\t#endregion\n\n\t\t#region SDL_syswm.h\n\n\t\tpublic enum SDL_SYSWM_TYPE\n\t\t{\n\t\t\tSDL_SYSWM_UNKNOWN,\n\t\t\tSDL_SYSWM_WINDOWS,\n\t\t\tSDL_SYSWM_X11,\n\t\t\tSDL_SYSWM_DIRECTFB,\n\t\t\tSDL_SYSWM_COCOA,\n\t\t\tSDL_SYSWM_UIKIT,\n\t\t\tSDL_SYSWM_WAYLAND,\n\t\t\tSDL_SYSWM_MIR,\n\t\t\tSDL_SYSWM_WINRT,\n\t\t\tSDL_SYSWM_ANDROID,\n\t\t\tSDL_SYSWM_VIVANTE,\n\t\t\tSDL_SYSWM_OS2,\n\t\t\tSDL_SYSWM_HAIKU\n\t\t}\n\n\t\t// FIXME: I wish these weren't public...\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct INTERNAL_windows_wminfo\n\t\t{\n\t\t\tpublic IntPtr window; // Refers to an HWND\n\t\t\tpublic IntPtr hdc; // Refers to an HDC\n\t\t\tpublic IntPtr hinstance; // Refers to an HINSTANCE\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct INTERNAL_winrt_wminfo\n\t\t{\n\t\t\tpublic IntPtr window; // Refers to an IInspectable*\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct INTERNAL_x11_wminfo\n\t\t{\n\t\t\tpublic IntPtr display; // Refers to a Display*\n\t\t\tpublic IntPtr window; // Refers to a Window (XID, use ToInt64!)\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct INTERNAL_directfb_wminfo\n\t\t{\n\t\t\tpublic IntPtr dfb; // Refers to an IDirectFB*\n\t\t\tpublic IntPtr window; // Refers to an IDirectFBWindow*\n\t\t\tpublic IntPtr surface; // Refers to an IDirectFBSurface*\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct INTERNAL_cocoa_wminfo\n\t\t{\n\t\t\tpublic IntPtr window; // Refers to an NSWindow*\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct INTERNAL_uikit_wminfo\n\t\t{\n\t\t\tpublic IntPtr window; // Refers to a UIWindow*\n\t\t\tpublic uint framebuffer;\n\t\t\tpublic uint colorbuffer;\n\t\t\tpublic uint resolveFramebuffer;\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct INTERNAL_wayland_wminfo\n\t\t{\n\t\t\tpublic IntPtr display; // Refers to a wl_display*\n\t\t\tpublic IntPtr surface; // Refers to a wl_surface*\n\t\t\tpublic IntPtr shell_surface; // Refers to a wl_shell_surface*\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct INTERNAL_mir_wminfo\n\t\t{\n\t\t\tpublic IntPtr connection; // Refers to a MirConnection*\n\t\t\tpublic IntPtr surface; // Refers to a MirSurface*\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct INTERNAL_android_wminfo\n\t\t{\n\t\t\tpublic IntPtr window; // Refers to an ANativeWindow\n\t\t\tpublic IntPtr surface; // Refers to an EGLSurface\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct INTERNAL_vivante_wminfo\n\t\t{\n\t\t\tpublic IntPtr display; // Refers to an EGLNativeDisplayType\n\t\t\tpublic IntPtr window; // Refers to an EGLNativeWindowType\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Explicit)]\n\t\tpublic struct INTERNAL_SysWMDriverUnion\n\t\t{\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic INTERNAL_windows_wminfo win;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic INTERNAL_winrt_wminfo winrt;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic INTERNAL_x11_wminfo x11;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic INTERNAL_directfb_wminfo dfb;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic INTERNAL_cocoa_wminfo cocoa;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic INTERNAL_uikit_wminfo uikit;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic INTERNAL_wayland_wminfo wl;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic INTERNAL_mir_wminfo mir;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic INTERNAL_android_wminfo android;\n\t\t\t[FieldOffset(0)]\n\t\t\tpublic INTERNAL_vivante_wminfo vivante;\n\t\t\t// private int dummy;\n\t\t}\n\n\t\t[StructLayout(LayoutKind.Sequential)]\n\t\tpublic struct SDL_SysWMinfo\n\t\t{\n\t\t\tpublic SDL_version version;\n\t\t\tpublic SDL_SYSWM_TYPE subsystem;\n\t\t\tpublic INTERNAL_SysWMDriverUnion info;\n\t\t}\n\n\t\t/* window refers to an SDL_Window* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_GetWindowWMInfo(\n\t\t\tIntPtr window,\n\t\t\tref SDL_SysWMinfo info\n\t\t);\n\n\t\t#endregion\n\n\t\t#region SDL_filesystem.h\n\n\t\t/* Only available in 2.0.1 or higher. */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetBasePath\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_SDL_GetBasePath();\n\t\tpublic static string SDL_GetBasePath()\n\t\t{\n\t\t\treturn UTF8_ToManaged(INTERNAL_SDL_GetBasePath(), true);\n\t\t}\n\n\t\t/* Only available in 2.0.1 or higher. */\n\t\t[DllImport(nativeLibName, EntryPoint = \"SDL_GetPrefPath\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe IntPtr INTERNAL_SDL_GetPrefPath(\n\t\t\tbyte* org,\n\t\t\tbyte* app\n\t\t);\n\t\tpublic static unsafe string SDL_GetPrefPath(string org, string app)\n\t\t{\n\t\t\tint utf8OrgBufSize = Utf8SizeNullable(org);\n\t\t\tbyte* utf8Org = stackalloc byte[utf8OrgBufSize];\n\n\t\t\tint utf8AppBufSize = Utf8SizeNullable(app);\n\t\t\tbyte* utf8App = stackalloc byte[utf8AppBufSize];\n\n\t\t\treturn UTF8_ToManaged(\n\t\t\t\tINTERNAL_SDL_GetPrefPath(\n\t\t\t\t\tUtf8EncodeNullable(org, utf8Org, utf8OrgBufSize),\n\t\t\t\t\tUtf8EncodeNullable(app, utf8App, utf8AppBufSize)\n\t\t\t\t),\n\t\t\t\ttrue\n\t\t\t);\n\t\t}\n\n\t\t#endregion\n\n\t\t#region SDL_power.h\n\n\t\tpublic enum SDL_PowerState\n\t\t{\n\t\t\tSDL_POWERSTATE_UNKNOWN = 0,\n\t\t\tSDL_POWERSTATE_ON_BATTERY,\n\t\t\tSDL_POWERSTATE_NO_BATTERY,\n\t\t\tSDL_POWERSTATE_CHARGING,\n\t\t\tSDL_POWERSTATE_CHARGED\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_PowerState SDL_GetPowerInfo(\n\t\t\tout int secs,\n\t\t\tout int pct\n\t\t);\n\n\t\t#endregion\n\n\t\t#region SDL_cpuinfo.h\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetCPUCount();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetCPUCacheLineSize();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasRDTSC();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasAltiVec();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasMMX();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_Has3DNow();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasSSE();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasSSE2();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasSSE3();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasSSE41();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasSSE42();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasAVX();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasAVX2();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasAVX512F();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern SDL_bool SDL_HasNEON();\n\n\t\t/* Only available in 2.0.1 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetSystemRAM();\n\n\t\t/* Only available in SDL 2.0.10 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern uint SDL_SIMDGetAlignment();\n\n\t\t/* Only available in SDL 2.0.10 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr SDL_SIMDAlloc(uint len);\n\n\t\t/* Only available in SDL 2.0.10 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_SIMDFree(IntPtr ptr);\n\n\t\t/* Only available in SDL 2.0.11 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void SDL_HasARMSIMD();\n\n\t\t#endregion\n\t}\n}\n"
  },
  {
    "path": "Engine/SDL2/SDL2_image.cs",
    "content": "#region License\n/* SDL2# - C# Wrapper for SDL2\n *\n * Copyright (c) 2013-2020 Ethan Lee.\n *\n * This software is provided 'as-is', without any express or implied warranty.\n * In no event will the authors be held liable for any damages arising from\n * the use of this software.\n *\n * Permission is granted to anyone to use this software for any purpose,\n * including commercial applications, and to alter it and redistribute it\n * freely, subject to the following restrictions:\n *\n * 1. The origin of this software must not be misrepresented; you must not\n * claim that you wrote the original software. If you use this software in a\n * product, an acknowledgment in the product documentation would be\n * appreciated but is not required.\n *\n * 2. Altered source versions must be plainly marked as such, and must not be\n * misrepresented as being the original software.\n *\n * 3. This notice may not be removed or altered from any source distribution.\n *\n * Ethan \"flibitijibibo\" Lee <flibitijibibo@flibitijibibo.com>\n *\n */\n#endregion\n\n#region Using Statements\nusing System;\nusing System.Runtime.InteropServices;\n#endregion\n\nnamespace SDL2\n{\n\tpublic static class SDL_image\n\t{\n\t\t#region SDL2# Variables\n\n\t\t/* Used by DllImport to load the native library. */\n\t\tprivate const string nativeLibName = \"SDL2_image\";\n\n\t\t#endregion\n\n\t\t#region SDL_image.h\n\n\t\t/* Similar to the headers, this is the version we're expecting to be\n\t\t * running with. You will likely want to check this somewhere in your\n\t\t * program!\n\t\t */\n\t\tpublic const int SDL_IMAGE_MAJOR_VERSION =\t2;\n\t\tpublic const int SDL_IMAGE_MINOR_VERSION =\t0;\n\t\tpublic const int SDL_IMAGE_PATCHLEVEL =\t\t6;\n\n\t\t[Flags]\n\t\tpublic enum IMG_InitFlags\n\t\t{\n\t\t\tIMG_INIT_JPG =\t0x00000001,\n\t\t\tIMG_INIT_PNG =\t0x00000002,\n\t\t\tIMG_INIT_TIF =\t0x00000004,\n\t\t\tIMG_INIT_WEBP =\t0x00000008\n\t\t}\n\n\t\tpublic static void SDL_IMAGE_VERSION(out SDL.SDL_version X)\n\t\t{\n\t\t\tX.major = SDL_IMAGE_MAJOR_VERSION;\n\t\t\tX.minor = SDL_IMAGE_MINOR_VERSION;\n\t\t\tX.patch = SDL_IMAGE_PATCHLEVEL;\n\t\t}\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"IMG_Linked_Version\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_IMG_Linked_Version();\n\t\tpublic static SDL.SDL_version IMG_Linked_Version()\n\t\t{\n\t\t\tSDL.SDL_version result;\n\t\t\tIntPtr result_ptr = INTERNAL_IMG_Linked_Version();\n\t\t\tresult = (SDL.SDL_version) Marshal.PtrToStructure(\n\t\t\t\tresult_ptr,\n\t\t\t\ttypeof(SDL.SDL_version)\n\t\t\t);\n\t\t\treturn result;\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int IMG_Init(IMG_InitFlags flags);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void IMG_Quit();\n\n\t\t/* IntPtr refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"IMG_Load\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe IntPtr INTERNAL_IMG_Load(\n\t\t\tbyte* file\n\t\t);\n\t\tpublic static unsafe IntPtr IMG_Load(string file)\n\t\t{\n\t\t\tbyte* utf8File = SDL.Utf8Encode(file);\n\t\t\tIntPtr handle = INTERNAL_IMG_Load(\n\t\t\t\tutf8File\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8File);\n\t\t\treturn handle;\n\t\t}\n\n\t\t/* src refers to an SDL_RWops*, IntPtr to an SDL_Surface* */\n\t\t/* THIS IS A PUBLIC RWops FUNCTION! */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr IMG_Load_RW(\n\t\t\tIntPtr src,\n\t\t\tint freesrc\n\t\t);\n\n\t\t/* src refers to an SDL_RWops*, IntPtr to an SDL_Surface* */\n\t\t/* THIS IS A PUBLIC RWops FUNCTION! */\n\t\t[DllImport(nativeLibName, EntryPoint = \"IMG_LoadTyped_RW\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe IntPtr INTERNAL_IMG_LoadTyped_RW(\n\t\t\tIntPtr src,\n\t\t\tint freesrc,\n\t\t\tbyte* type\n\t\t);\n\t\tpublic static unsafe IntPtr IMG_LoadTyped_RW(\n\t\t\tIntPtr src,\n\t\t\tint freesrc,\n\t\t\tstring type\n\t\t) {\n\t\t\tint utf8TypeBufSize = SDL.Utf8Size(type);\n\t\t\tbyte* utf8Type = stackalloc byte[utf8TypeBufSize];\n\t\t\treturn INTERNAL_IMG_LoadTyped_RW(\n\t\t\t\tsrc,\n\t\t\t\tfreesrc,\n\t\t\t\tSDL.Utf8Encode(type, utf8Type, utf8TypeBufSize)\n\t\t\t);\n\t\t}\n\n\t\t/* IntPtr refers to an SDL_Texture*, renderer to an SDL_Renderer* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"IMG_LoadTexture\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe IntPtr INTERNAL_IMG_LoadTexture(\n\t\t\tIntPtr renderer,\n\t\t\tbyte* file\n\t\t);\n\t\tpublic static unsafe IntPtr IMG_LoadTexture(\n\t\t\tIntPtr renderer,\n\t\t\tstring file\n\t\t) {\n\t\t\tbyte* utf8File = SDL.Utf8Encode(file);\n\t\t\tIntPtr handle = INTERNAL_IMG_LoadTexture(\n\t\t\t\trenderer,\n\t\t\t\tutf8File\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8File);\n\t\t\treturn handle;\n\t\t}\n\n\t\t/* renderer refers to an SDL_Renderer*.\n\t\t * src refers to an SDL_RWops*.\n\t\t * IntPtr to an SDL_Texture*.\n\t\t */\n\t\t/* THIS IS A PUBLIC RWops FUNCTION! */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr IMG_LoadTexture_RW(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr src,\n\t\t\tint freesrc\n\t\t);\n\n\t\t/* renderer refers to an SDL_Renderer*.\n\t\t * src refers to an SDL_RWops*.\n\t\t * IntPtr to an SDL_Texture*.\n\t\t */\n\t\t/* THIS IS A PUBLIC RWops FUNCTION! */\n\t\t[DllImport(nativeLibName, EntryPoint = \"IMG_LoadTextureTyped_RW\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe IntPtr INTERNAL_IMG_LoadTextureTyped_RW(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr src,\n\t\t\tint freesrc,\n\t\t\tbyte* type\n\t\t);\n\t\tpublic static unsafe IntPtr IMG_LoadTextureTyped_RW(\n\t\t\tIntPtr renderer,\n\t\t\tIntPtr src,\n\t\t\tint freesrc,\n\t\t\tstring type\n\t\t) {\n\t\t\tbyte* utf8Type = SDL.Utf8Encode(type);\n\t\t\tIntPtr handle = INTERNAL_IMG_LoadTextureTyped_RW(\n\t\t\t\trenderer,\n\t\t\t\tsrc,\n\t\t\t\tfreesrc,\n\t\t\t\tutf8Type\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8Type);\n\t\t\treturn handle;\n\t\t}\n\n\t\t/* IntPtr refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr IMG_ReadXPMFromArray(\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)]\n\t\t\t\tstring[] xpm\n\t\t);\n\n\t\t/* surface refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"IMG_SavePNG\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe int INTERNAL_IMG_SavePNG(\n\t\t\tIntPtr surface,\n\t\t\tbyte* file\n\t\t);\n\t\tpublic static unsafe int IMG_SavePNG(IntPtr surface, string file)\n\t\t{\n\t\t\tbyte* utf8File = SDL.Utf8Encode(file);\n\t\t\tint result = INTERNAL_IMG_SavePNG(\n\t\t\t\tsurface,\n\t\t\t\tutf8File\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8File);\n\t\t\treturn result;\n\t\t}\n\n\t\t/* surface refers to an SDL_Surface*, dst to an SDL_RWops* */\n\t\t/* THIS IS A PUBLIC RWops FUNCTION! */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int IMG_SavePNG_RW(\n\t\t\tIntPtr surface,\n\t\t\tIntPtr dst,\n\t\t\tint freedst\n\t\t);\n\n\t\t/* surface refers to an SDL_Surface* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"IMG_SaveJPG\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe int INTERNAL_IMG_SaveJPG(\n\t\t\tIntPtr surface,\n\t\t\tbyte* file,\n\t\t\tint quality\n\t\t);\n\t\tpublic static unsafe int IMG_SaveJPG(IntPtr surface, string file, int quality)\n\t\t{\n\t\t\tbyte* utf8File = SDL.Utf8Encode(file);\n\t\t\tint result = INTERNAL_IMG_SaveJPG(\n\t\t\t\tsurface,\n\t\t\t\tutf8File,\n\t\t\t\tquality\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8File);\n\t\t\treturn result;\n\t\t}\n\n\t\t/* surface refers to an SDL_Surface*, dst to an SDL_RWops* */\n\t\t/* THIS IS A PUBLIC RWops FUNCTION! */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int IMG_SaveJPG_RW(\n\t\t\tIntPtr surface,\n\t\t\tIntPtr dst,\n\t\t\tint freedst,\n\t\t\tint quality\n\t\t);\n\n\t\tpublic static string IMG_GetError()\n\t\t{\n\t\t\treturn SDL.SDL_GetError();\n\t\t}\n\n\t\tpublic static void IMG_SetError(string fmtAndArglist)\n\t\t{\n\t\t\tSDL.SDL_SetError(fmtAndArglist);\n\t\t}\n\n\t\t#region Animated Image Support\n\n\t\t/* This region is only available in 2.0.6 or higher. */\n\n\t\tpublic struct IMG_Animation\n\t\t{\n\t\t\tpublic int w;\n\t\t\tpublic int h;\n\t\t\tpublic IntPtr frames; /* SDL_Surface** */\n\t\t\tpublic IntPtr delays; /* int* */\n\t\t}\n\n\t\t/* IntPtr refers to an IMG_Animation* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr IMG_LoadAnimation(\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPStr)]\n\t\t\t\tstring file\n\t\t);\n\n\t\t/* IntPtr refers to an IMG_Animation*, src to an SDL_RWops* */\n\t\t/* THIS IS A PUBLIC RWops FUNCTION! */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr IMG_LoadAnimation_RW(\n\t\t\tIntPtr src,\n\t\t\tint freesrc\n\t\t);\n\n\t\t/* IntPtr refers to an IMG_Animation*, src to an SDL_RWops* */\n\t\t/* THIS IS A PUBLIC RWops FUNCTION! */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr IMG_LoadAnimationTyped_RW(\n\t\t\tIntPtr src,\n\t\t\tint freesrc,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPStr)]\n\t\t\t\tstring type\n\t\t);\n\n\t\t/* anim refers to an IMG_Animation* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void IMG_FreeAnimation(IntPtr anim);\n\n\t\t/* IntPtr refers to an IMG_Animation*, src to an SDL_RWops* */\n\t\t/* THIS IS A PUBLIC RWops FUNCTION! */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr IMG_LoadGIFAnimation_RW(IntPtr src);\n\n\t\t#endregion\n\n\t\t#endregion\n\t}\n}\n"
  },
  {
    "path": "Engine/SDL2/SDL2_mixer.cs",
    "content": "#region License\n/* SDL2# - C# Wrapper for SDL2\n *\n * Copyright (c) 2013-2020 Ethan Lee.\n *\n * This software is provided 'as-is', without any express or implied warranty.\n * In no event will the authors be held liable for any damages arising from\n * the use of this software.\n *\n * Permission is granted to anyone to use this software for any purpose,\n * including commercial applications, and to alter it and redistribute it\n * freely, subject to the following restrictions:\n *\n * 1. The origin of this software must not be misrepresented; you must not\n * claim that you wrote the original software. If you use this software in a\n * product, an acknowledgment in the product documentation would be\n * appreciated but is not required.\n *\n * 2. Altered source versions must be plainly marked as such, and must not be\n * misrepresented as being the original software.\n *\n * 3. This notice may not be removed or altered from any source distribution.\n *\n * Ethan \"flibitijibibo\" Lee <flibitijibibo@flibitijibibo.com>\n *\n */\n#endregion\n\n#region Using Statements\nusing System;\nusing System.Runtime.InteropServices;\n#endregion\n\nnamespace SDL2\n{\n\tpublic static class SDL_mixer\n\t{\n\t\t#region SDL2# Variables\n\n\t\t/* Used by DllImport to load the native library. */\n\t\tprivate const string nativeLibName = \"SDL2_mixer\";\n\n\t\t#endregion\n\n\t\t#region SDL_mixer.h\n\n\t\t/* Similar to the headers, this is the version we're expecting to be\n\t\t * running with. You will likely want to check this somewhere in your\n\t\t * program!\n\t\t */\n\t\tpublic const int SDL_MIXER_MAJOR_VERSION =\t2;\n\t\tpublic const int SDL_MIXER_MINOR_VERSION =\t0;\n\t\tpublic const int SDL_MIXER_PATCHLEVEL =\t\t5;\n\n\t\t/* In C, you can redefine this value before including SDL_mixer.h.\n\t\t * We're not going to allow this in SDL2#, since the value of this\n\t\t * variable is persistent and not dependent on preprocessor ordering.\n\t\t */\n\t\tpublic const int MIX_CHANNELS = 8;\n\n\t\tpublic static readonly int MIX_DEFAULT_FREQUENCY = 44100;\n\t\tpublic static readonly ushort MIX_DEFAULT_FORMAT =\n\t\t\tBitConverter.IsLittleEndian ? SDL.AUDIO_S16LSB : SDL.AUDIO_S16MSB;\n\t\tpublic static readonly int MIX_DEFAULT_CHANNELS = 2;\n\t\tpublic static readonly byte MIX_MAX_VOLUME = 128;\n\n\t\t[Flags]\n\t\tpublic enum MIX_InitFlags\n\t\t{\n\t\t\tMIX_INIT_FLAC =\t\t0x00000001,\n\t\t\tMIX_INIT_MOD =\t\t0x00000002,\n\t\t\tMIX_INIT_MP3 =\t\t0x00000008,\n\t\t\tMIX_INIT_OGG =\t\t0x00000010,\n\t\t\tMIX_INIT_MID =\t\t0x00000020,\n\t\t\tMIX_INIT_OPUS =\t\t0x00000040\n\t\t}\n\n\t\tpublic struct MIX_Chunk\n\t\t{\n\t\t\tpublic int allocated;\n\t\t\tpublic IntPtr abuf; /* Uint8* */\n\t\t\tpublic uint alen;\n\t\t\tpublic byte volume;\n\t\t}\n\n\t\tpublic enum Mix_Fading\n\t\t{\n\t\t\tMIX_NO_FADING,\n\t\t\tMIX_FADING_OUT,\n\t\t\tMIX_FADING_IN\n\t\t}\n\n\t\tpublic enum Mix_MusicType\n\t\t{\n\t\t\tMUS_NONE,\n\t\t\tMUS_CMD,\n\t\t\tMUS_WAV,\n\t\t\tMUS_MOD,\n\t\t\tMUS_MID,\n\t\t\tMUS_OGG,\n\t\t\tMUS_MP3,\n\t\t\tMUS_MP3_MAD_UNUSED,\n\t\t\tMUS_FLAC,\n\t\t\tMUS_MODPLUG_UNUSED,\n\t\t\tMUS_OPUS\n\t\t}\n\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate void MixFuncDelegate(\n\t\t\tIntPtr udata, // void*\n\t\t\tIntPtr stream, // Uint8*\n\t\t\tint len\n\t\t);\n\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate void Mix_EffectFunc_t(\n\t\t\tint chan,\n\t\t\tIntPtr stream, // void*\n\t\t\tint len,\n\t\t\tIntPtr udata // void*\n\t\t);\n\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate void Mix_EffectDone_t(\n\t\t\tint chan,\n\t\t\tIntPtr udata // void*\n\t\t);\n\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate void MusicFinishedDelegate();\n\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate void ChannelFinishedDelegate(int channel);\n\n\t\t[UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n\t\tpublic delegate int SoundFontDelegate(\n\t\t\tIntPtr a, // const char*\n\t\t\tIntPtr b // void*\n\t\t);\n\n\t\tpublic static void SDL_MIXER_VERSION(out SDL.SDL_version X)\n\t\t{\n\t\t\tX.major = SDL_MIXER_MAJOR_VERSION;\n\t\t\tX.minor = SDL_MIXER_MINOR_VERSION;\n\t\t\tX.patch = SDL_MIXER_PATCHLEVEL;\n\t\t}\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"MIX_Linked_Version\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_MIX_Linked_Version();\n\t\tpublic static SDL.SDL_version MIX_Linked_Version()\n\t\t{\n\t\t\tSDL.SDL_version result;\n\t\t\tIntPtr result_ptr = INTERNAL_MIX_Linked_Version();\n\t\t\tresult = (SDL.SDL_version) Marshal.PtrToStructure(\n\t\t\t\tresult_ptr,\n\t\t\t\ttypeof(SDL.SDL_version)\n\t\t\t);\n\t\t\treturn result;\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_Init(MIX_InitFlags flags);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void Mix_Quit();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_OpenAudio(\n\t\t\tint frequency,\n\t\t\tushort format,\n\t\t\tint channels,\n\t\t\tint chunksize\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_AllocateChannels(int numchans);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_QuerySpec(\n\t\t\tout int frequency,\n\t\t\tout ushort format,\n\t\t\tout int channels\n\t\t);\n\n\t\t/* src refers to an SDL_RWops*, IntPtr to a Mix_Chunk* */\n\t\t/* THIS IS A PUBLIC RWops FUNCTION! */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr Mix_LoadWAV_RW(\n\t\t\tIntPtr src,\n\t\t\tint freesrc\n\t\t);\n\t\t\n\t\t/* IntPtr refers to a Mix_Chunk* */\n\t\t/* This is an RWops macro in the C header. */\n\t\tpublic static IntPtr Mix_LoadWAV(string file)\n\t\t{\n\t\t\tIntPtr rwops = SDL.SDL_RWFromFile(file, \"rb\");\n\t\t\treturn Mix_LoadWAV_RW(rwops, 1);\n\t\t}\n\n\t\t/* IntPtr refers to a Mix_Music* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"Mix_LoadMUS\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe IntPtr INTERNAL_Mix_LoadMUS(\n\t\t\tbyte* file\n\t\t);\n\t\tpublic static unsafe IntPtr Mix_LoadMUS(string file)\n\t\t{\n\t\t\tbyte* utf8File = SDL.Utf8Encode(file);\n\t\t\tIntPtr handle = INTERNAL_Mix_LoadMUS(\n\t\t\t\tutf8File\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8File);\n\t\t\treturn handle;\n\t\t}\n\n\t\t/* IntPtr refers to a Mix_Chunk* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr Mix_QuickLoad_WAV(\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1)]\n\t\t\t\tbyte[] mem\n\t\t);\n\n\t\t/* IntPtr refers to a Mix_Chunk* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr Mix_QuickLoad_RAW(\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 1)]\n\t\t\t\tbyte[] mem,\n\t\t\tuint len\n\t\t);\n\n\t\t/* chunk refers to a Mix_Chunk* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void Mix_FreeChunk(IntPtr chunk);\n\n\t\t/* music refers to a Mix_Music* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void Mix_FreeMusic(IntPtr music);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_GetNumChunkDecoders();\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"Mix_GetChunkDecoder\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_Mix_GetChunkDecoder(int index);\n\t\tpublic static string Mix_GetChunkDecoder(int index)\n\t\t{\n\t\t\treturn SDL.UTF8_ToManaged(\n\t\t\t\tINTERNAL_Mix_GetChunkDecoder(index)\n\t\t\t);\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_GetNumMusicDecoders();\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"Mix_GetMusicDecoder\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_Mix_GetMusicDecoder(int index);\n\t\tpublic static string Mix_GetMusicDecoder(int index)\n\t\t{\n\t\t\treturn SDL.UTF8_ToManaged(\n\t\t\t\tINTERNAL_Mix_GetMusicDecoder(index)\n\t\t\t);\n\t\t}\n\n\t\t/* music refers to a Mix_Music* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern Mix_MusicType Mix_GetMusicType(IntPtr music);\n\n\t\t/* music refers to a Mix_Music*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, EntryPoint = \"Mix_GetMusicTitle\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr INTERNAL_Mix_GetMusicTitle(IntPtr music);\n\t\tpublic static string Mix_GetMusicTitle(IntPtr music)\n\t\t{\n\t\t\treturn SDL.UTF8_ToManaged(\n\t\t\t\tINTERNAL_Mix_GetMusicTitle(music)\n\t\t\t);\n\t\t}\n\n\t\t/* music refers to a Mix_Music*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, EntryPoint = \"Mix_GetMusicTitleTag\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr INTERNAL_Mix_GetMusicTitleTag(IntPtr music);\n\t\tpublic static string Mix_GetMusicTitleTag(IntPtr music)\n\t\t{\n\t\t\treturn SDL.UTF8_ToManaged(\n\t\t\t\tINTERNAL_Mix_GetMusicTitleTag(music)\n\t\t\t);\n\t\t}\n\n\t\t/* music refers to a Mix_Music*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, EntryPoint = \"Mix_GetMusicArtistTag\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr INTERNAL_Mix_GetMusicArtistTag(IntPtr music);\n\t\tpublic static string Mix_GetMusicArtistTag(IntPtr music)\n\t\t{\n\t\t\treturn SDL.UTF8_ToManaged(\n\t\t\t\tINTERNAL_Mix_GetMusicArtistTag(music)\n\t\t\t);\n\t\t}\n\n\t\t/* music refers to a Mix_Music*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, EntryPoint = \"Mix_GetMusicAlbumTag\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr INTERNAL_Mix_GetMusicAlbumTag(IntPtr music);\n\t\tpublic static string Mix_GetMusicAlbumTag(IntPtr music)\n\t\t{\n\t\t\treturn SDL.UTF8_ToManaged(\n\t\t\t\tINTERNAL_Mix_GetMusicAlbumTag(music)\n\t\t\t);\n\t\t}\n\n\t\t/* music refers to a Mix_Music*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, EntryPoint = \"Mix_GetMusicCopyrightTag\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr INTERNAL_Mix_GetMusicCopyrightTag(IntPtr music);\n\t\tpublic static string Mix_GetMusicCopyrightTag(IntPtr music)\n\t\t{\n\t\t\treturn SDL.UTF8_ToManaged(\n\t\t\t\tINTERNAL_Mix_GetMusicCopyrightTag(music)\n\t\t\t);\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void Mix_SetPostMix(\n\t\t\tMixFuncDelegate mix_func,\n\t\t\tIntPtr arg // void*\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void Mix_HookMusic(\n\t\t\tMixFuncDelegate mix_func,\n\t\t\tIntPtr arg // void*\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void Mix_HookMusicFinished(\n\t\t\tMusicFinishedDelegate music_finished\n\t\t);\n\n\t\t/* IntPtr refers to a void* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr Mix_GetMusicHookData();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void Mix_ChannelFinished(\n\t\t\tChannelFinishedDelegate channel_finished\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_RegisterEffect(\n\t\t\tint chan,\n\t\t\tMix_EffectFunc_t f,\n\t\t\tMix_EffectDone_t d,\n\t\t\tIntPtr arg // void*\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_UnregisterEffect(\n\t\t\tint channel,\n\t\t\tMix_EffectFunc_t f\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_UnregisterAllEffects(int channel);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_SetPanning(\n\t\t\tint channel,\n\t\t\tbyte left,\n\t\t\tbyte right\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_SetPosition(\n\t\t\tint channel,\n\t\t\tshort angle,\n\t\t\tbyte distance\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_SetDistance(int channel, byte distance);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_SetReverseStereo(int channel, int flip);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_ReserveChannels(int num);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_GroupChannel(int which, int tag);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_GroupChannels(int from, int to, int tag);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_GroupAvailable(int tag);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_GroupCount(int tag);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_GroupOldest(int tag);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_GroupNewer(int tag);\n\n\t\t/* chunk refers to a Mix_Chunk* */\n\t\tpublic static int Mix_PlayChannel(\n\t\t\tint channel,\n\t\t\tIntPtr chunk,\n\t\t\tint loops\n\t\t) {\n\t\t\treturn Mix_PlayChannelTimed(channel, chunk, loops, -1);\n\t\t}\n\n\t\t/* chunk refers to a Mix_Chunk* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_PlayChannelTimed(\n\t\t\tint channel,\n\t\t\tIntPtr chunk,\n\t\t\tint loops,\n\t\t\tint ticks\n\t\t);\n\n\t\t/* music refers to a Mix_Music* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_PlayMusic(IntPtr music, int loops);\n\n\t\t/* music refers to a Mix_Music* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_FadeInMusic(\n\t\t\tIntPtr music,\n\t\t\tint loops,\n\t\t\tint ms\n\t\t);\n\n\t\t/* music refers to a Mix_Music* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_FadeInMusicPos(\n\t\t\tIntPtr music,\n\t\t\tint loops,\n\t\t\tint ms,\n\t\t\tdouble position\n\t\t);\n\n\t\t/* chunk refers to a Mix_Chunk* */\n\t\tpublic static int Mix_FadeInChannel(\n\t\t\tint channel,\n\t\t\tIntPtr chunk,\n\t\t\tint loops,\n\t\t\tint ms\n\t\t) {\n\t\t\treturn Mix_FadeInChannelTimed(channel, chunk, loops, ms, -1);\n\t\t}\n\n\t\t/* chunk refers to a Mix_Chunk* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_FadeInChannelTimed(\n\t\t\tint channel,\n\t\t\tIntPtr chunk,\n\t\t\tint loops,\n\t\t\tint ms,\n\t\t\tint ticks\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_Volume(int channel, int volume);\n\n\t\t/* chunk refers to a Mix_Chunk* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_VolumeChunk(\n\t\t\tIntPtr chunk,\n\t\t\tint volume\n\t\t);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_VolumeMusic(int volume);\n\n\t\t/* music refers to a Mix_Music*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_GetVolumeMusicStream(IntPtr music);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_HaltChannel(int channel);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_HaltGroup(int tag);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_HaltMusic();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_ExpireChannel(int channel, int ticks);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_FadeOutChannel(int which, int ms);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_FadeOutGroup(int tag, int ms);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_FadeOutMusic(int ms);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern Mix_Fading Mix_FadingMusic();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern Mix_Fading Mix_FadingChannel(int which);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void Mix_Pause(int channel);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void Mix_Resume(int channel);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_Paused(int channel);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void Mix_PauseMusic();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void Mix_ResumeMusic();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void Mix_RewindMusic();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_PausedMusic();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_SetMusicPosition(double position);\n\n\t\t/* music refers to a Mix_Music*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern double Mix_GetMusicPosition(IntPtr music);\n\n\t\t/* music refers to a Mix_Music*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern double Mix_MusicDuration(IntPtr music);\n\n\t\t/* music refers to a Mix_Music*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern double Mix_GetMusicLoopStartTime(IntPtr music);\n\n\t\t/* music refers to a Mix_Music*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern double Mix_GetMusicLoopEndTime(IntPtr music);\n\n\t\t/* music refers to a Mix_Music*\n\t\t * Only available in 2.0.5 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern double Mix_GetMusicLoopLengthTime(IntPtr music);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_Playing(int channel);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_PlayingMusic();\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"Mix_SetMusicCMD\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe int INTERNAL_Mix_SetMusicCMD(\n\t\t\tbyte* command\n\t\t);\n\t\tpublic static unsafe int Mix_SetMusicCMD(string command)\n\t\t{\n\t\t\tbyte* utf8Cmd = SDL.Utf8Encode(command);\n\t\t\tint result = INTERNAL_Mix_SetMusicCMD(\n\t\t\t\tutf8Cmd\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8Cmd);\n\t\t\treturn result;\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_SetSynchroValue(int value);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_GetSynchroValue();\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"Mix_SetSoundFonts\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe int INTERNAL_Mix_SetSoundFonts(\n\t\t\tbyte* paths\n\t\t);\n\t\tpublic static unsafe int Mix_SetSoundFonts(string paths)\n\t\t{\n\t\t\tbyte* utf8Paths = SDL.Utf8Encode(paths);\n\t\t\tint result = INTERNAL_Mix_SetSoundFonts(\n\t\t\t\tutf8Paths\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8Paths);\n\t\t\treturn result;\n\t\t}\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"Mix_GetSoundFonts\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_Mix_GetSoundFonts();\n\t\tpublic static string Mix_GetSoundFonts()\n\t\t{\n\t\t\treturn SDL.UTF8_ToManaged(\n\t\t\t\tINTERNAL_Mix_GetSoundFonts()\n\t\t\t);\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_EachSoundFont(\n\t\t\tSoundFontDelegate function,\n\t\t\tIntPtr data // void*\n\t\t);\n\n\t\t/* Only available in 2.0.5 or later. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int Mix_SetTimidityCfg(\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPStr)]\n\t\t\t\tstring path\n\t\t);\n\n\t\t/* Only available in 2.0.5 or later. */\n\t\t[DllImport(nativeLibName, EntryPoint = \"Mix_GetTimidityCfg\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr INTERNAL_Mix_GetTimidityCfg();\n\t\tpublic static string Mix_GetTimidityCfg()\n\t\t{\n\t\t\treturn SDL.UTF8_ToManaged(\n\t\t\t\tINTERNAL_Mix_GetTimidityCfg()\n\t\t\t);\n\t\t}\n\n\t\t/* IntPtr refers to a Mix_Chunk* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr Mix_GetChunk(int channel);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void Mix_CloseAudio();\n\n\t\t#endregion\n\t}\n}\n"
  },
  {
    "path": "Engine/SDL2/SDL2_ttf.cs",
    "content": "#region License\n/* SDL2# - C# Wrapper for SDL2\n *\n * Copyright (c) 2013-2020 Ethan Lee.\n *\n * This software is provided 'as-is', without any express or implied warranty.\n * In no event will the authors be held liable for any damages arising from\n * the use of this software.\n *\n * Permission is granted to anyone to use this software for any purpose,\n * including commercial applications, and to alter it and redistribute it\n * freely, subject to the following restrictions:\n *\n * 1. The origin of this software must not be misrepresented; you must not\n * claim that you wrote the original software. If you use this software in a\n * product, an acknowledgment in the product documentation would be\n * appreciated but is not required.\n *\n * 2. Altered source versions must be plainly marked as such, and must not be\n * misrepresented as being the original software.\n *\n * 3. This notice may not be removed or altered from any source distribution.\n *\n * Ethan \"flibitijibibo\" Lee <flibitijibibo@flibitijibibo.com>\n *\n */\n#endregion\n\n#region Using Statements\nusing System;\nusing System.Runtime.InteropServices;\n#endregion\n\nnamespace SDL2\n{\n\tpublic static class SDL_ttf\n\t{\n\t\t#region SDL2# Variables\n\n\t\t/* Used by DllImport to load the native library. */\n\t\tprivate const string nativeLibName = \"SDL2_ttf\";\n\n\t\t#endregion\n\n\t\t#region SDL_ttf.h\n\n\t\t/* Similar to the headers, this is the version we're expecting to be\n\t\t * running with. You will likely want to check this somewhere in your\n\t\t * program!\n\t\t */\n\t\tpublic const int SDL_TTF_MAJOR_VERSION =\t2;\n\t\tpublic const int SDL_TTF_MINOR_VERSION =\t0;\n\t\tpublic const int SDL_TTF_PATCHLEVEL =\t\t16;\n\n\t\tpublic const int UNICODE_BOM_NATIVE =\t0xFEFF;\n\t\tpublic const int UNICODE_BOM_SWAPPED =\t0xFFFE;\n\n\t\tpublic const int TTF_STYLE_NORMAL =\t\t0x00;\n\t\tpublic const int TTF_STYLE_BOLD =\t\t0x01;\n\t\tpublic const int TTF_STYLE_ITALIC =\t\t0x02;\n\t\tpublic const int TTF_STYLE_UNDERLINE =\t\t0x04;\n\t\tpublic const int TTF_STYLE_STRIKETHROUGH =\t0x08;\n\n\t\tpublic const int TTF_HINTING_NORMAL =\t\t0;\n\t\tpublic const int TTF_HINTING_LIGHT =\t\t1;\n\t\tpublic const int TTF_HINTING_MONO =\t\t2;\n\t\tpublic const int TTF_HINTING_NONE =\t\t3;\n\t\tpublic const int TTF_HINTING_LIGHT_SUBPIXEL =\t4; /* >= 2.0.16 */\n\n\t\tpublic static void SDL_TTF_VERSION(out SDL.SDL_version X)\n\t\t{\n\t\t\tX.major = SDL_TTF_MAJOR_VERSION;\n\t\t\tX.minor = SDL_TTF_MINOR_VERSION;\n\t\t\tX.patch = SDL_TTF_PATCHLEVEL;\n\t\t}\n\n\t\t[DllImport(nativeLibName, EntryPoint = \"TTF_LinkedVersion\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_TTF_LinkedVersion();\n\t\tpublic static SDL.SDL_version TTF_LinkedVersion()\n\t\t{\n\t\t\tSDL.SDL_version result;\n\t\t\tIntPtr result_ptr = INTERNAL_TTF_LinkedVersion();\n\t\t\tresult = (SDL.SDL_version) Marshal.PtrToStructure(\n\t\t\t\tresult_ptr,\n\t\t\t\ttypeof(SDL.SDL_version)\n\t\t\t);\n\t\t\treturn result;\n\t\t}\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void TTF_ByteSwappedUNICODE(int swapped);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_Init();\n\n\t\t/* IntPtr refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"TTF_OpenFont\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe IntPtr INTERNAL_TTF_OpenFont(\n\t\t\tbyte* file,\n\t\t\tint ptsize\n\t\t);\n\t\tpublic static unsafe IntPtr TTF_OpenFont(string file, int ptsize)\n\t\t{\n\t\t\tbyte* utf8File = SDL.Utf8Encode(file);\n\t\t\tIntPtr handle = INTERNAL_TTF_OpenFont(\n\t\t\t\tutf8File,\n\t\t\t\tptsize\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8File);\n\t\t\treturn handle;\n\t\t}\n\n\t\t/* src refers to an SDL_RWops*, IntPtr to a TTF_Font* */\n\t\t/* THIS IS A PUBLIC RWops FUNCTION! */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_OpenFontRW(\n\t\t\tIntPtr src,\n\t\t\tint freesrc,\n\t\t\tint ptsize\n\t\t);\n\n\t\t/* IntPtr refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"TTF_OpenFontIndex\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe IntPtr INTERNAL_TTF_OpenFontIndex(\n\t\t\tbyte* file,\n\t\t\tint ptsize,\n\t\t\tlong index\n\t\t);\n\t\tpublic static unsafe IntPtr TTF_OpenFontIndex(\n\t\t\tstring file,\n\t\t\tint ptsize,\n\t\t\tlong index\n\t\t) {\n\t\t\tbyte* utf8File = SDL.Utf8Encode(file);\n\t\t\tIntPtr handle = INTERNAL_TTF_OpenFontIndex(\n\t\t\t\tutf8File,\n\t\t\t\tptsize,\n\t\t\t\tindex\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8File);\n\t\t\treturn handle;\n\t\t}\n\n\t\t/* src refers to an SDL_RWops*, IntPtr to a TTF_Font* */\n\t\t/* THIS IS A PUBLIC RWops FUNCTION! */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_OpenFontIndexRW(\n\t\t\tIntPtr src,\n\t\t\tint freesrc,\n\t\t\tint ptsize,\n\t\t\tlong index\n\t\t);\n\n\t\t/* font refers to a TTF_Font*\n\t\t * Only available in 2.0.16 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_SetFontSize(\n\t\t\tIntPtr font,\n\t\t\tint ptsize\n\t\t);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_GetFontStyle(IntPtr font);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void TTF_SetFontStyle(IntPtr font, int style);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_GetFontOutline(IntPtr font);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void TTF_SetFontOutline(IntPtr font, int outline);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_GetFontHinting(IntPtr font);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void TTF_SetFontHinting(IntPtr font, int hinting);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_FontHeight(IntPtr font);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_FontAscent(IntPtr font);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_FontDescent(IntPtr font);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_FontLineSkip(IntPtr font);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_GetFontKerning(IntPtr font);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void TTF_SetFontKerning(IntPtr font, int allowed);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern long TTF_FontFaces(IntPtr font);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_FontFaceIsFixedWidth(IntPtr font);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"TTF_FontFaceFamilyName\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_TTF_FontFaceFamilyName(\n\t\t\tIntPtr font\n\t\t);\n\t\tpublic static string TTF_FontFaceFamilyName(IntPtr font)\n\t\t{\n\t\t\treturn SDL.UTF8_ToManaged(\n\t\t\t\tINTERNAL_TTF_FontFaceFamilyName(font)\n\t\t\t);\n\t\t}\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"TTF_FontFaceStyleName\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern IntPtr INTERNAL_TTF_FontFaceStyleName(\n\t\t\tIntPtr font\n\t\t);\n\t\tpublic static string TTF_FontFaceStyleName(IntPtr font)\n\t\t{\n\t\t\treturn SDL.UTF8_ToManaged(\n\t\t\t\tINTERNAL_TTF_FontFaceStyleName(font)\n\t\t\t);\n\t\t}\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_GlyphIsProvided(IntPtr font, ushort ch);\n\n\t\t/* font refers to a TTF_Font*\n\t\t * Only available in 2.0.16 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_GlyphIsProvided32(IntPtr font, uint ch);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_GlyphMetrics(\n\t\t\tIntPtr font,\n\t\t\tushort ch,\n\t\t\tout int minx,\n\t\t\tout int maxx,\n\t\t\tout int miny,\n\t\t\tout int maxy,\n\t\t\tout int advance\n\t\t);\n\n\t\t/* font refers to a TTF_Font*\n\t\t * Only available in 2.0.16 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_GlyphMetrics32(\n\t\t\tIntPtr font,\n\t\t\tuint ch,\n\t\t\tout int minx,\n\t\t\tout int maxx,\n\t\t\tout int miny,\n\t\t\tout int maxy,\n\t\t\tout int advance\n\t\t);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_SizeText(\n\t\t\tIntPtr font,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPStr)]\n\t\t\t\tstring text,\n\t\t\tout int w,\n\t\t\tout int h\n\t\t);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"TTF_SizeUTF8\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern unsafe int INTERNAL_TTF_SizeUTF8(\n\t\t\tIntPtr font,\n\t\t\tbyte* text,\n\t\t\tout int w,\n\t\t\tout int h\n\t\t);\n\t\tpublic static unsafe int TTF_SizeUTF8(\n\t\t\tIntPtr font,\n\t\t\tstring text,\n\t\t\tout int w,\n\t\t\tout int h\n\t\t) {\n\t\t\tbyte* utf8Text = SDL.Utf8Encode(text);\n\t\t\tint result = INTERNAL_TTF_SizeUTF8(\n\t\t\t\tfont,\n\t\t\t\tutf8Text,\n\t\t\t\tout w,\n\t\t\t\tout h\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8Text);\n\t\t\treturn result;\n\t\t}\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_SizeUNICODE(\n\t\t\tIntPtr font,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPWStr)]\n\t\t\t\tstring text,\n\t\t\tout int w,\n\t\t\tout int h\n\t\t);\n\n\t\t/* font refers to a TTF_Font*\n\t\t * Only available in 2.0.16 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_MeasureText(\n\t\t\tIntPtr font,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPStr)]\n\t\t\t\tstring text,\n\t\t\tint measure_width,\n\t\t\tout int extent,\n\t\t\tout int count\n\t\t);\n\n\t\t/* font refers to a TTF_Font*\n\t\t * Only available in 2.0.16 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, EntryPoint = \"TTF_MeasureUTF8\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern unsafe int INTERNAL_TTF_MeasureUTF8(\n\t\t\tIntPtr font,\n\t\t\tbyte* text,\n\t\t\tint measure_width,\n\t\t\tout int extent,\n\t\t\tout int count\n\t\t);\n\t\tpublic static unsafe int TTF_MeasureUTF8(\n\t\t\tIntPtr font,\n\t\t\tstring text,\n\t\t\tint measure_width,\n\t\t\tout int extent,\n\t\t\tout int count\n\t\t) {\n\t\t\tbyte* utf8Text = SDL.Utf8Encode(text);\n\t\t\tint result = INTERNAL_TTF_MeasureUTF8(\n\t\t\t\tfont,\n\t\t\t\tutf8Text,\n\t\t\t\tmeasure_width,\n\t\t\t\tout extent,\n\t\t\t\tout count\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8Text);\n\t\t\treturn result;\n\t\t}\n\n\t\t/* font refers to a TTF_Font*\n\t\t * Only available in 2.0.16 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_MeasureUNICODE(\n\t\t\tIntPtr font,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPWStr)]\n\t\t\t\tstring text,\n\t\t\tint measure_width,\n\t\t\tout int extent,\n\t\t\tout int count\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderText_Solid(\n\t\t\tIntPtr font,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPStr)]\n\t\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"TTF_RenderUTF8_Solid\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Solid(\n\t\t\tIntPtr font,\n\t\t\tbyte* text,\n\t\t\tSDL.SDL_Color fg\n\t\t);\n\t\tpublic static unsafe IntPtr TTF_RenderUTF8_Solid(\n\t\t\tIntPtr font,\n\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg\n\t\t) {\n\t\t\tbyte* utf8Text = SDL.Utf8Encode(text);\n\t\t\tIntPtr result = INTERNAL_TTF_RenderUTF8_Solid(\n\t\t\t\tfont,\n\t\t\t\tutf8Text,\n\t\t\t\tfg\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8Text);\n\t\t\treturn result;\n\t\t}\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderUNICODE_Solid(\n\t\t\tIntPtr font,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPWStr)]\n\t\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*\n\t\t * Only available in 2.0.16 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderText_Solid_Wrapped(\n\t\t\tIntPtr font,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPStr)]\n\t\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tuint wrapLength\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*\n\t\t * Only available in 2.0.16 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, EntryPoint = \"TTF_RenderUTF8_Solid_Wrapped\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Solid_Wrapped(\n\t\t\tIntPtr font,\n\t\t\tbyte* text,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tuint wrapLength\n\t\t);\n\t\tpublic static unsafe IntPtr TTF_RenderUTF8_Solid_Wrapped(\n\t\t\tIntPtr font,\n\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tuint wrapLength\n\t\t) {\n\t\t\tbyte* utf8Text = SDL.Utf8Encode(text);\n\t\t\tIntPtr result = INTERNAL_TTF_RenderUTF8_Solid_Wrapped(\n\t\t\t\tfont,\n\t\t\t\tutf8Text,\n\t\t\t\tfg,\n\t\t\t\twrapLength\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8Text);\n\t\t\treturn result;\n\t\t}\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*\n\t\t * Only available in 2.0.16 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderUNICODE_Solid_Wrapped(\n\t\t\tIntPtr font,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPWStr)]\n\t\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tuint wrapLength\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderGlyph_Solid(\n\t\t\tIntPtr font,\n\t\t\tushort ch,\n\t\t\tSDL.SDL_Color fg\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*\n\t\t * Only available in 2.0.16 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderGlyph32_Solid(\n\t\t\tIntPtr font,\n\t\t\tuint ch,\n\t\t\tSDL.SDL_Color fg\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderText_Shaded(\n\t\t\tIntPtr font,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPStr)]\n\t\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tSDL.SDL_Color bg\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"TTF_RenderUTF8_Shaded\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Shaded(\n\t\t\tIntPtr font,\n\t\t\tbyte* text,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tSDL.SDL_Color bg\n\t\t);\n\t\tpublic static unsafe IntPtr TTF_RenderUTF8_Shaded(\n\t\t\tIntPtr font,\n\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tSDL.SDL_Color bg\n\t\t) {\n\t\t\tbyte* utf8Text = SDL.Utf8Encode(text);\n\t\t\tIntPtr result = INTERNAL_TTF_RenderUTF8_Shaded(\n\t\t\t\tfont,\n\t\t\t\tutf8Text,\n\t\t\t\tfg,\n\t\t\t\tbg\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8Text);\n\t\t\treturn result;\n\t\t}\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderUNICODE_Shaded(\n\t\t\tIntPtr font,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPWStr)]\n\t\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tSDL.SDL_Color bg\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderText_Shaded_Wrapped(\n\t\t\tIntPtr font,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPStr)]\n\t\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tSDL.SDL_Color bg,\n\t\t\tuint wrapLength\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*\n\t\t * Only available in 2.0.16 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, EntryPoint = \"TTF_RenderUTF8_Shaded_Wrapped\", CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Shaded_Wrapped(\n\t\t\tIntPtr font,\n\t\t\tbyte* text,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tSDL.SDL_Color bg,\n\t\t\tuint wrapLength\n\t\t);\n\t\tpublic static unsafe IntPtr TTF_RenderUTF8_Shaded_Wrapped(\n\t\t\tIntPtr font,\n\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tSDL.SDL_Color bg,\n\t\t\tuint wrapLength\n\t\t) {\n\t\t\tbyte* utf8Text = SDL.Utf8Encode(text);\n\t\t\tIntPtr result = INTERNAL_TTF_RenderUTF8_Shaded_Wrapped(\n\t\t\t\tfont,\n\t\t\t\tutf8Text,\n\t\t\t\tfg,\n\t\t\t\tbg,\n\t\t\t\twrapLength\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8Text);\n\t\t\treturn result;\n\t\t}\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderUNICODE_Shaded_Wrapped(\n\t\t\tIntPtr font,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPWStr)]\n\t\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tSDL.SDL_Color bg,\n\t\t\tuint wrapLength\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderGlyph_Shaded(\n\t\t\tIntPtr font,\n\t\t\tushort ch,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tSDL.SDL_Color bg\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*\n\t\t * Only available in 2.0.16 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderGlyph32_Shaded(\n\t\t\tIntPtr font,\n\t\t\tuint ch,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tSDL.SDL_Color bg\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderText_Blended(\n\t\t\tIntPtr font,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPStr)]\n\t\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"TTF_RenderUTF8_Blended\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Blended(\n\t\t\tIntPtr font,\n\t\t\tbyte* text,\n\t\t\tSDL.SDL_Color fg\n\t\t);\n\t\tpublic static unsafe IntPtr TTF_RenderUTF8_Blended(\n\t\t\tIntPtr font,\n\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg\n\t\t) {\n\t\t\tbyte* utf8Text = SDL.Utf8Encode(text);\n\t\t\tIntPtr result = INTERNAL_TTF_RenderUTF8_Blended(\n\t\t\t\tfont,\n\t\t\t\tutf8Text,\n\t\t\t\tfg\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8Text);\n\t\t\treturn result;\n\t\t}\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderUNICODE_Blended(\n\t\t\tIntPtr font,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPWStr)]\n\t\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderText_Blended_Wrapped(\n\t\t\tIntPtr font,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPStr)]\n\t\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tuint wrapped\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */\n\t\t[DllImport(nativeLibName, EntryPoint = \"TTF_RenderUTF8_Blended_Wrapped\", CallingConvention = CallingConvention.Cdecl)]\n\t\tprivate static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Blended_Wrapped(\n\t\t\tIntPtr font,\n\t\t\tbyte* text,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tuint wrapped\n\t\t);\n\t\tpublic static unsafe IntPtr TTF_RenderUTF8_Blended_Wrapped(\n\t\t\tIntPtr font,\n\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tuint wrapped\n\t\t) {\n\t\t\tbyte* utf8Text = SDL.Utf8Encode(text);\n\t\t\tIntPtr result = INTERNAL_TTF_RenderUTF8_Blended_Wrapped(\n\t\t\t\tfont,\n\t\t\t\tutf8Text,\n\t\t\t\tfg,\n\t\t\t\twrapped\n\t\t\t);\n\t\t\tMarshal.FreeHGlobal((IntPtr) utf8Text);\n\t\t\treturn result;\n\t\t}\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderUNICODE_Blended_Wrapped(\n\t\t\tIntPtr font,\n\t\t\t[In()] [MarshalAs(UnmanagedType.LPWStr)]\n\t\t\t\tstring text,\n\t\t\tSDL.SDL_Color fg,\n\t\t\tuint wrapped\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderGlyph_Blended(\n\t\t\tIntPtr font,\n\t\t\tushort ch,\n\t\t\tSDL.SDL_Color fg\n\t\t);\n\n\t\t/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*\n\t\t * Only available in 2.0.16 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern IntPtr TTF_RenderGlyph32_Blended(\n\t\t\tIntPtr font,\n\t\t\tuint ch,\n\t\t\tSDL.SDL_Color fg\n\t\t);\n\n\t\t/* Only available in 2.0.16 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_SetDirection(int direction);\n\n\t\t/* Only available in 2.0.16 or higher. */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_SetScript(int script);\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void TTF_CloseFont(IntPtr font);\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern void TTF_Quit();\n\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_WasInit();\n\n\t\t/* font refers to a TTF_Font* */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int SDL_GetFontKerningSize(\n\t\t\tIntPtr font,\n\t\t\tint prev_index,\n\t\t\tint index\n\t\t);\n\n\t\t/* font refers to a TTF_Font*\n\t\t * Only available in 2.0.15 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_GetFontKerningSizeGlyphs(\n\t\t\tIntPtr font,\n\t\t\tushort previous_ch,\n\t\t\tushort ch\n\t\t);\n\n\t\t/* font refers to a TTF_Font*\n\t\t * Only available in 2.0.16 or higher.\n\t\t */\n\t\t[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]\n\t\tpublic static extern int TTF_GetFontKerningSizeGlyphs32(\n\t\t\tIntPtr font,\n\t\t\tushort previous_ch,\n\t\t\tushort ch\n\t\t);\n\n\t\t#endregion\n\t}\n}\n"
  },
  {
    "path": "Engine/Utility/Bounds2.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\n\nstruct Bounds2\n{\n    public Vector2 Position;\n    public Vector2 Size;\n\n    private Vector2 Min => Position;\n    private Vector2 Max => Position + Size;\n\n    /// <summary>\n    /// Creates a new 2D bounds rectangle.\n    /// </summary>\n    /// <param name=\"position\">The origin of the bounds.</param>\n    /// <param name=\"size\">The size of the bounds.</param>\n    public Bounds2(Vector2 position, Vector2 size)\n    {\n        Position = position;\n        Size = size;\n    }\n\n    /// <summary>\n    /// Creates a new 2D bounds rectangle.\n    /// </summary>\n    /// <param name=\"x\">The X component of the origin of the bounds.</param>\n    /// <param name=\"y\">The Y component of the origin of the bounds.</param>\n    /// <param name=\"width\">The width of the bounds.</param>\n    /// <param name=\"height\">The height of the bounds.</param>\n    public Bounds2(float x, float y, float width, float height)\n    {\n        Position = new Vector2(x, y);\n        Size = new Vector2(width, height);\n    }\n\n    public override string ToString()\n    {\n        return string.Format(\"({0}, {1})\", Position, Size);\n    }\n\n    /// <summary>\n    /// Returns true if a point is within these bounds.\n    /// </summary>\n    /// <param name=\"point\">The point to test.</param>\n    public bool Contains(Vector2 point)\n    {\n        return Min.X <= point.X && point.X <= Max.X && Min.Y <= point.Y && point.Y <= Max.Y;\n    }\n\n    /// <summary>\n    /// Returns true if another bounds rectangle overlaps these bounds.\n    /// </summary>\n    /// <param name=\"bounds\">The bounds to test.</param>\n    public bool Overlaps(Bounds2 bounds)\n    {\n        return !(bounds.Max.X < Min.X || bounds.Min.X > Max.X || bounds.Max.Y < Min.Y || bounds.Min.Y > Max.Y);\n    }\n}\n"
  },
  {
    "path": "Engine/Utility/Color.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\n\nstruct Color\n{\n    public byte R;\n    public byte G;\n    public byte B;\n    public byte A;\n\n    /// <summary>\n    /// Creates a new color with full opacity (alpha = 255).\n    /// </summary>\n    /// <param name=\"r\">The red component, from 0 to 255.</param>\n    /// <param name=\"g\">The green component, from 0 to 255.</param>\n    /// <param name=\"b\">The blue component, from 0 to 255.</param>\n    public Color(byte r, byte g, byte b)\n    {\n        R = r;\n        G = g;\n        B = b;\n        A = 0xFF;\n    }\n\n    /// <summary>\n    /// Creates a new color.\n    /// </summary>\n    /// <param name=\"r\">The red component, from 0 to 255.</param>\n    /// <param name=\"g\">The green component, from 0 to 255.</param>\n    /// <param name=\"b\">The blue component, from 0 to 255.</param>\n    /// <param name=\"a\">The alpha component, from 0 to 255.</param>\n    public Color(byte r, byte g, byte b, byte a)\n    {\n        R = r;\n        G = g;\n        B = b;\n        A = a;\n    }\n\n    public override string ToString()\n    {\n        return string.Format(\"({0}, {1}, {2}, {3})\", R, G, B, A);\n    }\n\n    /// <summary>\n    /// Returns a copy of this color with a modified alpha value.\n    /// </summary>\n    /// <param name=\"a\">The scale factor to apply to the original alpha, between 0 and 1.</param>\n    public Color WithAlpha(float a)\n    {\n        byte alpha = (byte)Math.Max(Math.Min(A * a, 255), 0);\n        return new Color(R, G, B, alpha);\n    }\n\n    public static readonly Color Transparent = new Color(0x00, 0x00, 0x00, 0x00);\n    public static readonly Color AliceBlue = new Color(0xF0, 0xF8, 0xFF);\n    public static readonly Color AntiqueWhite = new Color(0xFA, 0xEB, 0xD7);\n    public static readonly Color Aqua = new Color(0x00, 0xFF, 0xFF);\n    public static readonly Color Aquamarine = new Color(0x7F, 0xFF, 0xD4);\n    public static readonly Color Azure = new Color(0xF0, 0xFF, 0xFF);\n    public static readonly Color Beige = new Color(0xF5, 0xF5, 0xDC);\n    public static readonly Color Bisque = new Color(0xFF, 0xE4, 0xC4);\n    public static readonly Color Black = new Color(0x00, 0x00, 0x00);\n    public static readonly Color BlanchedAlmond = new Color(0xFF, 0xEB, 0xCD);\n    public static readonly Color Blue = new Color(0x00, 0x00, 0xFF);\n    public static readonly Color BlueViolet = new Color(0x8A, 0x2B, 0xE2);\n    public static readonly Color Brown = new Color(0xA5, 0x2A, 0x2A);\n    public static readonly Color BurlyWood = new Color(0xDE, 0xB8, 0x87);\n    public static readonly Color CadetBlue = new Color(0x5F, 0x9E, 0xA0);\n    public static readonly Color Chartreuse = new Color(0x7F, 0xFF, 0x00);\n    public static readonly Color Chocolate = new Color(0xD2, 0x69, 0x1E);\n    public static readonly Color Coral = new Color(0xFF, 0x7F, 0x50);\n    public static readonly Color CornflowerBlue = new Color(0x64, 0x95, 0xED);\n    public static readonly Color Cornsilk = new Color(0xFF, 0xF8, 0xDC);\n    public static readonly Color Crimson = new Color(0xDC, 0x14, 0x3C);\n    public static readonly Color Cyan = new Color(0x00, 0xFF, 0xFF);\n    public static readonly Color DarkBlue = new Color(0x00, 0x00, 0x8B);\n    public static readonly Color DarkCyan = new Color(0x00, 0x8B, 0x8B);\n    public static readonly Color DarkGoldenrod = new Color(0xB8, 0x86, 0x0B);\n    public static readonly Color DarkGray = new Color(0xA9, 0xA9, 0xA9);\n    public static readonly Color DarkGreen = new Color(0x00, 0x64, 0x00);\n    public static readonly Color DarkKhaki = new Color(0xBD, 0xB7, 0x6B);\n    public static readonly Color DarkMagenta = new Color(0x8B, 0x00, 0x8B);\n    public static readonly Color DarkOliveGreen = new Color(0x55, 0x6B, 0x2F);\n    public static readonly Color DarkOrange = new Color(0xFF, 0x8C, 0x00);\n    public static readonly Color DarkOrchid = new Color(0x99, 0x32, 0xCC);\n    public static readonly Color DarkRed = new Color(0x8B, 0x00, 0x00);\n    public static readonly Color DarkSalmon = new Color(0xE9, 0x96, 0x7A);\n    public static readonly Color DarkSeaGreen = new Color(0x8F, 0xBC, 0x8F);\n    public static readonly Color DarkSlateBlue = new Color(0x48, 0x3D, 0x8B);\n    public static readonly Color DarkSlateGray = new Color(0x2F, 0x4F, 0x4F);\n    public static readonly Color DarkTurquoise = new Color(0x00, 0xCE, 0xD1);\n    public static readonly Color DarkViolet = new Color(0x94, 0x00, 0xD3);\n    public static readonly Color DeepPink = new Color(0xFF, 0x14, 0x93);\n    public static readonly Color DeepSkyBlue = new Color(0x00, 0xBF, 0xFF);\n    public static readonly Color DimGray = new Color(0x69, 0x69, 0x69);\n    public static readonly Color DodgerBlue = new Color(0x1E, 0x90, 0xFF);\n    public static readonly Color Firebrick = new Color(0xB2, 0x22, 0x22);\n    public static readonly Color FloralWhite = new Color(0xFF, 0xFA, 0xF0);\n    public static readonly Color ForestGreen = new Color(0x22, 0x8B, 0x22);\n    public static readonly Color Fuchsia = new Color(0xFF, 0x00, 0xFF);\n    public static readonly Color Gainsboro = new Color(0xDC, 0xDC, 0xDC);\n    public static readonly Color GhostWhite = new Color(0xF8, 0xF8, 0xFF);\n    public static readonly Color Gold = new Color(0xFF, 0xD7, 0x00);\n    public static readonly Color Goldenrod = new Color(0xDA, 0xA5, 0x20);\n    public static readonly Color Gray = new Color(0x80, 0x80, 0x80);\n    public static readonly Color Green = new Color(0x00, 0x80, 0x00);\n    public static readonly Color GreenYellow = new Color(0xAD, 0xFF, 0x2F);\n    public static readonly Color Honeydew = new Color(0xF0, 0xFF, 0xF0);\n    public static readonly Color HotPink = new Color(0xFF, 0x69, 0xB4);\n    public static readonly Color IndianRed = new Color(0xCD, 0x5C, 0x5C);\n    public static readonly Color Indigo = new Color(0x4B, 0x00, 0x82);\n    public static readonly Color Ivory = new Color(0xFF, 0xFF, 0xF0);\n    public static readonly Color Khaki = new Color(0xF0, 0xE6, 0x8C);\n    public static readonly Color Lavender = new Color(0xE6, 0xE6, 0xFA);\n    public static readonly Color LavenderBlush = new Color(0xFF, 0xF0, 0xF5);\n    public static readonly Color LawnGreen = new Color(0x7C, 0xFC, 0x00);\n    public static readonly Color LemonChiffon = new Color(0xFF, 0xFA, 0xCD);\n    public static readonly Color LightBlue = new Color(0xAD, 0xD8, 0xE6);\n    public static readonly Color LightCoral = new Color(0xF0, 0x80, 0x80);\n    public static readonly Color LightCyan = new Color(0xE0, 0xFF, 0xFF);\n    public static readonly Color LightGoldenrodYellow = new Color(0xFA, 0xFA, 0xD2);\n    public static readonly Color LightGray = new Color(0xD3, 0xD3, 0xD3);\n    public static readonly Color LightGreen = new Color(0x90, 0xEE, 0x90);\n    public static readonly Color LightPink = new Color(0xFF, 0xB6, 0xC1);\n    public static readonly Color LightSalmon = new Color(0xFF, 0xA0, 0x7A);\n    public static readonly Color LightSeaGreen = new Color(0x20, 0xB2, 0xAA);\n    public static readonly Color LightSkyBlue = new Color(0x87, 0xCE, 0xFA);\n    public static readonly Color LightSlateGray = new Color(0x77, 0x88, 0x99);\n    public static readonly Color LightSteelBlue = new Color(0xB0, 0xC4, 0xDE);\n    public static readonly Color LightYellow = new Color(0xFF, 0xFF, 0xE0);\n    public static readonly Color Lime = new Color(0x00, 0xFF, 0x00);\n    public static readonly Color LimeGreen = new Color(0x32, 0xCD, 0x32);\n    public static readonly Color Linen = new Color(0xFA, 0xF0, 0xE6);\n    public static readonly Color Magenta = new Color(0xFF, 0x00, 0xFF);\n    public static readonly Color Maroon = new Color(0x80, 0x00, 0x00);\n    public static readonly Color MediumAquamarine = new Color(0x66, 0xCD, 0xAA);\n    public static readonly Color MediumBlue = new Color(0x00, 0x00, 0xCD);\n    public static readonly Color MediumOrchid = new Color(0xBA, 0x55, 0xD3);\n    public static readonly Color MediumPurple = new Color(0x93, 0x70, 0xDB);\n    public static readonly Color MediumSeaGreen = new Color(0x3C, 0xB3, 0x71);\n    public static readonly Color MediumSlateBlue = new Color(0x7B, 0x68, 0xEE);\n    public static readonly Color MediumSpringGreen = new Color(0x00, 0xFA, 0x9A);\n    public static readonly Color MediumTurquoise = new Color(0x48, 0xD1, 0xCC);\n    public static readonly Color MediumVioletRed = new Color(0xC7, 0x15, 0x85);\n    public static readonly Color MidnightBlue = new Color(0x19, 0x19, 0x70);\n    public static readonly Color MintCream = new Color(0xF5, 0xFF, 0xFA);\n    public static readonly Color MistyRose = new Color(0xFF, 0xE4, 0xE1);\n    public static readonly Color Moccasin = new Color(0xFF, 0xE4, 0xB5);\n    public static readonly Color NavajoWhite = new Color(0xFF, 0xDE, 0xAD);\n    public static readonly Color Navy = new Color(0x00, 0x00, 0x80);\n    public static readonly Color OldLace = new Color(0xFD, 0xF5, 0xE6);\n    public static readonly Color Olive = new Color(0x80, 0x80, 0x00);\n    public static readonly Color OliveDrab = new Color(0x6B, 0x8E, 0x23);\n    public static readonly Color Orange = new Color(0xFF, 0xA5, 0x00);\n    public static readonly Color OrangeRed = new Color(0xFF, 0x45, 0x00);\n    public static readonly Color Orchid = new Color(0xDA, 0x70, 0xD6);\n    public static readonly Color PaleGoldenrod = new Color(0xEE, 0xE8, 0xAA);\n    public static readonly Color PaleGreen = new Color(0x98, 0xFB, 0x98);\n    public static readonly Color PaleTurquoise = new Color(0xAF, 0xEE, 0xEE);\n    public static readonly Color PaleVioletRed = new Color(0xDB, 0x70, 0x93);\n    public static readonly Color PapayaWhip = new Color(0xFF, 0xEF, 0xD5);\n    public static readonly Color PeachPuff = new Color(0xFF, 0xDA, 0xB9);\n    public static readonly Color Peru = new Color(0xCD, 0x85, 0x3F);\n    public static readonly Color Pink = new Color(0xFF, 0xC0, 0xCB);\n    public static readonly Color Plum = new Color(0xDD, 0xA0, 0xDD);\n    public static readonly Color PowderBlue = new Color(0xB0, 0xE0, 0xE6);\n    public static readonly Color Purple = new Color(0x80, 0x00, 0x80);\n    public static readonly Color Red = new Color(0xFF, 0x00, 0x00);\n    public static readonly Color RosyBrown = new Color(0xBC, 0x8F, 0x8F);\n    public static readonly Color RoyalBlue = new Color(0x41, 0x69, 0xE1);\n    public static readonly Color SaddleBrown = new Color(0x8B, 0x45, 0x13);\n    public static readonly Color Salmon = new Color(0xFA, 0x80, 0x72);\n    public static readonly Color SandyBrown = new Color(0xF4, 0xA4, 0x60);\n    public static readonly Color SeaGreen = new Color(0x2E, 0x8B, 0x57);\n    public static readonly Color SeaShell = new Color(0xFF, 0xF5, 0xEE);\n    public static readonly Color Sienna = new Color(0xA0, 0x52, 0x2D);\n    public static readonly Color Silver = new Color(0xC0, 0xC0, 0xC0);\n    public static readonly Color SkyBlue = new Color(0x87, 0xCE, 0xEB);\n    public static readonly Color SlateBlue = new Color(0x6A, 0x5A, 0xCD);\n    public static readonly Color SlateGray = new Color(0x70, 0x80, 0x90);\n    public static readonly Color Snow = new Color(0xFF, 0xFA, 0xFA);\n    public static readonly Color SpringGreen = new Color(0x00, 0xFF, 0x7F);\n    public static readonly Color SteelBlue = new Color(0x46, 0x82, 0xB4);\n    public static readonly Color Tan = new Color(0xD2, 0xB4, 0x8C);\n    public static readonly Color Teal = new Color(0x00, 0x80, 0x80);\n    public static readonly Color Thistle = new Color(0xD8, 0xBF, 0xD8);\n    public static readonly Color Tomato = new Color(0xFF, 0x63, 0x47);\n    public static readonly Color Turquoise = new Color(0x40, 0xE0, 0xD0);\n    public static readonly Color Violet = new Color(0xEE, 0x82, 0xEE);\n    public static readonly Color Wheat = new Color(0xF5, 0xDE, 0xB3);\n    public static readonly Color White = new Color(0xFF, 0xFF, 0xFF);\n    public static readonly Color WhiteSmoke = new Color(0xF5, 0xF5, 0xF5);\n    public static readonly Color Yellow = new Color(0xFF, 0xFF, 0x00);\n    public static readonly Color YellowGreen = new Color(0x9A, 0xCD, 0x32);\n}\n"
  },
  {
    "path": "Engine/Utility/Vector2.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\n\nstruct Vector2\n{\n    public float X, Y;\n\n    public static readonly Vector2 Zero = new Vector2(0, 0);\n\n    /// <summary>\n    /// Creates a new 2D vector.\n    /// </summary>\n    /// <param name=\"x\">The X component.</param>\n    /// <param name=\"y\">The Y component.</param>\n    public Vector2(float x, float y)\n    {\n        X = x;\n        Y = y;\n    }\n\n    public override string ToString()\n    {\n        return string.Format(\"({0}, {1})\", X, Y);\n    }\n\n    /// <summary>\n    /// Returns the length of this vector.\n    /// </summary>\n    public float Length()\n    {\n        return (float)Math.Sqrt(X * X + Y * Y);\n    }\n\n    /// <summary>\n    /// Returns a copy of this vector rotated clockwise around the origin.\n    /// </summary>\n    /// <param name=\"degrees\">The angle to rotate (in degrees).</param>\n    public Vector2 Rotated(float degrees)\n    {\n        float radians = (float)(degrees * Math.PI / 180);\n        float sin = (float)Math.Sin(radians);\n        float cos = (float)Math.Cos(radians);\n        return new Vector2(\n            X * cos - Y * sin,\n            X * sin + Y * cos);\n    }\n\n    /// <summary>\n    /// Returns a copy of this vector normalized so that its length is one. If the length is zero it will be unchanged.\n    /// </summary>\n    public Vector2 Normalized()\n    {\n        float length = Length();\n        if (length == 0)\n        {\n            return Vector2.Zero;\n        }\n        else\n        {\n            return this / length;\n        }\n    }\n\n    /// <summary>\n    /// Returns the dot product of two vectors.\n    /// </summary>\n    /// <param name=\"a\">The first vector.</param>\n    /// <param name=\"b\">The second vector.</param>\n    public static float Dot(Vector2 a, Vector2 b)\n    {\n        return a.X * b.X + a.Y * b.Y;\n    }\n\n    /// <summary>\n    /// Returns the Z component of the cross product of two vectors.\n    /// </summary>\n    /// <param name=\"a\">The first vector.</param>\n    /// <param name=\"b\">The second vector.</param>\n    public static float Cross(Vector2 a, Vector2 b)\n    {\n        return a.X * b.Y - a.Y * b.X;\n    }\n\n    public static Vector2 operator -(Vector2 a)\n    {\n        return new Vector2(-a.X, -a.Y);\n    }\n\n    public static Vector2 operator +(Vector2 a, Vector2 b)\n    {\n        return new Vector2(a.X + b.X, a.Y + b.Y);\n    }\n\n    public static Vector2 operator -(Vector2 a, Vector2 b)\n    {\n        return new Vector2(a.X - b.X, a.Y - b.Y);\n    }\n\n    public static Vector2 operator *(float s, Vector2 v)\n    {\n        return new Vector2(s * v.X, s * v.Y);\n    }\n\n    public static Vector2 operator *(Vector2 v, float s)\n    {\n        return new Vector2(s * v.X, s * v.Y);\n    }\n\n    public static Vector2 operator *(int s, Vector2 v)\n    {\n        return new Vector2(s * v.X, s * v.Y);\n    }\n\n    public static Vector2 operator *(Vector2 v, int s)\n    {\n        return new Vector2(s * v.X, s * v.Y);\n    }\n\n    public static Vector2 operator /(Vector2 v, float s)\n    {\n        return new Vector2(v.X / s, v.Y / s);\n    }\n\n    public static Vector2 operator /(Vector2 v, int s)\n    {\n        return new Vector2(v.X / s, v.Y / s);\n    }\n}\n"
  },
  {
    "path": "Game/Game.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\nclass Game\r\n{\r\n    public static readonly string Title = \"Minimalist Game Framework\";\r\n    public static readonly Vector2 Resolution = new Vector2(128, 128);\r\n\r\n    // Define some constants controlling animation speed:\r\n    static readonly float Framerate = 10;\r\n    static readonly float WalkSpeed = 50;\r\n\r\n    // Load some textures when the game starts:\r\n    Texture texKnight = Engine.LoadTexture(\"knight.png\");\r\n    Texture texBackground = Engine.LoadTexture(\"background.png\");\r\n\r\n    // Keep track of the knight's state:\r\n    Vector2 knightPosition = Resolution / 2;\r\n    bool knightFaceLeft = false;\r\n    float knightFrameIndex = 0;\r\n\r\n    public Game()\r\n    {\r\n    }\r\n\r\n    public void Update()\r\n    {\r\n        // Draw the background:\r\n        Engine.DrawTexture(texBackground, Vector2.Zero);\r\n\r\n        // Use the keyboard to control the knight:\r\n        Vector2 moveOffset = Vector2.Zero;\r\n        if (Engine.GetKeyHeld(Key.Left))\r\n        {\r\n            moveOffset.X -= 1;\r\n            knightFaceLeft = true;\r\n        }\r\n        if (Engine.GetKeyHeld(Key.Right))\r\n        {\r\n            moveOffset.X += 1;\r\n            knightFaceLeft = false;\r\n        }\r\n        if (Engine.GetKeyHeld(Key.Up))\r\n        {\r\n            moveOffset.Y -= 1;\r\n        }\r\n        if (Engine.GetKeyHeld(Key.Down))\r\n        {\r\n            moveOffset.Y += 1;\r\n        }\r\n        knightPosition += moveOffset * WalkSpeed * Engine.TimeDelta;\r\n\r\n        // Advance through the knight's 6-frame animation and select the current frame:\r\n        knightFrameIndex = (knightFrameIndex + Engine.TimeDelta * Framerate) % 6.0f;\r\n        bool knightIdle = moveOffset.Length() == 0;\r\n        Bounds2 knightFrameBounds = new Bounds2(((int)knightFrameIndex) * 16, knightIdle ? 0 : 16, 16, 16);\r\n\r\n        // Draw the knight:\r\n        Vector2 knightDrawPos = knightPosition + new Vector2(-8, -8);\r\n        TextureMirror knightMirror = knightFaceLeft ? TextureMirror.Horizontal : TextureMirror.None;\r\n        Engine.DrawTexture(texKnight, knightDrawPos, source: knightFrameBounds, mirror: knightMirror);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Game.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{6626172D-57E8-4E06-9449-65E8B8EFC912}</ProjectGuid>\n    <OutputType>WinExe</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>Game</RootNamespace>\n    <AssemblyName>Game</AssemblyName>\n    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Debug|x64'\">\n    <DebugSymbols>true</DebugSymbols>\n    <OutputPath>Builds\\Debug\\</OutputPath>\n    <IntermediateOutputPath>Builds\\Temp\\Debug</IntermediateOutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <DebugType>full</DebugType>\n    <PlatformTarget>x64</PlatformTarget>\n    <ErrorReport>prompt</ErrorReport>\n    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>\n    <Prefer32Bit>true</Prefer32Bit>\n    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Release|x64'\">\n    <OutputPath>Builds\\Release\\</OutputPath>\n    <IntermediateOutputPath>Builds\\Temp\\Release</IntermediateOutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <Optimize>true</Optimize>\n    <DebugType>pdbonly</DebugType>\n    <PlatformTarget>x64</PlatformTarget>\n    <ErrorReport>prompt</ErrorReport>\n    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>\n    <Prefer32Bit>true</Prefer32Bit>\n    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\n  </PropertyGroup>\n  <PropertyGroup>\n    <StartupObject />\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"System.Data.DataSetExtensions\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Net.Http\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"Engine\\Audio.cs\" />\n    <Compile Include=\"Engine\\Utility\\Bounds2.cs\" />\n    <Compile Include=\"Engine\\Utility\\Color.cs\" />\n    <Compile Include=\"Engine\\Content.cs\" />\n    <Compile Include=\"Engine\\Graphics.cs\" />\n    <Compile Include=\"Engine\\Input.cs\" />\n    <Compile Include=\"Engine\\Engine.cs\" />\n    <Compile Include=\"Game\\Game.cs\" />\n    <Compile Include=\"Engine\\SDL2\\SDL2.cs\" />\n    <Compile Include=\"Engine\\SDL2\\SDL2_image.cs\" />\n    <Compile Include=\"Engine\\Utility\\Vector2.cs\" />\n    <Compile Include=\"Engine\\SDL2\\SDL2_mixer.cs\" />\n    <Compile Include=\"Engine\\SDL2\\SDL2_ttf.cs\" />\n  </ItemGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <PropertyGroup>\n    <PostBuildEvent>(robocopy \"$(ProjectDir)Assets\" \"$(TargetDir)Assets\" /MIR /W:1) ^&amp; IF %25ERRORLEVEL%25 LSS 8 SET ERRORLEVEL = 0\n(robocopy \"$(ProjectDir)Libraries\" \"$(TargetDir)\\\" /W:1) ^&amp; IF %25ERRORLEVEL%25 LSS 8 SET ERRORLEVEL = 0</PostBuildEvent>\n  </PropertyGroup>\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "Game.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.29905.134\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Game\", \"Game.csproj\", \"{6626172D-57E8-4E06-9449-65E8B8EFC912}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|x64 = Debug|x64\n\t\tRelease|x64 = Release|x64\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{6626172D-57E8-4E06-9449-65E8B8EFC912}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{6626172D-57E8-4E06-9449-65E8B8EFC912}.Debug|x64.Build.0 = Debug|x64\n\t\t{6626172D-57E8-4E06-9449-65E8B8EFC912}.Release|x64.ActiveCfg = Release|x64\n\t\t{6626172D-57E8-4E06-9449-65E8B8EFC912}.Release|x64.Build.0 = Release|x64\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {D4DB74FD-4AB0-4BF4-B12B-D0DB1562152B}\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "LICENSE.md",
    "content": "Copyright (c) 2020 Zach Barth and Keith Holman\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# Minimalist Game Framework #\n\nThis is a minimalist game framework in the style of the \"game engine\" we use at [Zachtronics](http://www.zachtronics.com). It is a thin layer over [SDL2](http://wiki.libsdl.org/FrontPage) that encourages you to modify and extend the framework to suit your needs and preferences. There is also a [Java version](https://github.com/zachbarth/minimalist-game-framework-java) of this framework.\n\n# Getting Started #\n\n1. Clone the repo.\n2. Add your assets (images, fonts, sounds, and music) to the Assets folder. These files will be automatically synchronized to your build directory by a post-build step in Visual Studio.\n3. Start writing your game in the `Game` class.\n\nAll functions and properties listed below are members of the static `Engine` class. For example, if you wanted to draw a line, you could call `Engine.DrawLine()` from anywhere in your code. Documentation for function arguments and enum values can be found in the code itself.\n\n# Example #\n\n![Resizable Textures Example](Docs/example-game.gif)\n\n```C#\nclass Game\n{\n    public static readonly string Title = \"Minimalist Game Framework\";\n    public static readonly Vector2 Resolution = new Vector2(128, 128);\n\n    // Define some constants controlling animation speed:\n    static readonly float Framerate = 10;\n    static readonly float WalkSpeed = 50;\n\n    // Load some textures when the game starts:\n    Texture texKnight = Engine.LoadTexture(\"knight.png\");\n    Texture texBackground = Engine.LoadTexture(\"background.png\");\n\n    // Keep track of the knight's state:\n    Vector2 knightPosition = Resolution / 2;\n    bool knightFaceLeft = false;\n    float knightFrameIndex = 0;\n\n    public Game()\n    {\n    }\n\n    public void Update()\n    {\n        // Draw the background:\n        Engine.DrawTexture(texBackground, Vector2.Zero);\n\n        // Use the keyboard to control the knight:\n        Vector2 moveOffset = Vector2.Zero;\n        if (Engine.GetKeyHeld(Key.Left))\n        {\n            moveOffset.X -= 1;\n            knightFaceLeft = true;\n        }\n        if (Engine.GetKeyHeld(Key.Right))\n        {\n            moveOffset.X += 1;\n            knightFaceLeft = false;\n        }\n        if (Engine.GetKeyHeld(Key.Up))\n        {\n            moveOffset.Y -= 1;\n        }\n        if (Engine.GetKeyHeld(Key.Down))\n        {\n            moveOffset.Y += 1;\n        }\n        knightPosition += moveOffset * WalkSpeed * Engine.TimeDelta;\n\n        // Advance through the knight's 6-frame animation and select the current frame:\n        knightFrameIndex = (knightFrameIndex + Engine.TimeDelta * Framerate) % 6.0f;\n        bool knightIdle = moveOffset.Length() == 0;\n        Bounds2 knightFrameBounds = new Bounds2(((int)knightFrameIndex) * 16, knightIdle ? 0 : 16, 16, 16);\n\n        // Draw the knight:\n        Vector2 knightDrawPos = knightPosition + new Vector2(-8, -8);\n        TextureMirror knightMirror = knightFaceLeft ? TextureMirror.Horizontal : TextureMirror.None;\n        Engine.DrawTexture(texKnight, knightDrawPos, source: knightFrameBounds, mirror: knightMirror);\n    }\n}\n```\n\nArt Source: _[https://o-lobster.itch.io/simple-dungeon-crawler-16x16-pixel-pack](https://o-lobster.itch.io/simple-dungeon-crawler-16x16-pixel-pack)_\n\n# Core #\n\nfloat **`TimeDelta`**\n\n* The amount of time (in seconds) since the last frame.\n\n# Content #\n\nTexture **`LoadTexture`**(string path)\n\n* Loads a texture from the Assets directory. \n* Supports the following formats: BMP, GIF, JPEG, PNG, SVG, TGA, TIFF, WEBP.\n\nResizableTexture **`LoadResizableTexture`**(string path, int leftOffset, int rightOffset, int topOffset, int bottomOffset)\n\n* Loads a resizable texture from the Assets directory. \n* Supports the following formats: BMP, GIF, JPEG, PNG, SVG, TGA, TIFF, WEBP.\n* See below for an explanation of how resizable textures work.\n\nFont **`LoadFont`**(string path, int pointSize)\n\n* Loads a font from the Assets directory for a single text size.\n* Supports the following formats: TTF, FON.\n\nSound **`LoadSound`**(string path)\n\n* Loads a sound file from the Assets directory. \n* Supports the following formats: WAV, OGG.\n\nMusic **`LoadMusic`**(string path)\n\n* Loads a music file from the Assets directory. \n* Supports the following formats: WAV, OGG, MP3, FLAC.\n\n# Graphics #\n\nvoid **`DrawLine`**(Vector2 start, Vector2 end, Color color)\n\n* Draws a line.\n\nvoid **`DrawRectEmpty`**(Bounds2 bounds, Color color)\n\n* Draws an empty rectangle.\n\nvoid **`DrawRectSolid`**(Bounds2 bounds, Color color)\n\n* Draws a solid rectangle.\n\nvoid **`DrawTexture`**(Texture texture, Vector2 position, Color? color, Vector2? size, float rotation, Vector2? pivot, TextureMirror mirror, Bounds2? source, TextureBlendMode blendMode, TextureScaleMode scaleMode)\n\n* Draws a texture.\n* Look at the code for more information about the function arguments. Most of them are optional.\n\nvoid **`DrawResizableTexture`**(ResizableTexture texture, Bounds2 bounds, Color? color, TextureBlendMode blendMode, TextureScaleMode scaleMode)\n\n* Draws a resizable texture.\n* See below for an explanation of how resizable textures work.\n\nBounds2 **`DrawString`**(string text, Vector2 position, Color color, Font font, TextAlignment alignment, bool measureOnly)\n\n* Draws a text string. \n* Returns the bounds of the drawn text.\n\n# Keyboard Input #\n\nbool **`GetKeyDown`**(Key key, bool allowAutorepeat)\n\n* Returns true if a key was pressed down this frame.\n\nbool **`GetKeyHeld`**(Key key)\n\n* Returns true if a key was held during this frame.\n\nbool **`GetKeyUp`**(Key key)\n\n* Returns true if a key was released this frame.\n\nstring **`TypedText`**\n\n* The textual representation of the keys that were pressed this frame.\n\n# Mouse Input #\n\nVector2 **`MousePosition`**\n\n* The current position of the mouse cursor (in pixels).\n\nVector2 **`MouseMotion`**\n\n* The change in position of the mouse cursor this frame (in pixels).\n\nfloat **`MouseScroll`**\n\n* The amount the mouse wheel has been scrolled this frame (in scroll units).\n\nbool **`GetMouseButtonDown`**(MouseButton button)\n\n* Returns true if a mouse button was pressed down this frame.\n\nbool **`GetMouseButtonHeld`**(MouseButton button)\n\n* Returns true if a mouse button was held during this frame.\n\nbool **`GetMouseButtonUp`**(MouseButton button)\n\n* Returns true if a mouse button was released this frame.\n\nvoid **`SetMouseMode`**(MouseMode mode)\n\n* Sets the mouse mode, which controls the visibility and lock state of the cursor.\n\n# Gamepad Input #\n\nbool **`GetGamepadConnected`**(int player)\n\n* Returns true if a player's gamepad is connected.\n\nVector2 **`GetGamepadAxis`**(int player, GamepadAxis axis)\n\n* Reads the analog values of the specified axis on a player's gamepad.\n\nbool **`GetGamepadButtonDown`**(int player, GamepadButton button)\n\n* Returns true if a gamepad button was pressed down this frame.\n\nbool **`GetGamepadButtonHeld`**(int player, GamepadButton button)\n\n* Returns true if a gamepad button was held during this frame.\n\nbool **`GetGamepadButtonUp`**(int player, GamepadButton button)\n\n* Returns true if a gamepad button was released this frame.\n\n# Audio #\n\nSoundInstance **`PlaySound`**(Sound sound, bool repeat, float fadeTime)\n\n* Plays a sound.\n* Returns an instance handle that can be passed to StopSound() to stop playback of the sound.\n\nvoid **`StopSound`**(SoundInstance instance, float fadeTime)\n\n* Stops a playing sound.\n\nvoid **`PlayMusic`**(Music music, bool looping, float fadeTime)\n\n* Plays music, stopping any currently playing music first.\n\nvoid **`StopMusic`**(float fadeTime)\n\n* Stops the current music.\n\n# Utility Classes #\n\nclass **`Vector2`**\n\n* A simple 2D vector class that supports basic vector math operations that is used in many API functions.\n\nclass **`Bounds2`**\n\n* A simple axis-aligned 2D bounding rectangle that is used in a few API functions.\n\nclass **`Color`**\n\n* A data structure representing a 32-bit RGBA color that is used in many API functions. \n* The class also contains static members for all of the built-in .NET colors, e.g. `Color.CornflowerBlue` and others.\n\n# Appendix 1: Screen Resolution #\n\nTo keep things simple, the resolution of the game is fixed and specified at the top of the `Game` class. \n\nIf you hit Alt+Enter while the game is running it will toggle between windowed and fullscreen.\n* When running windowed the window will be the same size as the specified resolution. \n* When running fullscreen the game will scale up to fit your screen and automatically letterbox if the aspect ratios do not match (so that the contents are not distorted).\n\n# Appendix 2: Resizable Textures #\n\nMost of the asset types supported should be fairly obvious, but the framework also supports something ambiguously called a \"resizable texture\". Sometimes also called \"nine-patches\" or \"border textures\", these are textures that are divided into nine areas (specified at load time as numerical offsets from the edges) so that they can be drawn at different sizes without distorting the edges. The following example creates a resizable texture of a button and then draws it four times with different sizes:\n\n```C#\nResizableTexture button = Engine.LoadResizableTexture(\"button.png\", 20, 20, 20, 40);\nEngine.DrawResizableTexture(button, new Bounds2(10, 40, 50, 80));\nEngine.DrawResizableTexture(button, new Bounds2(70, 20, 100, 60));\nEngine.DrawResizableTexture(button, new Bounds2(180, 10, 70, 100));\nEngine.DrawResizableTexture(button, new Bounds2(260, 30, 120, 90));\n```\n\n![Resizable Textures Example](Docs/resizable-textures.png)\n"
  }
]