Mouse pointer flickering?

MooJuice

26-05-2009 09:38:42

Hey all,

I have my minimum scene set up in Ogre to test out MyGUI (GREAT library guys, it's absolutely perfect for my needs).

A quick question.. when I run it, the mouse pointer flickers (my single button I placed on the screen, does not). My minimal bit of code that get's called every frame is:


// tick
void Scene::tick()
{
float fDelta = (m_pTimer->getMilliseconds() - m_fDelta) / 1000.0f;
Application::getSingleton().getGUI().injectFrameEntered(fDelta);
Application::getSingleton().getOgreRoot().renderOneFrame();
m_fDelta = fDelta;
}; // eo tick


m_fDelta is initialised to "0". Outside of this call there's really not much going on:


while(true)
{
Ogre::WindowEventUtilities::messagePump();
captureInput();
if(m_SceneStack.top()->isValid())
m_SceneStack.top()->tick();
else // scene is marked as invalid, pop it
{
popScene();
if(m_SceneStack.size()) // there's another one
m_SceneStack.top()->wake();
}

if(!m_SceneStack.size()) // no scenes?
break;
};


Thanks in advance!

EDIT: One last question, the input injection methods return a bool. Is this 'true' if the GUI handled it?

Altren

27-05-2009 19:39:12

So you not giving MyGUI any info about mouse, right? (I mean you not calling injectMouseMove)
EDIT: One last question, the input injection methods return a bool. Is this 'true' if the GUI handled it?Yes, and you can read about it in comments to this methods.

MooJuice

27-05-2009 20:47:00

Hi Altren,

Yes, I am giving it the information (as my cursor moves).

My OIS Handler looks like this:


void Scene::_mouseMoved(const OIS::MouseEvent& e)
{
// GUI check before event
Application::getSingleton().getGUI().injectMouseMove(e);

MouseEventArgs args(e, OIS::MouseButtonID(0));
on_MouseMoved.raise(args);
}; // eo _mouseMoved


the getGUI() function returns MyGUI::Gui&.

Altren

27-05-2009 22:42:00

It looks more like problem with OIS. You should check values that OIS gives you, try output e.state.X.abs and e.state.Y.abs and look if this values flickers too.
Or just try something like button->setPosition(e.state.X.abs, e.state.Y.abs); in Scene::_mouseMoved

Tiblanc

30-05-2009 23:58:12


A quick question.. when I run it, the mouse pointer flickers (my single button I placed on the screen, does not). My minimal bit of code that get's called every frame is:


// tick
void Scene::tick()
{
float fDelta = (m_pTimer->getMilliseconds() - m_fDelta) / 1000.0f;
Application::getSingleton().getGUI().injectFrameEntered(fDelta);
Application::getSingleton().getOgreRoot().renderOneFrame();
m_fDelta = fDelta;
}; // eo tick


m_fDelta is initialised to "0". Outside of this call there's really not much going on:



What you must be describing as flickering is the default cursor animation that is messed up because you have a bug in that loop. m_fDelta should be storing the timer value for last frame, but you're setting it to the time delta of last frame. You should replace

m_fDelta = fDelta;

by

m_fDelta += fDelta;


You should see the cursor darken every few seconds.

MooJuice

11-06-2009 08:04:39

Thanks for this, I will try it and post back the result. I have a linker error at the moment that I'm trying to solve, so will let you know.

Thanks again

MooJuice

16-06-2009 12:29:50

@Tiblank,

Unfortunately this did not solve my issue. But thanks for the effort anyway, I'll keep looking when I can find the tme.