• 大小: 3.75MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-13
  • 语言: C/C++
  • 标签: ogremfc  

资源简介

ogre与mfc的整合,需要自己改一下,很不错的东西

资源截图

代码片段和文件信息

// ChildView.cpp : implementation of the CChildView class
//

#include “stdafx.h“
#include 
#include ameListener.h>

#include “OgreMFC.h“
#include “ChildView.h“
#include “.\childview.h“

using namespace Ogre;


// CChildView

CChildView::CChildView() : m_firstDraw(true)
{
    m_OgreRoot = 0;         // Until we know otherwise
    m_SceneManager = 0;
    m_Camera = 0;
    m_Window = 0;
}

CChildView::~CChildView()
{
}


BEGIN_MESSAGE_MAP(CChildView CWnd)
ON_WM_PAINT()
    ON_WM_ERASEBKGND()
    ON_WM_TIMER()
    ON_WM_SIZE()
    ON_WM_LBUTTONDOWN()
    ON_WM_MOUSEMOVE()
    ON_COMMAND(ID_ROBOT_WALK OnRobotWalk)
    ON_UPDATE_COMMAND_UI(ID_ROBOT_WALK OnUpdateRobotWalk)
    ON_COMMAND(ID_ROBOT_SHOOT OnRobotShoot)
    ON_UPDATE_COMMAND_UI(ID_ROBOT_SHOOT OnUpdateRobotShoot)
    ON_COMMAND(ID_ROBOT_IDLE OnRobotIdle)
    ON_UPDATE_COMMAND_UI(ID_ROBOT_IDLE OnUpdateRobotIdle)
    ON_COMMAND(ID_ROBOT_SLUMP OnRobotSlump)
    ON_UPDATE_COMMAND_UI(ID_ROBOT_SLUMP OnUpdateRobotSlump)
    ON_COMMAND(ID_ROBOT_DIE OnRobotDie)
    ON_UPDATE_COMMAND_UI(ID_ROBOT_DIE OnUpdateRobotDie)
END_MESSAGE_MAP()



// CChildView message handlers

BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs) 
{
if (!CWnd::PreCreateWindow(cs))
return FALSE;

cs.dwExstyle |= WS_EX_CLIENTEDGE;
cs.style &= ~WS_BORDER;
cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS 
::LoadCursor(NULL IDC_ARROW) reinterpret_cast(COLOR_WINDOW+1) NULL);

return TRUE;
}

//
// Name :         CChildView::OnPaint() 
// Description :  Handle drawing into the child window.
//

void CChildView::OnPaint() 
{
    // Do the initial update things since no OnInitialUpdate for raw CWnd objects.
    if(m_firstDraw)
    {
        m_firstDraw = false;
        SetupOgre();
        SetTimer(1 30 NULL);
    }

    m_OgreRoot->renderOneframe();
}

//
// Name :         CChildView::SetupOgre(void)
// Description :  Setup the OGRE system.
//

void CChildView::SetupOgre(void)
{
    // Obtain pointer to the Ogre root object
    m_OgreRoot = ((COgreMFCApp *)AfxGetApp())->GetOgreRoot();

    //
    // Create a render window
    // This window should be the current ChildView window using the externalWindowHandle
    // value pair option.
    //

    NameValuePairList parms;
    parms[“externalWindowHandle“] = StringConverter::toString((long)m_hWnd);

    CRect   rect;
    GetClientRect(&rect);

    m_Window = m_OgreRoot->createRenderWindow(“MFC Window“ rect.Width() rect.Height() false &parms);
    

    //
    // Choose a scene manager
    //

    m_SceneManager = m_OgreRoot->getSceneManager(Ogre::ST_GENERIC);

    //
    // Create a camera
    //

    // Create the camera
    m_Camera = m_SceneManager->createCamera(“Camera“);
    m_Camera->setNearClipDistance(5);

    //
    // Create a viewport
    //

    // Create one viewport entire

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件     1388544  2005-01-07 12:12  OgreMFC\cg.dll
     文件        7312  2005-12-01 23:01  OgreMFC\ChildView.cpp
     文件        1543  2005-12-01 23:00  OgreMFC\ChildView.h
     文件      757760  2005-10-28 20:43  OgreMFC\DevIL.dll
     文件       61440  2005-10-28 20:43  OgreMFC\ILU.dll
     文件        2678  2005-11-24 19:07  OgreMFC\MainFrm.cpp
     文件         900  2005-11-24 18:45  OgreMFC\MainFrm.h
     文件         449  2005-12-01 23:11  OgreMFC\OgreLeaks.log
     文件     2072576  2005-11-20 08:32  OgreMFC\OgreMain.dll
     文件     6461440  2005-11-20 11:17  OgreMFC\OgreMain_d.dll
     文件        1140  2005-12-01 23:11  OgreMFC\OgreMemory.log
     文件       65544  2005-12-01 23:01  OgreMFC\OgreMFC.aps
     文件        5776  2005-12-01 22:29  OgreMFC\OgreMFC.cpp
     文件         657  2005-11-24 19:09  OgreMFC\OgreMFC.h
     文件       14109  2005-12-01 23:12  OgreMFC\OgreMFC.log
     文件     1002496  2005-12-01 23:12  OgreMFC\OgreMFC.ncb
     文件       10318  2005-12-01 23:01  OgreMFC\OgreMFC.rc
     文件         903  2005-11-24 18:45  OgreMFC\OgreMFC.sln
     文件        9728  2005-12-01 23:12  OgreMFC\OgreMFC.suo
     文件        5394  2005-12-01 22:28  OgreMFC\OgreMFC.vcproj
     文件      360448  2005-11-20 08:45  OgreMFC\OgrePlatform.dll
     文件      532480  2005-11-20 11:17  OgreMFC\OgrePlatform_d.dll
     文件         321  2005-12-01 22:25  OgreMFC\plugins.cfg
     文件         321  2005-11-24 18:56  OgreMFC\plugins_d.cfg
     文件         242  2005-12-01 22:31  OgreMFC\ReadMe.txt
     目录           0  2005-11-24 18:45  OgreMFC\res\
     文件       21630  2001-04-20 02:48  OgreMFC\res\OgreMFC.ico
     文件         697  2005-11-24 18:45  OgreMFC\res\OgreMFC.manifest
     文件         398  2005-11-24 18:45  OgreMFC\res\OgreMFC.rc2
     文件         598  2000-11-21 01:09  OgreMFC\res\Toolbar.bmp
     文件         820  2005-12-01 23:01  OgreMFC\resource.h
............此处省略7个文件信息

评论

共有 条评论

相关资源