tree.h

来自「RGA: Biowaste Game Example This C++ app」· C头文件 代码 · 共 80 行

H
80
字号
/*
* ==============================================================================
*  Name        : Tree.h
*  Part of     : RGA Game Example
*  Interface   :
*  Description : 'fake' 3D tree 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 __TREE_H__
#define __TREE_H__

#include "SpriteBase.h"

/**
 * TTreeLayer
 * tree layer structure.
 * bitmap pointers are not owned by tree object
 */
struct TTreeLayer
	{
	IBitmap*		iBitmap;
	IBitmap*		iMask;
	TReal64			iHeight;
	};

const TUint32 KTransparentColor = 0;

	
class CTree : public CSpriteBase
	{
	public:
		CTree(CApplicationBase& aApp);
		virtual ~CTree();
		
		/**
		 * AddLayer
		 * add new layer into the tree. Tree layers
		 * are not owned by tree objects, but are
		 * shared between trees
		 * @param aLayer pointer to layer
		 */
		void AddLayer(TTreeLayer* aLayer);
	
		/**
		 * Update
		 * @param aFrametime frame time multiplier
		 */
		virtual void Update(const TReal64 aFrametime);
		
		/**
		 * Draw
		 * draw the tree
		 * @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 tree is visible on screen
		 * @param aCamera camera offset
		 * @return ETrue if tree is visible on screen
		 */
		virtual TBool IsVisible(const TVector2& aCamera) const;
		
	private:
		RArray<TTreeLayer*>		iLayers;	// layer data is not owned by tree object
	};

	
#endif /* __TREE_H__ */

⌨️ 快捷键说明

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