void CreateProgradeArrow() { PointD[] pnts = CreatePrimitiveShapes.CreateArrow(24); List <PointD> arrowPoints = new List <PointD>(pnts.Length); foreach (var point in pnts) { double x = point.X * Math.Cos(ProgradeAngle) + point.Y * Math.Sin(ProgradeAngle); double y = point.X * -Math.Sin(ProgradeAngle) + point.Y * Math.Cos(ProgradeAngle); arrowPoints.Add(new PointD() { X = x, Y = y }); } Shape vectorArrow = new Shape() { Points = arrowPoints.ToArray(), Color = VectorColour }; if (Shapes.Count < 1) { Shapes.Add(vectorArrow); } else { Shapes[0] = vectorArrow; } }
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 }); }
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); }
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; } }
void Cargo(int width, int height, int offsetX, int offsetY)//and fuel { byte r = 0; byte g = 0; byte b = 200; byte a = 255; SDL.SDL_Color colour = new SDL.SDL_Color() { r = r, g = g, b = b, a = a }; //TODO: change numbers depending on number of cargo containing components. int numberofPodsX = 4; int numberofPodsY = 2; int podWidth = width / numberofPodsX; int offsetx1 = (int)(offsetX - width * 0.5f + podWidth * 0.5); int podHeight = height / numberofPodsY; int offsety1 = (int)(offsetY + podHeight * 0.5); for (int podset = 0; podset < numberofPodsY; podset++) { offsety1 += podset * podHeight; int offsetx2 = offsetx1 - podWidth; for (int i = 0; i < numberofPodsX; i++) { offsetx2 += podWidth; Shape shape = new Shape() { Color = colour, Points = CreatePrimitiveShapes.RoundedCylinder(podWidth, height / numberofPodsY, offsetx2, offsety1) }; Shapes.Add(shape); } } }
void Unknown() { int vertDiameter = 8; int horDiameter = 8; int segments = 8; var points = CreatePrimitiveShapes.CreateArc(0, 0, horDiameter, vertDiameter, 0, Math.PI * 2, segments); //colors picked out of my ass for a blue/green look. //TODO: use minerals for this? but migth not have that info. going to have to work in with sensor stuff. byte r = 100; 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() { Color = colour, Points = points }); }
void Setup() { Shapes = new List <Shape>(5); CreateProgradeArrow(); Shape dot = new Shape() { Points = CreatePrimitiveShapes.Circle(0, 0, 3, 6), Color = PrimaryColour }; Shape circle = new Shape() { Points = CreatePrimitiveShapes.Circle(0, 0, 8, 12), Color = PrimaryColour }; //Shapes[0] = vectorArrow; //Shapes[1] = dot; //Shapes[2] = circle; //Shapes[3] = chevron; //Shapes[4] = chevron2; Shapes.Add(dot); Shapes.Add(circle); }
void Asteroid() { int vertDiameter = _rng.Next(4, 8); int horDiameter = _rng.Next(4, 8); 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 }); }
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 Vector4(0, 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 Vector4(0, 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 Vector4(100, 0, 0, 0), new Guid()); icons.Add(new ShipIcon(pos3)); }