OGRE 引擎官方基础教程 (七) OGRE 和 CEGUI

本文详细介绍了如何将CEGUI GUI库整合到OGRE 3D渲染引擎中,包括版本要求、工程设置、CEGUI资源组定义、初始化、事件处理和渲染到纹理等步骤。通过实例代码展示了如何创建窗口、处理键盘和鼠标事件,以及实现render-to-texture功能。
摘要由CSDN通过智能技术生成

版本要求

  • OGRE: >= 1.7.0
  • CEGUI: >= 0.7.0

修改Basic Tutorial 7类定义如下所示

BasicTutorial7 header
#include "BaseApplication.h"
 
#include <CEGUI/CEGUI.h>
#include <CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h>
 
class BasicTutorial7 : public BaseApplication
{
   
public:
    BasicTutorial7(void);
    virtual ~BasicTutorial7(void);
 
protected:
    CEGUI::OgreRenderer* mRenderer;
 
    virtual void createScene(void);
 
    virtual void createFrameListener(void);
 
    // Ogre::FrameListener
    virtual bool frameRenderingQueued(const Ogre::FrameEvent& evt);
 
    // OIS::KeyListener
    virtual bool keyPressed( const OIS::KeyEvent &arg );
    virtual bool keyReleased( const OIS::KeyEvent &arg );
    // OIS::MouseListener
    virtual bool mouseMoved( const OIS::MouseEvent &arg );
    virtual bool mousePressed( const OIS::MouseEvent &arg, OIS::MouseButtonID id );
    virtual bool mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id );
 
    bool quit(const CEGUI::EventArgs &e);
};

 

对应的cpp文件如下

BasicTutorial7 implementation
#include "BasicTutorial7.h"
 
//-------------------------------------------------------------------------------------
BasicTutorial7::BasicTutorial7(void)
{
   
}
//-------------------------------------------------------------------------------------
BasicTutorial7::~BasicTutorial7(void)
{
   
}
//-------------------------------------------------------------------------------------
void BasicTutorial7::createScene(void)
{
   
}
//-------------------------------------------------------------------------------------
void BasicTutorial7::createFrameListener(void)
{
   
    BaseApplication::createFrameListener();
}
//-------------------------------------------------------------------------------------
bool BasicTutorial7::frameRenderingQueued(const Ogre::FrameEvent& evt)
{
   
    return BaseApplication::frameRenderingQueued(evt);
}
//-------------------------------------------------------------------------------------
bool BasicTutorial7::keyPressed( const OIS::KeyEvent &arg )
{
   
    return BaseApplication::keyPressed(arg);
}
//-------------------------------------------------------------------------------------
bool BasicTutorial7::keyReleased( const OIS::KeyEvent &arg )
{
   
    return BaseApplication::keyReleased(arg);
}
//-------------------------------------------------------------------------------------
bool BasicTutorial7::mouseMoved( const OIS::MouseEvent &arg )
{
   
    return BaseApplication::mouseMoved(arg);
}
//-------------------------------------------------------------------------------------
bool BasicTutorial7::mousePressed( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
{
   
    return BaseApplication::mousePressed(arg, id);
}
//-------------------------------------------------------------------------------------
bool BasicTutorial7::mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
{
   
    return BaseApplication::mouseReleased(arg, id);
}
//-------------------------------------------------------------------------------------
bool BasicTutorial7::quit(const CEGUI::EventArgs &e)
{
   
    
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值