I have this in declaration
private:
scene::ISceneNode* Terrain;
public:
/* MyEventReceiver(scene::ISceneNode* terrain)
{
// store pointer to terrain so we can change its drawing mode
Terrain = terrain;
}*/
This is for use key to move character
virtual bool OnEvent(SEvent event)
{
// check if user presses the key 'W' or 'D'
if (event.EventType == irr::EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown)
{
switch (event.KeyInput.Key)
{
case irr::KEY_KEY_W: // switch wire frame mode
Terrain->setMaterialFlag(video::EMF_WIREFRAME, !Terrain->getMaterial(0).Wireframe);
return true;
case irr::KEY_KEY_D: // toggle detail map
Terrain->setMaterialType(
Terrain->getMaterial(0).MaterialType == video::EMT_SOLID ?
video::EMT_DETAIL_MAP : video::EMT_SOLID);
return true;
}
}
}
I have this code in subroutine
/*MyEventReceiver receiver(terrain);
device->setEventReceiver(&receiver);*/
I have this in main function
MyEventReceiver receiver;
device->setEventReceiver(&receiver);
This program can run
1. to menu and then click the "new game" button (as tutorial 5) to call subroutine (to go to game) but I can't use any buttons to move.
What is different from above code?? Because I have them in my program and the error is occured If I do not comment first and second???
So I want to know what it mean???What should I do???