cfont.h

来自「Symbian OS S60平台2D游戏引擎案例」· C头文件 代码 · 共 82 行

H
82
字号
   /*
============================================================================
    * Name : CBmFont.h
    * Part of : 2DExample
    * Description : Definition of CBmFont
    * Copyright (c) 2007 Nokia Corporation
============================================================================
    */

#ifndef __CFONT_H__
#define __CFONT_H__

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

// FORWARD DECLARATIONS
class CBitmap;
class MSystem;

// CLASS DECLARATION

/**
* CFont class handles creation and drawing of bitmap fonts
*/
class CBmFont
	{
	public:

		/**
		* Two-phased constructor.
		*/
		static CBmFont* NewL(CBitmap* aBitmap, MSystem* aSystem );
	
		/**
		* Destructor.
		*/	
		~CBmFont();

	private:

		/**
		* Default constructor
		*/
		CBmFont( CBitmap* aBitmap, MSystem* aSystem );

		/**
		* Second phase constructor
		*/
		void ConstructL( CBitmap* aBitmap );

	public: // New functions
		
		/**
		* Draws string to the given destination and coordinates.
		* @param aTarget Target bitmap.
		* @param aString Text to draw.
		* @param aPosition Text is drawn to this position.
		*/
		void DrawText(  CBitmap& aTarget,  const TDesC8& aString,
				   const TPoint& aPosition );

		/**
		* Draws number to the given destination and coordinates.
		* @param aTarget Target bitmap.
		* @param aNumber Number to be converted to string and drawn.
		* @param aPosition Number is drawn to this position.
		*/
		void DrawNumber(  CBitmap& aTarget,  const TInt aNumber,
				   const TPoint& aPosition );
		
	private: // Data members
				
		TRect		iRects[256];	/// font areas in bitmap
		CBitmap*	iBitmap;		/// font bitmap
		MSystem*    iSystem;		/// pointer to system
	};

#endif

// End of file

⌨️ 快捷键说明

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