Esempio n. 1
0
		private void SetAxis(Line2D axis, Vector2D startPoint, Vector2D endPoint)
		{
			axis.StartPoint = startPoint;
			axis.EndPoint = endPoint;
			axis.RenderLayer = renderLayer;
			axis.Clip(clippingBounds);
		}
Esempio n. 2
0
		public void FireShotByPlayer(Vector2D startPosition)
		{
			var bulletTrail = new Line2D(startPosition, new Vector2D(1, startPosition.Y), Color.Orange)
			{
				RenderLayer = (int)DefRenderLayer.Player - 1
			};
			bulletTrail.Add(new Duration(0.2f)).Start<SelfDestructTimer>();
		}
Esempio n. 3
0
		private void AddPointToEnd(Vector2D point)
		{
			points.Add(point);
			if (points.Count <= 1)
				return;
			var line = new Line2D(ToQuadratic(points[points.Count - 2], viewport, drawArea),
				ToQuadratic(point, viewport, drawArea), Color);
			line.Clip(clippingBounds);
			lines.Add(line);
		}
Esempio n. 4
0
		private Line2D CreateBlankPercentile()
		{
			Line2D percentile;
			if (line2DPool.Count > 0)
			{
				percentile = line2DPool[0];
				line2DPool.RemoveAt(0);
			}
			else
				percentile = new Line2D(Vector2D.Zero, Vector2D.Zero, Color.Black);
			return percentile;
		}
Esempio n. 5
0
		public void ZoomOnLines()
		{
			var line1 = new Line2D(new List<Vector2D>
			{
				new Vector2D(0.4f, 0.4f),
				new Vector2D(0.6f, 0.4f),
				new Vector2D(0.4f, 0.6f),
				new Vector2D(0.6f, 0.6f),
				new Vector2D(0.4f, 0.5f),
				new Vector2D(0.5f, 0.5f)
			}, Color.Red);
			new Command("Zoom", zoomAmount => ZoomLinePoints(line1.Points, zoomAmount));
		}
Esempio n. 6
0
		public void Check(Vector2D position, IEnumerable<Logo> logoSet)
		{
			if (isActive)
			{
				foreach (var logo in logoSet)
					logo.CheckForSlicing(lastMousePosition, position);

				var segment = new Line2D(lastMousePosition, position, Color.Cyan);
				segment.RenderLayer = (int)GameRenderLayer.Segments;

				segments.Add(segment);
				segment.IsActive = true;

				lastMousePosition = position;
			}
		}
Esempio n. 7
0
		public void ChangeOrientation()
		{
			var window = Resolve<Window>();
			var line = new Line2D(Vector2D.Zero, Vector2D.One, Color.Green);
			window.BackgroundColor = Color.Blue;
			new Command(() => window.ViewportPixelSize = new Size(800, 480)).Add(new KeyTrigger(Key.A));
			new Command(() => window.ViewportPixelSize = new Size(480, 800)).Add(new KeyTrigger(Key.B));
			RunAfterFirstFrame(() =>
			{
				var screen = ScreenSpace.Current;
				var startPosition = screen.Viewport.TopLeft;
				var endPosition = screen.Viewport.BottomRight;
				window.Title = "Size: " + window.ViewportPixelSize + " Start: " + startPosition +
					" End: " + endPosition;
				line.StartPoint = startPosition;
				line.EndPoint = endPosition;
			});
		}
Esempio n. 8
0
		private static void CreateOutlinesAndGizmos(Line2D[] newLines)
		{
			newLines[0] = new Line2D(Vector2D.Unused, Vector2D.Unused, SelectionColor)
			{
				RenderLayer = 1000
			};
			newLines[1] = new Line2D(Vector2D.Unused, Vector2D.Unused, SelectionColor)
			{
				RenderLayer = 1000
			};
			newLines[2] = new Line2D(Vector2D.Unused, Vector2D.Unused, SelectionColor)
			{
				RenderLayer = 1000
			};
			newLines[3] = new Line2D(Vector2D.Unused, Vector2D.Unused, SelectionColor)
			{
				RenderLayer = 1000
			};
		}
Esempio n. 9
0
		private static readonly Color SelectionColor = Color.White; //ncrunch: no coverage

		internal void UpdateOutlines(List<Entity2D> selectedControlList)
		{
			ClearLines();
			foreach (Entity2D selectedControl in selectedControlList)
			{
				var newOutlineColor = new Line2D[4];
				CreateOutlinesAndGizmos(newOutlineColor);
				if (selectedControl == null)
					return; //ncrunch: no coverage
				var rectangleCorners = GetRotatedRectangelCorners(selectedControl.DrawArea,
					selectedControl.Rotation);
				newOutlineColor[0].StartPoint = rectangleCorners[0];
				newOutlineColor[0].EndPoint = rectangleCorners[1];
				newOutlineColor[1].StartPoint = rectangleCorners[0];
				newOutlineColor[1].EndPoint = rectangleCorners[2];
				newOutlineColor[2].StartPoint = rectangleCorners[2];
				newOutlineColor[2].EndPoint = rectangleCorners[3];
				newOutlineColor[3].StartPoint = rectangleCorners[3];
				newOutlineColor[3].EndPoint = rectangleCorners[1];
				Outlines.Add(newOutlineColor);
			}
			CreateGeneralOutline(selectedControlList);
		}
Esempio n. 10
0
		public ControlProcessor()
		{
			Outlines = new List<Line2D[]>();
			GizmoList = new Sprite[2];
			GeneralOutline = new Line2D[4];
		}
Esempio n. 11
0
		public void FireShotByEnemy(Vector2D startPosition)
		{
			var bulletTrail = new Line2D(startPosition, new Vector2D(0, startPosition.Y), Color.Red);
			bulletTrail.Add(new Duration(0.1f)).Start<SelfDestructTimer>();
		}
Esempio n. 12
0
 public ControlProcessor(UIEditorViewModel uiEditorViewModel)
 {
     this.uiEditorViewModel = uiEditorViewModel;
     OutLines = new Line2D[4];
     CreateOutlines();
 }
Esempio n. 13
0
 private void CreateOutlines()
 {
     OutLines[0] = new Line2D(Vector2D.Unused, Vector2D.Unused, SelectionColor)
     {
         RenderLayer = 1000
     };
     OutLines[1] = new Line2D(Vector2D.Unused, Vector2D.Unused, SelectionColor)
     {
         RenderLayer = 1000
     };
     OutLines[2] = new Line2D(Vector2D.Unused, Vector2D.Unused, SelectionColor)
     {
         RenderLayer = 1000
     };
     OutLines[3] = new Line2D(Vector2D.Unused, Vector2D.Unused, SelectionColor)
     {
         RenderLayer = 1000
     };
 }
Esempio n. 14
0
		public Program()
		{
			var line = new Line2D(Vector2D.Zero, Vector2D.One, Color.Red);
			new Command("Click", () => line.Color = Color.Yellow);
		}
Esempio n. 15
0
		private void CreateGeneralOutline(List<Entity2D> selectedControlList)
		{
			var boudingBox = CalculateBoundingBox(selectedControlList);
			GeneralOutline[0] = new Line2D(boudingBox.TopLeft, boudingBox.TopRight, SelectionColor);
			GeneralOutline[1] = new Line2D(boudingBox.TopLeft, boudingBox.BottomLeft, SelectionColor);
			GeneralOutline[2] = new Line2D(boudingBox.BottomLeft, boudingBox.BottomRight, SelectionColor);
			GeneralOutline[3] = new Line2D(boudingBox.TopRight, boudingBox.BottomRight, SelectionColor);
			Material material = ContentExtensions.CreateDefaultMaterial2D(Color.Blue);
			GizmoList[0] = new Sprite(material,
				new Rectangle(new Vector2D(boudingBox.TopRight.X - 0.02f, boudingBox.TopRight.Y),
					new Size(0.02f, 0.02f)));
			GizmoList[1] = new Sprite(material,
				new Rectangle(
					new Vector2D(boudingBox.BottomRight.X - 0.02f, boudingBox.BottomRight.Y - 0.02f),
					new Size(0.02f, 0.02f)));
		}
Esempio n. 16
0
		private void InsertPointAt(Vector2D point, int index)
		{
			if (index > 0)
				MoveLineEndpoint(point, index);
			var line = new Line2D(ToQuadratic(point, viewport, drawArea),
				ToQuadratic(points[index], viewport, drawArea), Color);
			line.Clip(clippingBounds);
			lines.Insert(index, line);
			points.Insert(index, point);
		}
Esempio n. 17
0
		private void CreateOutline()
		{
			if (outline != null && outline.IsActive)
				outline.Dispose();
			outline = new Line2D(panel.DrawArea, Color.White) { RenderLayer = int.MaxValue };
		}