[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Creating unique userevent ids?
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Creating unique userevent ids?
- From: "Ian Mallett" <geometrian@xxxxxxxxx>
- Date: Mon, 25 Feb 2008 12:40:45 -0800
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Mon, 25 Feb 2008 15:40:50 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=nYQALH1zJ8XrzZ0JDPLJP7bg8Miw9cFHA1YLzq+FQKs=; b=eww6z/H5kPlX6ZCxexSR3cBRY+Cv9pDRX9urvDuhcj5mtVE9k0oP97mcFomXeqmvSEvCptBVwI3c+hV5CxDGRZI0Z48Xk+nHAjcBK2zG1N7O3f5nGqVm5/IfzWa6xD83q8GZWGmP31mwQ0IEfZA5gVOvlIMnV4Zkz7HfFJZ1Sxo=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=ZjGiUi2gv3OBrRgMPkqcHrZToiQZI1UD3eMXJdJwKAAl5V71iPkGze+Ph6xV3jTcRyKoArjBEYEsA5gS/C5LHTaJppGVfsS2AEqno3YVHsymd8Z8RcW08ge12p+mssqNRH+o8gWrQME8EsvjQSqapo3v2+kbhQUsuRtaK+BkxTc=
- In-reply-to: <47C324FE.5070301@xxxxxxxxxx>
- References: <47C324FE.5070301@xxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
I really have no idea what I'm talking about. :)If I have separate modules that must use the same set of integers to do something, (like my solution for wxPython menu bindings), I go like this:
module number + number
1 + 1 = 11
2 + 52 = 252
1 + 31 = 131
...and so on. This ensures that the bandwidth for each module remains reserved. All of the numbers beginning in 1 belong to module 1, like 11, 110, and 1100, all the ones to 2 begin with 2, like 21, 210, and 2100. You could add this value to pygame.USEREVENT for each submodule.
I've never used pygame.USEREVENT, so I have no idea what I'm talking about. This might totally work, or be completely in the wrong direction. I apologise in the case of the latter. :)
HTH
Ian
--
There are 10 kinds of people;
those who understand binary and those who don't.
Without order nothing can exist - without chaos nothing can evolve.