Beispiel #1
0
void PopupMenu::init()
{
   _contextMenu = 0;
   _lastHoveredAction = 0;
   _highlightedAction = 0;
   // Menus will trigger! Set to make sure our trigger handlers ignore menus.
   menuAction()->setData(-1);
   _cur_menu = this;
   _cur_menu_count = 1;
   _cur_item_width = 0;
   _cur_col_count = 0;
   moveDelta = 0;
   timer = 0;

   connect(this, SIGNAL(hovered(QAction*)), SLOT(popHovered(QAction*)));

   if(MusEGlobal::config.scrollableSubMenus)
   {
      setStyleSheet("QMenu { menu-scrollable: 1; }");
      return;
   }
   
#ifndef POPUP_MENU_DISABLE_AUTO_SCROLL
   timer = new QTimer(this);
   timer->setInterval(100);
   timer->setSingleShot(false);
   connect(timer, SIGNAL(timeout()), SLOT(timerHandler()));
#endif   // POPUP_MENU_DISABLE_AUTO_SCROLL
}
Beispiel #2
0
MainWindow::MainWindow(SkeletonTracker* tracker)
{
    resize(640,480);

    setCentralWidget(&glWindow_);
    setWindowTitle("TUIOSkeleton Tracker");
    
    tracker_ = tracker;
    glWindow_.setTracker(tracker);
    
    timer_ = new QTimer(this);
    connect(timer_, SIGNAL(timeout()), this, SLOT(timerHandler()));
    timer_->start(0);
    
    show();
}
Beispiel #3
0
static void timerTask(void *data)
{	
	Timer *thisTimer;
	void (* timerHandler)(void *);
	void *timerArg;
    UBYTE err;

	for (;;) {
		/* If no ready timers, wait for one.  Note that the mutex is just
		 * to protect the timer queue.  Somebody needs to wake us up when
		 * a timer expires. */
#ifdef OS_DEPENDENT
		OSSemPend(mutex, 0, &err);
#endif
		thisTimer = timerHead.timerNext;
		if ((long)(thisTimer->expiryTime - OSTimeGet()) > 0) {
#ifdef OS_DEPENDENT
			OSSemPost(mutex);
			(void) OSTaskSuspend(OS_PRIO_SELF);
#endif
#if ONETASK_SUPPORT > 0
      // In non multitasking environment - return
      // We don't want to loop for ever!
      return;
#endif
		}
		else {
			/* If the timer is the sentinal, reset the expiry time to the
			 * maximum delay.  This way the timer interrupt handler doesn't
			 * need to do a separate test for the timer queue being empty.
			 */
			if (thisTimer == &timerHead) {
				timerHead.expiryTime = OSTimeGet() + MAXJIFFYDELAY;
			}
			else {
				/* Remove the timer from the queue and if it's marked
				 * as temporary, put it back on the free list. */
				thisTimer = timerHead.timerNext;
				(timerHead.timerNext = thisTimer->timerNext)->timerPrev = &timerHead;
				thisTimer->timerPrev = NULL;
				if (thisTimer->timerFlags & TIMERFLAG_TEMP) {
					thisTimer->timerNext = timerFree;
					timerFree = thisTimer;
				}
			}
			
			/* Update timer counter - used as activity counter for
			 * development purposes. */
			thisTimer->timerCount++;
			
			/* Get the handler parameters which could change when
			 * we post the mutex. */
			timerHandler = thisTimer->timerHandler;
			timerArg = thisTimer->timerArg;
			
			/* Invoke the timer handler.  Make sure that we post the mutex 
			 * first so that we don't deadlock if the handler tries to reset
			 * the timer. */
#ifdef OS_DEPENDENT
			OSSemPost(mutex);
#endif
			timerHandler(timerArg);
		}
	}
}
Beispiel #4
0
void updateChopperDrop(ChopperDrop* game)
{
	int ipc_status;
	message msg;

	resetTickedFlag(game->timer);

	if (driver_receive(ANY, &msg, &ipc_status) != 0)
		return;

	if (is_ipc_notify(ipc_status))
	{
		switch (_ENDPOINT_P(msg.m_source))
		{
		case HARDWARE:
			// Keyboard
			if (msg.NOTIFY_ARG & game->IRQ_SET_KB)
				game->scancode = readFromKBC(0);

			// Timer
			if (msg.NOTIFY_ARG & game->IRQ_SET_TIMER)
				timerHandler(game->timer);

			// Mouse
			if (msg.NOTIFY_ARG & game->IRQ_SET_MOUSE)
				updateMouse();

			// RTC
			if (msg.NOTIFY_ARG & game->IRQ_SET_RTC)
				updateDate(game->date);
			break;
		default:
			break;
		}
	}

	if (game->timer->ticked)
	{
		// Update game states and mouse at 60 FPS

		getMouse()->draw = 1;

		switch(game->currentState)
		{
		case MAIN_MENU_STATE:
			updateMainMenuState(game->state, game->scancode);
			break;
		case GAME_STATE:
			updateGameState(game->state, game->scancode, game->timer->counter);
			break;
		case GAME_OVER_STATE:
			updateGameOverState(game->state, game->scancode);
			break;
		case GAME_WON_STATE:
			updateGameWonState(game->state, game->scancode);
			break;
		default:
			break;
		}

		game->scancode = 0;
		game->draw = 1;
	}

	checkIfStateIsDone(game);
}