cTextWriter.h
上传用户:sycq158
上传日期:2008-10-22
资源大小:15361k
文件大小:2k
源码类别:

游戏

开发平台:

Visual C++

  1. #include ".applibcSurface.h"
  2. #if !defined(AFX_CTEXTWRITER_H__88B976A5_5576_41EA_8DD2_DC29FA76C0C1__INCLUDED_)
  3. #define AFX_CTEXTWRITER_H__88B976A5_5576_41EA_8DD2_DC29FA76C0C1__INCLUDED_
  4. #include "resource.h"
  5. #if _MSC_VER > 1000
  6. #pragma once
  7. #endif // _MSC_VER > 1000
  8. // This structure is used to define the alphabet for the cTextWrite Class
  9. struct Alphabet
  10. {
  11. unsigned int start;
  12. unsigned int end;
  13. };
  14. //大号位图中字符分割位置
  15. const Alphabet DA[40] = 
  16. {
  17. {0,14},{19,27},{31,46},{47,61},{65,78},{80,94},
  18. {96,110},{114,125},{128,143},{145,159},{160,175},
  19. {176,191},{193,206},{207,222},{224,237},{238,252},{253,267},
  20. {269,284},{285,291},{292,307},{308,323},{324,338},{340,364},
  21. {365,380},{382,397},{398,413},{414,429},{430,444},{447,460},
  22. {464,475},{477,492},{494,508},{509,533},{533,548},{550,564},
  23. {564,579},{579,599},{600,610},{611,615},{617,620}
  24. };
  25. //小号位图中字符分割位置
  26. const Alphabet SDA[40] = 
  27. {
  28. {0,8},{8,14},{16,23},{24,31},{32,40},{40,47},
  29. {48,55},{57,63},{64,72},{72,80},{80,88},
  30. {88,96},{96,103},{104,111},{112,119},{119,126},{126,133},
  31. {134,142},{142,146},{146,154},{154,162},{162,169},{170,183},
  32. {183,191},{191,198},{198,206},{207,215},{215,223},{223,230},
  33. {232,238},{238,246},{247,254},{254,266},{267,274},{275,282},
  34. {282,289},{290,300},{300,305},{305,308},{308,310}
  35. };
  36. //黄色前景位图中字符分割位置
  37. const Alphabet VA[40] = 
  38. {
  39. {0,12},{13,24},{25,37},{36,48},{48,61},{62,74},
  40. {73,86},{86,98},{97,110},{109,122},{121,136},
  41. {136,149},{148,161},{161,175},{175,186},{187,198},{198,211},
  42. {212,226},{225,235},{235,246},{245,258},{258,270},{269,284},
  43. {286,300},{299,315},{315,327},{327,341},{342,355},{355,367},
  44. {366,379},{379,393},{393,406},{406,425},{425,438},{438,451},
  45. {450,462},{463,479},{479,486},{487,494},{495,499}
  46. };
  47. // cTextWriter Class
  48. //
  49. // This class is used to write text on the screen, it just receive a surface
  50. // as a parameter an blit each letter on the screen, using the Alphabet structure
  51. // of the specified font
  52. class cTextWriter  
  53. {
  54. private:
  55. Alphabet* AA;
  56. public:
  57. int m_iAlphabet;
  58. void Destroy();
  59. void Create(int iAlphabet = 1);
  60. int WriteText(LPDIRECTDRAWSURFACE7 pSurface, char* lpszText, int iX, int iY, bool bFixed = false);
  61. cSurface m_surfLetters;
  62. cTextWriter();
  63. virtual ~cTextWriter();
  64. };
  65. #endif // !defined(AFX_CTEXTWRITER_H__88B976A5_5576_41EA_8DD2_DC29FA76C0C1__INCLUDED_)