I'm using the event receive handler of Halifax and a code snippet of dudeMaN beginners tutorial.
Everything compiles fine but at runtime it generates this exception:
Unhandled exception at 0x00411a66 in Game.exe: 0xC0000005: Access violation reading location 0x00000001.
And its pointing to this line:
switch (event.EventType)
In file: CIrrEventReceiver.cpp
This is my main:
Code: Select all
int main(int argc, char **argv)
{
IrrlichtDevice* device = createDevice(EDT_OPENGL, core::dimension2d<s32>(640,480));
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
CIrrEventReceiver* rv = new CIrrEventReceiver();
device->setEventReceiver(rv);
for(int x=0; x<irr::KEY_KEY_CODES_COUNT; x++) keys[x] = false;
ISceneNode* cube = smgr->addCubeSceneNode();
cube->setPosition(vector3df(0,0,5));
while(device->run() && rv->isKeyUp(KEY_UP))
{
/*if(keys[KEY_KEY_W])
{
cube->setPosition(cube->getPosition()+vector3df(0,0,5));
}*/
driver->beginScene(true, true, video::SColor(255,0,0,255));
smgr->drawAll();
driver->endScene();
}
return 0;
}
What am i doing wrong guys?
Thanks in advance!