Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyEventReceiver : public IEventReceiver
- {
- public:
- // This is the one method that we have to implement
- virtual bool OnEvent(const SEvent& event)
- {
- // Remember whether each key is down or up
- if (event.EventType == irr::EET_KEY_INPUT_EVENT)
- KeyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown;
- return false;
- }
- // This is used to check whether a key is being held down
- virtual bool IsKeyDown(EKEY_CODE keyCode) const
- {
- return KeyIsDown[keyCode];
- }
- MyEventReceiver()
- {
- for (u32 i=0; i<KEY_KEY_CODES_COUNT; ++i)
- KeyIsDown[i] = false;
- }
- private:
- // We use this array to store the current state of each key
- bool KeyIsDown[KEY_KEY_CODES_COUNT];
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement