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

[pygame] substract rects



Hi,

has anyone written code to substract rects yet?
I could do it myself but don't want to reinvent the wheel.
I didn't find it on the Code Repository.

The exact problem: I have a Level class, and each Level has a
number of Backgrounds, with associated Rects. Everywhere where
the user has not defined a Background (using the Level editor),
an area with a associated black image will be created. Thus:

a level is created with Rect(0, 0, 1000, 1000).
A background tile is configured for Rect(100, 100, 800, 800).
Rect(0, 0, 1000, 1000) - Rect(100, 100, 800, 800) == \
    [Rect(0, 0, 900, 100), Rect(900, 0, 100, 900),
     Rect(0, 100, 100, 900), Rect(100, 900, 100, 900)]

...so that the rest of the screen is filled with other rects.
Has anyone ever done that?
If not and I write it, I'll share it in the PCR.

regards,
Gerrit.

-- 
24. If persons are stolen, then shall the community and ... pay one
mina of silver to their relatives.
        -- 1780 BC, Hammurabi, Code of Law
--
Asperger Syndroom - een persoonlijke benadering:
	http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
	http://www.sp.nl/