コード例 #1
0
ファイル: HUD.cs プロジェクト: mambotuna/DOTS-training
    public static void Draw_ArcGraph(Graph _graph, float _x, float _y, float _radius_START, float _radius_END, float _angle_MIN, float _angle_MAX, Color _col_MIN, Color _col_MAX, bool _alphaFade = false, int _sides = DEFAULT_ARC_SIDES, float _gutterRatio = DEFAULT_GUTTER_RATIO)
    {
        int   _COUNT         = _graph.binCount;
        float _DRAW_RANGE    = _radius_END - _radius_START;
        float _BAR_SPACE     = _DRAW_RANGE * _gutterRatio;
        float _BAR_THICKNESS = _BAR_SPACE / _COUNT;
        float _GUTTER        = (_DRAW_RANGE - _BAR_SPACE) / (_COUNT - 1f);
        float _ANGLE_RANGE   = _angle_MAX - _angle_MIN;

        for (int i = 0; i < _COUNT; i++)
        {
            float _BAR_START = _radius_START + ((i * _BAR_THICKNESS) + (i * _GUTTER));
            float _BIN_VALUE = _graph.Get_Value(i);
            Color _COL       = Color.Lerp(_col_MIN, _col_MAX, _BIN_VALUE);
            GL_DRAW.Draw_ARC_FILL(
                _sides,
                _x,
                _y,
                _angle_MIN,
                (_angle_MIN + (_ANGLE_RANGE * _BIN_VALUE)),
                _BAR_START,
                _BAR_START + _BAR_THICKNESS,
                (_alphaFade) ? COL.Set_alphaStrength(_COL, _BIN_VALUE) : _COL
                );
        }
    }
コード例 #2
0
    void DrawHoop(float _x, float _y, float _size, float _alphaStrength = 1f, float _start = 0, float _end = 1, float _angleOffset = 0)
    {
        float _HOOP_START     = _HOOP_SIZE * _size;
        float _HOOP_THICKNESS = 0.25f * _size;
        float _HOOP_END       = _HOOP_START + _HOOP_THICKNESS;
        float _ANGLE_START    = _start + _angleOffset;
        float _ANGLE_END      = _end + _angleOffset;

        GL_DRAW.Draw_ARC_FILL(_HOOP_SIDES, _x, _y, _ANGLE_START, _ANGLE_END, _HOOP_START, _HOOP_END, P.Get(3, _alphaStrength * 0.5f));
        GL_DRAW.Draw_ARC_FILL(_HOOP_SIDES, _x, _y, _ANGLE_START, _ANGLE_END, _HOOP_START, _HOOP_START + (_HOOP_THICKNESS * 0.25f), P.Get(3, _alphaStrength));
    }
コード例 #3
0
ファイル: HUD.cs プロジェクト: mambotuna/DOTS-training
    public static void Draw_ARC_PARTITIONS_FILL(Partitions _partitions, int _sides, float _x, float _y, float _radius, float _thickness, float _angle_start = 0, float _angle_end = 1, float _rotation = 0)
    {
        float _RADIUS_END = _radius + _thickness;
        float _angleRange = _angle_end - _angle_start;

        for (int i = 0; i < _partitions.count; i++)
        {
            Partition _P           = _partitions.Get(i);
            float     _ANGLE_START = _angleRange * _P.start;
            GL_DRAW.Draw_ARC_FILL(_sides, _x, _y, _ANGLE_START, _ANGLE_START + (_angleRange * _P.share), _radius, _radius + _thickness, _P.colour, _rotation);
        }
    }
コード例 #4
0
ファイル: GL_DRAW.cs プロジェクト: lichen123456789/ECS_2D
    public static void Draw_ARC_CELLS(float _x, float _y, float _radius_START, float _thickness, BitArray _cells, Color _col, float _angle_START = 0, float _angle_END = 1, float _gutterRatio = HUD.DEFAULT_GUTTER_RATIO, int _segmentSides = HUD.DEFAULT_ARC_SIDES, float _rotation = 0)
    {
        int   _TOTAL_CELLS     = _cells.Length;
        float _ANGLE_RANGE     = _angle_END - _angle_START;
        float _ANGLE_DRAW_AREA = _ANGLE_RANGE * _gutterRatio;
        float _DIV_ANGLE       = _ANGLE_DRAW_AREA / _TOTAL_CELLS;
        float _GUTTER_ANGLE    = (_ANGLE_RANGE - _ANGLE_DRAW_AREA) / (_TOTAL_CELLS - 1);

        for (int i = 0; i < _TOTAL_CELLS; i++)
        {
            if (_cells.Get(i))
            {
                float _START_ANGLE = _angle_START + ((i * _DIV_ANGLE) + (i * _GUTTER_ANGLE));
                GL_DRAW.Draw_ARC_FILL(_segmentSides, _x, _y, _START_ANGLE, _START_ANGLE + _DIV_ANGLE, _radius_START, _radius_START + _thickness, _col, _rotation);
            }
        }
    }