本文整理汇总了C++中Animation::SetDelay方法的典型用法代码示例。如果您正苦于以下问题:C++ Animation::SetDelay方法的具体用法?C++ Animation::SetDelay怎么用?C++ Animation::SetDelay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Animation
的用法示例。
在下文中一共展示了Animation::SetDelay方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
void LoadAnimationRes::Load(LPCTSTR lpszFileName/*=NULL*/)
{
fstream file;
if (lpszFileName)
file.open(lpszFileName, ios_base::in);
else
file.open(szFileName, ios_base::in);
Animation* pAni = NULL;
while (file.good())
{
string buffer;
getline(file, buffer);
if (buffer.empty())
continue;
if (buffer[0] == '/')
continue;
string::size_type pos = buffer.find(' ');
string::size_type prev = 0;
// 데이터를 크게 4부분으로 처리..
string id = buffer.substr(prev, pos-prev);
prev = pos;
pos = buffer.find(' ', prev+1);
int count = atoi(buffer.substr(prev+1, pos-prev-1).c_str());
prev = pos;
pos = buffer.find(' ', prev+1);
int nLoop = atoi(buffer.substr(prev+1, pos-prev-1).c_str());
prev = pos;
pos = buffer.find(' ', prev+1);
int nDelay = atoi(buffer.substr(prev+1).c_str());
if (id.empty())
continue;
pAni = new Animation;
pAni->SetDelay(nDelay);
if (nLoop == 0)
pAni->SetLoop(false);
else
pAni->SetLoop(true);
for (int i = 0; i < count;)
{
getline(file, buffer);
if (buffer.empty())
continue;
if (buffer[0] == '/')
continue;
prev = 0;
pos = buffer.find(' ');
string cfilename = buffer.substr(prev, pos-prev);
prev = pos;
pos = buffer.find(' ', prev+1);
string rect = buffer.substr(prev+1, pos-prev-1);
prev = pos;
pos = buffer.find(' ', prev+1);
string option = buffer.substr(prev+1);
if (cfilename.empty() || rect.empty())
continue;
// filename
wstring wfilename;
string::iterator it;
for (it = cfilename.begin(); it != cfilename.end(); it++)
{
char c = *it;
wchar_t wc = wchar_t(c);
wfilename.append(1, wc);
}
// rect
Rect rc;
prev = 0;
pos = rect.find(',',prev+1);
rc.left = atoi(rect.substr(prev, pos).c_str());
prev = pos;
pos = rect.find(',',prev+1);
rc.top = atoi(rect.substr(prev+1, pos).c_str());
prev = pos;
pos = rect.find(',',prev+1);
rc.right = atoi(rect.substr(prev+1, pos).c_str());
prev = pos;
pos = rect.find(',',prev+1);
rc.bottom = atoi(rect.substr(prev+1, pos).c_str());
Image* pImage = new Image;
pImage->Load(wfilename.c_str(), rc);
//.........这里部分代码省略.........