CSplash.cpp
上传用户:snevogroup
上传日期:2008-06-06
资源大小:432k
文件大小:1k
- #include <eikenv.h>
- #include "CSplash.h"
- #include <images.mbg>
- // construct and destruct
- // NewL()
- CSplash* CSplash::NewL(CWindowGc& aGc, RWindow& aWindow)
- {
- CSplash* self = new (ELeave) CSplash(aGc, aWindow);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
-
- return self;
- }
- CSplash::CSplash(CWindowGc& aGc, RWindow& aWindow)
- : iGc( aGc )
- , iWindow( aWindow )
- {}
- // ~CSplash()
- CSplash::~CSplash()
- {
- delete ibitmap;
- ibitmap = NULL;
- }
- // ConstuctL()
- void CSplash::ConstructL()
- {
- // load the bitmap from an .mbm file
- _LIT(KPathName, "\System\Apps\Tetris\images.mbm");
- ibitmap = CEikonEnv::Static()->CreateBitmapL(KPathName, EMbmImagesLogo);
- iCount = -11;
- }
- ///////////////////////////////////////////////////////////////////////
- // Other method
- // Show() @return 1 -- keep running else stop
- TBool CSplash::Draw()
- {
- if(iCount == 0)
- User::After(1000000);
- ++iCount;
- if(iCount < 11)
- {
- iGc.Activate( iWindow );
- iGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
- iGc.SetBrushColor(KRgbBlack);
- iGc.Clear();
- if(iCount < 0)
- iGc.SetFadingParameters(0, iCount*25);
- else
- iGc.SetFadingParameters(0, 255 - iCount*25);
- iGc.SetFaded(ETrue);
-
- iGc.BitBlt(TPoint(20, 60), ibitmap);
- iGc.Deactivate();
- }
- else
- {
- User::After(100000);
- iGc.Activate( iWindow );
- iGc.SetFaded(EFalse);
- iGc.Deactivate();
- iCount = -11;
- return 0;
- }
- return 1;
- }