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

📄 symbolmatrixdrawer.h

📁 RGA: Biowaste Game Example This C++ application demonstrates how to create a 2D mobile game for S60
💻 H
字号:
/*
* ==============================================================================
*  Name        : SymbolMatrixDrawer.h
*  Part of     : RGA Game Example
*  Interface   :
*  Description : helper class for drawing text input symbol matrix
*  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 __SYMBOLMATRIXDRAWER_H__
#define __SYMBOLMATRIXDRAWER_H__


// application base is required only for being able to use
// Symbian font sytem for text drawing
#include "ApplicationBase.h"

#include <textinput.h>          //ngi
#include <graphicscontext.h>	//ngi
using namespace ngi;


class CSymbolMatrixDrawer : public CBase
	{
	public:
		CSymbolMatrixDrawer();
		virtual ~CSymbolMatrixDrawer();
		
		/**
		 * NewL
		 * 1st phase constructor
		 * @param aSymbolMatrix pointer to RGA symbol matrix object
		 * @param aApplication
		 * @return pointer to initialised object
		 */
		static CSymbolMatrixDrawer* NewL(	ISymbolMatrix* aSymbolMatrix,
											CApplicationBase* aApplication);
		
		/**
		 * SetColors
		 * @param aBackgroundColor background fill color
		 * @param aGridColor color of the grid
		 * @param aTextColor font text color
		 */
		void SetColors(	const TRgb& aBackgroundColor,
						const TRgb& aGridColor,
						const TRgb& aTextColor );
		
		/**
		 * SetGridSize
		 * set the pixel size of the single grid in matrix
		 * @param aSize size to set
		 */
		void SetGridSize(const TSize& aSize);
		
		/**
		 * Size
		 * @return size of single matrix grid in pixels
		 */
		TSize GridSize() const;

		/**
		 * Draw
		 * draw symbol matrix
		 * @param aContext graphics context to draw symbol matrix into
		 * @param aFont Symbian font to use when drawing
		 * @param aPosition position to draw matrix into
		 */
		void Draw(	IGraphicsContext& aContext,
					const CFont* aFont,
					const TPoint& aPosition);
		
	private:
		/**
		 * ConstructL
		 * 2nd phase constructor
		 * @param aSymbolMatrix pointer to RGA symbol matrix object
		 * @param aApplication
		 */
		void ConstructL(	ISymbolMatrix* aSymbolMatrix,
							CApplicationBase* aApplication);
		
		/**
		 * DrawHorizontalLine
		 * @param aDevice locked graphics device
		 * @param aX1 start x coordinate
		 * @param aX2 end x coordinate
		 * @param aY y coordinate
		 * @param aColor color of the line
		 */
		void DrawHorizontalLine(	IGraphicsDevice* aDevice,
									TInt aX1,
									TInt aX2,
									TInt aY,
									TUint32 aColor) const;

		/**
		 * DrawVerticalLine
		 * @param aDevice locked graphics device
		 * @param aX x coordinate
		 * @param aY1 start y coordinate
		 * @param aY2 end y coordinate
		 * @param aColor color of the line
		 */
		void DrawVerticalLine(	IGraphicsDevice* aDevice,
								TInt aX,
								TInt aY1,
								TInt aY2,
								TUint32 aColor) const;
		
	private:	// data
		ISymbolMatrix*			iSymbolMatrix;	// not owned
		CApplicationBase*		iApplication;	// not owned
		
		TSize					iGridSize;
		
		TUint32					iBackgroundColor;
		TUint32					iGridColor;
		TRgb					iTextColor;
	};


#endif	// __SYMBOLMATRIXDRAWER_H__

⌨️ 快捷键说明

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