GameEndWnd.c
Upload User: shyhai1508
Upload Date: 2007-06-11
Package Size: 48k
Code Size: 2k
Category:

BREW

Development Platform:

Visual C++

  1. #include "GameEndWnd.h"
  2. #include "pfly.h"
  3. #include "pfly_res.h"
  4. #include "commondef.h"
  5. #include "GameWnd.h"
  6. #include "ScoreListWnd.h"
  7. static void GameEndWnd_Update(GameEndWnd* pthis);
  8. static boolean GameEndWnd_HandleKeyEvent(GameEndWnd* pthis, AEEEvent eCode, uint16 wParam);
  9. boolean GameEndWnd_New(GameEndWnd *pthis, PflyApp* pMe)
  10. {
  11. pthis->pMe = pMe;
  12. return TRUE;
  13. }
  14. boolean GameEndWnd_Open(GameEndWnd *pthis)
  15. {
  16. pthis->isSucceed = ScoreListWnd_AddToList(&pthis->pMe->score, pthis->pMe->game.layer);
  17. GameEndWnd_Update(pthis);
  18. return TRUE;
  19. }
  20. void GameEndWnd_Close(GameEndWnd *pthis)
  21. {
  22. }
  23. boolean GameEndWnd_HandleEvent(GameEndWnd* pthis, AEEEvent eCode, uint16 wParam, uint32 dwParam)
  24. {
  25. switch (eCode) {
  26. case EVT_APP_SUSPEND:
  27. return TRUE;
  28. case EVT_APP_RESUME:
  29. GameEndWnd_Update(pthis);
  30. return TRUE;
  31. default:
  32. return GameEndWnd_HandleKeyEvent(pthis, eCode, wParam);  
  33. }
  34. }
  35. void GameEndWnd_Free(GameEndWnd* pthis)
  36. {
  37. }
  38. static void GameEndWnd_Update(GameEndWnd* pthis)
  39. {
  40. IDisplay *m_pIDisplay = pthis->pMe->a.m_pIDisplay;
  41. IShell   *m_pIShell = pthis->pMe->a.m_pIShell;
  42.   AECHAR   cat[MAX_STRING_SIZE]; 
  43. AECHAR   str[MAX_STRING_SIZE];
  44. char     temp[MAX_STRING_SIZE];
  45.     IDISPLAY_ClearScreen(m_pIDisplay); 
  46. IDISPLAY_FillRect(m_pIDisplay, NULL, MAKE_RGB(128,138,238));
  47. ISHELL_LoadResString(m_pIShell, PFLY_RES_FILE, IDS_HINTSTR, str, MAX_STRING_SIZE);  
  48. SPRINTF(temp, "%d", pthis->pMe->game.layer);
  49. STRTOWSTR(temp, cat, MAX_STRING_SIZE);
  50. WSTRCAT(str, cat);
  51. IDISPLAY_DrawText(m_pIDisplay, AEE_FONT_NORMAL, str, -1, 0,
  52. 30, NULL, IDF_ALIGN_CENTER | IDF_TEXT_TRANSPARENT);
  53.  
  54. if(pthis->isSucceed) {
  55. ISHELL_LoadResString(m_pIShell, PFLY_RES_FILE, IDS_SUCCSTR, str, MAX_STRING_SIZE);
  56. } else {
  57. ISHELL_LoadResString(m_pIShell, PFLY_RES_FILE, IDS_LOSTSTR, str, MAX_STRING_SIZE);
  58. }
  59. IDISPLAY_DrawText(m_pIDisplay, AEE_FONT_NORMAL, str, -1, 0,
  60. 70, NULL, IDF_ALIGN_CENTER | IDF_TEXT_TRANSPARENT);
  61. IDISPLAY_Update (m_pIDisplay);
  62. }
  63. static boolean GameEndWnd_HandleKeyEvent(GameEndWnd* pthis, AEEEvent eCode, uint16 wParam)
  64. {
  65. if( eCode == EVT_KEY) {
  66.   switch(wParam) {
  67. case AVK_END:
  68. //此处不处理
  69. break;
  70. default:
  71.             Pfly_SetActiveWnd(pthis->pMe, IDW_MAINMENU);
  72. return TRUE;
  73. }
  74. }
  75. return FALSE;
  76. }