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

📄 player.h

📁 RGA: Biowaste Game Example This C++ application demonstrates how to create a 2D mobile game for S60
💻 H
字号:
/*
* ==============================================================================
*  Name        : Player.h
*  Part of     : RGA Game Example
*  Interface   :
*  Description : player sprite
*  Version     : 1.0
*
*  Copyright (c) 2007-2008 Nokia Corporation.
*  This material, including documentation and any related
*  computer programs, is protected by copyright controlled by
*  Nokia Corporation.
* ==============================================================================
*/

#ifndef __PLAYER_H__
#define __PLAYER_H__

#include "RotatingSprite.h"
#include "Level.h"

class CPlayer : public CRotatingSprite
	{
	public:
		CPlayer(CApplicationBase& aApp, CLevel& aLevel);
		virtual ~CPlayer();
		
		/**
		 * Init
		 * initialise player sprite with given images
		 * @param aBitmap sprite image
		 * @param aMask sprite alpha mask, or NULL
		 * @return KErrNone if successfull
		 */
		virtual TInt Init(	IBitmap* aBitmap,
							IBitmap* aMask);
		
		/**
		 * Update
		 * updates player object, read input
		 * @param aFrametime frame time multiplier
		 */
		virtual void Update(const TReal64 aFrametime);
		
		/**
		 * Draw
		 * draw player to its current location
		 * sprite is drawn rotated based on current angle
		 * @param aContext context to draw sprite into
		 * @param aCamera camera coordinate to subtract from sprite coordinates
		 */
		virtual void Draw(IGraphicsContext& aContext, const TVector2& aCamera);
		
		/**
		 * SetMaxSpeed
		 * set maximum movement speed of the player
		 */
		void SetMaxSpeed(TReal64 aMaxSpeed);
		
		/**
		 * SetScrollSpeed
		 * scroll speed determines how fast player
		 * ball is rolling. Scroll speed is independent from
		 * movement speed
		 * @param aScrollSpeed speed of roll animation
		 */
		void SetScrollSpeed(TReal64 aScrollSpeed);
		
		/**
		 * MovementSpeed
		 * @return current movement speed
		 */
		TReal64 MovementSpeed() const;
		
	private:
		CLevel&				iLevel;

		IBitmap*			iScrollBuffer;			// owned
		IGraphicsContext*	iScrollBufferContext;	// owned
		
		IBitmap*			iOriginalBitmap;

		TReal64				iBallAnimationPhase;
		
		TReal64				iMaxSpeed;
		TReal64				iScrollSpeed;
		TReal64				iMovementSpeed;
	};

#endif /* __PLAYER_H__ */

⌨️ 快捷键说明

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