Added more comments.

This commit is contained in:
Deathsbreed 2014-10-19 17:38:22 -05:00
parent 9600522e10
commit 320458ead7

View File

@ -1,18 +1,23 @@
#include "eventReceiver.h" #include "eventReceiver.h"
// Initialize
EventReceiver::EventReceiver() { EventReceiver::EventReceiver() {
// Set all keys to false, because none of them are pressed
for(u32 i = 0; i < KEY_KEY_CODES_COUNT; i++) { for(u32 i = 0; i < KEY_KEY_CODES_COUNT; i++) {
KeyIsDown[i] = false; KeyIsDown[i] = false;
} }
} }
bool EventReceiver::OnEvent(const SEvent &event) { bool EventReceiver::OnEvent(const SEvent &event) {
// If the input event is a key press
if(event.EventType == irr::EET_KEY_INPUT_EVENT) { if(event.EventType == irr::EET_KEY_INPUT_EVENT) {
// Set our keyIsDown variable to the event one
KeyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown; KeyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown;
} }
return false; return false;
} }
const bool EventReceiver::IsKeyDown(EKEY_CODE keyCode) { const bool EventReceiver::IsKeyDown(EKEY_CODE keyCode) {
// Return if the key is down
return KeyIsDown[keyCode]; return KeyIsDown[keyCode];
} }