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

[pygame] issue with pygame.rect.inflate_ip()



Hi,

I'm new here but I'm working whith pygame (1.9.2) since few month.
When I use inflate() or inflate_ip, the resulting size and the new rect.center are never as expected.

reading the sources (1.9.1, rect.c), I found :

self->r.x -= x / 2;
self->r.y -= y / 2;
self->r.w += x;
self->r.h += y;

if (r.w, r.h) is the size of the rect this is correct.
But it woks like if (r.w, r.h)  represents the rect.bottomright corner.
Andin this case, it seems better to write something like :

self->r.x -= x / 2;
self->r.y -= y / 2;
self->r.w += x / 2;
self->r.h += y / 2;

Please, excuse me if I am wrong : I am not a great C reader.

David.