Exemple #1
0
        public void Load()

        {
            string file = "test.bmp";

            IntPtr surfacePtr = VideoSetup();

            IntPtr imagePtr = SdlImage.IMG_Load(file);

            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);

            this.Quit();
        }
Exemple #2
0
        public void SetGetError()
        {
            string error = "Hi there";

            SdlImage.IMG_SetError(error);
            Assert.AreEqual(SdlImage.IMG_GetError(), error);
        }
Exemple #3
0
        public void isTIF()
        {
            string file = "test.tif";

            Assert.IsFalse(SdlImage.IMG_isTIF(Sdl.SDL_RWFromFile(file, "rb")) == IntPtr.Zero);
            Assert.AreEqual(SdlImage.IMG_isTIF(Sdl.SDL_RWFromFile("test.bmp", "rb")), IntPtr.Zero);
            this.Quit();
        }
Exemple #4
0
 public void LinkedVersion()
 {
     Sdl.SDL_version version = SdlImage.IMG_Linked_Version();
     Console.WriteLine("IMG version: " + version.ToString());
     Assert.AreEqual("1.2.5", version.major.ToString()
                     + "." + version.minor.ToString()
                     + "." + version.patch.ToString());
     this.Quit();
 }
Exemple #5
0
        public void LoadTyped_RW()

        {
            string file = "test.gif";

            IntPtr surfacePtr = VideoSetup();

            IntPtr imagePtr = SdlImage.IMG_LoadTyped_RW(Sdl.SDL_RWFromFile(file, "rb"), 1, "gif");

            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.png";

            surfacePtr = VideoSetup();

            imagePtr = SdlImage.IMG_LoadTyped_RW(Sdl.SDL_RWFromFile(file, "rb"), 1, "png");

            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();
        }
Exemple #6
0
 public static Sdl.SDL_version IMG_Linked_Version()
 {
     return((Sdl.SDL_version)Marshal.PtrToStructure(SdlImage.IMG_Linked_VersionInternal(), typeof(Sdl.SDL_version)));
 }