1. The Solution

Just wanted to make everybody aware of a DOS solution:

I was trying to print text to the screen a certain number of times per
second. I wasn't able to get above 32 FramesPerSecond, so I tried using
poke methods from Ad and Lucius. When THOSE didn't speed things up I got
concerned...

Anyway, I looked up tick_rate in the docs and, you guessed it, using
tick_rate(100) at the beginning of my main.ex sped things up a-plenty.

So, I guess if you want things to go faster and faster, use
tick_rate(100) (or higher?).

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...

Michael Bolin, got a suggestion or hint?

Thanks!
ck

new topic     » topic index » view message » categorize

2. Re: The Solution

>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 message » categorize

3. Re: The Solution

I, too, have made a useful include file for using keyread.e from Michael
Bolin. I've attached it hereto. If anybody has questions on using it, or
suggestions for improving it, please let me know.


Ralf Nieuwenhuijsen wrote:
>
> >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 message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu