Beispiel #1
0
        public static nk_command_base nk_command_buffer_push(nk_command_buffer b, int t)
        {
            if (b == null || t < 0 || t >= _commandCreators.Length || _commandCreators[t] == null)
            {
                return(null);
            }

            var creator = _commandCreators[t];

            var command = (nk_command_base)creator();

            command.header = new nk_command
            {
                type = t
            };

            if (b.last == null)
            {
                b.first = command;
                b.last  = command;
            }
            else
            {
                b.last.next = command;
                b.last      = command;
            }

            ++b.count;

            return(command);
        }
Beispiel #2
0
 public static void nk_command_buffer_reset(nk_command_buffer cmdbuf)
 {
     if (cmdbuf == null)
     {
         return;
     }
     cmdbuf.first = cmdbuf.last = null;
     cmdbuf.count = 0;
     cmdbuf.clip  = nk_null_rect;
 }
Beispiel #3
0
        public static void nk_fill_polygon(nk_command_buffer b, float *points, int point_count, nk_color col)
        {
            nk_command_polygon_filled cmd;

            if ((b == null) || (col.a == 0))
            {
                return;
            }
            cmd = (nk_command_polygon_filled)nk_command_buffer_push(b, NK_COMMAND_POLYGON_FILLED);
            if (cmd == null)
            {
                return;
            }
            cmd.color       = col;
            cmd.point_count = (ushort)point_count;
            cmd.points      = new nk_vec2i[point_count];
            for (var i = 0; i < point_count; ++i)
            {
                cmd.points[i].x = (short)points[i * 2 + 0];
                cmd.points[i].y = (short)points[i * 2 + 1];
            }
        }
Beispiel #4
0
        public static void nk_stroke_polygon(nk_command_buffer b, float *points, int point_count, float line_thickness,
                                             nk_color col)
        {
            if ((b == null) || (col.a == 0) || (line_thickness <= 0))
            {
                return;
            }
            var cmd = (nk_command_polygon)nk_command_buffer_push(b, NK_COMMAND_POLYGON);

            if (cmd == null)
            {
                return;
            }
            cmd.color          = col;
            cmd.line_thickness = (ushort)line_thickness;
            cmd.point_count    = (ushort)point_count;
            cmd.points         = new nk_vec2i[point_count];
            for (var i = 0; i < point_count; ++i)
            {
                cmd.points[i].x = (short)points[i * 2];
                cmd.points[i].y = (short)points[i * 2 + 1];
            }
        }
Beispiel #5
0
 public static void nk_command_buffer_init(nk_command_buffer cmdbuf, int clip)
 {
     cmdbuf.use_clipping = clip;
     cmdbuf.first        = cmdbuf.last = null;
     cmdbuf.count        = 0;
 }