I don't suppose there's an example anywhere of a very basic CEGui app with OGRE, that just uses mouse look with a basic window. Just the very basics, like moving around an object in space? If that makes sense.
Thanks
Basic example of mouse look?
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Basic example of mouse look?
Not anything official like. I don't know what other people may have got lying around though
What kind of behaviour were you looking for? By this I mean under what conditions should the mouse change the camera view, and under what conditions would the window be active?
There's probably a few ways of doing this. Switching on a keypress (like escape to show/hide a menu), or something else where the mouse cursor is always present, though the camera only moves when the mouse is outside any windows are two popular approaches.
CE.
What kind of behaviour were you looking for? By this I mean under what conditions should the mouse change the camera view, and under what conditions would the window be active?
There's probably a few ways of doing this. Switching on a keypress (like escape to show/hide a menu), or something else where the mouse cursor is always present, though the camera only moves when the mouse is outside any windows are two popular approaches.
CE.
Re: Basic example of mouse look?
As an example, take the Terrain sample in OGRE. The player is moving around the terrain using the mouse and keys (WSAD as usual!). They see something on the terrain (say a person) and click on it; a GUI window pops up and displays the person's name and details.
The user closes the window and they continue to move around the terrain using the mouse and keys.
I think I was wondering how to switch between feeding the input events to CEGui and OGRE.
Thanks!
The user closes the window and they continue to move around the terrain using the mouse and keys.
I think I was wondering how to switch between feeding the input events to CEGui and OGRE.
Thanks!
Re: Basic example of mouse look?
In my application, I switch between usin buffered and unbuffered input... When I have a Gui up that needs input, I switch to buffered, and when it's gone, go back to unbuffered. Here's how I setup up my input:
And here is how I switch between buffered/unbuffered:
And wether or not I'm in buffered mode, I can still poll the keys with;
m_InputDevice->capture();
if( m_InputDevice->isKeyDown(Ogre::KC_ESCAPE) )
quit();
And to use buffered, you just have to add and remove mouseListeners/mouseMotionListeners/ and/or keylisteners as you need them using the methods provided in m_EventProcessor.
Hope this helps you out
Code: Select all
m_EventProcessor = new Ogre::EventProcessor();
m_EventProcessor->initialise( GraphicsSystem::getSingleton().getRenderWindow() );
m_EventProcessor->startProcessingEvents();
m_InputDevice = m_EventProcessor->getInputReader();
m_UseBufferedKeyBoard = false;
m_UseBufferedMouse = false;
m_InputDevice->setBufferedInput(m_UseBufferedKeyBoard, m_UseBufferedMouse);
And here is how I switch between buffered/unbuffered:
Code: Select all
void InputSystem::setBufferedInputMode( bool bMouse, bool bKeyBoard )
{
if( bMouse != m_UseBufferedMouse || bKeyBoard != m_UseBufferedKeyBoard)
{
m_UseBufferedMouse = bMouse;
m_UseBufferedKeyBoard = bKeyBoard;
m_InputDevice->setBufferedInput(m_UseBufferedKeyBoard, m_UseBufferedMouse);
}
}
And wether or not I'm in buffered mode, I can still poll the keys with;
m_InputDevice->capture();
if( m_InputDevice->isKeyDown(Ogre::KC_ESCAPE) )
quit();
And to use buffered, you just have to add and remove mouseListeners/mouseMotionListeners/ and/or keylisteners as you need them using the methods provided in m_EventProcessor.
Hope this helps you out
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 1 guest