Пример #1
0
        /// <summary>
        /// Renders the profiler graph
        /// TODO: Make the graph renderer prettier. ie border, background, and then scaling it
        /// </summary>
        public override void Draw()
        {
            //Draw the background
            UiStateManager.DrawImage(new Rectangle(location.X + GameSettings.UIScale, location.Y + GameSettings.UIScale, size.X - 2 * GameSettings.UIScale, size.Y - 2 * GameSettings.UIScale), TextureLoader.getWhitePixel(), BackgroundColor);

            //Draw the border
            UiStateManager.DrawImage(new Rectangle(location.X, location.Y, size.X, GameSettings.UIScale), TextureLoader.getWhitePixel(), BorderColor);
            UiStateManager.DrawImage(new Rectangle(location.X, location.Y + size.Y - GameSettings.UIScale, size.X, GameSettings.UIScale), TextureLoader.getWhitePixel(), BorderColor);
            UiStateManager.DrawImage(new Rectangle(location.X, location.Y, GameSettings.UIScale, size.Y), TextureLoader.getWhitePixel(), BorderColor);
            UiStateManager.DrawImage(new Rectangle(location.X + size.X - GameSettings.UIScale, location.Y, GameSettings.UIScale, size.Y), TextureLoader.getWhitePixel(), BorderColor);

            X_START = location.X + GameSettings.UIScale + Padding;
            int currentY = location.Y + GameSettings.UIScale + Padding / 2;

            foreach (string timerId in Profiler.Timers.Keys)
            {
                //Draw each line, and overlay the text
                UiStateManager.DrawImage(new Rectangle(X_START, currentY, (int)(Profiler.Timers[timerId].ElapsedTicks * ADJUSTMENT), 18), TextureLoader.getWhitePixel(), Profiler.ProfilerColors[timerId]);
                UiStateManager.DrawText(new Vector2(X_START, currentY - 3), Profiler.ProfilerColors[timerId].Invert(), timerId + "(" + Profiler.Timers[timerId].ElapsedMilliseconds + " ms)");
                Profiler.Timers[timerId].Reset();
                currentY += 20;
            }
        }
Пример #2
0
        public override void Draw(Texture2D screen)
        {
            int MinX = screen.Width / 2 - CrossHairWidth / 2;
            int MaxX = MinX + CrossHairWidth;

            int MinY = screen.Height / 2 - CrossHairWidth / 2;
            int MaxY = MinY + CrossHairWidth;

            int HeightMinY = screen.Height / 2 - CrossHairThickness / 2;
            int HeightMaxY = HeightMinY + CrossHairThickness;

            int WidthMinY = screen.Width / 2 - CrossHairThickness / 2;
            int WidthMaxY = WidthMinY + CrossHairThickness;

            base.Draw(screen);

            Texture2D pixel = TextureLoader.getWhitePixel();

            //spriteBatch.Begin(SpriteSortMode.Deferred, InvertBlendState);
            UiStateManager.Begin();
            UiStateManager.DrawImage(new Rectangle(new Point(MaxX, HeightMaxY), new Point(MinX - MaxX, HeightMinY - HeightMaxY)), pixel, Color.White);
            UiStateManager.DrawImage(new Rectangle(new Point(WidthMaxY, MaxY), new Point(WidthMinY - WidthMaxY, MinY - MaxY)), pixel, Color.White);
            UiStateManager.End();
        }