使用urho3d的编辑器编辑UI思路及使用

使用urho3d其中UI原生编辑器,那么就需要了解怎么使用

urho3d的UI是直接使用一张png图片在加相应的DefaultStyle.xml来进行设计
看看机构

    <element type="BorderImage" >
        <attribute name="Texture" value="Texture2D;Textures/UI.png" />
        <attribute name="Blend Mode" value="alpha" />
    </element>
    <element type="Button" style="BorderImage">
        <attribute name="Image Rect" value="16 0 32 16" />
        <attribute name="Border" value="4 4 4 4" />
        <attribute name="Pressed Image Offset" value="16 0" />
        <attribute name="Hover Image Offset" value="0 16" />
        <attribute name="Pressed Child Offset" value="-1 1" />
    </element>

首先明确urho3d原生UI是使用像素点来做处理的

这里 BorderImage就是一整张UI.png图片了
看看Button他的类型是BorderImage,
Image Rect: 默认的状态的取的像素范围
这个就是一整张图片
在这里插入图片描述

大体就是这里,如果我们想定义自己的按钮可以这里

    <element type="BButon" style="Button" auto="false">
        <attribute name="Image Rect" value="288 0 304 16" />
        <attribute name="Border" value="4 4 4 4" />
        <attribute name="Pressed Image Offset" value="1 1" />
        <attribute name="Hover Image Offset" value="0 0" />
        <attribute name="Pressed Child Offset" value="-1 1" />
    </element>
    

下来就可以在编辑器里面直接设置这个东东了
在这里插入图片描述
有时候设置不一定生效,要保存
在这里插入图片描述

之后重新打开才会生效,需要自己尝试看看

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值