VS2008下CEGUI 0.7.1的安装

来源:互联网 发布:nodejs 数据接口开发 编辑:程序博客网 时间:2024/05/18 02:51

CEGUI原来是集成到OGRE里面的,至从OGRE1.7.0以后,OGRE有了自己的SDKTRAY了。不过不少OGRE教程,包括我实验室的项目都用到了CEGUI,那我也花点时间凑个热闹。


1.下装源文件

cegui0.7.1:http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-0.7.1.zip?download

cegui0.7.1辅助库:http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-DEPS-0.7.x-r1-vc8.zip?download

2.将 CEGUI-0.7.1.zip 解压到自己想设定位置,我的位置是D:\Work Files\CEGUI-0.7.1

3.将 CEGUI-DEPS-0.7.x-r1-vc9.zip 解压到上面的目录里,我这里解压到D:\Work Files\CEGUI-0.7.1这个目录里


这里我们可以看到dependencies文件夹就是CEGUI-DEPS-0.7.x-r1-vc9.zip解压出来的

4.找到D:\Work Files\CEGUI-0.7.1\projects\premake文件夹,用写字板打开config.lua(用记事本打开会很乱,不过也可以修改,比较难找)

修改里面的一些选项(修改成我标红的选项)

--
-- CEGUI premake configuration script
--


-- comment this to disable debug suffixes for dynamic module dlls
-- if you want to use another suffix, just change the string :)
-- all the debug cegui libraries are built with this suffix
DEBUG_DLL_SUFFIX = "_d"


-- SDK / dependency paths
-- { base, include_suffix, library_suffix }
-- base can be absolute or relative to the root cegui_mk2 dir
IRRLICHT_PATHS = { "irrlicht-1.4", "include", "lib/Win32-visualstudio" }
OGRE_PATHS = { "D:\Work Files\OGRE\ogre_src_v1-7-4\OgreMain", "include", "lib" }
OIS_PATHS = { "D:\Work Files\OGRE\ogre_src_v1-7-4\Dependencies", "include/OIS", "lib" }


--- Irrlicht SDK Version
--- 14 is means 1.4 or 1.5.x and 16 means 1.6 (and above?)
CEGUI_IRR_SDK_VERSION = 14


--- OIS API version to be used in the Ogre samples base app.
--- true: use older numKeyboards / numMice
--- false: use getNumberOfDevices
CEGUI_OLD_OIS_API = false
--- Lua version
--- 51 is 5.1 (and above?) From 0.7.0 onwards, lua 5.0 is no longer supported.
CEGUI_LUA_VER = 51


--- Freetype library
--- CEGUI uses the freetype library for some of it's font support.  To disable
--- the use of freetype, set this to false.
CEGUI_USE_FREETYPE = true


--- PCRE library
--- CEGUI uses the pcre library for it's regular expression based string
--- validation as used in the Editbox (and derived classes, such as Spinner).
--- To disable the use of PCRE (and therefore the validation factilities), set
--- this to false.  (Attempts to set validation string will throw).
CEGUI_USE_PCRE_REGEX = true


--- CEGUI::DefaultLogger
--- To disable compilation and use of the CEGUI::DefaultLogger, set this to
--- false.
---
--- Note: If you disable this, you MUST provide an alternative CEGUI::Logger
--- based class and instantiate it before creating the main CEGUI::System object.
CEGUI_USE_DEFAULT_LOGGER = true


--- BiDirectional text support.
--- To enable support for bi-directional text in CEGUI, set CEGUI_BIDI_SUPPORT
--- to true.
--- With bidirectional support enabled, CEGUI_USE_MINIBIDI then controls whether
--- that support is provided viaan embedded copy of minibidi (true) or an
--- external copy of the fribidi library (false).
CEGUI_BIDI_SUPPORT = false;
CEGUI_USE_MINIBIDI = true;


-------------
-- Renderers
-- this controls which renderer modules are built
OPENGL_RENDERER = true
DIRECT3D9_RENDERER = true
DIRECT3D10_RENDERER = false
IRRLICHT_RENDERER = false
OGRE_RENDERER = true


----------------
-- Image Codecs
-- this controls which image codecs are built
TGA_IMAGE_CODEC = true
SILLY_IMAGE_CODEC = true
DEVIL_IMAGE_CODEC = true
FREEIMAGE_IMAGE_CODEC = true
CORONA_IMAGE_CODEC = true


-- this setting selects the default image codec module
-- can be either "tga", "silly", "devil", "freeimage" or "corona"
-- SILLY was written for CEGUI
DEFAULT_IMAGE_CODEC = "silly"


---------------
-- Window Renderers
-- controls window renderers built
FALAGARD_WR = true


-- default WR
-- available: falagard
DEFAULT_WINDOW_RENDERER = "falagard"








---------------
-- XML parsers
-- this controls which xml parser modules are built
EXPAT_PARSER = true
XERCES_PARSER = false
TINYXML_PARSER = false
LIBXML_PARSER = false


-- this selects the default XML parser module
-- can be either "expat", "xerces", "tinyxml" or "libxml"
DEFAULT_XML_PARSER = "expat"




-------
-- Lua
-- this controls whether CEGUILua is enabled
LUA_SCRIPT_MODULE = true


-- disable this for a smaller and faster, but less safe Lua module
-- only affects Release builds. Debug and ReleaseWithSymbols always
-- enable this
LUA_SCRIPT_MODULE_SAFE = false


-- enable this to build the bundled tolua++ as a static library
TOLUA_STATIC = false




-----------
-- Samples
-- remember you have to edit CEGUISamplesConfig.h as well this just controls
-- dependencies etc. if the renderer is disabled this has no effect
SAMPLES_GL = true
SAMPLES_DX9 = true
SAMPLES_DX10 = false
SAMPLES_IRRLICHT = false
SAMPLES_OGRE = true
-- this setting controls if the samples should be included in the same
-- solution as the core libraries. If this setting is disabled you can
-- still generate a seperate solution for the samples
--
-- due to a missing feature in premake enabling this will cause the
-- output files to be placed in cegui_mk2/bin and not cegui_mk2/Samples/bin
--
SAMPLES_INCLUDED = false

5.在D:\Work Files\CEGUI-0.7.1\projects\premake中找到并运行build_vs2008.bat(或对应的其他版本),你将看到CEGUI.sln

6.D:\Work Files\CEGUI-0.7.1\projects\premake中找到并运行build_samples_vs2008.bat(或对应的其他版本),你将看到CEGUISamples.sln

7.打开CEGUI.sln将所有项目在debug和release模式下编译出来,然后将D:\Work Files\CEGUI-0.7.1\dependencies\bin里面的所有DLL拷贝到D:\Work Files\CEGUI-0.7.1\bin文件夹下

8.打开CEGUISamples.sln将CEGUISampleHelper项目在debug和release模式下分别编译出来.

9.,最后我们选择一个Sample_Demo6来运行作为检测标准,注意在release模式下运行,因为它使用OGRE渲染时,建立root时,直接用的d_ogreRoot = new Root();来自CEGuiOgreBaseApplication.cpp文件.而Root函数的默认值是        

Root(const String& pluginFileName = "plugins.cfg", 
const String& configFileName = "ogre.cfg", 
const String& logFileName = "Ogre.log");

来自OgreRoot.h文件

学过Ogre的应该知道上面三个文件就是release版本,所以为了避免不必要的麻烦我们选择在release模式下进行编译和运行.

10.当例子编译成功后,就表明我们的CEGUI已经编译成功.运行例子时,我们有三个Renderer可选.


但是问题出现了,当我们选择Ogre Engine Renderer后,程序找不到渲染系统


说明我们缺少plugins.cfg文件,那么我们就从OGRE里面(我这里是D:\Work Files\OGRE\ogre_src_v1-7-4\bin\release)将plugins.cfg和resources.cfg(资源文件,后面要用)这两个文件拷贝D:\Work Files\CEGUI-0.7.1\projects\premake\Samples\Demo6里面,我们再运行,发现找到了渲染系统,



但是新问题又出现了,我们点运行,会出现如下情况:



那我们试试其他Renderer,Microsoft Direct3D Renderer 和 OpenGL Renderer下运行都提示



看来是资源没有找到,解决方法:

右键点击Sample_Demo6,选择属性


然后选择配置属性->调试->工作目录,点击右边的小箭头,

点击浏览,选择D:\Work Files\CEGUI-0.7.1\datafiles这个目录

最后,再在三个renderer下运行,都成功了!


Ogre Engine Renderer下



Microsoft Direct3D Renderer下


OpenGL Renderer下


原创粉丝点击