History: Talk:Intermediate Tutorial 2
Source of version: 2 (current)
Copy to clipboard
This is a really cool tutorial. It has the basics you need for creating an RTS game!
Tutorial modifications for Dagon
!!!Getting Started
~pp~ mSceneMgr = mRoot->getSceneManager(ST_EXTERIOR_CLOSE);~/pp~
needs to be
~pp~ mSceneMgr = mRoot->createSceneManager(ST_EXTERIOR_CLOSE, "ExampleSMECInstance");
~/pp~
!!!Setting up the Scene
~pp~ mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, ST_EXTERIOR_CLOSE);~/pp~
needs to be
~pp~ mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr);
~/pp~
((User:Aladrin|William (Aladrin)))
!!Using CEGUI and OIS for terrain selection
I had to make the following changes to my code to get this working with OIS.
1) Set the window width and height for MouseState, eg:
~pp~ const OIS::MouseState &ms = mMouse->getMouseState();
ms.width = width;
ms.height = height;
~/pp~
If you're using the practical application tutorial (((Practical Application - Let's Get Started))), you can achieve this simply by calling eg. handler->setWindowExtents(1024,768); after creating the InputHandler.
2) The following:
~pp~ Ray mouseRay = mCamera->getCameraToViewportRay( e->getX(), e->getY() );
~/pp~
becomes:
~pp~ Ogre::Real normX = Ogre::Real(evt.state.X.abs)/evt.state.width;
Ogre::Real normY = Ogre::Real(evt.state.Y.abs)/evt.state.height;
Ogre::Ray mouseRay = camera->getCameraToViewportRay( normX, normY );
~/pp~
3) This had me scratching my head for a while. You need to initialize the CEGUI mouse cursor at the origin:
~pp~ CEGUI::MouseCursor::getSingleton().setPosition(CEGUI::Point(CEGUI::Vector2(0,0)));
~/pp~
[http://www.wreckedgames.com/forum/index.php/topic,353.0.html|This post] on the OIS forum was essential in getting it to work. Maybe someone with more confidence in their understanding can add this information to the tutorial?
--((User:Purrpledone|Purrpledone)) 19:26, 12 March 2007 (CST)
!!__Adding Mouse Look__
Find the __TutorialFrameListener__::mouseMoved function and add the following code just before the return statement:
should be:
Find the __MouseQueryListener__::mouseMoved function and add the following code just before the return statement:
Just added this pach to the tutorial. : ((User:Tautrimas|Tautrimas)) 19:03, 1 March 2008 (GMT)
!!Terrain Selection
''Ogre provides us with Camera::__getCameraToViewpointRay__; a nice function that[...]''
should be
''Ogre provides us with Camera::__getCameraToViewportRay__; a nice function that[...]''
Also made this correction : ((User:Tautrimas|Tautrimas)) 08:49, 2 March 2008 (GMT)
---
Alias: (alias(Talk:Intermediate_Tutorial_2))