m key always switching mouse buffer mode

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
Clay
OGRE Community Helper
OGRE Community Helper
Posts: 518
Joined: Wed Mar 17, 2004 4:14 am
x 1
Contact:

m key always switching mouse buffer mode

Post by Clay »

Ok I'm at my wit's end. Every time I hit the 'm' key my mouse freezes (using CEGUI) and when I hit m again it comes back. It's like it's switching off mouse buffered mode, but it shouldn't be happening since I don't let my frame listener call the base class.

Class:

Code: Select all

class PythonDemoListener : public ExampleFrameListener, public MouseMotionListener, public MouseListener
{
public:

    PythonDemoListener(RenderWindow* win, Camera* cam, CEGUI::Renderer *renderer, CEGUI::Window *iWindow);
    virtual ~PythonDemoListener( );
    virtual bool frameStarted(const FrameEvent &evt);
    virtual bool frameEnded(const FrameEvent& evt);
    virtual void mouseMoved (MouseEvent *e);
    virtual void mouseDragged (MouseEvent *e);
    virtual void mousePressed (MouseEvent *e);
    virtual void mouseReleased (MouseEvent *e);
    virtual void mouseClicked(MouseEvent* e);
    virtual void mouseEntered(MouseEvent* e);
    virtual void mouseExited(MouseEvent* e);

    virtual void keyPressed(KeyEvent* e);
    virtual void switchMouseMode();
	virtual void switchKeyMode();
protected:
    CEGUI::Renderer *mGUIRenderer;
    bool mShutdownRequested;
};
Part of the class:

Code: Select all

bool PythonDemoListener::frameStarted(const FrameEvent &evt)
{
    return true;
}

bool PythonDemoListener::frameEnded(const FrameEvent& evt)
{
    return ! mShutdownRequested;
}
Out side of the constructor call:

Code: Select all

ExampleFrameListener(win, cam, true, true)
There is no call to example frame listener. After scratching my head a while, I REMOVED this code from ExampleFrameListener:

Code: Select all

if (mInputTypeSwitchingOn && mInputDevice->isKeyDown(KC_M) && mTimeUntilNextToggle <= 0)
{
    ...
}
And it STILL turns off mouse movement when M is pressed.

Any clue as to what I can do about this?

I'm using Ogre 1.0.0 RC1 and the CEGUI that comes with it.

Edit: Pressing k also stops input from going to CEGUI as well, even though I've also disabled that piece of code. Is this a CEGUI problem?
AssiDragon
Greenskin
Posts: 145
Joined: Wed Apr 28, 2004 12:10 pm
Location: Hungary
Contact:

Post by AssiDragon »

It certainly is not a CEGUI problem - I use CEGUI with my app, and I don't get anything like that...

Why don't just remove the exampleframelistener from there? As I can see you don't really make use of it anyway...
Hope is the first step on the road to disappointment.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

It's this little gem in ExampleFrameListener:

Code: Select all

	void keyClicked(KeyEvent* e) 
	{
		if (e->getKeyChar() == 'm')
		{
			switchMouseMode();
		}
		else if (e->getKeyChar() == 'k')
		{

			switchKeyMode();
		}

	}
Thanks for spotting it, we need to override that in the GUI demo too.
User avatar
Clay
OGRE Community Helper
OGRE Community Helper
Posts: 518
Joined: Wed Mar 17, 2004 4:14 am
x 1
Contact:

Post by Clay »

Ohhh nasty little bugger. Thanks. =)
Post Reply