zzes
unread,Sep 18, 2011, 11:44:40 PM9/18/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Rabbyt
I am trying to use the viewport feature to implement a sort of camera
type thing, (with zooming and panning), but I am getting some very
strange behavior.
left = centerpoint[0]+(size[0]/2)/zoom
right = centerpoint[0]-(size[0]/2)/zoom
top = centerpoint[1]+(size[1]/2)/zoom
bottom = centerpoint[1]-(size[1]/2)/zoom
rabbyt.set_viewport((left, top, right, bottom))
Where (zoom) is the zoom multiplier, centerpoint is the XY of the
middle of the pygame display and size is the size in pixels of the
window, I get my sprites rendered very nicely, but upside-down and
backwards. Zooming works just as expected, and at all zoom levels the
drawn image fills the screen.
If I flip the corner coords:
rabbyt.set_viewport((right, bottom, left, top))
The sprites render rightways-up, but for some reason the image doesn't
scale anymore. (Giving me black bars all around my image)
Is there any way to re-enable automatic stretching to fit the screen?
Or am I doing it all wrong?