[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Determining if mod keys are pressed
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Determining if mod keys are pressed
- From: Evan Kroske <e.kroske@xxxxxxxxx>
- Date: Sun, 28 Jun 2009 19:32:59 -0400
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Sun, 28 Jun 2009 19:33:02 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=B+YUx/YJDZAZ2def3Vr9HjRllncuh66H6BnntqFVUhQ=; b=R2TnLKqhqDihEr14DrEYbbRDlGQF+NYXVZBPZRFtROjXwZBzx2329MPZl1xtdvtbQ4 xy4+fojcBesyPfDkNeHitxLFAZo7Soz7xIWTs/jku0TJBxKn/Uk9L7wvadC48BeQMcvD CADSA166dPWaBCGNaJUjynfqxYZGlLRyft4tA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=aBr/U+MMQ7Nhp01LeKn60Z9EoCIRLjKMnsmC7FNkVK1Jz7HytzkLs25+9Cq36oR3qI cSIMkrKs8xyowE2m8ByUuWk7MuF7sjGWzs4x8hBeCt1QII+y2uocVNo02FpPSF79crzJ uPUpL42ifjhAZLqJ3Wbosj46GT2m4lC4MpduE=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
I'm trying to make a game with pygame2, but I'm having trouble figuring out how to use the shift and control keys to control the game. I understand that Event.mod returns a number that you can compare to the sdl mod key constants to determine what mod keys are being pressed. However, I also understand that you have to do some kind of bitwise operation to accomplish this, and I have no idea how to do that.
Assuming that pygame is similar to pygame2 in this respect, could somebody give me a code snippet to demonstrate how to detect if a mod key is being pressed? Thanks.
Evan Kroske