Exemple #1
0
 public void Draw(Renderer2D renderer, GameTime time)
 {
     renderer.Draw(Font.CourierNew14, "UpdateFPS: " + counter.UpdateFPS + "\nDrawFPS: " + counter.DrawFPS, new Vector2(), Color.Green);
     if (time.IsRunningSlowly)
     {
         renderer.DrawRectangle(new Rectangle(0, 0, Control.RenderWidth - 5, Control.RenderHeight - 5), Color.Red, 5);
     }
 }
Exemple #2
0
        public void Render(Renderer2D renderer)
        {
            Color objColor = new Color(0.6f, 0.4f, 0.9f, 1.0f);

            foreach (Layer layer in _scene.Layers)
            {
                foreach (GameObject obj in layer.Objects)
                {
                    Color col = new Color(0.5f, 0.5f, 0.5f, 1.0f);
                    if (SelectedGameObject == obj)
                    {
                        col = new Color(0.9f, 0.9f, 0.9f, 1.0f);
                    }
                    renderer.DrawRectangle(
                        obj.Position,
                        obj.Width, obj.Height,
                        col, new Vector2(1, 1), SelectionBoxThickness);
                    float   strWidth = _viewportFont.MeasureString(obj.Name).X;
                    Vector2 namePos  = new Vector2(obj.Position.X - strWidth, obj.Position.Y + obj.Height + 10);
                    namePos.X += (strWidth / 2) + (obj.Width / 2);
                    renderer.DrawString(obj.Name, _viewportFont, namePos, col);
                }
            }
        }
 public void DrawRectangle(Rectangle rect, Color color, int thickness)
 {
     _spriteBatch.DrawRectangle(rect, color, thickness);
 }