edit: It has been fixed
What I do now gets by, but it clearly doesn't handle like a regular keyboard. It misses key presses every so often, and it's highly annoying. I downloaded an allegro game off allegro.cc last night, 3579 or something like that, and it had similar issues where it couldn't keep up with a fast typing user and would mis-read keys.
All I'm looking for is to be able to properly handle keyboard input as it regularly is in a windows environment. Can anyone offer some direction?
How to properly handle the keyboard with allegro
the keyboard is a magic device with mysteries powers... you should handle it with great care.. like you handle your woman... oh' i forgot, your an allegro game hacker, you probably dont know about that
What are you doing now in your input code?
What are you doing now in your input code?
Well, I haven't gotten into the meat of it yet. It's just debug stuff. Here is the call to the function that checks the keys:
if (keyboard_needs_poll()) { poll_keyboard(); } if (DEBUG == true) { Debug->CheckKeys(); }
and here's the CheckKeys function that is just kinda mangled together. It kinda works but notsomuch, hehe
1 | void objDebug::CheckKeys() |
2 | { |
3 | static bool F1_p = false; |
4 | static bool F2_p = false; |
5 | |
6 | if (key[KEY_ESC]) |
7 | { |
8 | GameManager->SetQuit(true); |
9 | } |
10 | |
11 | if (key[KEY_F1] && !(F1_p)) |
12 | { |
13 | if (key_shifts & KB_CTRL_FLAG) |
14 | { |
15 | if (mouse_info == true) |
16 | { |
17 | mouse_info = false; |
18 | } |
19 | else |
20 | { |
21 | mouse_info = true; |
22 | } |
23 | F1_p = true; |
24 | } |
25 | } |
26 | else if (!key[KEY_F1]) |
27 | { |
28 | F1_p = false; |
29 | } |
30 | |
31 | if (key[KEY_F2] && !(F2_p)) |
32 | { |
33 | if (key_shifts & KB_CTRL_FLAG) |
34 | { |
35 | if (timer_info == true) |
36 | { |
37 | timer_info = false; |
38 | } |
39 | else |
40 | { |
41 | timer_info = true; |
42 | } |
43 | F2_p = true; |
44 | } |
45 | } |
46 | else |
47 | { |
48 | F2_p = false; |
49 | } |
50 | } |
Check this out:
if (timer_info == true) { timer_info = false; } else { timer_info = true; }
timer_info = !timer_info;Both snippets do the same. You decide Same applies for the mouse_info variable.
hehe so they do :p thanks for the shortcut