BlitzCoder Essentials
•
Home Page
•
About BlitzCoder
•
Contributors
•
Terms of Use
•
Email Us
Main Areas
•
BlitzCoder Chat
•
Discussions
•
Articles/Tutorials
•
Code Database
•
Link Database
•
Showcase Area
•
Worklogs
•
Competitions
Special Areas
•
Undocumented
Other Blitz Sites
•
Blitz Basic Home
•
Blitz Showcase
•
BlitzPlay Library
Forum Login
Username:
Password:
•
Register Now!
BlitzCoder Code Archives Page
Main Codes Page
"KeyUp function"
, by thechange
Works similar to KeyDown except it returns True when the key was released.
Code
; Uses an array to keep track of pressed keys. ; The necessities part contains everything you need. ; The example program will demonstrate how the function is used. ;--------------------------------------- ; The necessities Dim RememberKey ( 255 ) Function KeyUp ( ScanCode ) Local KeyWasUp = False Local KeyWasDown = KeyDown ( ScanCode ) If KeyWasDown RememberKey ( ScanCode ) = KeyWasDown KeyWasUp = False Else If RememberKey ( ScanCode ) <> KeyWasDown Then RememberKey ( ScanCode ) = KeyWasDown KeyWasUp = True Else KeyWasUp = False EndIf EndIf Return KeyWasUp End Function ;--------------------------------------- ; Example program Repeat For Counter = 2 To 255 If KeyUp ( Counter ) Then Print Counter Next If KeyUp ( 1 ) Then ExitLoop = True Until ExitLoop End ;---------------------------------------
Copyright(c) 2000-2004, BlitzCoder. All Rights Reserved.
Code software created by Krylar's Kreations