【CEGUI】资源加载流程「建议收藏」

【CEGUI】资源加载流程「建议收藏」CEGUI资源加载流程主要资源类型Schemescheme资源(包括图像集、字体资源、窗口外观信息、类型映射)等。可以通过“.scheme“”将CEGUI系统所需要的全部资源一次加载。例:TaharezLook.scheme<?xmlversion=”1.0″?> <GUISchemeversion=”5″name=”TaharezLook”> <Imagesetfilename=”TaharezLook.imagese

大家好,又见面了,我是你们的朋友全栈君。

CEGUI资源加载流程

  • CEGUI版本 0.8.7

主要资源类型

Scheme

  • scheme资源(包括图像集、字体资源、窗口外观信息、类型映射)等。可以通过“.scheme“”将CEGUI系统所需要的全部资源一次加载。
  • 例:TaharezLook.scheme
<?xml version="1.0" ?>								
<GUIScheme version="5" name="TaharezLook">								
	<Imageset filename="TaharezLook.imageset" />							
	<Font filename="DejaVuSans-12.font" />							
	<LookNFeel filename="TaharezLook.looknfeel" />							
	<WindowRendererSet filename="CEGUICoreWindowRendererSet" />							
								
	<FalagardMapping windowType="TaharezLook/Label" targetType="DefaultWindow" renderer="Core/Default" lookNFeel="TaharezLook/Label" />							
	<FalagardMapping windowType="TaharezLook/Button" targetType="CEGUI/PushButton" renderer="Core/Button" lookNFeel="TaharezLook/Button" />							
	<FalagardMapping windowType="TaharezLook/Checkbox" targetType="CEGUI/ToggleButton" renderer="Core/ToggleButton" lookNFeel="TaharezLook/Checkbox" />							
	<FalagardMapping windowType="TaharezLook/ImageButton" targetType="CEGUI/PushButton" renderer="Core/Button" lookNFeel="TaharezLook/ImageButton" />							
	<FalagardMapping windowType="TaharezLook/RadioButton" targetType="CEGUI/RadioButton" renderer="Core/ToggleButton" lookNFeel="TaharezLook/RadioButton" />							
	<FalagardMapping windowType="TaharezLook/FrameWindow" targetType="CEGUI/FrameWindow" renderer="Core/FrameWindow" lookNFeel="TaharezLook/FrameWindow" />							
	<FalagardMapping windowType="TaharezLook/Titlebar" targetType="CEGUI/Titlebar" renderer="Core/Titlebar" lookNFeel="TaharezLook/Titlebar" />							
	<FalagardMapping windowType="TaharezLook/Editbox" targetType="CEGUI/Editbox" renderer="Core/Editbox" lookNFeel="TaharezLook/Editbox" />							
	<FalagardMapping windowType="TaharezLook/MultiLineEditbox" targetType="CEGUI/MultiLineEditbox" renderer="Core/MultiLineEditbox" lookNFeel="TaharezLook/MultiLineEditbox" />							
	<FalagardMapping windowType="TaharezLook/Menubar" targetType="CEGUI/Menubar" renderer="Core/Menubar" lookNFeel="TaharezLook/Menubar" />							
	<FalagardMapping windowType="TaharezLook/PopupMenu" targetType="CEGUI/PopupMenu" renderer="Core/PopupMenu" lookNFeel="TaharezLook/PopupMenu" />							
	<FalagardMapping windowType="TaharezLook/MenuItem" targetType="CEGUI/MenuItem" renderer="Core/MenuItem" lookNFeel="TaharezLook/MenuItem" />							
	<FalagardMapping windowType="TaharezLook/AlternateProgressBar" targetType="CEGUI/ProgressBar" renderer="Core/ProgressBar" lookNFeel="TaharezLook/AltProgressBar" />							
	<FalagardMapping windowType="TaharezLook/ProgressBar" targetType="CEGUI/ProgressBar" renderer="Core/ProgressBar" lookNFeel="TaharezLook/ProgressBar" />							
	<FalagardMapping windowType="TaharezLook/VUMeter" targetType="CEGUI/ProgressBar" renderer="Core/ProgressBar" lookNFeel="TaharezLook/VUMeter" />							
	<FalagardMapping windowType="TaharezLook/VerticalScrollbar" targetType="CEGUI/Scrollbar" renderer="Core/Scrollbar" lookNFeel="TaharezLook/VerticalScrollbar" />							
	<FalagardMapping windowType="TaharezLook/HorizontalScrollbar" targetType="CEGUI/Scrollbar" renderer="Core/Scrollbar" lookNFeel="TaharezLook/HorizontalScrollbar" />							
	<FalagardMapping windowType="TaharezLook/VerticalScrollbarThumb" targetType="CEGUI/Thumb" renderer="Core/Button" lookNFeel="TaharezLook/VerticalScrollbarThumb" />							
	<FalagardMapping windowType="TaharezLook/HorizontalScrollbarThumb" targetType="CEGUI/Thumb" renderer="Core/Button" lookNFeel="TaharezLook/HorizontalScrollbarThumb" />							
	<FalagardMapping windowType="TaharezLook/LargeVerticalScrollbar" targetType="CEGUI/Scrollbar" renderer="Core/Scrollbar" lookNFeel="TaharezLook/LargeVerticalScrollbar" />							
	<FalagardMapping windowType="TaharezLook/LargeVerticalScrollbarThumb" targetType="CEGUI/Thumb" renderer="Core/Button" lookNFeel="TaharezLook/LargeVerticalScrollbarThumb" />							
	<FalagardMapping windowType="TaharezLook/TabButton" targetType="CEGUI/TabButton" renderer="Core/TabButton" lookNFeel="TaharezLook/TabButton" />							
	<FalagardMapping windowType="TaharezLook/TabControl" targetType="CEGUI/TabControl" renderer="Core/TabControl" lookNFeel="TaharezLook/TabControl" />							
	<FalagardMapping windowType="TaharezLook/TabContentPane" targetType="DefaultWindow" renderer="Core/Default" lookNFeel="TaharezLook/TabContentPane" />							
	<FalagardMapping windowType="TaharezLook/TabButtonPane" targetType="DefaultWindow" renderer="Core/Default" lookNFeel="TaharezLook/TabButtonPane" />							
	<FalagardMapping windowType="TaharezLook/ComboDropList" targetType="CEGUI/ComboDropList" renderer="Core/Listbox" lookNFeel="TaharezLook/ComboDropList" />							
	<FalagardMapping windowType="TaharezLook/ComboEditbox" targetType="CEGUI/Editbox" renderer="Core/Editbox" lookNFeel="TaharezLook/ComboEditbox" />						
	<FalagardMapping windowType="TaharezLook/Combobox" targetType="CEGUI/Combobox" renderer="Core/Default" lookNFeel="TaharezLook/Combobox" />						
	<FalagardMapping windowType="TaharezLook/Listbox" targetType="CEGUI/Listbox" renderer="Core/Listbox" lookNFeel="TaharezLook/Listbox" />							
	<FalagardMapping windowType="TaharezLook/ListHeader" targetType="CEGUI/ListHeader" renderer="Core/ListHeader" lookNFeel="TaharezLook/ListHeader" />							
	<FalagardMapping windowType="TaharezLook/ListHeaderSegment" targetType="CEGUI/ListHeaderSegment" renderer="Core/ListHeaderSegment" lookNFeel="TaharezLook/ListHeaderSegment" />							
	<FalagardMapping windowType="TaharezLook/MultiColumnList" targetType="CEGUI/MultiColumnList" renderer="Core/MultiColumnList" lookNFeel="TaharezLook/MultiColumnList" />							
	<FalagardMapping windowType="TaharezLook/Slider" targetType="CEGUI/Slider" renderer="Core/Slider" lookNFeel="TaharezLook/Slider" />							
	<FalagardMapping windowType="TaharezLook/SliderThumb" targetType="CEGUI/Thumb" renderer="Core/Button" lookNFeel="TaharezLook/SliderThumb" />							
	<FalagardMapping windowType="TaharezLook/ScrollablePane" targetType="CEGUI/ScrollablePane" renderer="Core/ScrollablePane" lookNFeel="TaharezLook/ScrollablePane" />							
	<FalagardMapping windowType="TaharezLook/Spinner" targetType="CEGUI/Spinner" renderer="Core/Default" lookNFeel="TaharezLook/Spinner" />							
	<FalagardMapping windowType="TaharezLook/Tooltip" targetType="CEGUI/Tooltip" renderer="Core/Tooltip" lookNFeel="TaharezLook/Tooltip" />							
	<FalagardMapping windowType="TaharezLook/StaticImage" targetType="DefaultWindow" renderer="Core/StaticImage" lookNFeel="TaharezLook/StaticImage" />							
	<FalagardMapping windowType="TaharezLook/StaticText" targetType="DefaultWindow" renderer="Core/StaticText" lookNFeel="TaharezLook/StaticText" />							
	<FalagardMapping windowType="TaharezLook/ItemListbox" targetType="CEGUI/ItemListbox" renderer="Core/ItemListbox" lookNFeel="TaharezLook/ItemListbox" />							
	<FalagardMapping windowType="TaharezLook/ListboxItem" targetType="CEGUI/ItemEntry" renderer="Core/ItemEntry" lookNFeel="TaharezLook/ListboxItem" />							
	<FalagardMapping windowType="TaharezLook/GroupBox" targetType="DefaultWindow" renderer="Core/Default" lookNFeel="TaharezLook/GroupBox" />							
    <FalagardMapping windowType="TaharezLook/Tree" targetType="CEGUI/Tree" renderer="Core/Tree" lookNFeel="TaharezLook/Tree" />								
</GUIScheme>

Imageset

  • Imageset图像集,对应一张图片。Image对应该图片上一块区域。Image数量没有限制。
  • 例:
<Imageset autoScaled="vertical" imagefile="TaharezLook.png" name="TaharezLook" nativeHorzRes="1280" nativeVertRes="720" version="2">							
    <Image height="64" name="ClientBrush" width="64" xPos="2" yPos="2" />							
    <Image height="1" name="GenericBrush" width="1" xPos="9" yPos="71" />							
	省略...						
</Imagset>		

Font资源

  • CEGUI系统的字体资源。支持两种类型的Font: FreeTypeFont/ PixmapFont,即矢量字体和位图字体。
  • 例:
	<?xml version="1.0" ?>								
	<Font version="3" name="DejaVuSans-12" filename="DejaVuSans.ttf" type="FreeType" size="12" nativeHorzRes="1280" nativeVertRes="720" autoScaled="vertical"/>	

外观资源

  • 外观文件与渲染窗口有关。渲染窗口中定义的子窗口、命名区域在外观文件中需存在相对应的定义。外观文件定义内容非常多,相关内容参考下面的官方文档。
    http://static.cegui.org.uk/docs/0.8.7/fal_element_ref.html

资源加载流程分析

Scheme对象,是CEGUI提供的用来统一加载资源的对象。通过它利用Scheme文件,可一键加载CEGUI程序使用的各类资源文件。
Scheme只是统一的入口,也可以使用CEGUI提供的各类资源加载对象加载资源。
scheme会调用各类资源对象,进行资源加载。所以了解scheme加载即可了解各类资源加载流程。

  • Block图
    在这里插入图片描述

加载资源前,需要告知CEGUI系统其资源组目录(各类资源的目录设定)

  • 例:设定schemes资源组。
// 设定schemes资源组。
CEGUI::System::getSingleton().getResourceProvider().setResourceGroupDirectory("schemes", "path")
CEGUI::Scheme::setDefaultResourceGroup("schemes");
// 加载scheme文件。
SchemeManager::getSingleton().createFromFile("TaharezLook.scheme"); 
  • Scheme资源加载流程(以OpenGLRender为例)
    在这里插入图片描述
  1. shcemeManager默认是自动加载(方便一键加载资源)。可设定非自动加载,在需要时通过各资源对象加载。
  2. 资源加载为同步加载,大量资源加载会比较耗时。
  3. 同名资源,不会重复加载。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/163745.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • web漏洞扫描工具集合「建议收藏」

    web漏洞扫描工具集合「建议收藏」最好用的开源Web漏洞扫描工具梳理链接:www.freebuf.com/articles/web/155209.html赛门铁克2017年互联网安全威胁报告中提出在他们今年扫描的网站中,有76%都

  • JS于string 和 json互转对象

    JS于string 和 json互转对象

  • VS2008工具栏看不到配置管理器或者解决方案配置

    VS2008工具栏看不到配置管理器或者解决方案配置Vs2008工具栏看不到配置管理器或者解决方案配置,很不方便,看不出来是是Debug还是Release。解决方法如下:1、工具-选项-项目和解决方案-常规,勾选显示高级生成配置。2、如果第一步没有效果,那么可以在工具栏上点击右键,选择自定义,在命令选项卡中找到生成,然后在右侧的命令中找到这两项,直接拖动到工具栏。

  • pstack实现「建议收藏」

    pstack实现「建议收藏」注意,使用pstack查看系统进程的堆栈时需要sudo。注意第一行使用的bash,不可用dash。————————————#!/bin/bashiftest$#-ne1;then   echo”Usage:`basename$0.sh`”1>&2   exit1fiifte

  • uname命令详解_uname -r

    uname命令详解_uname -r博客搬家,原地址:https://langzi989.github.io/2018/12/25/uname命令说明/使用uname命令可以帮助我们了解当前使用的系统的硬件信息,内核信息,处理器信息和当前使用的系统信息等。该命令可以在Fedora,Debian,CentOS,SUSELinux或者其他Linux操作系统的发行版本上运行。uname命令的使用方法在网络上已经有很多,甚…

    2022年10月23日
  • MIPS五级流水线_工业级CPU报价

    MIPS五级流水线_工业级CPU报价一、流水线CPU流水线CPU就是指将一条分解为多步,在同一周期内进行多条指令的同时执行。MIPS五级流水线就是将指令分为:取指(IF),译码(ID),执行(EX),访存(MEM),写回(WB)五个阶段。举个例子:比如第二条指令lui$t2,0x2100在流水线CPU中执行的就是可以看到在200-300ns的周期里,IF阶段取到0x00400004处的指令,300-400ns,这条指令到了ID阶段,而IF阶段执行下一条指令。400-500ns,执行这条指令,ALU的结果为0x2100

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号