[AD] Keyboard timing problem

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hello all.

I have just successfully ported Allegro to Amiga OS4 and have it running
quite nicely (albeit waiting for some optimisation), but I have a problem
that I would like to get some feedback on.

The problem is with games accessing the key[] array.  I have a separate
thread that is waiting for keyboard events from the OS.  I then send those
events to cokeybd_thread_func() using the standard
_al_event_source_emit_event() mechanism.  Eventually the keypress makes its
way into the key[] array for the game to poll.  This worked fine until I
implemented my GFX_DRIVER->vsync() routine.

The problem is that now that vsync() is implemented it stops the games from
polling the key[] array at such a high frequency, meaning that the key down
event goes to cokeybd_thread_func() followed by the key up event, and by
the time the game wakes up from its call to vsync() and polls the key[]
array, the key is gone!  So you have to hold the keys down for a while
(maybe a half a second) for them to register with the game.  It has made
games quite unplayable.

I thought about various methods of queueing up keyboard events but anything
I came up with was messy.  I was wondering how the win/osx/linux people
tacked this problem?  After all, it seems to me that all ports would suffer
from this as it is an Allegro architecture issue rather than an Amiga
specific issue.

Ideas?

-- 
/-------------------------------------------------------------------\
[Hitman/Code HQ - 6502/z80/68000/604e/80x86/ARM coder - Amiga rulez!]
[VZ-200/VIC-20/MZ-700/c16/c64*10/c128*8/Plus-4/CPC464/CD32/500*2    ]
[600/1000/1200*2/A4000/SNES/N64/Dreamcast/Athlon 1100/AmigaOne      ]
[Assembly Language: The most fun you can have with your clothes on! ]
\-------------------------------------------------------------------/





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/