[Solved]Problems with mouse pointer

haltendehand

09-08-2010 22:38:59

Hello,
I have a little problem with QuickGUI, which is that I can move the mouse pointer only for some(probably about 50)pixels. Everything else works great, including buttons.
Here is the code for the GUI initialization:
header:
QuickGUI::Root* QuickGUIRoot;
QuickGUI::Button* ExitButton;
QuickGUI::GUIManager* MainGUIManager;

.cpp:
QuickGUIRoot = new QuickGUI::Root();
QuickGUI::SkinTypeManager::getSingleton().loadTypes();
QuickGUI::GUIManagerDesc MainManagerDesc;
MainManagerDesc.sceneManager = MainSceneManager;
MainManagerDesc.viewport = MainRenderWindow->getViewport(0);
MainManagerDesc.queueID = Ogre::RENDER_QUEUE_OVERLAY;

MainGUIManager = QuickGUI::Root::getSingletonPtr()->createGUIManager(MainManagerDesc);
QuickGUI::SheetDesc* MainSheetDesc = QuickGUI::DescManager::getSingleton().getDefaultSheetDesc();
MainSheetDesc->resetToDefault();
MainSheetDesc->widget_dimensions.size = QuickGUI::Size(1280, 1024);//I've also tried to set it to the size of the viewport
QuickGUI::Sheet* MainSheet = QuickGUI::SheetManager::getSingleton().createSheet(MainSheetDesc);

MainGUIManager->setActiveSheet(MainSheet);

I found out that all input is correctly injected, even after it's out of the "moving space".

kungfoomasta

12-08-2010 07:08:38

Did you check out the beginner tutorial? http://www.ogre3d.org/tikiwiki/QuickGUI ... Tutorial+1

I noticed you didn't register the script reader.

Is your viewport being resized in your application? Also, when you initialize OIS, you need to set the max x and y values.


//Create all devices
mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject( OIS::OISKeyboard, true ));
mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject( OIS::OISMouse, true ));

mKeyboard->setEventCallback(this);
mMouse->setEventCallback(this);

//Set initial mouse clipping size
mMouse->getMouseState().width = mRenderWindow->getWidth();
mMouse->getMouseState().height = mRenderWindow->getHeight();


It could be the case you didn't set the width and height, so the mouse positions are between 0 and some default value (ie 50)

haltendehand

12-08-2010 08:37:52

The script reader was registered before resource initialization, and I followed the tutorial 1.
I am pretty sure that it is because of OIS, but I'll check this when I am at home,