Re: The Solution

new topic     » goto parent     » topic index » view thread      » older message » newer message

>Now all I need is a way to rein-in the ever-so-speedy get_keys(). I've
>tried determining if the last key captured is the same as the current
>key pressed, but I just can't get the hang of it all over my program. I
>fear that going back to get_key() wouldn't slow things down much
>anyway...


Actually to get keys to work ok, Ive made this event.e file (im using it in
my latest unreleased botmatch routines.. currently sprites, virtual screen,
botmatch environment etc is already one.. just need to write a nice
interface, some documentation, and wait for Pete to release the latest
Neil..)

Anyways, with event.e you can say a thing like this:

event_scankey (1, {15,5},routine_id ("handler"))

And make sure you call events_run () -- a procedure often enough.
When Escape is pressed for the fist time (escape's scan code is 1) it will
call the routine named "handler" (as defined above). Then it will wait for
the value 1 to repeat itself 15 times before it will call the handler again.
After that it will call the handler every 5 times.

This way you can have set the initial delay and type rate to a different
setting for every key. The scan code of the key pressed is passed to the
handler routine, so you can have multiple keys share the same handler
routine, however for speed its best not to have too many independent keys
share the same handler. It will have to if-through them every time one of
them is pressed.

Eventually, I will add mouse support, and joystick support as well, when I
need it with my botmatch routines. However any one feel free to add them
themselves, or optimize my code. (please do!)

Ralf Nieuwenhuijsen
nieuwen at xs4all.nl
ralf_n at email.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu