• <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>

            08年05月08日

            Posted on 2008-05-08 16:30 RichardHe 閱讀(1935) 評(píng)論(4)  編輯 收藏 引用
            CEGUI有背景圖片的BUTTON:
            昨天聽(tīng)到刀哥問(wèn)我對(duì)Looknfeel寫(xiě)東西有沒(méi)有什么心德體會(huì).說(shuō)實(shí)話,我還真正的寫(xiě)過(guò)一個(gè)wideget.然后突然就有一個(gè)沖動(dòng)想法.很多東西不寫(xiě)是不會(huì)熟悉的.我就參考刀哥的方法寫(xiě)了一個(gè)BUTTON
            有兩種方法可以實(shí)現(xiàn),一為在Looknfeel文件中直接修改
            <WidgetLook name="Vanilla/MyButton">
                    
            <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
                    
            <PropertyDefinition name="HoverTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
                    
            <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
                    
            <PropertyDefinition name="DisabledTextColour" initialValue="FF888888" redrawOnWrite="true" />
                    
            <PropertyDefinition name="VertLabelFormatting" initialValue="CentreAligned" />
                    
            <PropertyDefinition name="HorzLabelFormatting" initialValue="CentreAligned" />
                    
            <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
                    
            <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
                    
            <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
                    
            <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
                    
            <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
                    
            <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
                    
            <ImagerySection name="label">
                        
            <TextComponent>
                            
            <Area>
                                
            <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
                                
            <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
                                
            <Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
                                
            <Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
                            
            </Area>
                            
            <VertFormatProperty name="VertLabelFormatting" />
                            
            <HorzFormatProperty name="HorzLabelFormatting" />
                        
            </TextComponent>
                    
            </ImagerySection>
                    
            <ImagerySection name="normal">
                            
            <FrameComponent>
                            
            <Area>
                                
            <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
                                
            <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
                                
            <Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
                                
            <Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
                            
            </Area>
                            
            <Image type="LeftEdge" imageset="TaharezLook" image="ButtonLeftNormal" />
                            
            <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightNormal" />
                            
            <Image type="Background" imageset="TaharezLook" image="ButtonMiddleNormal" />
                        
            </FrameComponent>
                        
            <ImageryComponent>
                            
            <Area>
                                
            <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                                
            <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                                
            <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
                                
            <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
                            
            </Area>
                            
            <ImageProperty name="NormalImage" />
                            
            <VertFormatProperty name="VertImageFormatting" />
                            
            <HorzFormatProperty name="HorzImageFormatting" />
                        
            </ImageryComponent>
                    
            </ImagerySection>
                    
            <ImagerySection name="hover">
                        
            <FrameComponent>
                            
            <Area>
                                
            <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                                
            <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                                
            <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
                                
            <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
                            
            </Area>
                            
            <Image type="LeftEdge" imageset="TaharezLook" image="ButtonLeftHighlight" />
                            
            <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightHighlight" />
                            
            <Image type="Background" imageset="TaharezLook" image="ButtonMiddleHighlight" />
                        
            </FrameComponent>
                     
                        
            <ImageryComponent>
                            
            <Area>
                                
            <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                                
            <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                                
            <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
                                
            <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
                            
            </Area>
                            
            <ImageProperty name="HoverImage" />
                            
            <VertFormatProperty name="VertImageFormatting" />
                            
            <HorzFormatProperty name="HorzImageFormatting" />
                        
            </ImageryComponent>
                    
            </ImagerySection>
                    
            <ImagerySection name="pushed">
                          
            <FrameComponent>
                            
            <Area>
                                
            <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                                
            <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                                
            <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
                                
            <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
                            
            </Area>
                            
            <Image type="LeftEdge" imageset="TaharezLook" image="ButtonLeftPushed" />
                            
            <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightPushed" />
                            
            <Image type="Background" imageset="TaharezLook" image="ButtonMiddlePushed" />
                        
            </FrameComponent>
                        
                        
            <ImageryComponent>
                            
            <Area>
                                
            <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                                
            <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                                
            <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
                                
            <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
                            
            </Area>
                            
            <ImageProperty name="PushedImage" />
                            
            <VertFormatProperty name="VertImageFormatting" />
                            
            <HorzFormatProperty name="HorzImageFormatting" />
                        
            </ImageryComponent>
                    
            </ImagerySection>
                    
            <StateImagery name="Normal">
                        
            <Layer>
                            
            <Section section="normal" />
                            
            <Section section="label">
                                
            <ColourProperty name="NormalTextColour" />
                            
            </Section>
                        
            </Layer>
                    
            </StateImagery>
                    
            <StateImagery name="Hover">
                        
            <Layer>
                            
            <Section section="hover" />
                            
            <Section section="label">
                                
            <ColourProperty name="HoverTextColour" />
                            
            </Section>
                        
            </Layer>
                    
            </StateImagery>
                    
            <StateImagery name="Pushed">
                        
            <Layer>
                            
            <Section section="pushed" />
                            
            <Section section="label">
                                
            <ColourProperty name="PushedTextColour" />
                            
            </Section>
                        
            </Layer>
                    
            </StateImagery>
                    
            <StateImagery name="PushedOff">
                        
            <Layer>
                            
            <Section section="hover" />
                            
            <Section section="label">
                                
            <ColourProperty name="HoverTextColour" />
                            
            </Section>
                        
            </Layer>
                    
            </StateImagery>
                    
            <StateImagery name="Disabled">
                        
            <Layer>
                            
            <Section section="normal">
                                
            <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
                            
            </Section>
                            
            <Section section="label">
                                
            <ColourProperty name="DisabledTextColour" />
                            
            </Section>
                        
            </Layer>
                    
            </StateImagery>
                
            </WidgetLook>
            <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
            <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />        <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
            定義三個(gè)屬性,分別為NormalImage,HoverImage,PushImage;代表三個(gè)狀態(tài)下的顯示的圖片
            如果想在上面的初始化固定圖片也是可以的initialValue="set:imagesetname image:對(duì)應(yīng)里面的小圖名字"
            我的
            initialValue="set:Vanilla-Images image:ShadowBrush"


            另一個(gè)方法可以在程序中控制,這樣的話,可以針對(duì)不同的BUTTON可以設(shè)置不同的背景圖片.我的程序如下:

                WindowManager& winMgr = WindowManager::getSingleton();
                Window* button = winMgr.getWindow("root/MyButton");         //
            "root/Richard"為你的你窗口layout文件中一個(gè)BUTTON

                button->setProperty("NormalImage","set:Vanilla-Images image:ShadowBrush");

               
            1 <?xml version="1.0" encoding="UTF-8"?>
            2 
            3 <GUILayout >
            4 <Window Type="Vanilla/Richard" Name="root/MyButton" >
            5             <Property Name="Font" Value="DejaVuSans-10" />
            6             <Property Name="Text" Value="MyButton" />
            7             <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
            8             <Property Name="UnifiedAreaRect" Value="{{0.225,0},{0.433333,0},{0.474998,0},{0.556667,0}}" />
            9 </GUILayout>

              同時(shí)對(duì)應(yīng)的主題文件.scheme添加一個(gè)MAP

            1 <?xml version="1.0" ?>
            2 <GUIScheme Name="VanillaSkin">
            3     <Imageset Name="Vanilla-Images" Filename="Vanilla.imageset" />
            4     <LookNFeel Filename="Vanilla.looknfeel" />
            5     <WindowRendererSet Filename="CEGUIFalagardWRBase" />
            6 <FalagardMapping WindowType="Vanilla/MyButton" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="Vanilla/MyButton" />
            7 </GUIScheme>

            以上東西我要十分感覺(jué)兩位游戲界新朋友的指點(diǎn)
            夏科藝(http://blog.csdn.net/powerkoria/)和 付坤(http://blog.csdn.net/kun1234567/)

            Feedback

            # re: 08年05月08日  回復(fù)  更多評(píng)論   

            2008-05-08 18:15 by lonkil
            CEGUI做界面,沒(méi)有一個(gè)生成工具,不累死人呀。

            # re: 08年05月08日  回復(fù)  更多評(píng)論   

            2008-05-08 19:01 by RichardHe
            @lonkil
            looknfeel肯定是要自己寫(xiě)的了,不過(guò)可以參考CEGUI自帶的.
            像IMAGESET和LAYOUT都有工具的.

            # re: 08年05月08日  回復(fù)  更多評(píng)論   

            2008-05-10 00:31 by 放屁阿狗
            在做wince項(xiàng)目時(shí),ui frame都是自己實(shí)現(xiàn)的,cegui我剛剛開(kāi)始接觸,覺(jué)得其設(shè)計(jì)確實(shí)很有借鑒的作用,開(kāi)始琢磨cegui

            老兄是否做過(guò)cegui到wince的移植

            # re: 08年05月08日  回復(fù)  更多評(píng)論   

            2008-05-10 09:06 by RichardHe
            @放屁阿狗
            沒(méi)有,目前也只是在WIN32上面跑下而已.
            好像可以移到WINCE上面的..有那么個(gè)宏定義就可以來(lái)用哪個(gè)編譯器來(lái)編譯

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


            posts - 94, comments - 138, trackbacks - 0, articles - 94

            Copyright © RichardHe

            久久久噜噜噜www成人网| 久久午夜电影网| 国产精品久久久久一区二区三区| 亚洲欧美成人久久综合中文网 | 久久青青草视频| 国产午夜电影久久| 久久精品人成免费| 久久精品国产亚洲AV香蕉| 囯产精品久久久久久久久蜜桃| 午夜欧美精品久久久久久久| 久久婷婷国产综合精品| 久久久久久狠狠丁香| 国产精品久久久久久| 久久精品一区二区影院| 久久久久久久91精品免费观看| 久久精品中文字幕有码| 久久久久亚洲av成人无码电影| 久久人人爽人人爽人人片av麻烦 | 国产精品久久久久久影院 | 中文无码久久精品| 99久久精品国产高清一区二区| 久久精品国产半推半就| 99久久99久久精品国产片果冻| 中文字幕无码久久人妻| 四虎国产精品成人免费久久| 香港aa三级久久三级| 久久国产成人午夜AV影院| 久久亚洲国产精品成人AV秋霞| 日韩精品无码久久久久久| 日本精品久久久久中文字幕8 | 久久久国产精华液| 久久国内免费视频| 久久线看观看精品香蕉国产| 日本加勒比久久精品| 国产精品免费久久久久影院| 久久性精品| AV色综合久久天堂AV色综合在| 国产成人精品综合久久久| 久久青青草原综合伊人| 亚洲国产香蕉人人爽成AV片久久| 国产精品无码久久久久久|