本文整理汇总了C++中CAnimation类的典型用法代码示例。如果您正苦于以下问题:C++ CAnimation类的具体用法?C++ CAnimation怎么用?C++ CAnimation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CAnimation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AnimationStateChanged
void CInfoPanel::AnimationStateChanged(bool state)
{
if(!CAnimationManager::GetInstance())
return;
int stav = state;
if(iSourceImage)
{
CAnimation* animation = NULL;
if(iSourceImage->GetAnimation())
{
animation = iSourceImage->GetAnimation();
animation->SetActive(state);
}
else
{
animation = CAnimationManager::GetInstance()->GetAnimation(iSourceImage);
//animation->SetOwnerImage(iSourceImage);
iSourceImage->SetAnimation(animation);
}
//TODO get animation params from UI
/*if(animation)
{
animation->SetStartFrame(iAnimationStartField->value());
animation->SetMSInterval(iAnimationMSIntervalField->value());
animation->SetStopFrame(iAnimationStopField->value());
animation->SetLoop(true);
}*/
animation->SetActive(state);
}
}
示例2: DEBUG
//Static
CAnimation* CSkeleton::AnimationParser(const std::string& p_crszKey, std::ifstream& p_rFile)
{
DEBUG(3, __FUNCTION__, "Parsing skeletal animation");
std::string szData;
CSkeleton* pSkele = new CSkeleton("data/skeletons/" + p_crszKey + ".skel");
CAnimation* pAnim = new CAnimation();
while(!p_rFile.eof())
{
p_rFile >> szData;
DEBUG(3, __FUNCTION__, szData);
if(szData == "end")
break;
if(szData == "nxt") //Next frame
{
DEBUG(3, __FUNCTION__, "Frame added");
pAnim->AddFrame(pSkele);
pSkele = new CSkeleton("data/skeletons/" + p_crszKey + ".skel");
}
else //Transformations
{
pSkele->ApplyTransformation(szData);
}
}
pAnim->AddFrame(pSkele);
return pAnim;
}
示例3: ASSERT
////////////////////////////////////////////////////////////////////////////
// Animations drag/drop
////////////////////////////////////////////////////////////////////////////
LRESULT AnimatorBar::OnBeginDrag(WPARAM wParam, LPARAM lParam)
{
XHTMLTREEMSGDATA *pMsg = (XHTMLTREEMSGDATA *) wParam;
ASSERT(pMsg);
XHTMLTREEDRAGMSGDATA *pData = (XHTMLTREEDRAGMSGDATA *) lParam;
LRESULT lResult = 0;
if (pMsg && pData)
{
// If it's an angle, and there's no other angles..
CAnimation* pAnimation = (CAnimation*)animations.GetItemData(pData->hItem);
if (pAnimation->IsAngle())
{
// Get parent
CAnimation* pParent = (CAnimation*)animations.GetItemData(animations.GetParentItem(pData->hItem));
if (pParent->m_SubAnimations.size() == 1)
lResult = 1;
}
}
return lResult; // return 0 to allow drag
}
示例4: m_frame
/*
* Internal constructor.
*/
CSharedAnimation::CSharedAnimation(const STRING file):
m_frame(-1),
m_tick(0),
m_pAnm(NULL)
{
SHARED_ANIMATIONS::iterator i = m_shared.find(file);
if (i != m_shared.end())
{
// Add a user to the current animation.
i->second->addUser();
m_pAnm = i->second;
}
else
{
// Create a new entry.
CAnimation *p = new CAnimation(file);
if (p->filename().empty())
{
// Filename not assigned during ANIMATION loading: failed to load animation.
delete p;
return;
}
m_shared[file] = m_pAnm = p;
}
}
示例5: GUI_MSG_VISIBLE
void CGUIControl::SetVisible(bool bVisible, bool setVisState)
{
if (bVisible && setVisState)
{ // TODO: currently we only update m_visible from GUI_MSG_VISIBLE (SET_CONTROL_VISIBLE)
// otherwise we just set m_forceHidden
GUIVISIBLE visible;
if (m_visibleCondition)
visible = m_visibleCondition->Get() ? VISIBLE : HIDDEN;
else
visible = VISIBLE;
if (visible != m_visible)
{
m_visible = visible;
SetInvalid();
}
}
if (m_forceHidden == bVisible)
{
m_forceHidden = !bVisible;
SetInvalid();
if (m_forceHidden)
MarkDirtyRegion();
}
if (m_forceHidden)
{ // reset any visible animations that are in process
if (IsAnimating(ANIM_TYPE_VISIBLE))
{
// CLog::Log(LOGDEBUG, "Resetting visible animation on control %i (we are %s)", m_controlID, m_visible ? "visible" : "hidden");
CAnimation *visibleAnim = GetAnimation(ANIM_TYPE_VISIBLE);
if (visibleAnim) visibleAnim->ResetAnimation();
}
}
}
示例6: CreateFader
CAnimation CAnimation::CreateFader(float start, float end, unsigned int delay, unsigned int length, ANIMATION_TYPE type)
{
CAnimation anim;
anim.m_type = type;
anim.AddEffect(new CFadeEffect(start, end, delay, length));
return anim;
}
示例7: 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;
}
示例8: GetAnimation
bool CAnimationManager::IsAnimationPlaying(int nAnimID) const
{
CAnimation* anim = GetAnimation(nAnimID);
if(anim)
return anim->IsPlaying();
else
return false;
}
示例9: AnimationStartFrameChanged
void CInfoPanel::AnimationStartFrameChanged(int val)
{
if(iSourceImage)
{
CAnimation *animation = iSourceImage->GetAnimation();
if(!animation)
return;
animation->SetStartFrame(val);
}
}
示例10: CNinja
CNinja* Factory::CreateNinja(int level)
{
CNinja* ninja = new CNinja();
CAnimation anim;
anim.Load("Resources/AnimationInfo/VG_WhiteNinja1.dat", 1,0.75f);
ninja->AddAnim(anim);
anim.Load("Resources/AnimationInfo/VG_WhiteNinja1.dat", 2,0.15f);
ninja->AddAnim(anim);
anim.Load("Resources/AnimationInfo/VG_WhiteNinja1.dat", 3,0.15f);
ninja->AddAnim(anim);
anim.Load("Resources/AnimationInfo/VG_WhiteNinja1.dat", 4,0.15f);
ninja->AddAnim(anim);
anim.Load("Resources/AnimationInfo/VG_WhiteNinja1.dat", 5,0.15f, false);
ninja->AddAnim(anim);
anim.Load("Resources/AnimationInfo/VG_WhiteNinja1.dat", 6,0.15f);
ninja->AddAnim(anim);
anim.Load("Resources/AnimationInfo/VG_WhiteNinja1.dat", 7,0.15f);
ninja->AddAnim(anim);
anim.Load("Resources/AnimationInfo/VG_WhiteNinja1.dat", 8,0.15f);
ninja->AddAnim(anim);
ninja->SetStrength(16);
ninja->SetDefense(4);
ninja->SetAccuracy(10);
ninja->SetRange(1);
ninja->SetLevel(level);
ObjectManager::GetInstance()->Add(ninja);
return ninja;
}
示例11: MarkDirtyRegion
void CGUIControl::QueueAnimation(ANIMATION_TYPE animType)
{
MarkDirtyRegion();
if (!CheckAnimation(animType))
return;
CAnimation *reverseAnim = GetAnimation((ANIMATION_TYPE)-animType, false);
CAnimation *forwardAnim = GetAnimation(animType);
// we first check whether the reverse animation is in progress (and reverse it)
// then we check for the normal animation, and queue it
if (reverseAnim && reverseAnim->IsReversible() && (reverseAnim->GetState() == ANIM_STATE_IN_PROCESS || reverseAnim->GetState() == ANIM_STATE_DELAYED))
{
reverseAnim->QueueAnimation(ANIM_PROCESS_REVERSE);
if (forwardAnim) forwardAnim->ResetAnimation();
}
else if (forwardAnim)
{
forwardAnim->QueueAnimation(ANIM_PROCESS_NORMAL);
if (reverseAnim) reverseAnim->ResetAnimation();
}
else
{ // hidden and visible animations delay the change of state. If there is no animations
// to perform, then we should just change the state straightaway
if (reverseAnim) reverseAnim->ResetAnimation();
UpdateStates(animType, ANIM_PROCESS_NORMAL, ANIM_STATE_APPLIED);
}
}
示例12: Create
CAnimation* CAnimationManager::Create(char* szName)
{
CAnimation* pcAnimation;
pcAnimation = mcList.Add();
if (pcAnimation)
{
pcAnimation->Init();
}
return pcAnimation;
}
示例13: CAnimation
CAnimation *CAnimation::CreateFader(float start, float end, unsigned int delay, unsigned int length)
{
CAnimation *anim = new CAnimation();
if (anim)
{
CFadeEffect *effect = new CFadeEffect(start, end, delay, length);
if (effect)
anim->AddEffect(effect);
}
return anim;
}
示例14: __ASSERT_ALWAYS
CAnimation* CTestContainer::CreateAnimationByTypeL(TAnimationFlag aAnimationType)
{
__ASSERT_ALWAYS(iAnimationsArray, Panic(TContainerPanicNoArray));
TInt count = iAnimationsArray->Count();
CAnimation* singleAnimationCtl = new (ELeave) CAnimation;
CleanupStack::PushL(singleAnimationCtl);
singleAnimationCtl->iIndex = count;
singleAnimationCtl->iType = aAnimationType;
CAnimateFramesCtl* animationCtl = NULL;
TRAPD(error, animationCtl = CAnimateFramesCtl::NewL());
if (error != KErrNone)
User::Panic(_L("New Animation"), error);
singleAnimationCtl->iAnimationCtl = animationCtl;
animationCtl->SetFileName(iFileName);
TInt resourceReaderId = 0;
switch (aAnimationType)
{
case EDefaultAnimation:
resourceReaderId = R_TBMPANIM_IMAGE1;
break;
case EDefaultAnimationSh:
resourceReaderId = R_TBMPANIM_IMAGE1;
break;
case EBallAnimation:
resourceReaderId = R_TBMPANIM_IMAGE3;
break;
case ERedPurpBallAnimationMaskedBackground:
resourceReaderId = R_TBMPANIM_IMAGE4;
break;
case ETBmpAnimBallAnimWindowCovering:
resourceReaderId = R_TBMPANIM_IMAGE5;
break;
default:
delete singleAnimationCtl;
return NULL;
}
TResourceReader reader;
iCoeEnv->CreateResourceReaderLC(reader,resourceReaderId);
animationCtl->ConstructFromResourceL(reader);
CleanupStack::PopAndDestroy(); // reader
singleAnimationCtl->SetAnimationExtent();
singleAnimationCtl->CopyAttributesFromClientData();
iAnimationsArray->AppendL(singleAnimationCtl);
CleanupStack::Pop(); // singleAnimationCtl
return singleAnimationCtl;
}
示例15: CAnimation
// ----------------------------------------------------------------
// CreateAnimation
// ----------------------------------------------------------------
CAnimation * CAnimationInfo::CreateAnimation()
{
CAnimation * animation = new CAnimation();
animation->SetSpeed( m_Fps );
for ( auto spriteId : m_SpriteId )
{
CSpriteInfo * spriteInfo = CResourceManager::GetInstance().GetSpriteInfo( spriteId );
animation->AddSprite( spriteInfo->CreateSprite() );
SafeRelease( spriteInfo );
}
return animation;
}