Example #1
0
	// ----------------------------------------------------------------------------
	void CInterfaceAnim::update()
	{
		if ((_Duration == 0) || (_Finished))
			return;

		const CWidgetManager::SInterfaceTimes &times = CWidgetManager::getInstance()->getInterfaceTimes();

		// Delta time limiter
		if ( ( times.frameDiffMs / 1000.0f )  > 0.1)
			_CurrentTime += 0.1;
		else
			_CurrentTime += ( times.frameDiffMs / 1000.0f );

		// Stop the anim if we have to
		if (_AnimHasToBeStopped)
		{
			stop();
			return;
		}

		// Do this here to let it play the last frame of the animation
		if (_CurrentTime >= _Duration)
		{
			_CurrentTime = _Duration;
			_AnimHasToBeStopped = true;
		}

		// Update tracks
		for (uint i = 0; i < _Tracks.size(); ++i)
		{
			CInterfaceTrack *pTrack = _Tracks[i];
			pTrack->update (_CurrentTime);
		}
	}
Example #2
0
// ----------------------------------------------------------------------------
void CInterfaceAnim::update()
{
	if ((_Duration == 0) || (_Finished))
		return;

	// Delta time limiter
	if (DT > 0.1)
		_CurrentTime += 0.1;
	else
		_CurrentTime += DT;

	// Stop the anim if we have to
	if (_AnimHasToBeStopped)
	{
		stop();
		return;
	}

	// Do this here to let it play the last frame of the animation
	if (_CurrentTime >= _Duration)
	{
		_CurrentTime = _Duration;
		_AnimHasToBeStopped = true;
	}

	// Update tracks
	for (uint i = 0; i < _Tracks.size(); ++i)
	{
		CInterfaceTrack *pTrack = _Tracks[i];
		pTrack->update (_CurrentTime);
	}
}
Example #3
0
	// ----------------------------------------------------------------------------
	bool CInterfaceAnim::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
	{
		CXMLAutoPtr ptr;

		ptr = xmlGetProp (cur, (xmlChar*)"id");
		_Id = (const char*)ptr;

		ptr = xmlGetProp (cur, (xmlChar*)"duration");
		if (!ptr)
		{
			nlwarning("anim with no duration");
			return false;
		}
		fromString((const char*)ptr, _Duration);
		if (_Duration == 0)
			_Duration = 1.0;
		_Duration *= CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionMulCoefAnim).getValFloat();

		ptr = xmlGetProp (cur, (xmlChar*)"disable_buttons");
		if (ptr)
			_DisableButtons = CInterfaceElement::convertBool(ptr);

		ptr = (char*) xmlGetProp( cur, (xmlChar*)"on_finish" );
		if (ptr) _AHOnFinish = (const char *) ptr;
		ptr = (char*) xmlGetProp( cur, (xmlChar*)"on_finish_params" );
		if (ptr) _AHOnFinishParams = (const char *) ptr;

		cur = cur->children;

	//	bool ok = true;
		while (cur)
		{
			// Check that this is a key node
			if ( stricmp((char*)cur->name,"track") != 0 )
			{
				cur = cur->next;
				continue;
			}

			CInterfaceTrack *pTrack = new CInterfaceTrack;
			if (!pTrack->parse(cur,parentGroup))
			{
				delete pTrack;
				nlwarning("track not added to anim");
			}
			else
			{
				_Tracks.push_back(pTrack);
			}
			cur = cur->next;
		}

		_Parent = parentGroup;

		return true;
	}