samsamsam
17-08-2008 21:31:16
i wrote this code::
/////
class GuiFrameListener : public ExampleFrameListener, public OIS::KeyListener, public OIS::MouseListener
{
private:
MyGUI::Gui * mGUI;
bool mShutdownRequested;
public:
// NB using buffered input, this is the only change
GuiFrameListener(RenderWindow* mWindow,Camera* cam) : ExampleFrameListener(mWindow,cam, true, true, true),
mShutdownRequested(false)
{
MyGUI::Gui * mGUI=new MyGUI::Gui();
mGUI->initialise(mWindow);
MyGUI::ButtonPtr button = mGUI->createWidget<MyGUI::Button>("Button", 10, 10, 300, 26, MyGUI::ALIGN_DEFAULT, "Main");
button->setCaption("exit");
mMouse->setEventCallback(this);
mKeyboard->setEventCallback(this);
}
bool GuiFrameListener::frameStarted(const Ogre::FrameEvent& evt)
{
mGUI->injectFrameEntered(evt.timeSinceLastFrame);
return true;
}
bool GuiFrameListener::mouseMoved( const OIS::MouseEvent &arg )
{
mGUI->injectMouseMove(arg);
return true;
}
bool GuiFrameListener::mousePressed( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
{
mGUI->injectMousePress(arg, id);
return true;
}
bool GuiFrameListener::mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
{
mGUI->injectMouseRelease(arg, id);
return true;
}
bool GuiFrameListener::keyPressed( const OIS::KeyEvent &arg )
{
mGUI->injectKeyPress(arg);
return true;
}
bool GuiFrameListener::keyReleased( const OIS::KeyEvent &arg )
{
mGUI->injectKeyRelease(arg);
return true;
}
};
//////////
but when i try to make a new insatnce of that class in my ogre program and try to do this:
GuiFrameListener* mFrameListener= new GuiFrameListener(mWindow, mCamera);
mRoot->addFrameListener(mFrameListener);
i had this error in running time::
Unhandled exception at 0x0083f884 (MyGUI_d.dll) in test.exe: 0xC0000005: Access violation reading location 0xcdcdce51.
so any help pls....
/////
class GuiFrameListener : public ExampleFrameListener, public OIS::KeyListener, public OIS::MouseListener
{
private:
MyGUI::Gui * mGUI;
bool mShutdownRequested;
public:
// NB using buffered input, this is the only change
GuiFrameListener(RenderWindow* mWindow,Camera* cam) : ExampleFrameListener(mWindow,cam, true, true, true),
mShutdownRequested(false)
{
MyGUI::Gui * mGUI=new MyGUI::Gui();
mGUI->initialise(mWindow);
MyGUI::ButtonPtr button = mGUI->createWidget<MyGUI::Button>("Button", 10, 10, 300, 26, MyGUI::ALIGN_DEFAULT, "Main");
button->setCaption("exit");
mMouse->setEventCallback(this);
mKeyboard->setEventCallback(this);
}
bool GuiFrameListener::frameStarted(const Ogre::FrameEvent& evt)
{
mGUI->injectFrameEntered(evt.timeSinceLastFrame);
return true;
}
bool GuiFrameListener::mouseMoved( const OIS::MouseEvent &arg )
{
mGUI->injectMouseMove(arg);
return true;
}
bool GuiFrameListener::mousePressed( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
{
mGUI->injectMousePress(arg, id);
return true;
}
bool GuiFrameListener::mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
{
mGUI->injectMouseRelease(arg, id);
return true;
}
bool GuiFrameListener::keyPressed( const OIS::KeyEvent &arg )
{
mGUI->injectKeyPress(arg);
return true;
}
bool GuiFrameListener::keyReleased( const OIS::KeyEvent &arg )
{
mGUI->injectKeyRelease(arg);
return true;
}
};
//////////
but when i try to make a new insatnce of that class in my ogre program and try to do this:
GuiFrameListener* mFrameListener= new GuiFrameListener(mWindow, mCamera);
mRoot->addFrameListener(mFrameListener);
i had this error in running time::
Unhandled exception at 0x0083f884 (MyGUI_d.dll) in test.exe: 0xC0000005: Access violation reading location 0xcdcdce51.
so any help pls....
