Ejemplo n.º 1
0
        /// <inheritdoc />
        protected override void OnDraw(GameTime gameTime, SpriteRocket2D renderer)
        {
            foreach (var scene in _sceneStack)
            {
                scene.Draw(gameTime, renderer);
            }

            // If the developer setting is enabled, draw a blue highlight over the hovered GUI element if any.
            if (Settings.HighlightHoveredGuiElement)
            {
                if (_hoveredControl != null)
                {
                    var bounds = _hoveredControl.BoundingBox;

                    renderer.Begin();
                    renderer.FillRectangle(bounds, Color.Blue * 0.33f);
                    renderer.End();
                }
            }

            if (_showBoundingRects)
            {
                if (_sceneStack.Any())
                {
                    renderer.Begin();

                    var root = _sceneStack.Last().Gui;

                    foreach (var child in root.CollapseControlTree())
                    {
                        renderer.DrawRectangle(child.ContentRectangle, Color.Yellow, 1);
                        renderer.DrawRectangle(child.BoundingBox, Color.White, 1);
                    }

                    renderer.End();
                }
            }


            if (_showFps)
            {
                var fps     = 1f / gameTime.ElapsedGameTime.TotalSeconds;
                var fpsText = $"{Math.Round(fps)} fps";
                var font    = Skin.GetFont(SkinFontStyle.Code);
                var m       = font.MeasureString(fpsText);

                renderer.Begin();
                renderer.FillRectangle(new Rectangle(0, 0, (int)m.X, (int)m.Y), Color.Black);
                renderer.DrawString(font, fpsText, Vector2.Zero, Color.White);
                renderer.End();
            }
        }
Ejemplo n.º 2
0
        protected override void OnDraw(GameTime gameTime, SpriteRocket2D renderer)
        {
            //Texture2D weebTexture = Texture2D.FromStream(renderer.GraphicsDevice, fileStream);

            var font = Skin.GetFont(SkinFontStyle.Heading1);

            renderer.Begin();
            if (onbeat)
            {
                renderer.FillRectangle(Gui.BoundingBox, Color.White);
            }
            else
            {
                renderer.FillRectangle(Gui.BoundingBox, Color.LightGray);
            }
            renderer.DrawString(font, "hello", new Vector2((Gui.BoundingBox.Width - font.MeasureString("hello").X) / 2, (Gui.BoundingBox.Width - font.MeasureString("hello").Y) / 2 - ((float)musicManager.SongTime - 7737)), Color.LimeGreen);
            string stuff = $"{onbeat}: BPM: {musicManager.CurrentTimingPoint.Bpm} Offset: {musicManager.CurrentTimingPoint.Offset} Clock - {musicManager.SongTime} | FMP - {musicManager.Player.CurrentBackend?.CurrentTime.TotalMilliseconds} {(float)musicManager.SongTime - 40137}";

            renderer.DrawString(font, stuff, new Vector2((Gui.BoundingBox.Width - font.MeasureString(stuff).X) / 2, (Gui.BoundingBox.Height - font.MeasureString(stuff).Y) / 2), Color.Black);
            renderer.End();
            base.OnDraw(gameTime, renderer);
        }