📄 mario2dcontainer.h
字号:
/*
============================================================================
* Name : TAudioClip.h
* Part of : 2DMario
* Description : Definition of TAudioClip
* Copyright (c) 2007 Nokia Corporation
============================================================================
*/
#ifndef __MARIO2DCONTAINER_H__
#define __MARIO2DCONTAINER_H__
// INCLUDES
#include <coecntrl.h>
#include <coemain.h>
#include <msvids.h> // Folder Ids
#include <MSVAPI.H>
#include "MSystem.h"
#include "MTimingCall.h"
#include "MAudioSource.h"
// FORWARD DECLARATIONS
class CBitmap;
class MModel;
class CTiming;
class CAudio;
#ifdef __WINS__
const TMsvId KObservedFolderId = KMsvDraftEntryId;
#else
const TMsvId KObservedFolderId = KMsvGlobalInBoxIndexEntryId;
#endif
class TAudioClip
{
public:
inline TAudioClip( const TPtrC8& aData )
: iPosition( 0 )
, iData( aData )
{
}
TInt iPosition; /// play position
TPtrC8 iData; /// pointer to audio data
};
// CLASS DECLARATION
/**
* CMario2DContainer container control class.
*
*/
class CMario2DContainer
: public CCoeControl
, public MCoeForegroundObserver
, public MSystem
, public MTimingCall
, public MAudioSource
, public MMsvSessionObserver
{
public: // Constructors and destructor
void ConstructL(const TRect& aRect);
~CMario2DContainer();
private: // CCoeControl
TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
private: // MCoeForegroundObserver
void HandleGainingForeground();
void HandleLosingForeground();
private: // From MMsvSessionObserver
virtual void HandleSessionEventL(MMsvSessionObserver::TMsvSessionEvent aEvent,
TAny *aArg1, TAny *aArg2, TAny *aArg3);
public: // MSystem
void Exit();
void ChangeModelL( TModel aModel );
TBool KeyState( TInt aKey );
const TFileName& Path();
void AddAudio( const TDesC8& aAudio );
void ToggleAudio();
void PrepareExit();
void LoadMusic();
TUint8 ExitKey();
TUint8 SelectKey();
TUint8 OkKey();
TUint8 BackKey();
public: // MTimingCall
void TimingCall();
public: // MAudioSource
void FillAudio( TInt16* aBuffer, TInt aLength );
public:
// called from AppUi's HandleWsEventL
void HandleScreenDeviceChanged();
private: // new methods
/**
* Inits variables by phone model
*/
void InitPhone();
/**
* Starts audio playback
*/
void StartAudio();
private:
TUint16* iScreenPtr; /// Pointer to screen data
CFbsBitmap iBitmap; /// Screen bitmap
TBool iForeGround; /// Application is foreground or not
CBitmap* iBmScreen; /// Screen bitmap as CBitmap
TUint8 iKeyState[ 256 ]; /// Key press status for each key
TUint8 iExitKey; /// Exit key value
TUint8 iSelectKey; /// Select key value
TUint8 iOkKey; /// Ok key value
TUint8 iBackKey; /// Back key value
CTiming* iTiming; /// Timing class, provides callbacks
TInt iPos; /// Window ordinal position
TTime iLastTime; /// Last screen update time
TFileName iPath; /// Application path
CAudio* iAudio; /// Audio player
MModel* iGameModel; /// game model
MModel* iCurrentModel; /// current ( active ) model
RPointerArray< MModel >iModel; /// list of all models
TBool iChangeModel; /// Model change initiated
TModel iNextModel; /// Next model
TBool iExitFromModel;
TUint8* iMusicData; /// Music data
TInt iMusicLength; /// Music data length
RArray< TAudioClip >iAudioSource; /// list of audio sources
TBool iAudioState; /// Audio on / off
// used by HandleSessionEventL to get SMS notification
CMsvEntry* iMsvEntry;
CMsvSession* iMsvSession;
TMsvId iNewMessageId;
};
#endif
// End of file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -