Giter VIP home page Giter VIP logo

xugl's Introduction

XUGL

UGUI Graphics Library for Unity.
UGUI 图形库。

一款孵化自XChartsUGUI图形库,可绘制点、线、面等其他常见的图形。通过重载 UGUIOnPopulateMesh() 重新填充顶点缓冲区来实现绘制自定义图形效果。

API

UGL.DrawArrow( ) 画箭头
UGL.DrawLine( ) 画直线
UGL.DrawDashLine( ) 画虚线
UGL.DrawDotLine( ) 画点线
UGL.DrawDashDotLine( ) 画点划线
UGL.DrawDashDotDotLine( ) 画双点划线
UGL.DrawZebraLine( ) 画斑马线
UGL.DrawDiamond( ) 画菱形(钻石形状)
UGL.DrawSquare( ) 画正方形
UGL.DrawRectangle( ) 画带长方形
UGL.DrawQuadrilateral( ) 画任意的四边形
UGL.DrawRoundRectangle( ) 画圆角矩形
UGL.DrawBorder( ) 画边框
UGL.DrawTriangle( ) 画三角形
UGL.DrawCricle( ) 画圆
UGL.DrawEmptyCricle( ) 画空心圆
UGL.DrawSector( ) 画扇形
UGL.DrawRoundCap( ) 画圆帽
UGL.DrawDoughnut( ) 画圆环
UGL.DrawCurves( ) 画贝塞尔曲线

使用

通过源码或Package Manager的方式导入XUGL
自定义类继承自UGUIGraphic,或相关的可重载 OnPopulateMesh() 的类。

public class UGLExample : MaskableGraphic
{
}

重载 OnPopulateMesh(), 用 XUGL 重新填充 UGUI 的顶点缓冲区数据。

protected override void OnPopulateMesh(VertexHelper vh)
{
    Vector3 sp, cp, ep;
    vh.Clear();

    //背景边框
    UGL.DrawSquare(vh, m_Center, m_Width / 2, m_BackgroundColor);
    UGL.DrawBorder(vh, m_Center, m_Width, m_Height, 10, Color.green, 0, m_BorderRadius);

    //点
    UGL.DrawCricle(vh, m_LeftTopPos + new Vector3(20, -20), 10, m_DrawColor);

    //直线
    sp = new Vector3(m_LeftTopPos.x + 50, m_LeftTopPos.y - 20);
    ep = new Vector3(m_LeftTopPos.x + 250, m_LeftTopPos.y - 20);
    UGL.DrawLine(vh, sp, ep, 3, m_DrawColor);

    //3点确定的折线
    sp = new Vector3(m_LeftTopPos.x + 20, m_LeftTopPos.y - 100);
    cp = new Vector3(m_LeftTopPos.x + 200, m_LeftTopPos.y - 40);
    ep = new Vector3(m_LeftTopPos.x + 250, m_LeftTopPos.y - 80);
    UGL.DrawLine(vh, sp, cp, ep, 5, m_DrawColor);
}

完整代码请查阅ExamplesUGLExample.cs

日志

更新日志

Licenses

MIT License

xugl's People

Contributors

monitor1394 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.