History: IntermediateTutorial1Source
Source of version: 5
Copy to clipboard
This is the source code for ((Intermediate Tutorial 1)).
{CODE(caption="ITutorial01 header",wrap="1", colors="c++")}
#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_
{CODE}
{CODE(caption="ITutorial01 implementation",wrap="1", colors="c++")}
#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
{CODE}