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

游戏

开发平台:

Visual C++

  1. /*****************************************************************************
  2. *                                                                             
  3. *   KbdManager.inl
  4. *                                                                             
  5. *   Electrical Engineering Faculty - Software Lab                             
  6. *   Spring semester 1998                                                      
  7. *                                                                             
  8. *   Tanks game                                                                
  9. *                                                                             
  10. *   Contents: Inline functions implementations.
  11. *                                                                             
  12. *   Authors: Eran Yariv - 28484475                                           
  13. *            Moshe Zur  - 24070856                                           
  14. *                                                                            
  15. *                                                                            
  16. *   Date: 23/09/98                                                           
  17. *                                                                            
  18. ******************************************************************************/
  19. inline
  20. CKbdManager::CKbdManager() :
  21. m_pManouverSet(NULL)
  22. {}
  23. inline
  24. CKbdManager::~CKbdManager()
  25. {}
  26. inline void
  27. CKbdManager::SetManouverSet(CManouverSet *pManouverSet)
  28. {
  29.     ASSERT(pManouverSet);
  30.     m_pManouverSet = pManouverSet;
  31. }
  32. inline void
  33. CKbdManager::InitKeysTable()
  34. {
  35.     m_Keys.InitTable();
  36. }
  37. inline BOOL
  38. CKbdManager::SetKey(UINT uKey)
  39. {
  40.     if (! m_pManouverSet)
  41.         return FALSE;
  42.     for (UINT ind = 0; ind < CManouverSet::MAX_MANOUVER_BIT; ind++)
  43.     {   
  44.         if (uKey == m_Keys.GetKey(ind))
  45.         {
  46.                 // Set relevant manouver bit
  47.             m_pManouverSet -> SetBit (ind);
  48.             return TRUE;
  49.         }
  50.     }
  51.     return FALSE;
  52. }
  53. inline BOOL
  54. CKbdManager::UnsetKey(UINT uKey)
  55. {
  56.     if (! m_pManouverSet)
  57.         return FALSE;
  58.     for (UINT ind = 0; ind < CManouverSet::MAX_MANOUVER_BIT; ind++)
  59.     {   
  60.         if (uKey == m_Keys.GetKey(ind))
  61.         {
  62.                 // Set relevant manouver bit
  63.             m_pManouverSet -> UnsetBit (ind);
  64.             return TRUE;
  65.         }
  66.     }
  67.     return FALSE;
  68. }