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_texDoc=cTexManager.GetTextureID(TEX_DOCUMENT);
  35. m_cPhotoBar.SetChangeBar(rect,texid,3,0);
  36. ///////////// processbar
  37. m_iSelect=-1;
  38.     m_bActive=false;
  39. //////////////
  40. return true;
  41. }
  42. int CCreditSheet::RenderSheet()
  43. {
  44. if(!m_bActive)return -1;
  45. if(CInput::m_keys[VK_ESCAPE])
  46. {
  47. CInput::m_keys[VK_ESCAPE]=false;
  48. m_iSelect=0;
  49. return 0;
  50. }
  51. if(CInput::m_keys[13]) // key enter pressed
  52. {
  53. CInput::m_keys[13]=false;
  54. m_iSelect=0;
  55. return 0;
  56. }
  57. DrawBackGround();
  58.     m_cBackButton.RenderButton();
  59.     if(m_cBackButton.m_bSelected)
  60. {
  61. m_cBackButton.m_bSelected=false;
  62. m_iSelect=0;
  63. return 0;
  64. }
  65. m_cPhotoBar.RenderChangeBar();
  66. /////////////////////////////
  67. glColor3f(1,1,1);
  68.     glBindTexture(GL_TEXTURE_2D,m_texDoc);
  69. glEnable(GL_TEXTURE_2D);
  70. glBegin(GL_QUADS);
  71. glTexCoord2f(0,0);
  72.     glVertex3f(-165, -225 ,-520);
  73. glTexCoord2f(1,0);
  74.     glVertex3f(375, -225 ,-520);
  75. glTexCoord2f(1,1);
  76.     glVertex3f(375, 235 ,-520);
  77. glTexCoord2f(0,1);
  78.     glVertex3f(-165, 235 ,-520);
  79. glEnd();
  80.     
  81. /////////////////////////////
  82. return -1;
  83. }
  84. void  CCreditSheet::DrawBackGround()
  85. {
  86. ///////////////////title and rectangle
  87. CImgText cText;
  88. glColor3f(1,1,0);
  89. cText.PrintString(20,14,"Make Friends",0,24,0);
  90. glColor3f(0.8f,0.8f,0);
  91. cText.PrintString(240,60,"Who am I",0,18,0);
  92.     cText.PrintString(20,295,"My Information",0,18,0);
  93. glColor3f(0.4f,0.8f,0);
  94. int y=340;
  95. int dy=62;
  96.     cText.PrintString(20,y     ,"Name:",0,16,0);
  97.     cText.PrintString(20,y+dy  ,"E-Mail:",0,16,0);
  98.     cText.PrintString(20,y+dy*2,"Birth Day:",0,16,0);
  99. glColor3f(0.0f,1.0f,0);
  100.     y=365;
  101.     cText.PrintString(45,y     ,"Wu Xue Ping",0,16,0);
  102.     cText.PrintString(45,y+dy  ,"Hunter3d@263.net",0,16,0);
  103.     cText.PrintString(45,y+dy*2,"1978.12.12",0,16,0);
  104. glColor3f(0,0.7f,0);
  105. ////////////////
  106. int x0=10,x1=800-x0;
  107. int y0=50,y1=540;
  108.     DrawRectangle( x0, x1, y0, y1);  //  All
  109.     x0=13;  x1=225;
  110. y0=53;  y1=275;
  111.     DrawRectangle( x0, x1, y0, y1);  // left top
  112. y0=278;  y1=537;
  113.     DrawRectangle( x0, x1, y0, y1);  // left bottom
  114. x0=228;  x1=787;
  115. y0=53, y1=537;
  116.     DrawRectangle( x0, x1, y0, y1);  // right 
  117. glColor3f(1,1,1);
  118. }
  119. void CCreditSheet::DrawRectangle(int x0,int x1,int y0,int y1)
  120. {
  121. glBegin(GL_LINE_LOOP);
  122. glVertex3i(x0-400,300-y0,-520);
  123. glVertex3i(x1-400,300-y0,-520);
  124. glVertex3i(x1-400,300-y1,-520);
  125. glVertex3i(x0-400,300-y1,-520);
  126.     glEnd();
  127. }