CreateChr.cpp
Upload User: cydong117
Upload Date: 2009-11-10
Package Size: 638k
Code Size: 3k
Development Platform:

Visual C++

  1. #include "stdafx.h"
  2. #define GENDER_MALE 0
  3. #define GENDER_FEMALE 1
  4. #define JOB_WOR 0
  5. #define JOB_TAO 1
  6. #define JOB_SOR 2
  7. CCreateChr::CCreateChr()
  8. {
  9. m_pxImage = NULL;
  10. m_nSelectGender=GENDER_MALE;
  11. m_nSelectJob=JOB_WOR;
  12. }
  13. CCreateChr::~CCreateChr()
  14. {
  15. }
  16. VOID CCreateChr::Create(CWHWilImageData* pxImage)
  17. {
  18. INT nLoop;
  19. // Buttons
  20. BUTTONINFO CharProcBtnInfo[] = {
  21. { IMG_IDX_EMPTY_BTN_UP,  CREATE_CHAR_OK_BTN_POS_X, CREATE_CHAR_OK_BTN_POS_Y, WIDTH_EMPTY_BTN, HEIGHT_EMPTY_BTN}, // Create Charector Ok Button
  22. { IMG_IDX_WAR_BTN_UP,   CREATE_CHAR_WAR_BTN_POS_X, CREATE_CHAR_BTN_POS_Y, WIDTH_JOB_BTN, HEIGHT_JOB_BTN}, // 傈荤 Button
  23. { IMG_IDX_SOR_BTN_UP, CREATE_CHAR_SOR_BTN_POS_X, CREATE_CHAR_BTN_POS_Y, WIDTH_JOB_BTN, HEIGHT_JOB_BTN}, // 贱荤 Button
  24. { IMG_IDX_TAO_BTN_UP,  CREATE_CHAR_TAO_BTN_POS_X, CREATE_CHAR_BTN_POS_Y, WIDTH_JOB_BTN, HEIGHT_JOB_BTN} // 档荤 Button
  25. };
  26. m_pxImage = pxImage;
  27. for(nLoop = 0 ; nLoop < 4; nLoop++)
  28. {
  29. m_xButtons[nLoop].SetBtn(&CharProcBtnInfo[nLoop]);
  30. }
  31. }
  32. HRESULT CCreateChr::OnKeyDown(WPARAM wParam, LPARAM lParam)
  33. {
  34. if (wParam == VK_RETURN || wParam == VK_TAB)
  35. {
  36. return 1;
  37. }
  38. return 0;
  39. }
  40. HRESULT CCreateChr::OnButtonDown(WPARAM wParam, LPARAM lParam)
  41. {
  42. // INT i;
  43. // RECT tRect;
  44. m_fIsButtonDown = TRUE;
  45. return 0;
  46. }
  47. HRESULT CCreateChr::OnButtonDown(POINT ptMouse)
  48. {
  49. m_fIsButtonDown = TRUE;
  50. return 0;
  51. }
  52. HRESULT CCreateChr::OnButtonUp(WPARAM wParam, LPARAM lParam)
  53. {
  54. // INT i;
  55. m_fIsButtonDown = FALSE;
  56. return 0;
  57. }
  58. HRESULT CCreateChr::OnButtonUp(POINT ptMouse)
  59. {
  60. return 0;
  61. }
  62. LRESULT CCreateChr::OnMouseMove(WPARAM wParam, LPARAM lParam)
  63. {
  64. /* INT i;
  65. if(!m_fIsButtonDown)
  66. {
  67. for( i = BTN_NEW_ID ; i <= BTN_OK_ID ; i ++)
  68. {
  69. if (m_xButtons[i].CheckMouseOn(LOWORD(lParam), HIWORD(lParam)))
  70. m_xButtons[i].m_nState = BUTTON_STATE_ON;
  71. else
  72. m_xButtons[i].m_nState = BUTTON_STATE_UP;
  73. }
  74. }
  75. */
  76. return 0;
  77. }
  78. VOID CCreateChr::Render(INT nLoopTime)
  79. {
  80. INT i ;
  81. POINT nPos[] = { {120, 88}, {120, 85}, {150, 108}};
  82. if(m_fIsActive)
  83. {
  84. MoveWindow(g_xChatEditBox.GetSafehWnd(), 
  85.    g_xMainWnd.m_rcWindow.left+280,
  86.    g_xMainWnd.m_rcWindow.top+400, 75, 15, TRUE);
  87. for (i = ID_CREATE_CHR_OK_BTN ; i <= ID_CREATE_CHR_TAO_BTN; i++)
  88. {
  89. m_pxImage->NewSetIndex(m_xButtons[i].m_nButtonID + m_xButtons[i].m_nState -1);
  90. g_xMainWnd.DrawWithImageForComp(m_xButtons[i].m_Rect.left, m_xButtons[i].m_Rect.top,
  91. m_pxImage->m_lpstNewCurrWilImageInfo->shWidth,
  92. m_pxImage->m_lpstNewCurrWilImageInfo->shHeight
  93. , (WORD*)(m_pxImage->m_pbCurrImage));
  94. }
  95. // 烙矫~!
  96. m_pxImage->NewSetIndex(IMG_IDX_WAR_MALE_CREATE + m_nSelectGender + m_nSelectJob * 2);
  97. g_xMainWnd.DrawWithImageForComp(nPos[m_nSelectJob].x,nPos[m_nSelectJob].y
  98. ,m_pxImage->m_lpstNewCurrWilImageInfo->shWidth,m_pxImage->m_lpstNewCurrWilImageInfo->shHeight
  99. ,(WORD*)(m_pxImage->m_pbCurrImage));
  100. }
  101. }
  102. /*
  103. #define GENDER_MALE 0
  104. #define GENDER_FEMALE 1
  105. #define JOB_WOR 0
  106. #define JOB_TAO 1
  107. #define JOB_SOR 2
  108. */