main.cpp
Code: Select all
int main(){
EventReceiver receiver;
receiver.h
Code: Select all
#ifndef RECEIVER_H
#define RECEIVER_H
#include "include/irrlicht.h"
using namespace irr;
class EventReceiver: public IEventReceiver{
public:
virtual bool onEvent(const SEvent& event);
virtual bool keyCheck(EKEY_CODE keyCode) const;
EventReceiver();
private:
bool keyIsDown[KEY_KEY_CODES_COUNT];
};
#endif
Code: Select all
#include "receiver.h"
bool EventReceiver::onEvent(const SEvent& event){
if(event.EventType == irr::EET_KEY_INPUT_EVENT){
keyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown;
}
return false;
}
bool EventReceiver::keyCheck(EKEY_CODE keyCode) const{
return keyIsDown[keyCode];
}
EventReceiver::EventReceiver(){
for(u32 i = 0; i < KEY_KEY_CODES_COUNT; ++i){
keyIsDown[i] = false;
}
}
I'm getting an error...
Code: Select all
main.cpp: In function 'int main()':
main.cpp:9:16: error: cannot declare variable 'receiver' to be of abstract type
'EventReceiver'
EventReceiver receiver;
^
In file included from main.cpp:3:0:
receiver.h:10:7: note: because the following virtual functions are pure within
'EventReceiver':
class EventReceiver: public IEventReceiver{
^
In file included from include/ISceneNodeAnimator.h:12:0,
from include/ISceneNode.h:12,
from include/IAnimatedMeshSceneNode.h:8,
from include/irrlicht.h:59,
from main.cpp:2:
include/IEventReceiver.h:446:15: note: virtual bool irr::IEventReceiver::OnEven
t(const irr::SEvent&)
virtual bool OnEvent(const SEvent& event) = 0;
What's my problem?