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

[pygame] Pygame2 FRect bug



I was working on my rapid-development game framework when I stumbled
upon a highly suspicious behavior. It appears that an FRect's center
can't be assigned values lower than their original values. For
example, if you define a template rectangle orgRect = Rect(0, 0, 30,
30), create a new rectangle newRect = FRect(orgRect), and attempt to
set the center of newRect to values lower than (15, 15) (the center of
orgRect), newRect will remain at (0, 0) with its center at (15, 15).
Here's an example:

import pygame2

def startTest():

    orgRect = pygame2.Rect(0, 0, 20, 20)
    newRect = pygame2.FRect(orgRect)

    newRect.center = (-10, -10)
    print(newRect.center) # (10, 10)
    print(newRect.topleft) # (0, 0)

    newRect.topleft = (-10, -10)
    print(newRect.center) # (0, 0)
    print(newRect.topleft) # (-10, -10)

if __name__ == "__main__":

    startTest()

-- 
Evan Kroske
http://welcome2obscurity.blogspot.com/
The personal blog of Evan Kroske,
novice software developer.