CreditSheet.cpp
上传用户:hkb425
上传日期:2007-06-16
资源大小:34191k
文件大小:3k
源码类别:

游戏引擎

开发平台:

Visual C++

  1. // CreditSheet.cpp: implementation of the CCreditSheet class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "CreditSheet.h"
  6. #include "texmanager.h"
  7. //////////////////////////////////////////////////////////////////////
  8. // Construction/Destruction
  9. //////////////////////////////////////////////////////////////////////
  10. CCreditSheet::CCreditSheet()
  11. {
  12. }
  13. CCreditSheet::~CCreditSheet()
  14. {
  15. }
  16. bool CCreditSheet::InitSheet()
  17. {
  18. RECT rect;
  19. rect.top=555;
  20. rect.bottom=585;
  21. rect.left=300;
  22. rect.right=500;
  23.     m_cBackButton.SetButton(rect,"Back");
  24. /////////////////////photo bar
  25.     rect.top=60;
  26. rect.bottom=265;
  27. rect.left=20;
  28. rect.right=215;
  29. unsigned int texid[4];
  30. CTexManager cTexManager;
  31. texid[0]=cTexManager.GetTextureID(TEX_MY_PHOTO_0);
  32. texid[1]=cTexManager.GetTextureID(TEX_MY_PHOTO_1);
  33. texid[2]=cTexManager.GetTextureID(TEX_MY_PHOTO_2);
  34. m_cPhotoBar.SetChangeBar(rect,texid,3,0);
  35. ///////////// processbar
  36. m_iSelect=-1;
  37.     m_bActive=false;
  38. return true;
  39. }
  40. int CCreditSheet::RenderSheet()
  41. {
  42. if(!m_bActive)return -1;
  43. if(CInput::m_keys[VK_ESCAPE])
  44. {
  45. CInput::m_keys[VK_ESCAPE]=false;
  46. m_iSelect=0;
  47. return 0;
  48. }
  49. if(CInput::m_keys[13]) // key enter pressed
  50. {
  51. CInput::m_keys[13]=false;
  52. m_iSelect=0;
  53. return 0;
  54. }
  55. DrawBackGround();
  56.     m_cBackButton.RenderButton();
  57.     if(m_cBackButton.m_bSelected)
  58. {
  59. m_cBackButton.m_bSelected=false;
  60. m_iSelect=0;
  61. return 0;
  62. }
  63. m_cPhotoBar.RenderChangeBar();
  64. return -1;
  65. }
  66. void  CCreditSheet::DrawBackGround()
  67. {
  68. ///////////////////title and rectangle
  69. CImgText cText;
  70. glColor3f(1,1,0);
  71. cText.PrintString(20,14,"Make Friends",0,24,0);
  72. glColor3f(0.8f,0.8f,0);
  73. cText.PrintString(240,60,"Who am I",0,18,0);
  74.     cText.PrintString(20,295,"My Information",0,18,0);
  75. glColor3f(0.4f,0.8f,0);
  76. int y=340;
  77. int dy=62;
  78.     cText.PrintString(20,y     ,"Name:",0,16,0);
  79.     cText.PrintString(20,y+dy  ,"E-Mail:",0,16,0);
  80.     cText.PrintString(20,y+dy*2,"Birth Day:",0,16,0);
  81. glColor3f(0.0f,1.0f,0);
  82.     y=365;
  83.     cText.PrintString(45,y     ,"Wu Xue Ping",0,16,0);
  84.     cText.PrintString(45,y+dy  ,"Hunter3d@263.net",0,16,0);
  85.     cText.PrintString(45,y+dy*2,"1978.12.12",0,16,0);
  86. glColor3f(0,0.7f,0);
  87. ////////////////
  88. int x0=10,x1=800-x0;
  89. int y0=50,y1=540;
  90.     DrawRectangle( x0, x1, y0, y1);  //  All
  91.     x0=13;  x1=225;
  92. y0=53;  y1=275;
  93.     DrawRectangle( x0, x1, y0, y1);  // left top
  94. y0=278;  y1=537;
  95.     DrawRectangle( x0, x1, y0, y1);  // left bottom
  96. x0=228;  x1=787;
  97. y0=53, y1=537;
  98.     DrawRectangle( x0, x1, y0, y1);  // right 
  99. glColor3f(1,1,1);
  100. }
  101. void CCreditSheet::DrawRectangle(int x0,int x1,int y0,int y1)
  102. {
  103. glBegin(GL_LINE_LOOP);
  104. glVertex3i(x0-400,300-y0,-520);
  105. glVertex3i(x1-400,300-y0,-520);
  106. glVertex3i(x1-400,300-y1,-520);
  107. glVertex3i(x0-400,300-y1,-520);
  108.     glEnd();
  109. }