On Monday 31 December 2001 06:33, WAL 9000 wrote:

> I notice that neither Race Fever nor Ababall have this problem. Ababall
> lets you use the stylus on the Graffiti area or the main screen... no
> slowdowns, and a buttery-smooth framerate.

Ababall was the first app I made using the pen and I had the same problem 
than you : I found that using the pen eat a lot of time and make the 
framerate drop too much, but using the pen was a very cool feature so I 
needed to find a solution.

Somewhere in the SDK ( sorry, I don't remember exactly where... ) it is 
mentioned that when the pen is used, the hardware is set in a special mode 
which 'consume' more CPU time than usually ( I guess there is an interrupt 
which happen very often, to read the position of the pen ).

I didn't find any way to disable this behaviour and after asking here if it 
could be possible, I didn't get a positive answer, so I think this is maybe 
not possible.

The only thing I find possible to do was to tell the system that I don't care 
about the pen management and to don't loose too much time with it.

Doing that solved most of the issues I had and the time lost by the pen 
management was much more less noticeable.

Here is what I done :

EvtEnableGraffiti( false ) : disable graffiti, so the system don't loose time 
to find which character was made.

In EventLoop, eat all pen events ( SysEventPenDownEvent, SysEventPenMoveEvent 
and SysEventPenUpEvent ) and each time one of these is generated, clear the 
pen queue by calling EvtFlushPenQueue() ( it seems that when there is too 
much stored pen events, the system loose a lot of time managing it ).

I only read the current position of the pen one time per frame and to do 
that, I read the values in the EventPtr structure ( event->screenX and 
event->screenY ), when the pen is down ( event->penDown is true ).

An other important thing, to avoid a system 'freeze' of several seconds : 
don't always use 0 as value for the timeout of EvtGetEvent call !
When you use the pen, the system ( and the hardware ) have a lot of things to 
do, so you need to 'give it' some 'free' time by avoiding too much 
consecutive 0 for the timeout parameter of EvtGetEvent call.

I hope that these suggestions will help you.

-- 
Daniel Morais

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to