Пример #1
0
void RunCount(UInt32 start_tik)
{
    UInt32 tik,dtik;
    run=1;
    while(run==1) {
	tik = TimGetTicks();
	dtik = tik - start_tik;
	drawCount(dtik);

	// call this periodically to hold off auto off  
	if (stopWatchPrefs.disableAutoOff) EvtResetAutoOffTimer();

	// delay one tenth of a sec (.09 acksherly to be sly)
	SysTaskDelay((90 * SysTicksPerSecond())/1000);
	// within loop call SysHandleEvent to
	//  give system opportunity to break in? 
	// /opt/palmdev/sdk-5/include/Core/UI/Event.h
	{ 
	    UInt16 err;
	    EventType e;
	    EvtGetEvent(&e, 0);
	    if (! SysHandleEvent (&e))
		if (! MenuHandleEvent (NULL, &e, &err))
		    if (! ApplicationHandleEvent (&e))
			FrmDispatchEvent (&e);
	}
    }

}
Пример #2
0
/**********************************************************************
 * Function: EventLoop
 * Description: this is the main event loop for the program. It 
 * listens for events for .5 seconds, if none come in, it checks 
 * wheter it should timeout and lock the program. If the unit
 * is scheduled to sleep within the next five seconds, it locks
 * the display. 
 * Note: timeout does not work properly if you overclock you 
 * palm's processor.
 * ********************************************************************/ 
static void 
EventLoop (void) 
{
	EventType event;
	UInt16 error;
	
	do
		
	{
		
			// wait a bit for an event
			EvtGetEvent (&event, 50);

				/* Dont seed with empty events!*/
			if(event.eType != nilEvent)
				random_seed((byte *) &event, sizeof(event)); 
	
			// first the system gets the event, then the Menu event handler, then the application
			// event handler, then finally the form event handler
			if (!SysHandleEvent (&event))
			if (!MenuHandleEvent (0, &event, &error))
				if (!ApplicationHandleEvent (&event))
					FrmDispatchEvent (&event);
	}
	while (event.eType != appStopEvent);
}
Пример #3
0
static void
EventLoop (void)
{
    EventType	event;
    SDWord	timeout;
    UInt32	timer_next;
    Word	error;

    do
    {
        timeout = evtWaitForever;
        timer_next = 0;
        if (needRedisplay)
            timeout = 0;
        else if (game.timer_running)
        {
            UInt32  now = TimGetTicks ();
            int	    sec = (now - game.timer_start) / sysTicksPerSecond;

            timer_next = ((sec + 1) * sysTicksPerSecond + game.timer_start);
            timeout = timer_next - now;
        }
        EvtGetEvent (&event, timeout);
        DIAG (("Event %d\n", event.eType));
        if (timer_next && TimGetTicks () <= timer_next)
            DamageCount ();
        if (needRedisplay && event.eType == nilEvent)
            FrmUpdateForm (mainForm, frmRedrawUpdateCode);
        if (event.eType == nilEvent)
            continue;

        /* Give the system a chance to handle the event. */
        if (! SysHandleEvent (&event))
        {
            if (!MenuHandleEvent (0, &event, &error))
            {
                /* Give the application a chance to handle the event. */
                if (!ApplicationHandleEvent (&event))
                {
                    /* Let the form object provide default handling of the event. */
                    FrmDispatchEvent (&event);
                }
            }
        }
    }
    while (event.eType != appStopEvent);
    // ** SPECIAL NOTE **
    // In order for the Emulator to exit
    // cleanly when the File|Quit menu option is
    // selected, the running application
    // must exit.  The emulator will generate an
    // ÒappStopEventÓ when Quit is selected.
}
Пример #4
0
/* The main event loop */
static void EventLoop(void)
{
    UInt16 err;
    EventType e;

    do {
	EvtGetEvent(&e, evtWaitForever);
	if (! SysHandleEvent (&e))
	    if (! MenuHandleEvent (NULL, &e, &err))
		if (! ApplicationHandleEvent (&e))
		    FrmDispatchEvent (&e);
    } while (e.eType != appStopEvent);
}
Пример #5
0
static void EventLoop( void )
{
	EventType event;
	UInt error;

	do {
		EvtGetEvent( &event, evtWaitForever );
		if( !SysHandleEvent( &event ) )
			if( !MenuHandleEvent( 0, &event, &error ) )
				if( !ApplicationHandleEvent( &event ) )
					FrmDispatchEvent( &event );
	} while( event.eType != appStopEvent );
}
Пример #6
0
/* The main event loop */
static void EventLoop(void)
{
  Word err;
  EventType e;

  do {
    if( EQIsEmpty() ) {
      EvtGetEvent(&e, .66 * SysTicksPerSecond());
    } else {
      EvtGetEvent(&e, .05 * SysTicksPerSecond());
    }
    if (! SysHandleEvent (&e))
      if (! MenuHandleEvent (NULL, &e, &err) )
	if (! ApplicationHandleEvent (&e) )
	  if( ! FrmDispatchEvent (&e) )
            GameEvents();
  } while (e.eType != appStopEvent);
}
Пример #7
0
/* The main event loop */
static void EventLoop(void)
{
        UInt16 err;
        EventType e;
        static float timeout = .05;

        do {
                if( EQIsEmpty() &&
                    timeout < 600 &&
                    !DrawFlashies() )
                {
                        timeout *= 2;
                } else {
                        timeout = .05;
                }

                EvtGetEvent(&e, timeout * SysTicksPerSecond());
                if (! SysHandleEvent (&e))
                        if (! MenuHandleEvent (NULL, &e, &err) )
                                if (! ApplicationHandleEvent (&e) )
                                        if( ! FrmDispatchEvent (&e) )
                                                GameEvents();
        } while (e.eType != appStopEvent);
}