[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 Tue, Sep 27, 2011 at 2:13 AM, Mac Ryan <quasipedia@xxxxxxxxx> wrote:
On Sun, 25 Sep 2011 11:41:19 -0400
Christopher Night <cosmologicon@xxxxxxxxx> wrote:

> Suppose the current transformation is (x, y) -> (0.1x, 0.1y). What
> pygame Rect will the following correspond to (after all the
> coordinates are coerced to ints)?

Could you please articulate a bit more? I'm not sure I followed. From
your post it seems to me that you are imagining a two-way
transformation in which you use model-scaled data to the draw
function (draw a 150 metres radius circle) and you also get
model-scaled data when you query the object (what is the size of the
bounding rect for the circle? --> 300 metres).

What I am talking about is just a "one-way" transformation that convert
the input of the drawing functions. In pseudocode:

   >>> init_surface(scale_factor=0.1)
   >>> draw_circle(radius=150)
   >>> get_size_bounding_rect()
   ... 30x30

That's how I understood it... I'm not sure what I said that made it sound like I was thinking of a two-way transformation.... Let me try rephrasing my question using your notation. Please tell me what the following would output (where I have question marks), and tell me if you don't understand what I mean by the pseudocode:

>>> init_surface(scale_factor = 0.1)
>>> r1 = myrect(0, 0, 108, 10)
>>> r1.left = 4
>>> fill_rect(r1)
>>> get_size_bounding_rect()
??? x ???

I assume it would either be 10x1 or 11x1. Do you understand my question now?