Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 I need no keystroke buffer.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Nitro




PostPosted: Fri Jan 17, 2003 3:30 pm   Post subject: I need no keystroke buffer.

in a game when I want to slow down my character by using a delay, the buffer records many keystrokes ahead of where my character is. For instance, if I press a key to activate an animation, but I hold down for a slightly longer period of time, the animation will repeat itself like 4 times. Definately unwanted. how do I fix this?
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Fri Jan 17, 2003 5:49 pm   Post subject: (No subject)

code:

procedure flush
            var ch : string ( 1 )
            loop
                exit when not hasch
                getch ( ch )    % Discard this character
            end loop
        end flush


put this in your code close to top and put in flush when you need to clear out buffer.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: