Beispiel #1
0
        void Front(int width, int height, int offsetX, int offsetY) //crew
        {
            var  points = CreatePrimitiveShapes.CreateArc(offsetX, offsetY, width * 0.5, height * 0.5, CreatePrimitiveShapes.QuarterCircle, CreatePrimitiveShapes.HalfCircle, 16);
            byte r      = 0;
            byte g      = 100;
            byte b      = 100;
            byte a      = 255;

            SDL.SDL_Color colour = new SDL.SDL_Color()
            {
                r = r, g = g, b = b, a = a
            };
            Shapes.Add(new Shape()
            {
                Points = points, Color = colour
            });
        }
Beispiel #2
0
        void Reactors(int width, int height, int offsetX, int offsetY)
        {
            byte r = 100;
            byte g = 0;
            byte b = 0;
            byte a = 255;

            SDL.SDL_Color colour = new SDL.SDL_Color()
            {
                r = r, g = g, b = b, a = a
            };

            var shape = new Shape()
            {
                Color = colour, Points = CreatePrimitiveShapes.CreateArc(offsetX, offsetY, (int)(width * 0.5), (int)(height * 0.5), 0, CreatePrimitiveShapes.PI2, 12)
            };

            Shapes.Add(shape);
        }
Beispiel #3
0
        void Engines(int width, int height, int offsetX, int offsetY)
        {
            byte r1 = 200;
            byte g1 = 200;
            byte b1 = 200;
            byte a1 = 255;

            SDL.SDL_Color colourbox = new SDL.SDL_Color()
            {
                r = r1, g = g1, b = b1, a = a1
            };

            byte r2 = 100;
            byte g2 = 150;
            byte b2 = 0;
            byte a2 = 255;

            SDL.SDL_Color colourCone = new SDL.SDL_Color()
            {
                r = r2, g = g2, b = b2, a = a2
            };

            int thrusterCount = 3;
            int twidth        = width / thrusterCount;
            int toffset       = (int)(offsetX - width * 0.5f + twidth * 0.5);

            for (int i = 0; i < thrusterCount; i++)
            {
                int boxHeight  = height / 3;
                int boxWidth   = twidth;
                int coneHeight = height - boxHeight;
                Shapes.Add(new Shape()
                {
                    Color = colourbox, Points = CreatePrimitiveShapes.Rectangle(toffset, (int)(offsetY + boxHeight * 0.5), boxWidth, boxHeight, CreatePrimitiveShapes.PosFrom.Center)
                });
                Shapes.Add(new Shape()
                {
                    Color = colourCone, Points = CreatePrimitiveShapes.CreateArc(toffset, offsetY + boxHeight + coneHeight, (int)(boxWidth * 0.5), coneHeight, CreatePrimitiveShapes.QuarterCircle, CreatePrimitiveShapes.HalfCircle, 8)
                });
                toffset += twidth;
            }
        }
Beispiel #4
0
        void Asteroid()
        {
            _iconMinSize = 8;
            double vertDiameter = _rng.Next(50, 100);
            double horDiameter  = _rng.Next(50, 100);
            int    segments     = _rng.Next(8, 32);
            int    jagMax       = _rng.Next(5, 8);
            int    jagMin       = _rng.Next(4, jagMax);

            var points = CreatePrimitiveShapes.CreateArc(0, 0, horDiameter, vertDiameter, 0, Math.PI * 2, segments);

            for (int i = 0; i < segments; i = i + 2)
            {
                //this is not right, need to pull the points in towards the center, not just pull them left.
                double x = points[i].X - _rng.Next(jagMin, jagMax);
                double y = points[i].Y - _rng.Next(jagMin, jagMax);
                points[i] = new PointD()
                {
                    X = x, Y = y
                };
            }
            //colors picked out of my ass for a brown look.
            //TODO: use minerals for this? but migth not have that info. going to have to work in with sensor stuff.
            byte r = 150;
            byte g = 100;
            byte b = 50;
            byte a = 255;

            SDL.SDL_Color colour = new SDL.SDL_Color()
            {
                r = r, g = g, b = b, a = a
            };
            Shapes.Add(new Shape()
            {
                Color = colour, Points = points
            });
        }
Beispiel #5
0
        private static void Setup(List <Icon> icons)
        {
            List <Shape> shapes = new List <Shape>();

            PointD[] lpoints1 = new PointD[] {
                new PointD {
                    X = 0, Y = -160
                },
                new PointD {
                    X = 0, Y = 160
                },
            };
            PointD[] lpoints2 = new PointD[] {
                new PointD {
                    X = -25, Y = 0
                },
                new PointD {
                    X = 25, Y = 0
                }
            };
            SDL.SDL_Color lcolor = new SDL.SDL_Color()
            {
                r = 0, g = 255, b = 0, a = 255
            };
            shapes.Add(new Shape()
            {
                Points = lpoints1, Color = lcolor
            });
            shapes.Add(new Shape()
            {
                Points = lpoints2, Color = lcolor
            });
            PositionDB lpos = new PositionDB(new Vector3(0, 0, 0), new Guid());

            icons.Add(new Icon(lpos)
            {
                Shapes = shapes
            });

            for (int i = 0; i < 4; i++)
            {
                PointD[]      points = CreatePrimitiveShapes.CreateArc(50 + 50 * i, 400, 100, 100, 0, 4.71, 160);
                SDL.SDL_Color color  = new SDL.SDL_Color()
                {
                    r = (byte)(i * 60), g = 100, b = 100, a = 255
                };
                Shape shape = new Shape()
                {
                    Points = points, Color = color
                };
                PositionDB pos1 = new PositionDB(new Vector3(0, 0, 0), new Guid());

                icons.Add(new Icon(pos1)
                {
                    Shapes = new List <Shape> {
                        shape
                    }
                });
            }

            /*
             * PositionDB pos2 = new PositionDB(new Vector4(0, -0, 0, 0), new Guid());
             * var shape2 = new Shape() { Color = new SDL.SDL_Color() { r = 255, g = 0, b = 0, a = 255 }, Points = CreatePrimitiveShapes.RoundedCylinder(50, 100, 0, 0) };
             * var shapes2 = new List<Shape>() { shape2 };
             *
             * icons.Add(new Icon(pos2) { Shapes = shapes2 });
             */

            PositionDB pos3 = new PositionDB(new Vector3(100, 0, 0), new Guid());

            icons.Add(new ShipIcon(pos3));
        }