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

📄 rotatingsprite.h

📁 RGA: Biowaste Game Example This C++ application demonstrates how to create a 2D mobile game for S60
💻 H
字号:
/*
* ==============================================================================
*  Name        : RotatingSprite.h
*  Part of     : RGA Game Example
*  Interface   :
*  Description : rotating 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 __ROTATINGSPRITE_H__
#define __ROTATINGSPRITE_H__

#include "SpriteBase.h"
#include "Settings.h"

class CRotatingSprite : public CSpriteBase
	{
	public:
		CRotatingSprite(CApplicationBase& aApp);
		virtual ~CRotatingSprite();
		
		/**
		 * Init
		 * initialise rotating 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 rotating sprite
		 * @param aFrametime frame time multiplier
		 */
		virtual void Update(const TReal64 aFrametime);
		
		/**
		 * Draw
		 * draw sprite 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);
		
		/**
		 * IsVisible
		 * check if rotating is visible on screen
		 * @param aCamera camera offset
		 * @return ETrue if visible on screen
		 */
		virtual TBool IsVisible(const TVector2& aCamera) const;
		
	protected:
		/**
		 * RotateBuffers
		 * rotate sprite into the internal buffers
		 */
		void RotateBuffers();
		
		/**
		 * ComputeRotationAngle
		 * compute sprite rotation angle based on given
		 * vector direction
		 * @param aDirection direction to rotate to
		 */
		void ComputeRotationAngle(const TVector2& aDirection);
		
	protected:	// data
		IBitmap*			iBitmap;				// not owned
		IBitmap*			iMask;					// not owned
	
		IBitmap*			iRotateBuffer[2];			// owned
		IGraphicsContext*	iRotateBufferContext[2];	// owned

		TReal64				iAngle;
		
		CSettings*			iSettings;
	};


#endif /* __ROTATINGSPRITE_H__ */

⌨️ 快捷键说明

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