Пример #1
0
        public static IntPtr LoadTextureFromImage(string path, IntPtr renderer)
        {
            var texture = SDL_image.IMG_LoadTexture(renderer, path);

            if (texture == IntPtr.Zero)
            {
                SdlLogger.Error(nameof(SDL_image.IMG_LoadTexture));
            }

            return(texture);
        }
Пример #2
0
        public static IntPtr LoadTextureFromBitmap(string path, IntPtr renderer)
        {
            var texture = IntPtr.Zero;

            var image = SDL.SDL_LoadBMP(path);

            if (image != IntPtr.Zero)
            {
                texture = SDL.SDL_CreateTextureFromSurface(renderer, image);
                SDL.SDL_FreeSurface(image);

                if (texture == IntPtr.Zero)
                {
                    SdlLogger.Error(nameof(SDL.SDL_CreateTextureFromSurface));
                }
            }
            else
            {
                SdlLogger.Error(nameof(SDL.SDL_LoadBMP));
            }

            return(texture);
        }