www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/21/00:00:26

From: Mike McLean <libolt AT primenet DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Allegro: reading input and comparing with switch
Date: 20 Nov 1997 16:43:00 -0700
Organization: Primenet Services for the Internet
Lines: 46
Message-ID: <3474CB66.BBF414A5@primenet.com>
MIME-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I have functions that read in input using allegro's readkey command, and
I have that character or letter checked by a switch statement.  The
Problem is sometimes it takes 2 or 3 times hitting the key to get it to
read it.  I'm stuck here.  Please help me out.

BTW Thanks to all those that helped me out with my question on MIDI
playing.  It works terrific now! :)

The Code is below:

void raiknerEntrance(int stamina, int strength, int dexterity, int
magic)
{
  char decision[10];
  clear(screen);
  textprintf(screen,font,10,10,2, "     You wake up and find yourself at
the entrance to");
  textprintf(screen,font,10,20,2, "a large town.  A sign above you reads
'Raikner Village' ");
  textprintf(screen,font,10,30,2, "A man on horseback passes by on the
road leading inward");
  textprintf(screen,font,10,40,2, "> ");
  readkey();

  switch(readkey() & 0xff)
    {
      case 'f':
        insideRaikner(stamina,strength,dexterity,magic);
        break;

      case 'b':
        raiknerRoad(stamina,strength,dexterity,magic);
        break;

      case 'q':
        exit(1);
        break;

      default:
        break;
    }
}

any help is greatly appreciated.

Mike.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019