AnimateTank.cpp
上传用户:royluo
上传日期:2007-01-05
资源大小:1584k
文件大小:2k
源码类别:

游戏

开发平台:

Visual C++

  1. /*****************************************************************************
  2. *                                                                             
  3. *   AnimateTank.cpp
  4. *                                                                             
  5. *   Electrical Engineering Faculty - Software Lab                             
  6. *   Spring semester 1998                                                      
  7. *                                                                             
  8. *   Tanks game                                                                
  9. *                                                                             
  10. *   Module description: Implements the animated tanks shown in the game setting
  11. *                       dialog.
  12. *                       
  13. *                                                                             
  14. *   Authors: Eran Yariv - 28484475                                           
  15. *            Moshe Zur  - 24070856                                           
  16. *                                                                            
  17. *                                                                            
  18. *   Date: 23/09/98                                                           
  19. *                                                                            
  20. ******************************************************************************/
  21. #include "stdafx.h"
  22. #include "Tanks.h"
  23. #include "AnimateTank.h"
  24. #include <GameConsts.h>
  25. #ifdef _DEBUG
  26. #define new DEBUG_NEW
  27. #undef THIS_FILE
  28. static char THIS_FILE[] = __FILE__;
  29. #endif
  30. CAnimateTank::CAnimateTank() :
  31.         m_bSelected (FALSE),
  32.         CAnimateCtrl()
  33. {}
  34. void CAnimateTank::Select ()
  35. {
  36.     m_bSelected = TRUE;
  37.     Play (0,UINT(-1),UINT(-1));
  38. }
  39. void CAnimateTank::Unselect ()
  40. {
  41.     m_bSelected = FALSE;
  42.     Stop();
  43.     Seek(0);
  44. }
  45. BOOL CAnimateTank::Init(int index, CWnd *pParent) 
  46. {
  47.     SubclassDlgItem (IDC_ANIMATE_TANK1 + index - 1, pParent);
  48.     if (!Open (IDR_AVI_TANK0 + index - 1))
  49.         return FALSE;
  50.     SetWindowPos (&wndTop, 10 + (index-1) * (10+TANK_ANIM_WIDTH), 10, 
  51.           TANK_ANIM_WIDTH, TANK_ANIM_HEIGHT, 0);
  52.     return TRUE;
  53. }