[events receiver] I think quite a simple problem O_o
Posted: Thu Sep 22, 2005 4:23 pm
I've got such a code:
now, up to the point how to make camera doesn't react to the mouse or keyboard so that i move the mouse and the camera stands still ??
Code: Select all
class events_receiver : public IEventReceiver {
public:
virtual bool OnEvent(SEvent event) {
if(event.EventType == EET_MOUSE_INPUT_EVENT) {
if(event.MouseInput.Event==EMIE_LMOUSE_PRESSED_DOWN) {
printf("l_button\n");
}
if(event.MouseInput.Event==EMIE_RMOUSE_PRESSED_DOWN) {
printf("r_button\n");
}
if(event.MouseInput.Event==EMIE_MOUSE_MOVED) {
printf("moved\n");
}
}
}
};
int main() {
events_receiver events;
IrrlichtDevice* device = createDevice(EDT_OPENGL, dimension2d<s32>(800, 600), 16, false, false, false, &events);
IVideoDriver *driver = device->getVideoDriver();
ISceneManager *smgr = device->getSceneManager();
IAnimatedMesh *map_mesh = smgr->getMesh("maps_mesh/test_mesh.3ds");
ISceneNode *mapa = smgr->addOctTreeSceneNode(map_mesh->getMesh(0));
mapa->setMaterialFlag(EMF_LIGHTING, true);
ICameraSceneNode *camera = smgr->addCameraSceneNodeFPS();
while(device->run()) {
driver->beginScene(true, true, SColor(0, 200, 200, 200));
smgr->drawAll();
driver->endScene();
camera->setPosition(vector3df(0,200,0));
camera->setRotation(vector3df(90,0,90));
}
device->drop();
return 0;
}