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

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>
            亚洲免费中文字幕| 欧美日韩国产在线看| 欧美激情第10页| 在线亚洲电影| 午夜宅男久久久| 国产精品羞羞答答| 欧美aaa级| 欧美香蕉大胸在线视频观看| 久久精品女人| 免费在线日韩av| 亚洲欧美视频在线| 久久久久久久久久久成人| 亚洲美女黄色片| 午夜精品久久久久久久男人的天堂 | 欧美国产日韩一二三区| 亚洲午夜女主播在线直播| 欧美一区二区免费观在线| 一区二区三区.www| 美日韩在线观看| 看欧美日韩国产| 国产精品免费电影| 揄拍成人国产精品视频| 最新国产精品拍自在线播放| 国产精自产拍久久久久久蜜| 美女久久一区| 国内精品国语自产拍在线观看| 亚洲精品视频在线看| 亚洲激情视频网站| 久久噜噜噜精品国产亚洲综合| 香蕉久久国产| 国产精品免费观看视频| 中文在线不卡视频| 午夜精品在线看| 国产精品制服诱惑| 欧美一级免费视频| 久久综合狠狠综合久久激情| 一区二区三区在线看| 久久野战av| 欧美成人免费全部观看天天性色| 韩国成人福利片在线播放| 香蕉乱码成人久久天堂爱免费 | 欧美大胆人体视频| 尤物网精品视频| 欧美欧美天天天天操| 亚洲美女毛片| 欧美一区二区三区久久精品茉莉花 | 亚洲精品乱码久久久久久黑人| 夜夜嗨av一区二区三区| 国产精品视频福利| 免费成人黄色片| 亚洲欧美日韩综合aⅴ视频| 欧美bbbxxxxx| 亚洲欧美第一页| 亚洲深夜福利网站| 久久综合综合久久综合| 一本色道久久综合一区| 国内自拍亚洲| 国产精品色网| 欧美激情一区二区三区成人| 香蕉久久精品日日躁夜夜躁| 亚洲精品国产精品国自产观看| 久久九九99| 亚洲在线成人| 99精品国产一区二区青青牛奶| 狠狠色综合一区二区| 国产精品视频导航| 亚洲第一精品在线| 亚洲一区视频在线观看视频| 亚洲三级电影在线观看| 永久555www成人免费| 韩日欧美一区二区| 在线精品一区| 亚洲欧洲一区二区在线播放| 91久久久精品| 日韩午夜三级在线| 中文亚洲免费| 欧美一区二区三区免费视| 新狼窝色av性久久久久久| 午夜精品视频在线观看一区二区| 欧美一区三区三区高中清蜜桃| 亚洲制服av| 久久久青草青青国产亚洲免观| 久久久久久久91| 亚洲精品久久久久久久久久久久| 亚洲欧洲一级| 亚洲欧美激情视频| 久久国产一区二区三区| 欧美成人免费在线| 欧美日韩在线一区| 国产综合精品一区| 日韩视频在线观看免费| 久久夜色精品国产亚洲aⅴ| 亚洲人线精品午夜| 制服丝袜亚洲播放| 欧美在线观看视频在线| 欧美成人一二三| 亚洲免费人成在线视频观看| 蜜桃av一区二区三区| 狠狠色丁香婷婷综合影院| 浪潮色综合久久天堂| 国产精品久久久免费| 亚洲人午夜精品免费| 久久久久久久成人| 亚洲免费综合| 国产精品一二三| 亚洲一区二区欧美日韩| 欧美fxxxxxx另类| 久久久国产精品一区| 国产精品男女猛烈高潮激情| 亚洲小视频在线| 亚洲精品日本| 欧美激情小视频| 亚洲欧洲视频| 亚洲精品视频一区二区三区| 久久一区国产| 亚洲三级毛片| 99国产精品视频免费观看| 欧美视频一区二区在线观看| 一区二区三区四区五区精品| 亚洲人成网站色ww在线 | 欧美成人精品在线观看| 亚洲精品欧美| 亚洲天堂激情| 欧美激情自拍| 欧美伦理a级免费电影| 午夜亚洲精品| 麻豆精品视频| 亚洲欧美精品一区| 欧美一区二区三区在线视频| 亚洲国产精品久久久久秋霞不卡| 欧美国产日韩a欧美在线观看| 欧美午夜免费| 蜜臀久久久99精品久久久久久 | 久久国产精品久久w女人spa| 欧美亚洲网站| 久久精品国产久精国产一老狼| 亚洲欧洲一区二区三区| 亚洲色无码播放| 亚洲经典三级| 欧美一级精品大片| 亚洲一级一区| 欧美成人精品h版在线观看| 久久riav二区三区| 欧美日本高清| 欧美承认网站| 国产亚洲一区在线播放| 妖精视频成人观看www| 韩国福利一区| 亚洲欧美日韩在线高清直播| 亚洲调教视频在线观看| 美女诱惑一区| 美女日韩在线中文字幕| 国产视频一区欧美| av成人激情| 亚洲自拍偷拍色片视频| 欧美激情视频在线播放 | 韩国免费一区| 欧美在线免费视屏| 亚洲欧美日韩国产综合在线| 欧美日韩在线播放三区| 亚洲国产视频一区二区| 日韩一区二区精品| 欧美日韩免费在线观看| 妖精成人www高清在线观看| 亚洲一区在线免费观看| 国产精品欧美日韩久久| 欧美一区二区视频免费观看| 久久精品人人做人人爽电影蜜月| 国产一区在线视频| 欧美大片在线观看一区二区| 日韩视频免费观看| 午夜日本精品| 亚洲人成在线观看| 国产精品无人区| 久久亚洲一区| 亚洲精品免费在线观看| 亚洲欧美成人网| 亚洲国产精品一区二区第一页| 欧美精品一区视频| 久久国产直播| 亚洲男人的天堂在线aⅴ视频| 国产精品一区二区欧美| 久久婷婷人人澡人人喊人人爽| 91久久久亚洲精品| 欧美怡红院视频| 一区二区三区四区五区视频| 在线成人激情黄色| 国产精品国产福利国产秒拍| 免费日韩一区二区| 久久久久国产精品厨房| 亚洲一区二区伦理| 日韩一级大片在线| 最新亚洲电影| 欧美成人免费在线| 欧美多人爱爱视频网站| 玖玖玖免费嫩草在线影院一区| 久久精品日韩| 久久久噜噜噜久噜久久| 久久久久久尹人网香蕉| 久久久久久**毛片大全|