Пример #1
0
void AnimatorBar::UpdateFilmStrip()
{
	film_strip.SetRedraw(false);
	m_ImageList.DeleteImageList();
	film_strip.DeleteAllItems();

	if(!m_pCurrentAnimation)
		return;
	
	m_ImageList.Create(32, 32, ILC_COLOR24, 3, 3);
	film_strip.SetImageList(&m_ImageList, LVSIL_NORMAL);
	
	for (int i = 0; i < m_pCurrentAnimation->m_Images.size(); i++)
	{
		// Create thumbnail & add to filmstrip
		CImageResource* pImage = application->resources.FindImageResourceFromNumber(m_pCurrentAnimation->m_Images[i]);

		if(pImage)
		{
			HBITMAP Bitmap = pImage->GetHBitmap(true,false);
			ImageList_Add(m_ImageList.m_hImageList, Bitmap, Bitmap);


			CString Name;
			Name.Format("%d", i + 1);
			film_strip.InsertItem(i, Name, i);
		}
	}

	film_strip.SetRedraw(true);
	film_strip.Invalidate();
}
Пример #2
0
void CAnimationEditorDlg::UpdateList()
{
	m_Frames.SetRedraw(false);
	m_ImageList.DeleteImageList();
	m_Frames.DeleteAllItems();

	if(!m_CurrentAnimation)
		return;
	
	m_ImageList.Create(32, 32, ILC_COLOR24, 3, 3);
	m_Frames.SetImageList(&m_ImageList, LVSIL_NORMAL);
	
	for (int i = 0; i < m_CurrentAnimation->m_Images.size(); i++)
	{
		// Create thumbnail & add to filmstrip
		CImageResource* image = m_pApplication->FindImageResourceFromNumber(m_CurrentAnimation->m_Images[i]);

		if(image)
		{
				
				HBITMAP Bitmap = image->GetHBitmap(true,false);
				ImageList_Add(m_ImageList.m_hImageList, Bitmap, Bitmap);

				CString name;
				name.Format("%d", i+1);
				m_Frames.InsertItem(i, name, i);
		}
	}

	m_Frames.SetRedraw(true);
	m_Frames.Invalidate();
}
Пример #3
0
void CAnimationEditorDlg::OnTimer(UINT_PTR nIDEvent)
{
	KillTimer(500);

	
	
	


	// Show next bitmap
	if(!m_CurrentAnimation)
	{
		m_Preview.SetBitmap(0);
		return;
	}

	if(m_CurrentAnimation->m_RepeatTo < 1)
		m_CurrentAnimation->m_RepeatTo = 1;
	if(m_CurrentAnimation->m_RepeatTo > m_CurrentAnimation->m_Images.size())
		m_CurrentAnimation->m_RepeatTo = m_CurrentAnimation->m_Images.size();

	if(m_CurrentAnimation->m_Images.size() == 0)
	{
		m_Preview.SetBitmap(0);
		return;
	}

	

	if(m_iPlayForward)
		m_iFrame ++;
	else
		m_iFrame --;

	if (m_iFrame >= m_CurrentAnimation->m_Images.size())
	{		
		if(m_CurrentAnimation->m_bPingPong)
		{
			m_iPlayForward = 1 - m_iPlayForward;
			m_iFrame -=2;
		}
		else
		{
			m_iPlayCount ++;
			m_iFrame = m_CurrentAnimation->m_RepeatTo - 1;
		}
	}
	if(m_iFrame < m_CurrentAnimation->m_RepeatTo-1)
	{
		m_iFrame = m_CurrentAnimation->m_Images.size() - 1;
		m_iPlayForward = 1 - m_iPlayForward;	
		m_iFrame = m_CurrentAnimation->m_RepeatTo-1;
		m_iPlayCount ++;
	}
	
	if(m_iPlayCount < m_CurrentAnimation->m_Repeat || m_CurrentAnimation->m_bForever)
	{
		CImageResource* res = m_pApplication->FindImageResourceFromNumber(m_CurrentAnimation->m_Images[m_iFrame]);
		if(m_Preview.GetBitmap() != res->GetHBitmap(true,true))
			m_Preview.SetBitmap(res->GetHBitmap(true,true));
			
		SetTimer(0, ((int)m_CurrentAnimation->m_FrameTimes[m_iFrame]) * m_CurrentAnimation->m_Speed*20, NULL);
	}
	else
		m_Preview.SetBitmap(NULL);
	CDialog::OnTimer(nIDEvent);
}