コード例 #1
0
 /// <summary>Look up the texture details to make sure it matches what we expect
 /// </summary>
 /// <param name="textureHandle">Unsafe handle to the texture</param>
 private void QueryTexture(IntPtr textureHandle)
 {
     SDL.SDL_QueryTexture(textureHandle, out uint format, out int access, out int width, out int height);
     PixelFormat = PixelFormatMap.SDLToEnum(format);
     AccessMode  = (TextureAccessMode)access;
     Width       = width;
     Height      = height;
 }
コード例 #2
0
        internal IntPtr CreateTexture(int width, int height, PixelFormat pixelFormat, TextureAccessMode accessMode)
        {
            uint mappedPixelFormat = PixelFormatMap.EnumToSDL(pixelFormat);

            IntPtr unsafeHandle = SDL.SDL_CreateTexture(renderer.Handle, mappedPixelFormat, (int)accessMode, width, height);

            if (unsafeHandle == IntPtr.Zero)
            {
                throw new InvalidOperationException(Utilities.GetErrorMessage("SDL_CreateTextureFromSurface"));
            }

            return(unsafeHandle);
        }