[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Native PyGame method for automatically scaling inputs to a surface resolution?



Mac Ryan wrote:

I suppose there are various ways of using pygame, but I would still
hold that having the scaling function should be "one way only".

As far as drawing is concerned, I tend to agree. The only
difficulty is that some drawing operations in pygame are
defined to return a rect indicating the affected area.
I've never used that feature myself, so I don't have any
use cases to go on, but if a surface with a scaled coordinate
system was being used, I find it hard to imagine that the
calling code would have any use for post-scaling coordinates,
because it's doing all its calculations pre-scaling.

3. Scaling mess: a concrete example... In the application I am
   developing now, I scale the modelled space to match screen
   resolution, but since the objects moving in the space might have
   sub-pixel dimensions if scaled to the same resolution, I am
   often obliged to scale the sprites representing them to a different
   resolution

Yes, sometimes you don't want to just scale everything uniformly,
but do something more complicated. However, I don't see how the
rect returned by the drawing operation is of much help in this
example. You're deciding beforehand how big you want the sprite
to be in pixels, not asking pygame to tell you after the fact.

--
Greg