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

David Olofson david at olofson.net
Tue Nov 22 22:56:14 PST 2005


On Wednesday 23 November 2005 04.32, Nick Stovall wrote:
> I'm not sure if this is normal behavior, whenever I have a surface
> whose coordinates are less than 0 in either direction, they are
> automatically pushed back to zero, sometimes very slowly. 

Well, there is one feature that might cause confusion if you don't 
know about it:

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


> This causes problems, as sometimes sprites need to exit the screen
> at the top or left. Any fix for this?

Unless you're seeing something that doesn't match the documented 
behavior:

Always use a temporary SDL_Rect for the destination coordinates. (If 
you need clipped coordinates, you'll find them in that rect after 
each blit. Useful for smart updating with SDL_UpdateRects(), which 
does not perform clipping.)


//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