Ejemplo n.º 1
0
	void tick(sf::RenderWindow* window)
	{
		if(m_transitioning == DONE)
		{
			return;
		}
		
		// Pill lasts for 15 seconds
		if (m_pillTimer->GetElapsedTime() >= PILL_EFFECT_LENGTH && m_transitioning != TO_INSANITY)
		{
			m_transitioning = TO_INSANITY;
			m_alpha = 255;
			m_animTimer->Reset();
		}
		
		// First we tick if we are transitioning
		// Then do some fade effects if the pill is 
		// about to wear out
		if (m_transitioning == TO_INSANITY)
		{
			fadeTick(0.0, 0.25);
			
			if (m_alpha <= 0)
			{
				m_transitioning = DONE;
			}
		}
		else if (m_transitioning == FROM_INSANITY)
		{
			fadeTick(0.0, 10);
		}

		
		window->Draw(m_transition);
	}
Ejemplo n.º 2
0
LongPressSpinner::LongPressSpinner()
{
	m_goodPressFlag = false;
	m_progress = 0.;

	double iconSize = 64.;
#ifdef Q_OS_ANDROID
	iconSize= 192.;
#endif

	QSizeF size = QSizeF(iconSize,iconSize);//.expandTo(QApplication::globalStrut());

	//m_boundingRect = QRectF(QPointF(0,0),size);
	double fingerTipAdjust = 0;
 	#ifdef Q_OS_ANDROID
// 	// TODO Is there some OS preference that indicates right or left handed usage?
	fingerTipAdjust = (iconSize/2)/3;
	#endif

	m_boundingRect = QRectF(QPointF(-iconSize/2 - fingerTipAdjust,-iconSize/2),size);

	connect(&m_goodPressTimer, SIGNAL(timeout()), this, SLOT(fadeTick()));
	m_goodPressTimer.setInterval(333/20);
	//m_goodPressTimer.setSingleShot(true);

}
Ejemplo n.º 3
0
void StatusView::MessageReceived(
	BMessage *message) {
	D_MESSAGE(("StatusView::MessageReceived()\n"));

	switch (message->what) {
		case 'Tick':
			fadeTick();
			break;
			
		case RouteAppNodeManager::M_LOG: {
			D_MESSAGE((" -> RouteAppNodeManager::M_LOG\n"));

			BString title;
			if (message->FindString("title", &title) != B_OK) {
				return;
			}
			BString details, line;
			for (int32 i = 0; message->FindString("line", i, &line) == B_OK; i++) {
				if (details.CountChars() > 0) {
					details << "\n";
				}
				details << line;
			}
			status_t error = B_OK;
			message->FindInt32("error", &error);
			setMessage(title, details, error);
			break;
		}
		default: {
			BStringView::MessageReceived(message);
		}
	}
}