本文整理汇总了C++中CAnimation::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ CAnimation::Init方法的具体用法?C++ CAnimation::Init怎么用?C++ CAnimation::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAnimation
的用法示例。
在下文中一共展示了CAnimation::Init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: all
/**
** Parse an animation frame
**
** @param str string formated as "animationType extraArgs"
*/
static CAnimation *ParseAnimationFrame(lua_State *l, const char *str)
{
const std::string all(str);
const size_t len = all.size();
size_t end = all.find(' ');
const std::string op1(all, 0, end);
size_t begin = std::min(len, all.find_first_not_of(' ', end));
const std::string extraArg(all, begin);
CAnimation *anim = NULL;
if (op1 == "frame") {
anim = new CAnimation_Frame;
} else if (op1 == "exact-frame") {
anim = new CAnimation_ExactFrame;
} else if (op1 == "wait") {
anim = new CAnimation_Wait;
} else if (op1 == "random-wait") {
anim = new CAnimation_RandomWait;
} else if (op1 == "sound") {
anim = new CAnimation_Sound;
} else if (op1 == "random-sound") {
anim = new CAnimation_RandomSound;
} else if (op1 == "attack") {
anim = new CAnimation_Attack;
} else if (op1 == "spawn-missile") {
anim = new CAnimation_SpawnMissile;
} else if (op1 == "spawn-unit") {
anim = new CAnimation_SpawnUnit;
} else if (op1 == "if-var") {
anim = new CAnimation_IfVar;
} else if (op1 == "set-var") {
anim = new CAnimation_SetVar;
} else if (op1 == "set-player-var") {
anim = new CAnimation_SetPlayerVar;
} else if (op1 == "die") {
anim = new CAnimation_Die();
} else if (op1 == "rotate") {
anim = new CAnimation_Rotate;
} else if (op1 == "random-rotate") {
anim = new CAnimation_RandomRotate;
} else if (op1 == "move") {
anim = new CAnimation_Move;
} else if (op1 == "unbreakable") {
anim = new CAnimation_Unbreakable;
} else if (op1 == "label") {
anim = new CAnimation_Label;
AddLabel(anim, extraArg);
} else if (op1 == "goto") {
anim = new CAnimation_Goto;
} else if (op1 == "random-goto") {
anim = new CAnimation_RandomGoto;
} else if (op1 == "lua-callback") {
anim = new CAnimation_LuaCallback;
} else {
LuaError(l, "Unknown animation: %s" _C_ op1.c_str());
}
anim->Init(extraArg.c_str(), l);
return anim;
}
示例2: Create
CAnimation* CAnimationManager::Create(char* szName)
{
CAnimation* pcAnimation;
pcAnimation = mcList.Add();
if (pcAnimation)
{
pcAnimation->Init();
}
return pcAnimation;
}