青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

socketref,再見!高德

https://github.com/adoggie

  C++博客 :: 首頁 :: 聯系 :: 聚合  :: 管理
  246 Posts :: 4 Stories :: 312 Comments :: 0 Trackbacks

常用鏈接

留言簿(54)

我參與的團隊

搜索

  •  

最新評論

閱讀排行榜

評論排行榜

The purpose of this tutorial is to show you how to create a simple window and get it on screen. Before continuing here, it is very important that you have already read and fully understood the articles The Beginner Guide to Getting CEGUI Rendering and The Beginner Guide to Loading Data Files and Initialisation; this is important because this tutorial builds upon the basic ideas introduced in those tutorials.


Contents

[hide]

Introduction to window and widget concepts

Before we get the the meat of this tutorial there are some essential ideas that you must first consider.

Every widget is a window

This is the most central concept that must be grasped when working with CEGUI. Every widget within the system is derived from the same Window base class; so for the purposes of this tutorial, whenever I mention a window, the same ideas could just as easily be applied to a push button or scrollbar widget.

Many settings are inherited

Many of the settings and properties available for windows in CEGUI are passed down the window hierarchy. For example, if you set the alpha transparency on a particular window to 0.5, then by default, all window and widgets attached to that window will also be affected by the change applied at the higher level; although note also that the actual setting on the child window remains unchanged - the final values and/or settings used are usually some combination of the setting values from all windows in the hierarchy down to the current window. This also applies to things such as window destruction; by default, a window will destroy attached child windows and widgets when it is destroyed. The main advantages of this arrangement are that you can easily affect a the whole GUI by making changes to the root window settings for things like alpha, visibility, enabled / disabled state, and can easily 'clean up' an entire GUI layout by simply destroying the root window. The default 'inherited' behaviours can be overridden on a per window basis where more fine grained control is needed, or where certain advanced management techniques are to be used.


Creating the windows

Enough of the waffle! Lets create a window.

There are two ways of doing this, via C++ code and XML layout files. Each approach is discussed below.

GUI Creation via C++ code

All windows in CEGUI are created by the WindowManager singleton object. You can get access to this object via the usual getSingleton method as follows:

using namespace CEGUI;
WindowManager& wmgr = WindowManager::getSingleton();

In general, you will be using what is known as a DefaultWindow (or to use it's old name, DefaultGUISheet) as the 'root' window in your GUI. This is not required, but is the accepted pattern of usage for CEGUI and, once you start adding more top-level windows, helps simplify laying things out.

So, to get the ball rolling, we'll create a DefaultWindow as set it as the root 'GUI Sheet' for the GUI:

Window* myRoot = wmgr.createWindow( "DefaultWindow", "root" );
System::getSingleton().setGUISheet( myRoot );

The createWindow method of the WindowManager takes two strings as its parameters. The first one, "DefaultWindow" in this example, tells the system the type or class of the window you wish to create. Generally, the windows you have available are those which were registered when you loaded your scheme file, although some, like DefaultWindow, are global types and are always available. The second parameter, "root" in this example, is a unique name which will be assigned to the window; this name can be used to retrieve a pointer to the window from the WindowManager at a later time. Note that naming your root window "root" is not required, but is a common convention.

The setGUISheet method in the System singleton object is used to specify a given window as the root of the GUI. This will replace any current sheet / root window, although do note that the previous window hierarchy is not actually destroyed; it is just unlinked from the display - you can easily switch between GUI 'pages' by simply flipping between them using the setGUISheet method.

Now you have created your first window and attached it to the GUI system, and the system will use this window as the root of the GUI when it draws the GUI. But, if you were to compile a simple program using this code, you still can't see anything; what gives? There's nothing wrong with your application, the DefaultWindow which we created above is just totally invisible! This is what makes the DeafultWindow ideally suited as a root window; it serves as a blank canvas onto which other window and widgets can be attached. So, lets do that now...

Here we will create a frame window; this is a window that functions in a similar manner to the windows on your desktop UI, it has a title bar and can be moved and re-sized.

FrameWindow* fWnd = (FrameWindow*)wmgr.createWindow( "TaharezLook/FrameWindow", "testWindow" );

here we are creating a "TaharezLook/FrameWindow" window. This name uses a convention seen throughout the system, whereby a window type is prefixed by the name of the widget set (if you were to load the WindowsLook scheme, you could create a "WindowsLook/FrameWindow" object instead). We have given our new window the simple test name of "testWindow". One final thing to note is the use of the cast, this is required since the createWindow method always returns a base Window type; in this, and many other cases a basic Window pointer will suffice, but there are times when you'll want to access methods introduced in the window and widget sub-classes, so the use of the cast as shown is common when using CEGUI.

In order for the system to be able to do something useful with our new window, we must perform a few additional steps.

First, we must attach the window to the root window we established above:

myRoot->addChildWindow( fWnd );

Now, we can set an initial position and size for our window. CEGUI uses a 'unified' co-ordinate system enabling the use of relative (scale) and absolute (offset) components at the same time - this is why each co-ordinate you will see has two parts. For a slightly extended introduction of this concept see Introduction and overview of core "Falagard" support systems. Back to the example:

// position a quarter of the way in from the top-left of parent.
fWnd->setPosition( UVector2( UDim( 0.25f, 0 ), UDim( 0.25f, 0 ) ) );

// set size to be half the size of the parent
fWnd->setSize( UVector2( UDim( 0.5f, 0 ), UDim( 0.5f, 0 ) ) );

Finally, we set a caption for the frame window's title bar:

fWnd->setText( "Hello World!" );

And that's it! When compiled into an application, you will now see a simple frame window in the middle of the display.


XML layouts

All of the above is very nice, but there is one major drawback; any time you wish to adjust the GUI layout, you need to edit your code and recompile. This will get old pretty quick, so what you really want is to be able to specify your GUI layout externally, and have your code load the layout via a file. This is the purpose of the CEGUI layout XML files.

The system supports XML layout files, which can be loaded via the WindowManager using the loadWindowLayout method. This method creates all the windows for you and returns a pointer to the root window of the loaded hierarchy; which is ideal for assigning as the root of the GUI!

So, first of all we need a layout file. The following XML saved as a text file, is a layout file equivalent to the code we discussed above:

<?xml version="1.0" ?>
<GUILayout>
<Window Type="DefaultWindow" Name="root">
<Window Type="TaharezLook/FrameWindow" Name="testWindow">
<Property Name="UnifiedPosition" Value="{{0.25,0},{0.25,0}}" />
<Property Name="UnifiedSize" Value="{{0.5,0},{0.5,0}}" />
<Property Name="Text" Value="Hello World!" />
</Window>
</Window>
</GUILayout>

The Window elements show an obvious mapping to the createWindow method from the WindowManager object; they take a type and a name which directly correspond to the parameters discussed previously.

Nesting of the Window elements is used to attach certain windows to others. Note that you may only have one 'root' level window in a layout file, which is another reason you'll usually see the DefaultWindow used as a canvas on which other windows and widgets are placed.

The Property elements are used to set properties on the Window being defined. There are many properties available for each window/widget class, and each class also inherits all properties from it's parent class. See the <element>Properties namespaces in the API reference for documentation on the available hard-coded properties and their 'value string' formats. Since 'Falagard' skins can create their own properties, it is likely that the windows you are using contain many more properties than listed in the previous link - for these 'soft' properties, you need to consult whichever documentation is provided with the skin you are using (for the sample skins see TaharezLook and WindowsLook).

If saved as a file called "test.layout", you could load this layout and set it as the GUI root as follows:

using namespace CEGUI;
Window* myRoot = WindowManager::getSingleton().loadWindowLayout( "test.layout" );
System::getSingleton().setGUISheet( myRoot );

The end result is exactly the same as what was done in C++ code earlier, except that now you can modify and enhance the GUI layout without the need for constant editing and recompilation of the application code.




理解以上教程很是簡單,提供了兩種創建widget的方法


posted on 2008-05-10 02:58 放屁阿狗 閱讀(745) 評論(0)  編輯 收藏 引用 所屬分類: OpenSource開源工程
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲欧美日韩中文视频| 亚洲另类一区二区| 亚洲国产99| 伊人婷婷久久| 亚洲韩国一区二区三区| 91久久久久久久久| 亚洲在线视频观看| 亚洲欧美一区二区原创| 亚洲肉体裸体xxxx137| 欧美午夜一区| 国产精品红桃| 国产在线不卡精品| 狠狠色香婷婷久久亚洲精品| 精品1区2区| 一本久道久久综合狠狠爱| 性刺激综合网| 亚洲国产日韩欧美综合久久| 亚洲高清色综合| 亚洲尤物在线| 欧美不卡一区| 国产午夜精品全部视频播放| 亚洲精品久久久一区二区三区| 一区二区三区精品国产| 久久久精品2019中文字幕神马| 蜜桃久久av一区| 久久国产精品第一页| 欧美日韩国产专区| 亚洲乱亚洲高清| 欧美成人亚洲| 欧美体内谢she精2性欧美| 久久这里有精品视频| 欧美成人午夜| 欧美日韩黄色大片| 亚洲精品免费一二三区| 亚洲欧美日韩另类| 欧美韩日一区| 久久精品在线| 国产精品久久婷婷六月丁香| 欧美夫妇交换俱乐部在线观看| 久久综合国产精品台湾中文娱乐网| 欧美日韩在线综合| 亚洲美女精品成人在线视频| 久久久蜜臀国产一区二区| 久久九九久久九九| 日韩一级二级三级| 欧美在线看片| 国产精品99久久久久久久久 | 免费不卡在线观看av| 在线播放不卡| 99日韩精品| 亚洲国产片色| 国产精品入口福利| 亚洲精品视频在线观看网站| 午夜一区二区三区不卡视频| 99成人免费视频| 欧美日韩在线一区| 亚洲一区久久| 亚洲女女女同性video| 欧美黑人一区二区三区| 久久综合中文色婷婷| 国产日韩精品一区二区| 亚洲视频精选| 中文久久精品| 欧美日韩在线高清| 最新国产精品拍自在线播放| 一区二区三区在线观看视频 | 亚洲欧美日韩一区二区三区在线| 久久亚洲一区| 亚洲国产一区二区a毛片| 亚洲激情国产| 欧美日韩免费精品| 一本久久综合亚洲鲁鲁| 久久久国产精品一区二区三区| 性欧美在线看片a免费观看| 国产欧美日韩视频一区二区| 亚洲综合三区| 欧美激情第六页| 99视频在线观看一区三区| 欧美日韩高清在线观看| 亚洲综合色丁香婷婷六月图片| 久久久噜久噜久久综合| 最新国产精品拍自在线播放| 欧美三级乱人伦电影| 亚洲欧美日韩国产一区二区| 久久成人免费电影| 亚洲毛片在线观看.| 国产一区二区中文| 欧美日韩精品一本二本三本| 久久国产精品久久久| 日韩一区二区电影网| 欧美成人一区在线| 欧美在线不卡视频| 亚洲综合日韩| 日韩视频在线一区| 亚洲激情视频网| 国产一二精品视频| 国产精品视频一区二区高潮| 美日韩丰满少妇在线观看| 欧美一区二区三区另类| 亚洲私人影吧| 日韩一级网站| 亚洲少妇最新在线视频| 国产精品视频观看| 久久精品国产视频| 久久99伊人| 久久久久久久网| 久久久久久久久岛国免费| 久久国产免费看| 蜜臀99久久精品久久久久久软件| 久久精品首页| 久久久亚洲国产天美传媒修理工| 欧美电影在线免费观看网站| 久久亚洲国产成人| 免费看亚洲片| 欧美人与性动交α欧美精品济南到| 久久综合久久88| 欧美激情一区二区三区在线视频 | 久久九九精品| 欧美精品三区| 国产女人精品视频| 亚洲激情小视频| 久久爱www久久做| 久久久欧美一区二区| 亚洲麻豆视频| 欧美剧在线免费观看网站| 欧美成人第一页| 在线免费观看日本欧美| 久久亚洲精品视频| 中文一区字幕| 欧美日韩免费精品| 日韩午夜av在线| 最新国产精品拍自在线播放| 午夜在线一区二区| 欧美日韩免费观看一区三区 | 午夜激情一区| 欧美午夜宅男影院在线观看| 亚洲人成网站999久久久综合| 久久久久国产一区二区| 亚洲精品国精品久久99热| 久久麻豆一区二区| 国产专区一区| 噜噜爱69成人精品| 久久精品一二三区| 伊人成年综合电影网| 玖玖玖国产精品| 久久精品国产99| 伊人夜夜躁av伊人久久| 久久视频在线看| 久久在线视频| 久久激情中文| 99国内精品| 亚洲一区亚洲| 在线日韩精品视频| 一本久道久久综合狠狠爱| 国产精品日韩精品欧美精品| 欧美成人日韩| 狠狠色伊人亚洲综合成人| 亚洲尤物视频在线| 亚洲一区一卡| 亚洲一区二区视频| 国产婷婷精品| 亚洲电影第三页| 欧美日韩综合另类| 久久riav二区三区| 欧美极品一区| 久久综合色88| 国产精品qvod| 欧美69wwwcom| 国产精品私房写真福利视频 | 韩国视频理论视频久久| 久久久久成人精品| 欧美三级电影精品| 亚洲成色777777女色窝| 国产精品午夜在线| 亚洲日本va午夜在线影院| 狠狠色综合色区| 亚洲欧美日韩综合aⅴ视频| 亚洲欧洲一区二区在线观看| 亚洲综合激情| 亚洲欧美视频| 欧美日韩午夜在线| 亚洲美女视频网| 亚洲精品女人| 免费成人毛片| 亚洲二区免费| 亚洲精品永久免费| 男男成人高潮片免费网站| 久久九九精品99国产精品| 国产精品美女| 久久高清免费观看| 蜜臀91精品一区二区三区| 亚洲国内自拍| 欧美日韩国产123| 日韩小视频在线观看| 欧美精品在线观看播放| 久久久久久穴| 亚洲国产欧美一区| 欧美日本一区二区三区| 夜夜精品视频一区二区| 午夜伦欧美伦电影理论片|