Esempio n. 1
0
        private void DrawRectangle(SpriteBatch spriteBatch, Rectangle rect)
        {
            Texture2D tex = YnGraphics.CreateTexture(Color.Red, 1, 1);

            Vector2 a;
            Vector2 b;

            // Top
            a = new Vector2(rect.X, rect.Y);
            b = new Vector2(rect.X + rect.Width, rect.Y);
            YnGraphics.DrawLine(spriteBatch, tex, 1F, Color.White, a, b);

            // Right
            a = new Vector2(rect.X + rect.Width, rect.Y);
            b = new Vector2(rect.X + rect.Width, rect.Y + rect.Height);
            YnGraphics.DrawLine(spriteBatch, tex, 1F, Color.White, a, b);

            // Bottom
            a = new Vector2(rect.X + rect.Width, rect.Y + rect.Height);
            b = new Vector2(rect.X, rect.Y + rect.Height);
            YnGraphics.DrawLine(spriteBatch, tex, 1F, Color.White, a, b);

            // Left
            a = new Vector2(rect.X, rect.Y + rect.Height);
            b = new Vector2(rect.X, rect.Y);
            YnGraphics.DrawLine(spriteBatch, tex, 1F, Color.White, a, b);
        }
        private void DrawLines(SpriteBatch spriteBatch, int y = 50, int offset = 30)
        {
            Texture2D blank = YnGraphics.CreateTexture(Color.White, 1, 1);

            float percent   = (((100.0f * (float)(y - (offset * 4))) / ((float)YnG.Height / 2))) / 100.0f;
            float direction = -1.0f;

            offset = (int)(offset * percent * direction);

            YnGraphics.DrawLine(spriteBatch, blank, 2, new Color(100, 100, 100), new Vector2(borderLeft.X, YnG.Height - y), new Vector2(borderLeft.X + borderLeft.Width, YnG.Height - y));
            YnGraphics.DrawLine(spriteBatch, blank, 1, new Color(75, 75, 75), new Vector2(borderLeft.X + borderLeft.Width, YnG.Height - y), new Vector2(angularLeft.X + angularLeft.Width, YnG.Height - (y + offset)));
            YnGraphics.DrawLine(spriteBatch, blank, 1, new Color(50, 50, 50), new Vector2(angularLeft.X + angularLeft.Width, YnG.Height - (y + offset)), new Vector2(center.X + center.Width, YnG.Height - (y + offset)));
            YnGraphics.DrawLine(spriteBatch, blank, 1, new Color(75, 75, 75), new Vector2(center.X + center.Width, YnG.Height - (y + offset)), new Vector2(angularRight.X + angularRight.Width, YnG.Height - y));
            YnGraphics.DrawLine(spriteBatch, blank, 2, new Color(100, 100, 100), new Vector2(angularRight.X + angularRight.Width, YnG.Height - y), new Vector2(borderRight.X + borderRight.Width, YnG.Height - y));
        }