Пример #1
0
        public static Surface LoadBMP(string imagePath)
        {
            IntPtr filePointer    = SDL2.SDL_RWFromFile(imagePath, "rb");
            IntPtr surfacePointer = SDL_LoadBMP_RW(filePointer, 1);

            if (surfacePointer == null)
            {
                string message = $"Unable to load bitmap {imagePath}! SDL_Error: {SDL2.GetError()}";
                throw new InitializationException(message);
            }

            return(new Surface(surfacePointer));
        }
Пример #2
0
        public Window(string title, int x, int y, int width, int height, WindowOptions options)
        {
            _windowPointer = SDL_CreateWindow(title, x, y, width, height, options);

            if (_windowPointer == null)
            {
                string message = $"Window could not be created! SDL_Error: {SDL2.GetError()}";
                throw new InitializationException(message);
            }

            IntPtr surfacePointer = SDL_GetWindowSurface(_windowPointer);

            Surface = new Surface(surfacePointer);
        }