Exemple #1
0
        public void Load_RW()
        {
            string file       = "test.bmp";
            IntPtr surfacePtr = VideoSetup();
            IntPtr imagePtr   = SdlImage.IMG_Load_RW(Sdl.SDL_RWFromFile(file, "rb"), 1);

            Assert.IsFalse(imagePtr == IntPtr.Zero);
            Sdl.SDL_Rect rect1  = new Sdl.SDL_Rect(0, 0, 200, 200);
            Sdl.SDL_Rect rect2  = new Sdl.SDL_Rect(0, 0, 200, 200);
            int          result = Sdl.SDL_BlitSurface(imagePtr, ref rect1, surfacePtr, ref rect2);

            Sdl.SDL_UpdateRect(surfacePtr, 0, 0, 200, 200);
            Thread.Sleep(sleepTime);
            Assert.AreEqual(result, 0);
            file       = "test.jpg";
            surfacePtr = VideoSetup();
            imagePtr   = SdlImage.IMG_Load_RW(Sdl.SDL_RWFromFile(file, "rb"), 1);
            Assert.IsFalse(imagePtr == IntPtr.Zero);
            result = Sdl.SDL_BlitSurface(imagePtr, ref rect1, surfacePtr, ref rect2);
            Sdl.SDL_UpdateRect(surfacePtr, 0, 0, 200, 200);
            Thread.Sleep(sleepTime);
            Assert.AreEqual(result, 0);
            this.Quit();
        }