⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simplescenesapplication.h

📁 使用stl技术,(还没看,是听说的)
💻 H
字号:
/*
SimpleScenesApplication.h
------------------------
Defintion of the class responsible for running the OgreOde
demo scenes. Wrangles input and the various different test
scenes into a single application. Extends the ExampleApplication
and ExampleFrameListener classes.
*/
#ifndef _SIMPLESCENESAPPLICATION_H_
#define _SIMPLESCENESAPPLICATION_H_

// Include the OgreOde interface which includes Ogre itself
#include "OgreOde.h"
#include "ExampleApplication.h"

// Our framework class for the different tests
#include "SimpleScenes.h"

class SimpleScenesApplication;

/*
A frame listener that does default processing before deferring to the main application
*/
class SimpleScenesFrameListener:public ExampleFrameListener
{
public:
	// Standard example constructor with one additional parameter
	SimpleScenesFrameListener(SimpleScenesApplication* demo,RenderWindow* win,Camera* cam):ExampleFrameListener(win,cam),_demo(demo)
	{
		mMoveSpeed = 15.0;
	}
	~SimpleScenesFrameListener(){}

	bool frameStarted(const FrameEvent& evt);
	bool frameEnded(const FrameEvent& evt);

protected:
	// Keep track of the application that created us
	SimpleScenesApplication* _demo;
};

/*
The test application, based on the Ogre example application for consistency
*/
class SimpleScenesApplication: public ExampleApplication
{
	// The frame listener gets access to some special things
	friend class SimpleScenesFrameListener;

public:
	// Standard constructor/destructor
	SimpleScenesApplication()
	{
		_test = 0;
		_plane = 0;
		_stepper = 0;	
		_world = 0;

		_time_elapsed = 0.0;
		_time_step = SimpleScenes::STEP_RATE;
		_looking = _chasing = false;
		_paused = false;
	}
    ~SimpleScenesApplication();

protected:
	// Override stuff from the base class
    void createScene(void);	
    void createFrameListener(void)
    {
        mFrameListener= new SimpleScenesFrameListener(this,mWindow,mCamera);
        mRoot->addFrameListener(mFrameListener);
    }
    void chooseSceneManager(void)
    {
        mSceneMgr = mRoot->getSceneManager(ST_GENERIC);
    }

	// Add the standard resources, plus our own pack
	void setupResources(void)
    {
		ExampleApplication::setupResources();
		ResourceManager::addCommonArchiveEx("../../../../OgreOde/demos/Media/OgreOdeDemos.zip","Zip");		
	}

	// The frame listener will call these
	void frameStarted(const FrameEvent& evt,InputReader* mInputDevice);
	void frameEnded(const FrameEvent& evt,InputReader* mInputDevice);
	
protected:
	OgreOde::World*					_world;
	OgreOde::Stepper*				_stepper;
	OgreOde::InfinitePlaneGeometry* _plane;
	SimpleScenes*					_test;

	Real	_delay,_time_elapsed,_time_step;
	Light*	_spot;
	bool	_looking,_chasing,_paused;
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -