Advertisement
JeffBobbo

Untitled

Sep 15th, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. class MyEventReceiver : public IEventReceiver
  2. {
  3. public:
  4.     // This is the one method that we have to implement
  5.     virtual bool OnEvent(const SEvent& event)
  6.     {
  7.         // Remember whether each key is down or up
  8.         if (event.EventType == irr::EET_KEY_INPUT_EVENT)
  9.             KeyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown;
  10.  
  11.         return false;
  12.     }
  13.  
  14.     // This is used to check whether a key is being held down
  15.     virtual bool IsKeyDown(EKEY_CODE keyCode) const
  16.     {
  17.         return KeyIsDown[keyCode];
  18.     }
  19.    
  20.     MyEventReceiver()
  21.     {
  22.         for (u32 i=0; i<KEY_KEY_CODES_COUNT; ++i)
  23.             KeyIsDown[i] = false;
  24.     }
  25.  
  26. private:
  27.     // We use this array to store the current state of each key
  28.     bool KeyIsDown[KEY_KEY_CODES_COUNT];
  29. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement