New to FreeBASIC? Post your questions here.
Stormy
Posts: 198 Joined: May 28, 2005 17:57
Location: Germany
Contact:
Post
by Stormy » Jun 02, 2005 19:27
Hi guys,
i need a better way to clear the keyboard-buffer than this one:
regards,
Stormy
v1ctor
Site Admin
Posts: 3804 Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:
Post
by v1ctor » Jun 03, 2005 0:12
You could use "while GETKEY <> 0: wend", not that it will speed up anything really..
VonGodric
Posts: 997 Joined: May 27, 2005 9:06
Location: London
Contact:
Post
by VonGodric » Jun 03, 2005 9:20
while not len(inkey$)
wend
lillo
Site Admin
Posts: 447 Joined: May 27, 2005 8:00
Location: Rome, Italy
Contact:
Post
by lillo » Jun 03, 2005 12:32
If too much typing is your problem, you could do:
Code: Select all
#define clear_keybuf while inkey$<>"": wend
clear_keybuf
Stormy
Posts: 198 Joined: May 28, 2005 17:57
Location: Germany
Contact:
Post
by Stormy » Jun 03, 2005 12:40
No, the problem is that my program is stucking for awhile. I'am working on an RPG and when every time this this
will be loaded, the game stucks for a little moment... In DOS-times there was a little interrupt for that necessary...
Stormy
Posts: 198 Joined: May 28, 2005 17:57
Location: Germany
Contact:
Post
by Stormy » Jun 03, 2005 19:43
It is ok now ! I tried out MULTIKEY and I'm happy with this ! Works so smoothly... =)
Antoni
Posts: 1393 Joined: May 27, 2005 15:40
Location: Barcelona, Spain
Post
by Antoni » Jun 03, 2005 19:55
Victor:
Not really a hidden keyword, it's in the keywords list , but you never explained it. And it's in my to do list for the Wiki.....
DrV
Site Admin
Posts: 2116 Joined: May 27, 2005 18:39
Location: Midwestern USA
Contact:
Post
by DrV » Jun 03, 2005 19:56
IIRC, GetKey just returns an integer version of what InKey$ would return... is this correct?
Antoni
Posts: 1393 Joined: May 27, 2005 15:40
Location: Barcelona, Spain
Post
by Antoni » Jun 03, 2005 19:57
You are doing the DOS version and dont' know it??????
v1ctor
Site Admin
Posts: 3804 Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:
Post
by v1ctor » Jun 03, 2005 20:04
Correct.. after 300 or so runtime functions it becomes not so easy to remember.. i can't remember the number of rt functions either.. nm
Antoni
Posts: 1393 Joined: May 27, 2005 15:40
Location: Barcelona, Spain
Post
by Antoni » Jun 03, 2005 20:06
Just kidding...
Well, i did some testing and I can refresh your memory ;)
EDITED:
It removes a char from the keyboard buffer, waiting for it if the buffer is empty and returns it's ascii value. If it's an extended key (so returning 2 chars), it skips the char 255 at the front and returns the ASCII of the second one.