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

Re: [pygame] Rects and they handle right and bottom borders



Brian Fisher wrote:
I don't know why rect was set up that way, but one good thing about
the way right & bottom relate to width, is that right = left + width
and bottom = top + height

It's useful for much the same reasons that Python's slice indexing convention is useful. For example, if you're filling two adjacent rectangles, you can make r2.left = r1.right and they will fit together properly.

There's another way of thinking about this that you may
find less confusing. Instead of labelling the pixels,
think of the coordinates as labelling infinitely thin
lines *between* the pixels. Then everything makes
sense.

--
Greg