Пример #1
0
        protected void DrawSomething(Graphics gfx, Coordinates lastTurnShotCoorinates, string what, Color transparent)
        {
            var image = ShipPainter.GetBitmapResource(what);

            image.MakeTransparent(transparent);

            gfx.DrawImage(image, new Point(lastTurnShotCoorinates.X * 51, lastTurnShotCoorinates.Y * 51));
        }
Пример #2
0
        private void DrawMenu(Graphics gfx, Bitmap bitmap, bool alignTop, bool drawBackground, int indexOffset, int[] selectedIndicies, params string[] menuItems)
        {
            if (Timer.Interval != 25)
            {
                this.Timer.Interval = 25;
            }


            if (BackgroundImage == null)
            {
                BackgroundImage = ShipPainter.GetBitmapResource("Menu");
            }

            var distanceFromTheTop    = 275;
            var distanceFromTheBottom = 50;
            var spacing = 55;

            if (drawBackground == true)
            {
                gfx.DrawImage(BackgroundImage, new Rectangle(0, 0, this.pictureBox1.Width, this.pictureBox1.Height));
            }

            for (int i = 0; i < menuItems.Count(); i++)
            {
                int yPosition = alignTop
                    ? distanceFromTheTop + (i * spacing)
                    : this.pictureBox1.Height - distanceFromTheBottom - (spacing * menuItems.Count()) + (i * spacing);

                var selected    = selectedIndicies.Contains(i + indexOffset);
                var highlighted = SelectedMenuIndex == i + indexOffset && (ScrollingXPos / 10) % 2 == 0;
                var brush       = highlighted
                    ? Brushes.White : selected
                        ? Brushes.Green
                        : Brushes.Black;

                gfx.DrawString(menuItems.ElementAt(i),
                               new Font(FontFamily.GenericMonospace, 36, FontStyle.Bold),
                               brush,
                               new PointF(10, yPosition));
            }
        }