CursorControl
CursorControl
Hi all!
I have a scene with CursorControl and i made if i press ESC key than the programm shows the ingame menu.. i wanna drop the CursorControl for this time and i wanna get it back if i press the Cancel button... how can i drop the CursorControl cause the device->getCursorControl()->drop(); don't works here..
I have a scene with CursorControl and i made if i press ESC key than the programm shows the ingame menu.. i wanna drop the CursorControl for this time and i wanna get it back if i press the Cancel button... how can i drop the CursorControl cause the device->getCursorControl()->drop(); don't works here..
First off, you never want to drop a pointer that is not owned by you. If you do that, you will throw off the reference count and the object will be deleted and other parts of the code will have pointers to a deleted object. This will cause your program to crash.
I'm pretty sure you don't want to drop the cursor control. You probably want to call CursorControl->setVisible(true) when the dialog is displayed and CursorControl->setVisible(false) when the dialog is dismissed.
Travis
I'm pretty sure you don't want to drop the cursor control. You probably want to call CursorControl->setVisible(true) when the dialog is displayed and CursorControl->setVisible(false) when the dialog is dismissed.
Travis
You have to set the pointer camera to refer to a valid ICameraSceneNode instance. Typically you would ask the scene manager for the active camera...
You should check pointers to make sure that they are not NULL before using them also...
Travis
Code: Select all
scene::ICameraSceneNode* camera = SceneManager->getActiveCamera();
Code: Select all
if (camera != NULL)
camera->setInputReceiverEnabled(false);
-
Guest
create a new static cam and an empty cam node
but why detain to use ur brain? look in the api doc 
Code: Select all
scene::ICameraSceneNode *staticCam = smgr->addCameraSceneNode();
scene::ICameraSceneNode *lastStateCam = NULL;
void switchToMenuCam(bool _menuCam)
{
if(_menuCam)
{
lastStateCam = smgr->getActiveCamera();
if(lastStateCam != NULL)
{
//copy the pos, rot(aka target) and upvector
//for the same view, but you dont need, if you dont want it
staticCam->setPosition(lastStateCam->getPosition());
staticCam->setTarget(lastStateCam->getTarget());
staticCam->setUpVector(lastStateCam->getUpVector());
//activate the static cam without any cursor events
smgr->setActiveCamera(staticCam);
}
}
else
{
if(lastStateCam != NULL)
{
//reactivate the in game cam
smgr->setActiveCamera(lastStateCam);
}
}
}