Ejemplo n.º 1
0
 /// <summary>
 /// Erase Rectangles from surface
 /// </summary>
 /// <param name="rectangles">Rectangle to erase</param>
 /// <param name="background">background to use to erase rectangle.</param>
 public void Erase(Collection<Rectangle> rectangles, BaseSdlResource background)
 {
     foreach (Rectangle rectangle in rectangles)
     {
         this.Blit(background, rectangle, rectangle);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Fades in a sound the specified number of times on 
 /// a specific channel, stopping after the specified number of ms
 /// </summary>
 /// <param name="sound">The sound to play</param>
 /// <param name="milliseconds">The number of milliseconds to fade in for
 /// </param>
 /// <param name="loops">The number of loops.  
 /// Specify 1 to have the sound play twice</param>
 /// <param name="ticks">The time limit in milliseconds</param>
 /// <returns>The channel used to play the sound</returns>
 /// <remarks></remarks>
 public int FadeIn(BaseSdlResource sound, int milliseconds, int loops, int ticks)
 {
     if (sound == null)
     {
         throw new ArgumentNullException("sound");
     }
     int ret = SdlMixer.Mix_FadeInChannelTimed(this.index, sound.Handle, loops, milliseconds, ticks);
     if (ret == (int)SdlFlag.Error)
     {
         throw SdlException.Generate();
     }
     return ret;
 }
Ejemplo n.º 3
0
 public Rectangle Blit(
     BaseSdlResource sourceSurface,
     System.Drawing.Point destinationPosition,
     System.Drawing.Rectangle sourceRectangle)
 {
     return this.Blit(sourceSurface,
         new Rectangle(
         destinationPosition.X,
         destinationPosition.Y, 0, 0),
         sourceRectangle);
 }
Ejemplo n.º 4
0
 public Rectangle Blit(
     BaseSdlResource sourceSurface,
     System.Drawing.Rectangle destinationRectangle,
     System.Drawing.Rectangle sourceRectangle)
 {
     if (sourceSurface == null)
     {
         throw new ArgumentNullException("sourceSurface");
     }
     if (this.disposed)
     {
         throw (new ObjectDisposedException(this.ToString()));
     }
     Sdl.SDL_Rect s = Surface.ConvertRectToSdlRect(sourceRectangle);
     Sdl.SDL_Rect d = Surface.ConvertRectToSdlRect(destinationRectangle);
     int result = Sdl.SDL_BlitSurface(sourceSurface.Handle, ref s, this.Handle, ref d);
     GC.KeepAlive(this);
     if (result != (int)SdlFlag.Success)
     {
         throw SdlException.Generate();
     }
     return new Rectangle(d.x, d.y, d.w, d.h);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Renders final frame of movie and puts it on a surface
 /// </summary>
 /// <param name="surface">surface to display frame to</param>
 public void RenderFinalFrame(BaseSdlResource surface)
 {
     if (surface == null)
     {
         throw new ArgumentNullException("surface");
     }
     if (this.Handle != IntPtr.Zero)
     {
         Smpeg.SMPEG_renderFinal(this.Handle, surface.Handle, 0, 0);
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Display video surface
 /// </summary>
 /// <param name="resource">Surface to display movie object on</param>
 public void Display(BaseSdlResource resource)
 {
     if (resource == null)
     {
         throw new ArgumentNullException("resource");
     }
     if (this.Handle != IntPtr.Zero)
     {
         Smpeg.SMPEG_setdisplay(
             this.Handle,
             resource.Handle,
             IntPtr.Zero, null);
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// sets the icon for the current window
 /// </summary>
 /// <param name="icon">the surface containing the image</param>
 /// <remarks>This should be called before Video.SetVideoMode</remarks>
 public static void WindowIcon(BaseSdlResource icon)
 {
     if (icon == null)
     {
         throw new ArgumentNullException("icon");
     }
     Video.Initialize();
     Sdl.SDL_WM_SetIcon(icon.Handle, null);
 }