今天在參考WindowsLook.looknfeel自己寫了一個Button
<?xml version="1.0" ?>
<Falagard>
<WidgetLook name="WindowsLook/MyButton">
上面的意思大慨是明白的.但是
section = "normal"不是已經設置好了這個Button的所有東西嗎?為什么還要一個section = "label"??這是什么意思呢?
還是不明白是什么意思??
雖然不明白,但是還是自己寫了一個BUTTON.首先,用CELayoutEditor.exe 來加載TaharezLook.scheme的,
去對應的TaharezLook.looknfeel里,將這個按鈕添加在后面.你可以改為任意名字,我們把剛才寫的Button外觀改成MyButton
再到TaharezLook.scheme文件里照著Button復制一下,然后修改
<FalagardMapping WindowType="WindowsLook/MyButton" TargetType='CEGUI/Button' Renderer="Falagard/Editbox" LookNFeel="TaharezLook/MyButton" />
這個就可以在添加新的窗口下面你的MyButton.
---------------------------------------------------------------
用MSN用了一個朋友總算知道大慨是怎么回事了.一個BUUTON相當于圖片加LABEL文字了...
section 是一個外觀配置,多個Section構成了 某個狀態的 外觀
StateImagery 是指 某個狀態下的外觀
section是可以復用的。而StateImagery 就象是自由組裝它們的 人
為什么 StateImagery 有那些狀態?因為CEGUI 規定了這些狀態。
那什么是 section, section就是 具體的表現。它對應著Imageset里具體的 Image區域。
所以, section 負責實現各種外觀, StateImagery 負責為各種狀態選擇、組合 合適的外觀
但是 對于其他的 控件 ,一個圖片就不夠了。一般來說,定義一個窗口,我們需要定義9個部分:
1 2 3
4 5 6
7 8 9
4個邊 4個角, 1個中間
相當于 一個 Button+ 一個Laber 的復合控件
<?xml version="1.0" ?>
<Falagard>
<WidgetLook name="WindowsLook/MyButton">
1 <ImagerySection name="normal">
2 <FrameComponent>
3 <Area>
4 <Dim type="LeftEdge">
5 <AbsoluteDim value="0" />
6 </Dim>
7 <Dim type="TopEdge">
8 <AbsoluteDim value="0" />
9 </Dim>
10 <Dim type="RightEdge">
11 <UnifiedDim scale="1" type="RightEdge" />
12 </Dim>
13 <Dim type="BottomEdge">
14 <UnifiedDim scale="1" type="BottomEdge" />
15 </Dim>
16 </Area>
17 <Image type="TopLeftCorner" imageset="WindowsLook" image="ButtonNormalTopLeft" />
18 <Image type="TopRightCorner" imageset="WindowsLook" image="ButtonNormalTopRight" />
19 <Image type="BottomLeftCorner" imageset="WindowsLook" image="ButtonNormalBottomLeft" />
20 <Image type="BottomRightCorner" imageset="WindowsLook" image="ButtonNormalBottomRight" />
21 <Image type="LeftEdge" imageset="WindowsLook" image="ButtonNormalLeft" />
22 <Image type="TopEdge" imageset="WindowsLook" image="ButtonNormalTop" />
23 <Image type="RightEdge" imageset="WindowsLook" image="ButtonNormalRight" />
24 <Image type="BottomEdge" imageset="WindowsLook" image="ButtonNormalBottom" />
25 </FrameComponent>
26 <ImageryComponent>
27 <Area>
28 <Dim type="LeftEdge">
29 <ImageDim imageset="WindowsLook" image="ButtonNormalLeft" dimension="Width" />
30 </Dim>
31 <Dim type="TopEdge">
32 <ImageDim imageset="WindowsLook" image="ButtonNormalTop" dimension="Height" />
33 </Dim>
34 <Dim type="RightEdge">
35 <UnifiedDim scale="1" type="RightEdge">
36 <DimOperator op="Subtract">
37 <ImageDim imageset="WindowsLook" image="ButtonNormalRight" dimension="Width" />
38 </DimOperator>
39 </UnifiedDim>
40 </Dim>
41 <Dim type="BottomEdge">
42 <UnifiedDim scale="1" type="BottomEdge">
43 <DimOperator op="Subtract">
44 <ImageDim imageset="WindowsLook" image="ButtonNormalBottom" dimension="Height" />
45 </DimOperator>
46 </UnifiedDim>
47 </Dim>
48 </Area>
49 <Image imageset="WindowsLook" image="Background" />
50 <Colours topLeft="FFAFAFAF" topRight="FFFFFFFF" bottomLeft="FFFFFFFF" bottomRight="FFAFAFAF" />
51 <VertFormat type="Stretched" />
52 <HorzFormat type="Stretched" />
53 </ImageryComponent>
54 </ImagerySection>
2 <FrameComponent>
3 <Area>
4 <Dim type="LeftEdge">
5 <AbsoluteDim value="0" />
6 </Dim>
7 <Dim type="TopEdge">
8 <AbsoluteDim value="0" />
9 </Dim>
10 <Dim type="RightEdge">
11 <UnifiedDim scale="1" type="RightEdge" />
12 </Dim>
13 <Dim type="BottomEdge">
14 <UnifiedDim scale="1" type="BottomEdge" />
15 </Dim>
16 </Area>
17 <Image type="TopLeftCorner" imageset="WindowsLook" image="ButtonNormalTopLeft" />
18 <Image type="TopRightCorner" imageset="WindowsLook" image="ButtonNormalTopRight" />
19 <Image type="BottomLeftCorner" imageset="WindowsLook" image="ButtonNormalBottomLeft" />
20 <Image type="BottomRightCorner" imageset="WindowsLook" image="ButtonNormalBottomRight" />
21 <Image type="LeftEdge" imageset="WindowsLook" image="ButtonNormalLeft" />
22 <Image type="TopEdge" imageset="WindowsLook" image="ButtonNormalTop" />
23 <Image type="RightEdge" imageset="WindowsLook" image="ButtonNormalRight" />
24 <Image type="BottomEdge" imageset="WindowsLook" image="ButtonNormalBottom" />
25 </FrameComponent>
26 <ImageryComponent>
27 <Area>
28 <Dim type="LeftEdge">
29 <ImageDim imageset="WindowsLook" image="ButtonNormalLeft" dimension="Width" />
30 </Dim>
31 <Dim type="TopEdge">
32 <ImageDim imageset="WindowsLook" image="ButtonNormalTop" dimension="Height" />
33 </Dim>
34 <Dim type="RightEdge">
35 <UnifiedDim scale="1" type="RightEdge">
36 <DimOperator op="Subtract">
37 <ImageDim imageset="WindowsLook" image="ButtonNormalRight" dimension="Width" />
38 </DimOperator>
39 </UnifiedDim>
40 </Dim>
41 <Dim type="BottomEdge">
42 <UnifiedDim scale="1" type="BottomEdge">
43 <DimOperator op="Subtract">
44 <ImageDim imageset="WindowsLook" image="ButtonNormalBottom" dimension="Height" />
45 </DimOperator>
46 </UnifiedDim>
47 </Dim>
48 </Area>
49 <Image imageset="WindowsLook" image="Background" />
50 <Colours topLeft="FFAFAFAF" topRight="FFFFFFFF" bottomLeft="FFFFFFFF" bottomRight="FFAFAFAF" />
51 <VertFormat type="Stretched" />
52 <HorzFormat type="Stretched" />
53 </ImageryComponent>
54 </ImagerySection>
上面的意思大慨是明白的.但是
1 <StateImagery name="Normal">
2 <Layer>
3 <Section section="normal" />
4 <Section section="label">
5 <ColourProperty name="NormalTextColour" />
6 </Section>
7 </Layer>
8 </StateImagery>
2 <Layer>
3 <Section section="normal" />
4 <Section section="label">
5 <ColourProperty name="NormalTextColour" />
6 </Section>
7 </Layer>
8 </StateImagery>
section = "normal"不是已經設置好了這個Button的所有東西嗎?為什么還要一個section = "label"??這是什么意思呢?
1 <ImagerySection name="label">
2 <TextComponent>
3 <Area>
4 <Dim type="LeftEdge">
5 <AbsoluteDim value="0" />
6 </Dim>
7 <Dim type="TopEdge">
8 <AbsoluteDim value="0" />
9 </Dim>
10 <Dim type="RightEdge">
11 <UnifiedDim scale="1" type="RightEdge" />
12 </Dim>
13 <Dim type="BottomEdge">
14 <UnifiedDim scale="1" type="BottomEdge" />
15 </Dim>
16 </Area>
17 <VertFormat type="CentreAligned" />
18 <HorzFormat type="WordWrapCentreAligned" />
19 </TextComponent>
20 </ImagerySection>
這個lable主要是用來干嘛的呢?一個朋友的BLOG說是為這個BUTTON設置文本??2 <TextComponent>
3 <Area>
4 <Dim type="LeftEdge">
5 <AbsoluteDim value="0" />
6 </Dim>
7 <Dim type="TopEdge">
8 <AbsoluteDim value="0" />
9 </Dim>
10 <Dim type="RightEdge">
11 <UnifiedDim scale="1" type="RightEdge" />
12 </Dim>
13 <Dim type="BottomEdge">
14 <UnifiedDim scale="1" type="BottomEdge" />
15 </Dim>
16 </Area>
17 <VertFormat type="CentreAligned" />
18 <HorzFormat type="WordWrapCentreAligned" />
19 </TextComponent>
20 </ImagerySection>
還是不明白是什么意思??
雖然不明白,但是還是自己寫了一個BUTTON.首先,用CELayoutEditor.exe 來加載TaharezLook.scheme的,
去對應的TaharezLook.looknfeel里,將這個按鈕添加在后面.你可以改為任意名字,我們把剛才寫的Button外觀改成MyButton
再到TaharezLook.scheme文件里照著Button復制一下,然后修改
<FalagardMapping WindowType="WindowsLook/MyButton" TargetType='CEGUI/Button' Renderer="Falagard/Editbox" LookNFeel="TaharezLook/MyButton" />
這個就可以在添加新的窗口下面你的MyButton.
---------------------------------------------------------------
用MSN用了一個朋友總算知道大慨是怎么回事了.一個BUUTON相當于圖片加LABEL文字了...
section 是一個外觀配置,多個Section構成了 某個狀態的 外觀
StateImagery 是指 某個狀態下的外觀
section是可以復用的。而StateImagery 就象是自由組裝它們的 人
為什么 StateImagery 有那些狀態?因為CEGUI 規定了這些狀態。
那什么是 section, section就是 具體的表現。它對應著Imageset里具體的 Image區域。
所以, section 負責實現各種外觀, StateImagery 負責為各種狀態選擇、組合 合適的外觀
但是 對于其他的 控件 ,一個圖片就不夠了。一般來說,定義一個窗口,我們需要定義9個部分:
1 2 3
4 5 6
7 8 9
4個邊 4個角, 1個中間
相當于 一個 Button+ 一個Laber 的復合控件