Basic example of mouse look?

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
stodge
Just popping in
Just popping in
Posts: 9
Joined: Wed Jan 12, 2005 12:06

Basic example of mouse look?

Postby stodge » Sat Feb 05, 2005 23:58

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

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Basic example of mouse look?

Postby CrazyEddie » Sun Feb 06, 2005 11:44

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.

User avatar
stodge
Just popping in
Just popping in
Posts: 9
Joined: Wed Jan 12, 2005 12:06

Re: Basic example of mouse look?

Postby stodge » Thu Feb 10, 2005 01:28

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!

User avatar
pjcast
Quite a regular
Quite a regular
Posts: 47
Joined: Wed Jan 12, 2005 12:06

Re: Basic example of mouse look?

Postby pjcast » Thu Feb 10, 2005 02:41

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:

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 7 guests