CursorControl

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Gao
Posts: 6
Joined: Wed Mar 01, 2006 7:55 pm

CursorControl

Post by Gao »

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..
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

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
Gao
Posts: 6
Joined: Wed Mar 01, 2006 7:55 pm

Post by Gao »

Thanks but not.

the set visible is just shows me my arow :)

my camera is controlled by the mouse and when the dialog is displayed i don't want to controll the camera by the mouse.

sorry but i'm Hungarian and i can't speak english well :)
Gao
Posts: 6
Joined: Wed Mar 01, 2006 7:55 pm

Post by Gao »

I MADE IT :) YIPPPPIIIII :)

smgr->setActiveCamera(0);
device->getCursorControl()->setVisible(true);

i know this isn't the best but it works now :) thanks for the help :)
Guest

Good

Post by Guest »

Gao if you must reactivate the camera you can use the method of the ICameraSceneNode that enable or disable the keyboard control.

camera.setInputReceiverEnabled( bool flag )

It can make your life simple in case you need to switch in a simple way the controls sharing a bool var.
Gao
Posts: 6
Joined: Wed Mar 01, 2006 7:55 pm

Post by Gao »

scene::ICameraSceneNode* camera;

camera->setInputReceiverEnabled(false);

and

camera->setInputReceiverEnabled(false);

like this?

whan the programm arrive this part it crashes :(
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

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...

Code: Select all

scene::ICameraSceneNode* camera = SceneManager->getActiveCamera();
You should check pointers to make sure that they are not NULL before using them also...

Code: Select all

if (camera != NULL)
  camera->setInputReceiverEnabled(false);
Travis
Guest

Post by Guest »

i'm crying :(:(

crash :(

i'm trying to make it :(
sdi2000
Posts: 131
Joined: Thu Aug 25, 2005 12:19 pm
Location: Berlin, DE
Contact:

Post by sdi2000 »

meditate about a second cam :D
if pressed esc activate a static cam with the same pos, rot and upvector.
if u release ur gamemenu activate the ingame cam...
its quite simple :P
Guest

Post by Guest »

how can i do that?

setActriveCam();

and what need in the bracket...

sorry but i'm very very beginner :D
sdi2000
Posts: 131
Joined: Thu Aug 25, 2005 12:19 pm
Location: Berlin, DE
Contact:

Post by sdi2000 »

create a new static cam and an empty cam node

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);
    }
  }
}
but why detain to use ur brain? look in the api doc :P
Gao
Posts: 6
Joined: Wed Mar 01, 2006 7:55 pm

Post by Gao »

Thnx a lot... it works well :)

is there any IRC server or something where can i talk with people who use irrlicht?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

yep, check my sig
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
sdi2000
Posts: 131
Joined: Thu Aug 25, 2005 12:19 pm
Location: Berlin, DE
Contact:

Post by sdi2000 »

try the forum search function...
i know its a magic function and beginners dont like this function but mostly it can helps... *hrhr*
:P

or try this: irc://irc.freenode.net/irrlicht
comes from bitplanes sig
Post Reply