⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 explosion.cpp

📁 series60 应用程序开发的源代码 series60 应用程序开发的源代码
💻 CPP
字号:
/**
 *
 * @brief Definition of CExplosion
 *
 * Copyright (c) EMCC Software Ltd 2003
 * @version 1.0
 */

#include "Explosion.h"

#include <aknutils.h>

#include <ClientAnimation.mbg>

_LIT(KFramesPath, "\\system\\apps\\ClientAnimation\\ClientAnimation.mbm");
const TInt KMaxNumFrames = 4;

CExplosion* CExplosion::NewL(TPoint aPoint)
{
    CExplosion* self = CExplosion::NewLC(aPoint);
    CleanupStack::Pop();
    return self;
}

CExplosion* CExplosion::NewLC(TPoint aPoint)
{
    CExplosion* self = new (ELeave) CExplosion(aPoint);
    CleanupStack::PushL(self);
    self->ConstructL();
    return self;
}

CExplosion::CExplosion(TPoint aPoint) :
    iCurrentFrame(0),
    iPoint(aPoint),
    iDescending(EFalse)
{
}

CExplosion::~CExplosion()
{
    iBitmapArray.ResetAndDestroy();
    iMasksArray.ResetAndDestroy();
}

void CExplosion::ConstructL()
{
    CEikonEnv* env = CEikonEnv::Static();
    TFileName framesFile(KFramesPath);
    User::LeaveIfError(CompleteWithAppPath(framesFile));

    iBitmapArray.Append(env->CreateBitmapL(framesFile, EMbmClientanimationExplosionone));
    iBitmapArray.Append(env->CreateBitmapL(framesFile,EMbmClientanimationExplosiontwo));
    iBitmapArray.Append(env->CreateBitmapL(framesFile,EMbmClientanimationExplosionthree));
    iBitmapArray.Append(env->CreateBitmapL(framesFile,EMbmClientanimationExplosionfour));
    iMasksArray.Append(env->CreateBitmapL(framesFile, EMbmClientanimationExplosiononemask));
    iMasksArray.Append(env->CreateBitmapL(framesFile,EMbmClientanimationExplosiontwomask));
    iMasksArray.Append(env->CreateBitmapL(framesFile,EMbmClientanimationExplosionthreemask));
    iMasksArray.Append(env->CreateBitmapL(framesFile,EMbmClientanimationExplosionfourmask));
}

TBool CExplosion::IsFinished()
{
    return iCurrentFrame == 0 && iDescending;
}

void CExplosion::BlitCurrentFrame(CBitmapContext& aBitmapContext)
{
    aBitmapContext.BitBltMasked(iPoint, iBitmapArray[iCurrentFrame], TRect(TPoint(0,0), iBitmapArray[iCurrentFrame]->SizeInPixels()), iMasksArray[iCurrentFrame], ETrue);

    if(iDescending)
    {
        iCurrentFrame--;
    }
    else
    {
        iCurrentFrame++;

        if(iCurrentFrame == KMaxNumFrames)
        {
            iDescending = ETrue;
            iCurrentFrame--;
        }
    }
}
// End of File

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -