Beispiel #1
0
        public void DrawWindow(SpriteBatch b)
        {
            // Background fill colour
            b.Draw(
                texture: Game1.fadeToBlackRect,
                destinationRectangle: BorderSafeArea,
                color: PageColour);

            // Window border
            int   lineWidth = BorderWidth / 2 * MenuScale;
            Color colour    = WindowBar.BorderColour;

            // outside:
            Desktop.DrawLine(b, colour: colour, startPosition: new Point(xPositionOnScreen, yPositionOnScreen), length: height, width: lineWidth, isHorizontal: false);
            Desktop.DrawLine(b, colour: colour, startPosition: new Point(xPositionOnScreen, yPositionOnScreen + height), length: width, width: lineWidth, isHorizontal: true);
            Desktop.DrawLine(b, colour: colour, startPosition: new Point(xPositionOnScreen + width - lineWidth, yPositionOnScreen), length: height, width: lineWidth, isHorizontal: false);
            // recolour outside border to match interface

            /*
             * b.Draw(
             *      texture: Game1.fadeToBlackRect,
             *      destinationRectangle: new Rectangle(xPositionOnScreen, yPositionOnScreen, width, height),
             *      color: Desktop.Taskbar.InterfaceColour);*/

            colour = IsSelected ? InnerBorderColourSelected : InnerBorderColourDeselected;
            // inside:
            Desktop.DrawLine(b, colour: colour, startPosition: new Point(xPositionOnScreen + lineWidth, yPositionOnScreen), length: height - lineWidth, width: lineWidth, isHorizontal: false);
            Desktop.DrawLine(b, colour: colour, startPosition: new Point(xPositionOnScreen + lineWidth, yPositionOnScreen + height - lineWidth), length: width - (lineWidth * 2), width: lineWidth, isHorizontal: true);
            Desktop.DrawLine(b, colour: colour, startPosition: new Point(xPositionOnScreen + width - (lineWidth * 2), yPositionOnScreen), length: height - lineWidth, width: lineWidth, isHorizontal: false);
        }
        private static void DrawGrid(SpriteBatch b, Color colour, int width = 1, float opacity = 1f)
        {
            // DON'T touch ANYTHING

            Point start = new Point();
            Point end   = new Point();

            start.X = Game1.viewport.X > 0 ? 0 - (Game1.viewport.X % Game1.tileSize) : 0 - Game1.viewport.X;
            start.Y = Game1.viewport.Y > 0 ? 0 - ((Game1.viewport.Y % Game1.tileSize) / 2) : 0 - (Game1.viewport.Y / 2);
            end.X   = Math.Min(Game1.currentLocation.Map.DisplayWidth - Game1.viewport.X, start.X + Math.Min(Game1.viewport.Width, Game1.currentLocation.Map.DisplayWidth));
            end.Y   = Math.Min(Game1.currentLocation.Map.DisplayHeight - Game1.viewport.Y, start.Y + Math.Min(Game1.viewport.Height, Game1.currentLocation.Map.DisplayHeight));

            for (int i = start.Y; i < end.Y + Game1.tileSize; i += Game1.tileSize)
            {
                Point point = new Point(start.X, start.Y + i);
                Desktop.DrawLine(b: b, colour: colour * opacity, startPosition: point, length: end.X - start.X, width: width, isHorizontal: true);
            }

            start.X = Game1.viewport.X > 0 ? 0 - ((Game1.viewport.X % Game1.tileSize) / 2) : 0 - (Game1.viewport.X / 2);
            start.Y = Game1.viewport.Y > 0 ? 0 - (Game1.viewport.Y % Game1.tileSize) : 0 - Game1.viewport.Y;
            end.X   = Math.Min(Game1.currentLocation.Map.DisplayWidth - Game1.viewport.X, start.X + Math.Min(Game1.viewport.Width, Game1.currentLocation.Map.DisplayWidth));
            end.Y   = Math.Min(Game1.currentLocation.Map.DisplayHeight - Game1.viewport.Y, start.Y + Math.Min(Game1.viewport.Height, Game1.currentLocation.Map.DisplayHeight));

            for (int i = start.X; i < end.X + Game1.tileSize; i += Game1.tileSize)
            {
                Point point = new Point(start.X + i, start.Y);
                Desktop.DrawLine(b: b, colour: colour * opacity, startPosition: point, length: end.Y - start.Y, width: width, isHorizontal: false);
            }
        }
Beispiel #3
0
        public void DrawActionButtonSidebar(SpriteBatch b)
        {
            b.Draw(texture: Game1.fadeToBlackRect,
                   destinationRectangle: ActionButtonSidebarArea,
                   color: SidebarColour);
            Desktop.DrawLine(b,
                             colour: Color.White * 0.75f,
                             startPosition: new Point(ActionButtonSidebarArea.X, ActionButtonSidebarArea.Y),
                             length: ActionButtonSidebarArea.Height,
                             width: BorderWidth / 2 * MenuScale,
                             isHorizontal: false);

            foreach (ClickableTextureComponent button in SidebarActionButtons)
            {
                this.DrawActionButton(b, button: button);
            }
        }