mcharacter.h

来自「symbian 下的mario游戏源代码」· C头文件 代码 · 共 110 行

H
110
字号
   /*
============================================================================
    * Name : MCharacter.h
    * Part of : 2DMario
    * Description : Definition of MCharacter
    * Copyright (c) 2007 Nokia Corporation
============================================================================
    */

#ifndef __MCHARACTER_H__
#define __MCHARACTER_H__

// INCLUDE FILES
#include <e32std.h>
#include "CBitmap.h"

// FORWARD DECLARATIONS
class CSprite;
class MSystem;

// CONSTANTS
enum TChType 
	{
	KPlayer,
	KMonster,
	KDiamond,
	KDiamondBox,
	KDiamondBoxCollected,
	KCollected,
	KUnsupported
	};

// CLASS DECLARATION

/**
* MCharacter is a base class for the different character types
* in the game
*/
class MCharacter
	{
	public:

		/**
		* Virtual destructor
		*/
		virtual ~MCharacter() {}
		
		/**
		* Activate object.
		*/
		virtual void ActivateL() = 0;
		
		/**
		* Deactivate object.
		*/
		virtual void Deactivate() = 0;
		
		/**
		* Draw object.
		* @param aTarget Target bitmap.
		* @param aCamera Camera position.
		*/
		virtual void Draw( CBitmap& aTarget, const TPoint& aCamera ) = 0;

		/**
		* Move object. This is called by game timer.
		*/		
		virtual void Move() = 0;

		/**
		* Returns the position of object.
		* @return TPoint Object position.
		*/
		virtual TPoint Position() = 0;

		/**
		* Set the position of object.
		* @param aPosition Object position.
		*/
		virtual void SetPosition( const TPoint& aPosition ) = 0;
		
		/**
		* Object has to die. 
		*/		
		virtual void Die() = 0;


		/**
		* Set the type of object.
		* @param aChType Object type.
		*/
		virtual void SetType( const TChType& aChType ) = 0;

		/**
		* Get the type of object.
		* @return TChType Type of the object.
		*/		
		virtual TChType Type() = 0;

		/**
		* Get the sprite of object.
		* @return CSprite* Sprite of the object.
		*/	
		virtual CSprite* Sprite() = 0;
	};

#endif

// End of file

⌨️ 快捷键说明

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