delorie.com/archives/browse.cgi | search |
From: | Andrew Crabtree <andrewc AT typhoon DOT rose DOT hp DOT com> |
Message-Id: | <199703290432.AA038299936@typhoon.rose.hp.com> |
Subject: | Re: Allegro Question |
To: | admcs AT megsinet DOT net (Paul Schmidt) |
Date: | Fri, 28 Mar 1997 20:32:15 PST |
Cc: | djgpp AT delorie DOT com |
In-Reply-To: | <19970329000031723.AAA166@ns1.megsinet.net>; from "Paul Schmidt" at Mar 28, 97 6:00 pm |
No - the individual bits are each mapped to a different flag. When you do a bitwise AND you are looking for overlapping bits. No will never have overlapping bits here. Evaluate each separately and then use a logical AND if ((key_shifts & SHIFT) && (key_shifts & CTRL)) { > > How do you use the following? > Do you bitwise AND 2 constants together to see if they are both pressed? > Like if (KB_SHIFT_FLAG & KB_CTRL_FLAG) > printf("Shift and CTRL Pressed\n"); > ? > > extern volatile int key_shifts; > Bitmask containing the current shift/ctrl/alt state. This can contain any > of the flags: > > KB_SHIFT_FLAG > KB_CTRL_FLAG > KB_ALT_FLAG > KB_SCROLOCK_FLAG > KB_NUMLOCK_FLAG > KB_CAPSLOCK_FLAG > KB_INALTSEQ_FLAG > >
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |