Cegui 3 data file loading and initialization

Source: Internet
Author: User
Tags xml parser

Cegui 3 data file loading and initialization has now learned how to get started with cegui rendering and resource management. The next step is to learn how to load data files. only when the data file is loaded can the cegui generate the desired output .. data File overview cegui uses multiple types of data files. xml xsd? Most of the files used by xmlcegui are in XML format. Apart from the special pictures and the module files (DLL) that can be loaded, you may think of the special one here. XSD file. although cegui uses the expat XML library by default, cegui used the xerces-C ++ library as its XML parsing library. crazy eddies prefers this library, which provides schema validation ). through mode verification, we can check whether the input file contains the required data and whether the data is correctly set during parsing. the system needs an additional file to do this. they use. the cegui mode file of XSD as the suffix is stored in the cgui_mk2/xmlrefschema/directory. currently. you only need to know that when xerce-C ++ is used as an XML parser, The resourceprovider system must find them. to do this, you only need to set a Resource Group and associate it with a resource group. and set the Resource Group to cegui: xeracesparser. the XSD file is the resource group used. to clearly describe the types of resources that a data file represents. not all data files are. XML is used as the suffix, but a more meaningful suffix. for example, the suffix of imageset is. imageset, Suffix of font. font and so on imageset for efficiency, we usually combine material files and other images into a large material image, in the use of each small material on the top. this imageset stores the region information of each small material in the source image. the source image is also specified in it. Each region has a unique name. When it is mentioned, the system treats it as an image. therefore, it can be said that the imageset defines a series of images. By modifying the source image name in the imageset and the location and size of each region, you can easily change the GUI appearance. font clearly defines the font used by cegui. two types of font can be defined: FreeType font, which is based on true-type (. TTF. starting from cegui 0.5.0. in the font file, use type = "FreeType" to specify the font type. In earlier versions, use "dynamic" to specify the font type. pixmap font bitmap font. this font is based on an imageset that defines text images. starting from cegui0.5.0. in the font file, use type = "pixmap" to specify the font. in earlier versions, use "static" to specify the font. scheme: this file is the main means to link other data files. It is also the most convenient way to load and define various controls. one scheme file can include one or more of the following files. (When a scheme file is loaded, its contained files are also loaded and initialized.) imagesetfontwindowset?wrendererset=waliasfalagardmapping windowset is mainly used to specify a load-able module. DLL. so. and list the names of the controls you want to register in the controls. if no space name is listed, all controls in the module will be registered. windowalias provides an alias to specify a window/space type. this method can also be used to "Replace" a registered space type with another control type to hide the registered controls.

Windowrendererset

Specify the name of a loadable module (. dll, etc.) and list the name of the window Renderer you want to register in the window Renderer used by the module. If no window Renderer name is listed, all the window Renderer in the module will be registered. The "window Renderer" is something that can control the rendering of basic window types. All the window pasters are rendered using the 'falagard' skin system (although not very necessary ). Falagardmapping is used to create an available windowtype, which contains three parts. targettype -- specify the base class (with related functions); Renderer ---- specify the window Renderer (you can control the specified targettype for rendering) looknfeel-specifies the skin to be used (generally, they are specified through the looknfeel file in XML format) The layout file describes the layout of a window in XML format. each embedded "window" element defines a window or control to be created. The "property" element sets relevant properties for each defined window. the configcegui file supports configuration file I. this file allows you to define some default parameters, such as the scheme loaded by default and the layout file loaded by default. initialize and terminate the script, as well as other things that are not mentioned. load basic files to successfully display the cegui, You need to load some files, at least the following imageset font scheme is worth noting The scehme file can automatically load the other two files. Based on the tutorial purpose, we will load a scheme file and a font file ------ the scheme file will automatically help us load an imageset file. code: // load scheme, which automatically loads taharezlook imageset cegui: schememanger: getsingleton (). loadscheme ("taharezlook. scheme "); load the font file. the first loaded font file will automatically become the default font. if (! Cegui: fontmanger: getsingleton (). isfontpresent ("Commonwealth-10") cegui: fontmanger: getsingleton (). createfont ("Commonwealth-10"); the Code above assumes that the resource group and default Resource Group are all set according to the method described in resource management. some default values need to be set at the end of simple default settings to ensure that the system always uses available fonts and mouse pointers, to prevent a window or control from setting its own font and mouse pointer. in fact, we do not need to specify a default font, because fontmanager will automatically set the first loaded font as the default font if it is not the default font you want. you can set it to another. the code for setting is as follows: System: getsingleton (). setdefaultfont ("Commonwealth-10 ");

The other thing you need to set the default value is the mouse pointer. This is done to ensure that the cursor does not disappear when it is placed on controls without pointers. The code for setting the default mouse pointer is as follows (taharezlook imageset loaded by the preceding scheme is used in this example ):

  1. System: getsingleton (). setdefaultmousecursor (
  2. "Taharezlook", "mousearrow ");

If you want to use a tooltip, You need to specify the type name of the tooltip-based control you want to use. Although this is usually not required, it is beyond the scope of this basic tutorial. In fact, you can set it based on each window. The code for setting the tooltip type is as follows:

  1. System: getsingleton (). setdefaulttooltip ("taharezlook/tooltip ");

 

Summary


At present, we have discussed the most basic things about the data files used by cegui: what they are, how they are loaded, and the minimum initialization work to be done. In the future, we will discuss each type of data file in depth and explore their more advanced usage.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.