From: Tudor Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro Question Date: Sat, 29 Mar 1997 16:12:01 -0800 Organization: Communications Accesibles Montreal Lines: 24 Message-ID: <333DAFD1.6A33@cam.org> References: <19970329000031723 DOT AAA166 AT ns1 DOT megsinet DOT net> Reply-To: tudor AT cam DOT org NNTP-Posting-Host: dynamicppp-193.hip.cam.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Paul Schmidt wrote: > > 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 I think you'd better use the logical and: If ( xxx && yyy) -- tudor 'at' cam 'dot' org http://www.cam.org/~tudor 'This is Scott Nudds of the Borg. C is irrelevant.'