Injecting input help needed


25-10-2007 23:07:26

Firstly, thanks for spending the time producing QuickGUI :D

I have QuickGUI running in my game using a custom loop without the use of a framelistener, what do I need to call manually each loop in order for QuickGUI to function properly?
The main problem I'm having at the moment involves input and what I need to do to get it to work. I've tried several different things, I'm currently doing the following, but that isn't working correctly...

QuickGUI::GUIManager::getSingleton().injectMouseMove(GameManager::getSingletonPtr()->mInputManager->oMouse->getMouseState().X.rel, GameManager::getSingletonPtr()->mInputManager->oMouse->getMouseState().Y.rel);



Sorry if this is a stupid question but I'm fairly new to programming still.



25-10-2007 23:30:47

No worries, I'm only a few years in myself. :)

Are you using multiple Game States?

First thing. Grab the zip I uploaded last night, it's the nearing completion of the next version. That way any bugs you find can be fixed relatively quickly.

Even if you aren't using the default frame listener, somewhere you should have a function "onMouseMoved", "onMouseDown", etc. right? What I did in my personal project a while back was have my GameStates implement these same methods. That way, when you detect an input change, you will notify the current GameState of this change.

bool MyGameState::onMouseMoved(const OIS::MouseEventArgs& arg)

I use "..." because I don't remember the exact syntax. I would copy from the Demo. I remember that OIS gives absolute and relative coords, but I don't remember which you should inject as input.

Also, you might consider your class storing pointers to the InputManager, so you don't have to make so many calls for access every input change. You might have to use some class forwarding to get it to compile.

Best bet is to upgrade and use the demo source as reference. If there are more questions, please ask.


26-10-2007 06:15:41

Thanks for the quick responce, I'll upgrade to the latest code, try what you said and let you know how I get on, and yes I am using multiple game states.



26-10-2007 17:01:40

I use ois and states too. But i need to do this in the bool mousePressed
if(m_GUIManager->injectMouseButtonUp(static_cast<QuickGUI::MouseButtonID>(id)) == true)
return false;

If not, it will crash switching to another state when pressing a button.


26-10-2007 22:35:46

I haven't had time to update to the latest QuickGUI code yet but I have now got input working, many thanks for the help. :D