public ViewportManager() { var top = new Viewport { Name = "Top", Position = Viewport.Quadrant.TopLeft, ProjectionMode = ProjectionType.Orthographic, Axis = Vector3.UnitY }; top.Camera.SetRotation(0, MathHelper.DegreesToRadians(-90), MathHelper.DegreesToRadians(180)); var right = new Viewport { Name = "Side", Position = Viewport.Quadrant.TopRight, ProjectionMode = ProjectionType.Orthographic, Axis = Vector3.UnitX }; right.Camera.SetRotation(MathHelper.DegreesToRadians(-90), 0, 0); var front = new Viewport { Name = "Front", Position = Viewport.Quadrant.BottomLeft, ProjectionMode = ProjectionType.Orthographic, Axis = Vector3.UnitZ }; front.Camera.SetRotation(MathHelper.DegreesToRadians(180), 0, 0); var threedee = new Viewport { Name = "3D", Position = Viewport.Quadrant.BottomRight }; threedee.Camera.SetRotation(0, MathHelper.DegreesToRadians(-135), MathHelper.DegreesToRadians(135)); viewports.Add(top); viewports.Add(right); viewports.Add(front); viewports.Add(threedee); active = threedee; InputManager.Current.RegisterBinding('*', KeyBinding.KeysActionScaleUp, ActionScaleUp); InputManager.Current.RegisterBinding('/', KeyBinding.KeysActionScaleDown, ActionScaleDown); InputManager.Current.RegisterBinding(Properties.Settings.Default.KeysCameraFrame, KeyBinding.KeysCameraFrame, Frame); Current = this; }
public void MouseMove(int X, int Y) { if (!active.Enabled) { return; } if (!isMouseDown) { foreach (var viewport in viewports) { if (!viewport.Enabled) { continue; } if (viewport.IsActive(X, Y)) { viewport.Active = true; active = viewport; if (OnMouseMove != null) { OnMouseMove(this, new ViewportMouseMoveEventArgs(viewport.ConvertScreenToWorldCoords(X, Y))); } } else { viewport.Active = false; } } return; } Drag(new ViewportMouseDragEventArgs(previousMouseDragPosition, new Vector2(X, Y))); previousMouseDragPosition = new Vector2(X, Y); }
public void Maximise(Viewport chosen) { foreach (var viewport in viewports) { viewport.Enabled = false; } chosen.Enabled = true; chosen.SetWidthHeightPosition(Viewport.Size.Full, Viewport.Size.Full, Viewport.Quadrant.BottomLeft); foreach (var viewport in viewports) { viewport.Resize(); } }
public void Minimise(Viewport chosen) { foreach (var viewport in viewports) { viewport.Enabled = true; } chosen.ResetWidthHeightPosition(); foreach (var viewport in viewports) { viewport.Resize(); } }
public void AddViewport(Viewport viewport) { viewports.Add(viewport); }