Mouse Position

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
Guest

Mouse Position

Post by Guest »

Is there a way to get the position of the mouse pointer (x,y) and then change it in code? Needed for 3rd person mouse control. :(
Saguman
Posts: 10
Joined: Fri Jul 23, 2004 7:48 am

Post by Saguman »

Guest

An example?

Post by Guest »

I saw that before and I'm sure the answer is there but I'm too new to working with APIs to make much sense of it. Could someone give me an example?
puh
Posts: 356
Joined: Tue Aug 26, 2003 3:53 pm

Post by puh »

Code: Select all

        if (event.EventType == irr::EET_MOUSE_INPUT_EVENT)
        {
                s32 mouseX = event.MouseInput.X;
                s32 mouseY = event.MouseInput.Y;
        }
Guest

Cool

Post by Guest »

puh, thanks for the code, works great but I'm still not sure how to change the mouse position in code. For example, what if I want to reset the mouse's x and y back to the center of the screen? Can it be done?
turboferret
Posts: 49
Joined: Thu Aug 12, 2004 12:42 pm
Location: Sweden
Contact:

Post by turboferret »

Code: Select all

irrlichtDevice->getCursorControl->setPosition(0.5f, 0.5f);
would set the cursor to the middle of the screen
This monkey is useless, it only has ONE ass!!!
Guest

Didn't seem to work?

Post by Guest »

turboferret, it gave me an error messaage:
error C2227: left of '->setPosition' must point to class/struct/union

Any ideas? If I can get this working I'll write a tutorial about it to help other newbies. :?
Unarekin
Posts: 60
Joined: Thu Apr 22, 2004 11:02 pm

Post by Unarekin »

Try:

irrlichtDevice->getCursorControl()->setPosition(0.5f, 0.5f);

This is assuming that you have a variable named irrlichtDevice that stores a pointer to a device.
Post Reply