Added more comments.
This commit is contained in:
parent
9600522e10
commit
320458ead7
@ -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];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user