Page 1 of 1
[SOLVED] OIS Problem
Posted: Mon Jul 16, 2012 11:16 pm
by fixtone
Hello,
I have a problem with OIS mouse moved.
The mouse moved works backwards, I use LandScape Right in info.plist file.
This is the video.
[youtube]HEqDyF8hl2M[/youtube]
In the function touchMoved call:
Code: Select all
m_pTrayMgr-> injectMouseMove (evt)
I am using Xcode 4.3, IOS 5.1 and ogre 1.8
P.D: If I use SetOrientation method of viewport produce an Exception es not suported.
Thanks
Re: OIS Problem
Posted: Tue Jul 17, 2012 6:34 am
by masterfalcon
SetOrientation was only supported for OGRE 1.7. You'll see that we transform the touch coordinates somewhere in the sample code(not sure where it is right now). You may need to do the same.
Re: OIS Problem
Posted: Tue Jul 17, 2012 7:54 am
by fixtone
Thank you very much masterfalcon.
Just one question: how to transform the touch coordinates?
Can you show me an example?
Re: OIS Problem
Posted: Tue Jul 17, 2012 8:02 am
by masterfalcon
Yeah, see the implementation of transformInputState in SampleContext.h
Re: OIS Problem
Posted: Tue Jul 17, 2012 7:23 pm
by fixtone
Thanks masterfalcon,
But I have a question, I can't modify the evt.state because is read only read-only.
I let my code to know how to fix it.
Code: Select all
bool MenuState::touchMoved(const OIS::MultiTouchEvent &evt)
{
OIS::MultiTouchState state = evt.state;
AdvancedOgreFramework::getSingletonPtr()->transformInputState(state);
if(AdvancedOgreFramework::getSingletonPtr()->m_pTrayMgr->injectMouseMove(evt)) return true;
return true;
}
AdvancedOgreFramework.cpp (Only LandScape Right)
Code: Select all
// Variation based upon device orientation for use with a view controller
void AdvancedOgreFramework::transformInputState(OIS::MultiTouchState &state)
{
int w = m_pRenderWnd->getViewport(0)->getActualWidth();
int h = m_pRenderWnd->getViewport(0)->getActualHeight();
int absX = state.X.abs;
int absY = state.Y.abs;
int relX = state.X.rel;
int relY = state.Y.rel;
state.X.abs = w - absY;
state.Y.abs = absX;
state.X.rel = -relY;
state.Y.rel = relX;
}
I hope your answer. Thank you very much;
Re: OIS Problem
Posted: Wed Jul 18, 2012 10:02 pm
by fixtone
Please Help!
I'm doing a study to determine the feasibility of using OGRE at work.

Re: OIS Problem
Posted: Tue Jul 24, 2012 8:21 am
by fixtone
I've solved the problem, then show the solution to someone helps.
Code: Select all
bool MenuState::touchMoved(const OIS::MultiTouchEvent &evt)
{
OIS::MultiTouchState state = evt.state;
AdvancedOgreFramework::getSingletonPtr()->transformInputState(state);
Ogre::OverlayContainer* o = AdvancedOgreFramework::getSingletonPtr()->m_pTrayMgr->getCursorContainer();
o->setPosition(state.X.abs,state.Y.abs);
return true;
}
Only for Right Landscape
Code: Select all
void AdvancedOgreFramework::transformInputState(OIS::MultiTouchState &state)
{
int w = m_pRenderWnd->getViewport(0)->getActualWidth();
int h = m_pRenderWnd->getViewport(0)->getActualHeight();
int absX = state.X.abs;
int absY = state.Y.abs;
int relX = state.X.rel;
int relY = state.Y.rel;
state.X.abs = absY;
state.Y.abs = h - absX;
state.X.rel = relY;
state.Y.rel = -relX;
}
Thank you very much for the help masterfalcon.
