cursor disapears when i move it...

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

unclepauly
Just popping in
Just popping in
Posts: 7
Joined: Sun Jan 21, 2007 17:43

cursor disapears when i move it...

Postby unclepauly » Sun Jan 21, 2007 18:59

OMG i must be doing something so stupid, please help me figure out what it is!

im adding cegui to an existing Ogre project of mine. i initially set up cegui like this:

Code: Select all

    mGUIRenderer = new CEGUI::OgreCEGUIRenderer(win, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, sceneMgr);
    mGUISystem = new CEGUI::System(mGUIRenderer);
    CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Informative);

   CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme");
    mGUISystem->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseMoveCursor");
    CEGUI::MouseCursor::getSingleton().setImage("TaharezLook", "MouseMoveCursor");


this just displays the cursor (a '+' sign) in the centre of the screen when the app first loads up. all i am trying to do is make it move round the screen by using the mouse! so simple! but im having problems. as soon as i touch the mouse, the cursor disappears. note: i dont actually see a mouse cursor when the app first loads up, i see the '+' sign. i would expect that when i move the mouse around, the cursor turns into a pointer.

now, i handle input using OIS, not Ogre's ExampleFrameListener. in my frameStarted method, i call mouse->capture (OIS functionality here), and then in my mouseMoved event i do:

Code: Select all

bool OISManager::mouseMoved( const OIS::MouseEvent &arg)
{
   int width = mGUIManager->GetOgreCEGUIRenderer()->getWidth();
   int height = mGUIManager->GetOgreCEGUIRenderer()->getHeight();
   double x = arg.state.relX * width;
   double y = arg.state.relY * height;
   CEGUI::System::getSingleton().injectMouseMove(x, y);

   return true;
}


so you can see that the argument that gets passed is an OIS::MouseEvent, and not Ogre::MouseEvent. this is the only difference that i can see between the tutorial on the Ogre wiki, and my app. i can still get relX and relY from the OIS argument, and i calculate the x and y screen positions and then call injectMouseMove(x, y). i have set a breakpoint on this function and it definately hits, and i can see x and y have values.

so why does the mouse cursor just disappear? is there something else i need to do after this? have i forgot something blindingly obvious?

unclepauly
Just popping in
Just popping in
Posts: 7
Joined: Sun Jan 21, 2007 17:43

Postby unclepauly » Sun Jan 21, 2007 19:28

i think i know now. running the ogre/cegui wiki tutorial, i can see that relX and relY from the Ogre::MouseEvents argument is very small compared to the relX and relY from the OIS::MouseEvents argument. this causes x and y to be huge when multiplied by the window width/height and so the cursor shoots off the window.

maybe i need to divide it by 10 or something. anyway, this is not a cegui issue so ill leave it here.

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Sun Jan 21, 2007 22:30

Remove the window width and height multipliers; they are not needed. Instead replace them with a "mouse sensitivity" multiplier. Personally I like 1.75:

injectMouseMove(arg.state.X.rel * 1.75, arg.state.Y.rel * 1.75)

I'm using a slightly different OIS version than you are, but this should not make any difference; it's the same behavior since a few versions.

unclepauly
Just popping in
Just popping in
Posts: 7
Joined: Sun Jan 21, 2007 17:43

Postby unclepauly » Wed Jan 24, 2007 14:31

cool, thanks :)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 24 guests