一个不错的Ogre游戏框架

发布时间:2014-10-23 23:27:30
来源:分享查询网

在Ogred的官方教程中有许多高质量的资源,比如Advanced Ogre Famework,是一个很好的游戏框架,它实现了主菜单,游戏场景的切换,跳转。 效果 这是主菜单界面 游戏场景Demo 可以暂停游戏,选择恢复或退出 实现 首先,每个游戏场景继承自AppState类,需要实现以下虚函数 virtual void enter() = 0; virtual void exit() = 0; virtual bool pause(){return true;} virtual void resume(){}; virtual void update(double timeSinceLastFrame) = 0; AppState由AppStateManager类控制,AppStateManager是一个单例类,它维护一个AppState的堆栈,通过以下功能实现对场景的控制 // Function to later add a new state to the manager virtual void manageAppState(Ogre::String stateName, AppState* state) = 0; virtual AppState* findByName(Ogre::String stateName) = 0; // Exits the current app state and starts the one specified as the parameter virtual void changeAppState(AppState *state) = 0; // Puts a new app state on the active state stack that will then be excecuted virtual bool pushAppState(AppState* state) = 0; // Removes the top active state from the stack, which results in returning to the one below virtual void popAppState() = 0; virtual void pauseAppState() = 0; virtual void shutdown() = 0; // Removes all current app states from the stack and moves to the given new state virtual void popAllAndPushAppState(AppState* state) = 0; 这里有完整的框架代码介绍和相关资源链接 http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Advanced+Ogre+Framework&structure=Tutorials 源代码下载 http://download.csdn.net/detail/guinao/6614265

返回顶部
查看电脑版