CEGUI学习笔记1. CEGUI 配置和运行

CEGUI 配置和运行

设置资源目录:

1.在工作目录设置资源文件夹(datafiles)路径

2.设置附加包含目录

D:\CEGUI\CEGUI-SDK-0.7.2-vc9\为安装路径

D:\CEGUI\CEGUI-SDK-0.7.2-vc9\cegui\include

D:\CEGUI\CEGUI-SDK-0.7.2-vc9\dependencies\include

D:\CEGUI\CEGUI-SDK-0.7.2-vc9\Samples\common\include

3.设置附加库

D:\CEGUI\CEGUI-SDK-0.7.2-vc9\lib

D:\CEGUI\CEGUI-SDK-0.7.2-vc9\dependencies\lib\dynamic

4.运行方式选择debug

假设出现找不到dll文件

D:\CEGUI\CEGUI-SDK-0.7.2-vc9\dependencies\bindll文件和D:\CEGUI\CEGUI-SDK-0.7.2-vc9\bindll文件合在一起,还不行的话,把这些dl文件全放在C:\Windows\System32里。

测试代码:

 

 

Demo.h

#ifndef __DEMOH__

#define __DEMOH__

 

#include "CEGUI.h"

#include "CEGuiSample.h"

#pragma comment(lib,"CEGUISampleHelper_d.lib")

#pragma comment(lib,"CEGUIBase_d.lib")

class demoSample:public CEGuiSample

{

public:

    bool initialiseSample();

    void cleanupSample();

};

#endif

 

Demo.cpp

 

#include "demo.h"

#include "CEGUI.h"

#include "CEGuiBaseApplication.h"

#include <cstdlib>

 

int main()

{

    demoSample demo;

    return demo.run();

}

bool demoSample::initialiseSample()

{

    using namespace CEGUI;

    WindowManager& winmgr = WindowManager::getSingleton();

    SchemeManager::getSingleton().create("TaharezLook.scheme");

    FontManager::getSingleton().create("DejaVuSans-10.font");

     ImagesetManager::getSingleton().create("DriveIcons.imageset");

    

    System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");

    Window * background = winmgr.createWindow("TaharezLook/StaticImage", "background_wnd");

    background->setPosition(UVector2(cegui_reldim(0),cegui_reldim(0)));

    background->setSize(UVector2(cegui_reldim(1), cegui_reldim(1)));

    System::getSingleton().setGUISheet(background);

    Window * sheet = winmgr.createWindow("DefaultWindow","root_wnd");

    background->addChildWindow(sheet);

    Window* st = winmgr.createWindow("TaharezLook/StaticText", "TextWindow/Static");

    sheet->addChildWindow(st);

    st->setPosition(UVector2(cegui_reldim(0.45f), cegui_reldim( 0.23f)));

    st->setSize(UVector2(cegui_reldim(0.15f), cegui_reldim( 0.05f)));

    st->setText("hello,CEGUI");

 

    return true;

}

void demoSample::cleanupSample()

{

 

}

运行结果

posted @ 2010-09-15 20:04  xfate  阅读(1219)  评论(1编辑  收藏  举报