[SDL] Re: Surface coordinates can't be less than zero?

David Olofson david at olofson.net
Sun Nov 27 11:49:36 PST 2005

On Sunday 27 November 2005 19.27, Nick Stovall wrote:
> > Exactly - that's the result of the clipping operation, and that's
> > what  
> > SDL writes back into the destination rectangle. w and/or h should 
> > alse be affected in this case, and if you hit the right or bottom 
> > edge of the target, clipping should affect *only* w and/or h.
> Oops, I read the previous question wrong. In any case, it SHOULD
> only affect w or h, I'm guess the problem is that it's affecting the
> x- and y- coordinates as well. 

It has to affect x and y as well, when clipping at the left and top 
edges respectively. Otherwise, sprites going off the top and left 
edges would be cut off on the opposite side instead, of appearing to 
move outside the screen.

Anyway, I can't see what the problem is here. Are we all failing to 
understand what the question is about?

Here's the relevant part of the documentation, and I think is pretty 
       int SDL_BlitSurface(SDL_Surface *src,
			SDL_Rect *srcrect, SDL_Surface *dst,
			SDL_Rect *dstrect);

	This performs a fast blit from the source surface
	to the destination surface.

	Only the position is used in the dstrect (the width
	and height are ignored).

	If either srcrect or dstrect are NULL, the entire
	surface (src or dst) is copied.

-->	The  final blit rectangle is saved in dstrect after
-->	all clipping is performed (srcrect is not modified).

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
|  Free/Open Source audio engine for games and multimedia.  |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---

More information about the SDL mailing list