示例#1
0
文件: UIItem.cs 项目: hvp/Gemgine
        public virtual void Render(Renderer.RenderContext2D context)
        {
            if (Visible)
            {
                if (GetSetting("hidden-container", null) == null)
                {
                    if (GetSetting("transparent", null) == null)
                    {
                        context.Texture = context.White;
                        context.Color = (GetSetting("bg-color", Vector3.One) as Vector3?).Value;
                        context.Quad(rect);
                    }

                    var label = GetSetting("label", null);
                    var font = GetSetting("font", null);
                    if (label != null && font != null)
                    {
                        context.Color = (GetSetting("text-color", Vector3.Zero) as Vector3?).Value;
                        BitmapFont.RenderText(label.ToString(), rect.X, rect.Y, rect.Width + rect.X,
                            context, font as BitmapFont);
                    }
                }

                foreach (var child in children)
                    child.Render(context);
            }
        }
示例#2
0
文件: Slider.cs 项目: hvp/Gemgine
        public override void Render(Renderer.RenderContext2D context)
        {
            base.Render(context);
            if (Visible)
            {
                context.Texture = context.White;
                context.Color = (GetSetting("fg-color", Vector3.Zero) as Vector3?).Value;

                var halfWidth = rect.Width / 2;
                var handleSize = this.handle_size;

                context.Quad(rect.X + halfWidth - 1, rect.Y, 2, rect.Height);
                context.Quad(rect.X, rect.Y + handlePosition - (handleSize / 2), rect.Width, handleSize);
            }
        }