[SDL] Re: Surface coordinates can't be less than zero?
t.wilson at hazid.com
Wed Nov 23 13:22:04 PST 2005
> I do use clipping and dst rects. All I can assume is that SDL_BlitSurface()
> sets the dst rect's y or x value to 0 if it's less than 0. Is there
> any way around this?
Try rendering to an off screen surface that is larger than your screen,
and then copy a portion of this surface to the actual screen.
You can store the co-ordinates of your graphical items in screen based
co-ordinates as usual, and when they are rendered to the off screen
surface, you first translate them relative to the origin of the screen
on the offscreen surface.
So, for example if your screen is size 100x100 and you have a off screen
surface of size 150x150 this gives you a 25 pixel buffering zone all
round the edge of the screen.
You would translate any screen co-ordinates by (+25, +25) before drawing
to the off screen surface. Then you would blit the off screen surface
from 25,25 to 125,125 to the screen at screen position 0,0.
Hope this makes sense. I tend to ramble.
> SDL mailing list
> SDL at libsdl.org
\ / ASCII Ribbon Campaign
X against HTML email & vCards
More information about the SDL