[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?



On Mon, 03 Oct 2011 17:52:13 +1300
Greg Ewing <greg.ewing@xxxxxxxxxxxxxxxx> wrote:

> > Could be another parameter for the
> > surface (coord_system=PIXEL_CENTRE | PIXEL_BOUNDARIES)!! :P  
> 
> I don't think that would be strictly necessary, because you
> would be able to get the same effect by adjusting the translation
> by 0.5 pixels.
> 
> Also, providing too many options could just lead to confusion.
> Surfaces already have a bewildering collection of options --
> let's not add any more if we don't have to!

Ah, the ambiguities of written langauge! ;) The ":P" was meant to
indicate it was a joke! :)

Anyhow I agree with you that the theory should be well thought out.

So far this is a summary of how I would try to implement the feature:

1. Scaling option... optional. Defaults to 1 and in that case the
   scaling procedure is bypassed at once instantiating a class that
   doesn't have it.
2. Scaling only happens one-way, returned rectangles are in pixels (so
   no floating point coords).
3. Pixels and hairlines are supported without having to specify their
   size by defaulting the unspecified size to 1/scale.

I'm still undecided on whether the positioning should use pixel
boundaries or pixel centres: I think there are good reasons to go for
both. Namely I think "centres" is a more appropriate way to describe
position of objects in a modelled space (nobody says "the car is in the
far end left corner of the garage", as intuitively we consider the
geometrical centre of objects as their most significative one for
positional reference). OTOH, boundaries are way more consistent with
how PyGame operates on standard surfaces.

Again: it might well be that when I will have a crack at it it will
prove beyond my capacities, but before even try to start working on it
(which I shall repeat won't be immediately), I would like to know I'm
moving towards a sensible direction...

/mac