示例#1
0
        public void Render(IRenderContext renderContext, Rectangle layout, FileSelect fileSelect)
        {
            var offset = 0;

            if (fileSelect.State == ButtonUIState.Clicked)
            {
                _basicSkinHelper.DrawSunken(renderContext, layout);
                offset = 1;
            }
            else
            {
                _basicSkinHelper.DrawRaised(renderContext, layout);
            }

            var text = fileSelect.Path ?? string.Empty;

            while (text.Length > 0 && _renderUtilities.MeasureText(renderContext, "(file select) ..." + text, _fontAsset).X > layout.Width - 10)
            {
                text = text.Substring(1);
            }

            if (text.Length != (fileSelect.Path ?? string.Empty).Length)
            {
                text = "..." + text;
            }

            _renderUtilities.RenderText(
                renderContext,
                new Vector2(layout.Center.X + offset, layout.Center.Y + offset),
                "(file select) " + text,
                _fontAsset,
                HorizontalAlignment.Center,
                VerticalAlignment.Center);
        }
        public void Render(IRenderContext renderContext, Rectangle layout, TextBox textBox)
        {
            _basicSkinHelper.DrawSunken(renderContext, layout);

            var textToRender = textBox.Text;

            if (textBox.Focused && (textBox.UpdateCounter / 15) % 2 == 0)
            {
                textToRender += "_";
            }

            if (string.IsNullOrEmpty(textBox.Text) && !textBox.Focused)
            {
                _renderUtilities.RenderText(
                    renderContext,
                    new Vector2(layout.X + 4, layout.Center.Y),
                    textBox.Hint,
                    _fontAsset,
                    textColor: Color.DimGray,
                    verticalAlignment: VerticalAlignment.Center);
            }
            else
            {
                _renderUtilities.RenderText(
                    renderContext,
                    new Vector2(layout.X + 4, layout.Center.Y),
                    textToRender,
                    _fontAsset,
                    verticalAlignment: VerticalAlignment.Center);
            }
        }
        public void Render(IRenderContext renderContext, Rectangle layout, ScrollableContainer scrollableContainer)
        {
            _basicSkinHelper.DrawSunken(renderContext, layout);

            var layoutWidth  = layout.Width - _skinLayout.HorizontalScrollBarHeight;
            var layoutHeight = layout.Height - _skinLayout.VerticalScrollBarWidth;

            var childContent = scrollableContainer.ChildContent;

            _renderUtilities.RenderTexture(
                renderContext,
                new Vector2(layout.X, layout.Y),
                new TextureAsset(childContent),
                new Vector2(layoutWidth, layoutHeight),
                sourceArea: new Rectangle(
                    (int)(scrollableContainer.ScrollX * (System.Math.Max(childContent.Width, layoutWidth) - layoutWidth)),
                    (int)(scrollableContainer.ScrollY * (System.Math.Max(childContent.Height, layoutHeight) - layoutHeight)),
                    layoutWidth,
                    layoutHeight));

            var raisedPadding = 3;

            _basicSkinHelper.DrawSunken(renderContext, new Rectangle(
                                            layout.X,
                                            layout.Y + layout.Height - _skinLayout.HorizontalScrollBarHeight,
                                            layout.Width - _skinLayout.VerticalScrollBarWidth,
                                            _skinLayout.HorizontalScrollBarHeight));
            _basicSkinHelper.DrawSunken(renderContext, new Rectangle(
                                            layout.X + layout.Width - _skinLayout.VerticalScrollBarWidth,
                                            layout.Y,
                                            _skinLayout.VerticalScrollBarWidth,
                                            layout.Height - _skinLayout.HorizontalScrollBarHeight));

            _basicSkinHelper.DrawRaised(renderContext, new Rectangle(
                                            (int)(layout.X + scrollableContainer.ScrollX * (layoutWidth - layoutWidth / (float)childContent.Width * layoutWidth)) + raisedPadding,
                                            layout.Y + layout.Height - _skinLayout.HorizontalScrollBarHeight + raisedPadding,
                                            (int)(layoutWidth / (float)childContent.Width * layoutWidth) - raisedPadding * 2,
                                            _skinLayout.HorizontalScrollBarHeight - raisedPadding * 2));

            _basicSkinHelper.DrawRaised(renderContext, new Rectangle(
                                            layout.X + layout.Width - _skinLayout.VerticalScrollBarWidth + raisedPadding,
                                            (int)(layout.Y + scrollableContainer.ScrollY * (layoutHeight - layoutHeight / (float)childContent.Height * layoutHeight)) + raisedPadding,
                                            _skinLayout.VerticalScrollBarWidth - raisedPadding * 2,
                                            (int)(layoutHeight / (float)childContent.Height * layoutHeight) - raisedPadding * 2));
        }
        public void Render(IRenderContext renderContext, Rectangle layout, TextureViewer textureViewer)
        {
            _basicSkinHelper.DrawSunken(renderContext, layout);

            if (textureViewer.Texture != null)
            {
                _renderUtilities.RenderTexture(renderContext, new Vector2(layout.X, layout.Y), textureViewer.Texture);
            }
        }
        public void Render(IRenderContext renderContext, Rectangle layout, AudioPlayer audioPlayer)
        {
            _basicSkinHelper.DrawSunken(renderContext, layout);

            _renderUtilities.RenderText(
                renderContext,
                new Vector2(layout.Center.X, layout.Center.Y + 12),
                "No visualization available.",
                _fontAsset,
                HorizontalAlignment.Center,
                VerticalAlignment.Center);
        }
        public void Render(IRenderContext renderContext, Rectangle layout, FontViewer fontViewer)
        {
            _basicSkinHelper.DrawSunken(renderContext, layout);

            if (fontViewer.Font != null)
            {
                _renderUtilities.RenderText(
                    renderContext,
                    new Vector2(layout.X, layout.Y),
                    "Font Example",
                    fontViewer.Font);
            }
        }
        public void Render(IRenderContext renderContext, Rectangle layout, Button button)
        {
            var offset = 0;

            if (button.State == ButtonUIState.Clicked)
            {
                _basicSkinHelper.DrawSunken(renderContext, layout);
                offset = 1;
            }
            else
            {
                _basicSkinHelper.DrawRaised(renderContext, layout);
            }

            _renderUtilities.RenderText(
                renderContext,
                new Vector2(layout.Center.X + offset, layout.Center.Y + offset),
                button.Text,
                _fontAsset,
                HorizontalAlignment.Center,
                VerticalAlignment.Center);
        }
示例#8
0
 public void Render(IRenderContext renderContext, Rectangle layout, ListView listView)
 {
     _basicSkinHelper.DrawSunken(renderContext, layout);
 }