Exemple #1
0
        public void Build(WidgetGroup rootGroup)
        {
            Time.StartTimer("GuiRenderer.Rebuild()", "Update");

            vertices = new List<Vector2>();
            uv = new List<Vector3>();
            colors = new List<Vector4>();

            lock(vertices)
            {
                int index = 0;

                RecursiveBuild(rootGroup, vertices, uv, colors, ref index);

                rootGroup.Dirty = false;

                count = vertices.Count;
                reupload = true;
            }

            Time.StopTimer("GuiRenderer.Rebuild()");
        }
Exemple #2
0
        void UpdateGroup(WidgetGroup rootGroup, double delta)
        {
            for (int i = 0; i < rootGroup.Widgets.Count; i++)
            {
                var widget = rootGroup.Widgets[i];

                if (!widget.Visible)
                    continue;

                widget.Update(delta);

                if (widget.DirtyColor)
                {
                    renderer.UpdateColor(widget.drawStartIndex, widget.drawEndIndex, widget.Color);
                    widget.DirtyColor = false;
                    //Debug.WriteLine("DirtyColor = " + widget);
                }

                if (widget.CustomRenderLayer != string.Empty)
                    EnqueueCustomRenderingWidget(widget);

                var group = widget as WidgetGroup;

                if (group != null) UpdateGroup(group, delta);
            }

            if (rootGroup.RequiresSorting)
            {
                rootGroup.SortChildWidgets();
                rootGroup.RequiresSorting = false;
            }
        }
Exemple #3
0
        void RecursiveBuild(WidgetGroup rootGroup, List<Vector2> vertices, List<Vector3> uv, List<Vector4> colors, ref int index)
        {
            foreach (var widget in rootGroup.Widgets)
            {
                if (!widget.Visible)
                    continue;

                if(widget.Anchor != null)
                    widget.Anchor.SetCoordinates(widget.position, widget.size);

                widget.Dirty = false;

                int start = vertices.Count;

                widget.GetVertices(vertices, uv, colors);

                int current = vertices.Count;

                if (vertices != null && vertices.Count > 0 && start < current)
                {
                    index += current - start;

                    widget.drawStartIndex = start;
                    widget.drawEndIndex = current;
                }

                var group = widget as WidgetGroup;

                if (group != null)
                    RecursiveBuild(group, vertices, uv, colors, ref index);
            }
        }