Skip to main content

History: IntermediateTutorial1Source

Preview of version: 5

This is the source code for Intermediate Tutorial 1.

ITutorial01 header
Copy to clipboard
#ifndef __ITutorial01_h_ #define __ITutorial01_h_ #include "BaseApplication.h" #include <deque> #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 #include "../res/resource.h" #endif class ITutorial01 : public BaseApplication { public: ITutorial01(void); virtual ~ITutorial01(void); protected: virtual void createScene(void); virtual void createFrameListener(void); virtual bool nextLocation(void); virtual bool frameRenderingQueued(const Ogre::FrameEvent &evt); Ogre::Real mDistance; // The distance the object has left to travel Ogre::Vector3 mDirection; // The direction the object is moving Ogre::Vector3 mDestination; // The destination the object is moving towards Ogre::AnimationState *mAnimationState; // The current animation state of the object Ogre::Entity *mEntity; // The Entity we are animating Ogre::SceneNode *mNode; // The -SceneNode that the Entity is attached to std::deque<Ogre::Vector3> mWalkList; // The list of points we are walking to Ogre::Real mWalkSpeed; // The speed at which the object is moving }; #endif // #ifndef __ITutorial01_h_

ITutorial01 implementation
Copy to clipboard
#include "ITutorial01.h" //------------------------------------------------------------------------------------- ITutorial01::ITutorial01(void) { } //------------------------------------------------------------------------------------- ITutorial01::~ITutorial01(void) { } //------------------------------------------------------------------------------------- void ITutorial01::createScene(void) { } void ITutorial01::createFrameListener(void){ BaseApplication::createFrameListener(); } bool ITutorial01::nextLocation(void){ return true;} bool ITutorial01::frameRenderingQueued(const Ogre::FrameEvent &evt){ return BaseApplication::frameRenderingQueued(evt); } #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 #define WIN32_LEAN_AND_MEAN #include "windows.h" #endif #ifdef __cplusplus extern "C" { #endif #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT ) #else int main(int argc, char *argv[]) #endif { // Create application object ITutorial01 app; try { app.go(); } catch( Ogre::Exception& e ) { #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL); #else std::cerr << "An exception has occured: " << e.getFullDescription().c_str() << std::endl; #endif } return 0; } #ifdef __cplusplus } #endif

History

Information Version
Sun 17 of Feb, 2013 04:14 GMT-0000 holocronweaver Update file and class naming to conform with other tutorials 8
Mon 20 of Sep, 2010 16:04 GMT-0000 jacmoe 7
Fri 20 of Aug, 2010 10:46 GMT-0000 atomr 6
Fri 20 of Aug, 2010 10:40 GMT-0000 atomr 5
Wed 16 of Jun, 2010 13:59 GMT-0000 pera code fixed :) 4
Mon 04 of Jan, 2010 05:24 GMT-0000 jacmoe 3
Sun 06 of Dec, 2009 08:25 GMT-0000 jacmoe 2
Wed 15 of Oct, 2008 19:01 GMT-0000 OgreWikiBot Robot: Cosmetic changes 1