Beispiel #1
0
        protected override void OnFillRegionComputed(Point[][] polygonSet)
        {
            using (PdnGraphicsPath path = new PdnGraphicsPath())
            {
                path.AddPolygons(polygonSet);

                using (PdnRegion fillRegion = new PdnRegion(path))
                {
                    Rectangle boundingBox = fillRegion.GetBoundsInt();

                    Surface        surface = ((BitmapLayer)ActiveLayer).Surface;
                    RenderArgs     ra      = new RenderArgs(surface);
                    HistoryMemento ha;

                    using (PdnRegion affected = Utility.SimplifyAndInflateRegion(fillRegion))
                    {
                        ha = new BitmapHistoryMemento(Name, Image, DocumentWorkspace, DocumentWorkspace.ActiveLayerIndex, affected);
                    }

                    ra.Graphics.CompositingMode = AppEnvironment.GetCompositingMode();
                    ra.Graphics.FillRegion(brush, fillRegion.GetRegionReadOnly());

                    HistoryStack.PushNewMemento(ha);
                    ActiveLayer.Invalidate(boundingBox);
                    Update();
                }
            }
        }
Beispiel #2
0
        public void HighlightPointUsingValues(double xv1, double yv1, int highlightLevel)
        {
            double xrange = Math.Abs(Config.XMin) + Config.XMax;
            double yrange = Math.Abs(Config.YMin) + Config.YMax;

            double xper = (Config.CanvasWidth - Config.XStart) / xrange;
            double yper = (Config.CanvasHeight - Config.YStart) / yrange;

            var cxp = (Math.Abs(Config.XMin) + xv1) * xper + Config.XStart;
            var cyp = (Math.Abs(Config.YMax) - yv1) * yper + Config.YStart;
            // -------------------------------

            double size    = 12;
            double offset  = size / 2;
            var    ellipse = CreateEllipse(size, cxp - offset, cyp - offset);

            ellipse.Stroke = new SolidColorBrush(Colors.Yellow);

            var cc = new CanvasComponent();

            cc.AddUiElement(ellipse);
            cc.SendToFarBack();

            ActiveLayer.AddComponent(cc);
        }
Beispiel #3
0
        public void HighlightLineUsingValues(double xv1, double yv1, double xv2, double yv2)
        {
            // -------------------------------
            // works-ish
            double xrange = Math.Abs(Config.XMin) + Config.XMax;
            double yrange = Math.Abs(Config.YMin) + Config.YMax;

            double xper = (Config.CanvasWidth - Config.XStart) / xrange;
            double yper = (Config.CanvasHeight - Config.YStart) / yrange;

            var cp_x1 = (Math.Abs(Config.XMin) + xv1) * xper + Config.XStart;
            var cp_y1 = (Math.Abs(Config.YMax) - yv1) * yper + Config.YStart;

            var cp_x2 = (Math.Abs(Config.XMin) + xv2) * xper + Config.XStart;
            var cp_y2 = (Math.Abs(Config.YMax) - yv2) * yper + Config.YStart;
            // -------------------------------

            var line = new Line();

            line.Stroke          = new SolidColorBrush(Colors.Yellow);
            line.StrokeThickness = 6;
            line.Fill            = new SolidColorBrush(Colors.Yellow);

            line.X1 = cp_x1;
            line.Y1 = cp_y1;
            line.X2 = cp_x2;
            line.Y2 = cp_y2;

            var cc = new CanvasComponent();

            cc.AddUiElement(line);
            cc.SendToFarBack();

            ActiveLayer.AddComponent(cc);
        }
Beispiel #4
0
        public void DrawLineUsingIndexes(int xi1, int yi1, int xi2, int yi2)
        {
            double xp1 = xi1 * Config.XIncrement + Config.XStart;
            double yp1 = yi1 * Config.YIncrement + Config.YStart;

            double xp2 = xi2 * Config.XIncrement + Config.XStart;
            double yp2 = yi2 * Config.YIncrement + Config.YStart;

            var line = new Line();

            line.Stroke          = new SolidColorBrush(Colors.Red);
            line.StrokeThickness = 1;
            line.Fill            = new SolidColorBrush(Colors.Red);

            line.X1  = xp1;
            line.Y1  = yp1;
            line.X2  = xp2;
            line.Y2  = yp2;
            line.Tag = new LineModel
            {
                StartPoint = new Vector(xp1, yp1, xi1, yi1),
                EndPoint   = new Vector(xp2, yp2, xi2, yi2)
            };

            var cc = new CanvasComponent();

            cc.AddUiElement(line);

            ActiveLayer.AddComponent(cc);
        }
Beispiel #5
0
 public override void Save(BinaryWriter BW)
 {
     BW.Write(ListLayer.Count);
     foreach (MapLayer ActiveLayer in ListLayer)
     {
         ActiveLayer.Save(BW);
     }
 }
Beispiel #6
0
 public override void Draw(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
 {
     try
     {
         ActiveLayer.Draw(d, g, width, height, screenChanged);
     }
     catch (Exception e)
     {
         throw new ImplementationException("Error drawing active menu layer.", e);
     }
 }
Beispiel #7
0
        public void MoveSelectedIditorsToLayer(LayerEditor chosenLayer)
        {
            var selected = SelectedEditors.ToList(  );

            foreach (var eachSelectedEditor in selected)
            {
                ActiveLayer.RemoveEditor(eachSelectedEditor);

                eachSelectedEditor.ParentLayer = chosenLayer;

                chosenLayer.AddEditor(eachSelectedEditor);
            }
        }
Beispiel #8
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            mouseUp = true;

            if (!mouseDownSettingCloneSource)
            {
                Cursor = cursorMouseUp;
            }

            if (IsMouseLeftDown(e))
            {
                this.rendererDst.Visible = true;

                if (savedRegion != null)
                {
                    //RestoreRegion(this.savedRegion);
                    ActiveLayer.Invalidate(this.savedRegion.GetBoundsInt());
                    savedRegion.Dispose();
                    savedRegion = null;
                    Update();
                }

                if (GetStaticData().takeFrom == Point.Empty || GetStaticData().lastMoved == Point.Empty)
                {
                    return;
                }

                if (historyRects.Count > 0)
                {
                    PdnRegion saveMeRegion;

                    Rectangle[] rectsRO;
                    int         rectsROLength;
                    this.historyRects.GetArrayReadOnly(out rectsRO, out rectsROLength);
                    saveMeRegion = Utility.RectanglesToRegion(rectsRO, 0, rectsROLength);

                    PdnRegion simplifiedRegion = Utility.SimplifyAndInflateRegion(saveMeRegion);
                    SaveRegion(simplifiedRegion, simplifiedRegion.GetBoundsInt());

                    historyRects = new Vector <Rectangle>();

                    HistoryMemento ha = new BitmapHistoryMemento(Name, Image, DocumentWorkspace, ActiveLayerIndex,
                                                                 simplifiedRegion, this.ScratchSurface);

                    HistoryStack.PushNewMemento(ha);
                    this.ClearSavedMemory();
                }
            }
        }
            public AnimationLayerHolder Copy()
            {
                AnimationLayerHolder NewAnimationLayerHolder = new AnimationLayerHolder();

                NewAnimationLayerHolder.ListAnimationLayer = new List <AnimationLayer>(ListAnimationLayer.Count);

                foreach (AnimationLayer ActiveLayer in ListAnimationLayer)
                {
                    NewAnimationLayerHolder.ListAnimationLayer.Add(ActiveLayer.Copy());
                }

                NewAnimationLayerHolder.GameEngineLayer = (GameEngineLayer)GameEngineLayer.Copy();

                return(NewAnimationLayerHolder);
            }
        public override void Save(string FilePath)
        {
            //Create the Part file.
            FileStream FS = new FileStream(FilePath, FileMode.Create, FileAccess.Write);
            BinaryWriter BW = new BinaryWriter(FS);

            SaveProperties(BW);

            SaveSpawns(BW);

            MapScript.SaveMapScripts(BW, ListMapScript);

            SaveTilesets(BW);

            BW.Write(ListLayer.Count);
            foreach (MapLayer ActiveLayer in ListLayer)
            {
                ActiveLayer.Save(BW);
            }

            BW.Write(ListZone.Count);
            for (int Z = 0; Z < ListZone.Count; Z++)
            {
                MapZoneInfo ActiveZone = ListZone[Z];
                BW.Write(ActiveZone.Name);
                BW.Write(ActiveZone.NumberOfUnitsRequired);
                BW.Write(ActiveZone.Color.R);
                BW.Write(ActiveZone.Color.G);
                BW.Write(ActiveZone.Color.B);

                BW.Write(ActiveZone.ListZoneTile.Count);
                for (int T = 0; T < ActiveZone.ListZoneTile.Count; T++)
                {
                    BW.Write(ActiveZone.ListZoneTile[T].X);
                    BW.Write(ActiveZone.ListZoneTile[T].Y);
                    BW.Write(ActiveZone.ListZoneTile[T].Z);
                }
            }

            FS.Close();
            BW.Close();
        }
            protected void UpdateFrom(AnimationLayer Other)
            {
                _Name = Other._Name;
                Owner = Other.Owner;

                ListChildren = new List <AnimationLayer>(Other.ListChildren.Count);
                foreach (AnimationLayer ActiveLayer in Other.ListChildren)
                {
                    ListChildren.Add(ActiveLayer.Copy());
                }

                DicTimelineEvent = new Dictionary <int, List <Timeline> >(Other.DicTimelineEvent.Count);
                foreach (KeyValuePair <int, List <Timeline> > ActiveListTimelineEvent in Other.DicTimelineEvent)
                {
                    List <Timeline> ListTimelineEvent = new List <Timeline>(ActiveListTimelineEvent.Value.Count);

                    foreach (Timeline ActiveTimelineEvent in ActiveListTimelineEvent.Value)
                    {
                        ListTimelineEvent.Add(ActiveTimelineEvent.Copy(this));
                    }

                    DicTimelineEvent.Add(ActiveListTimelineEvent.Key, ListTimelineEvent);
                }
                DicGroupEvent = new Dictionary <uint, GroupTimeline>(Other.DicGroupEvent.Count);
                foreach (KeyValuePair <uint, GroupTimeline> ActiveGroupEvent in Other.DicGroupEvent)
                {
                    DicGroupEvent.Add(ActiveGroupEvent.Key, (GroupTimeline)ActiveGroupEvent.Value.Copy(this));
                }

                ListVisibleObject = new List <VisibleTimeline>();
                ListActiveMarker  = new List <MarkerTimeline>();
                ListPolygonCutter = new List <PolygonCutterTimeline>();
                renderTarget      = Other.renderTarget;

                _LayerBlendState = Other._LayerBlendState;
                _Alpha           = Other._Alpha;
                ShowChildren     = Other.ShowChildren;
                IsSelected       = Other.IsSelected;
                IsVisible        = Other.IsVisible;
                IsLocked         = Other.IsLocked;
            }
Beispiel #12
0
        public override void Save(string FilePath)
        {
            //Create the Part file.
            FileStream   FS = new FileStream(FilePath, FileMode.Create, FileAccess.Write);
            BinaryWriter BW = new BinaryWriter(FS);

            SaveProperties(BW);

            MapScript.SaveMapScripts(BW, ListMapScript);

            SaveTilesets(BW);

            BW.Write(ListLayer.Count);
            foreach (MapLayer ActiveLayer in ListLayer)
            {
                ActiveLayer.Save(BW);
            }

            FS.Close();
            BW.Close();
        }
        /// <summary>
        /// constructs a new LayeredViewViewModel, and wires up the necessary events
        /// </summary>
        /// <param name="container">the unity container for resolving things</param>
        /// <param name="eventAggregator">the event aggregator for sending/receiving</param>
        /// <param name="repository">the model repository</param>
        public LayeredViewViewModel(IUnityContainer container,
                                    IEventAggregator eventAggregator,
                                    IModelRepository repository)
        {
            _container       = container;
            _eventAggregator = eventAggregator;
            _repository      = repository;

            // store the UI thread SynchronizationContext
            _uiUpdateContext = SynchronizationContext.Current;
            System.Diagnostics.Trace.Assert(_uiUpdateContext != null);

            // create a new PresentationState view model and add to the active layer
            PresentationState = _container.Resolve <PresentationStateViewModel>();
            ActiveLayer.Add(PresentationState);

            // subscribe to events
            _eventAggregator.GetEvent <NavigationPointUpdateEvent>()
            .Subscribe(OnNavigationPointUpdated, ThreadOption.UIThread);
            _eventAggregator.GetEvent <ImageDataLoadedEvent>()
            .Subscribe(OnImageDataLoadedEvent, ThreadOption.UIThread);
            _eventAggregator.GetEvent <VolumeUpdatedEvent>()
            .Subscribe(OnVolumeUpdatedEvent, ThreadOption.UIThread);
            _eventAggregator.GetEvent <SetIsocurveLevelEvent>()
            .Subscribe(OnSetIsocurveLevel, ThreadOption.UIThread);

            // set up the performance counters
            FrameRatePerformance       = new PerformanceCounter("FrameRate", _uiUpdateContext);
            BackgroundLayerPerformance = new PerformanceCounter("BackLayer", _uiUpdateContext);
            PassiveLayerPerformance    = new PerformanceCounter("PassLayer", _uiUpdateContext);

            _renderUpdateManager = _container.Resolve <IFrameUpdateManager>();
            if (_renderUpdateManager.UiUpdatePerformance == null)
            {
                _renderUpdateManager.UiUpdatePerformance = new PerformanceCounter("UIUpdate", _uiUpdateContext);
            }
            UiUpdatePerformance = _renderUpdateManager.UiUpdatePerformance;
        }
Beispiel #14
0
        public void Draw()
        {
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            GL.DepthFunc(DepthFunction.Lequal);
            program["view"].SetValue(camera.ViewMatrix);

            background.Draw();

            foreach (Layer l in layerList)
            {
                if (l != ActiveLayer || preview)
                {
                    l.Draw();
                }
            }
            if (!preview)
            {
                ActiveLayer.Draw();
            }

            if (selectionBox != null)
            {
                selectionBox.Draw();
            }

            if (showGrid && !layerCreator.Active)
            {
                gridMesh.Draw();
                originMesh.Draw();
            }

            templateMenu.Draw();
            CurrentManipulator.Draw();
            templateCreator.Draw();

            layerCreator.Draw();
        }
Beispiel #15
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            this.rendererDst.BrushLocation = new Point(e.X, e.Y);
            this.rendererDst.BrushSize     = AppEnvironment.PenInfo.Width / 2.0f;

            if (!(ActiveLayer is BitmapLayer) || (takeFromLayer == null))
            {
                return;
            }

            if (GetStaticData().updateSrcPreview)
            {
                Point currentMouse = new Point(e.X, e.Y);
                Point difference   = new Point(currentMouse.X - GetStaticData().lastMoved.X, currentMouse.Y - GetStaticData().lastMoved.Y);
                this.rendererSrc.BrushLocation = new Point(GetStaticData().takeFrom.X + difference.X, GetStaticData().takeFrom.Y + difference.Y);;
                this.rendererSrc.BrushSize     = AppEnvironment.PenInfo.Width / 2.0f;
            }

            if (IsMouseLeftDown(e) &&
                (GetStaticData().takeFrom != Point.Empty) &&
                !IsCtrlDown())
            {
                Point currentMouse = new Point(e.X, e.Y);
                Point lastTakeFrom = Point.Empty;

                lastTakeFrom = GetStaticData().takeFrom;
                if (GetStaticData().lastMoved != Point.Empty)
                {
                    Point difference = new Point(currentMouse.X - GetStaticData().lastMoved.X, currentMouse.Y - GetStaticData().lastMoved.Y);
                    GetStaticData().takeFrom = new Point(GetStaticData().takeFrom.X + difference.X, GetStaticData().takeFrom.Y + difference.Y);
                }
                else
                {
                    GetStaticData().lastMoved = currentMouse;
                }

                int       penWidth = (int)AppEnvironment.PenInfo.Width;
                Rectangle rect;

                if (penWidth != 1)
                {
                    rect = new Rectangle(new Point(GetStaticData().takeFrom.X - penWidth / 2, GetStaticData().takeFrom.Y - penWidth / 2), new Size(penWidth + 1, penWidth + 1));
                }
                else
                {
                    rect = new Rectangle(new Point(GetStaticData().takeFrom.X - penWidth, GetStaticData().takeFrom.Y - penWidth), new Size(1 + (2 * penWidth), 1 + (2 * penWidth)));
                }

                Rectangle boundRect = new Rectangle(GetStaticData().takeFrom, new Size(1, 1));

                // If the takeFrom area escapes the boundary
                if (!ActiveLayer.Bounds.Contains(boundRect))
                {
                    GetStaticData().lastMoved = currentMouse;
                    lastTakeFrom = GetStaticData().takeFrom;
                }

                if (this.savedRegion != null)
                {
                    ActiveLayer.Invalidate(savedRegion.GetBoundsInt());
                    this.savedRegion.Dispose();
                    this.savedRegion = null;
                }

                rect.Intersect(takeFromLayer.Surface.Bounds);

                if (rect.Width == 0 || rect.Height == 0)
                {
                    return;
                }

                this.savedRegion = new PdnRegion(rect);
                SaveRegion(this.savedRegion, rect);

                // Draw that clone line
                Surface takeFromSurface;
                if (object.ReferenceEquals(takeFromLayer, ActiveLayer))
                {
                    takeFromSurface = this.ScratchSurface;
                }
                else
                {
                    takeFromSurface = takeFromLayer.Surface;
                }

                if (this.clipRegion == null)
                {
                    this.clipRegion = Selection.CreateRegion();
                }

                DrawCloneLine(currentMouse, GetStaticData().lastMoved, lastTakeFrom,
                              takeFromSurface, ((BitmapLayer)ActiveLayer).Surface);

                this.rendererSrc.BrushLocation = GetStaticData().takeFrom;

                ActiveLayer.Invalidate(rect);
                Update();

                GetStaticData().lastMoved = currentMouse;
            }
        }
Beispiel #16
0
        public void Logic()
        {
            CalculateDelta();
            UpdateEditMode();

            tilesetList.Logic();
            templateCreator.Logic();
            templateMenu.Logic();
            layerCreator.Logic();

            camera.Logic();

            CurrentManipulator.Logic();

            if (!Paused)
            {
                {
                    float mousex = MouseInput.Current.Position.X;
                    float mousey = MouseInput.Current.Position.Y;

                    mousex = (float)Math.Round(mousex);
                    mousey = (float)Math.Round(mousey);

                    Console.Clear();
                    Console.WriteLine(mousex + ", " + mousey);
                }

                if (KeyboardInput.Current[Key.LControl])
                {
                    if (KeyboardInput.KeyPressed(Key.Z))
                    {
                        Undo();
                    }

                    if (KeyboardInput.KeyPressed(Key.Y))
                    {
                        Redo();
                    }

                    if (KeyboardInput.KeyPressed(Key.D))
                    {
                        DuplicateSelected();
                    }

                    if (KeyboardInput.KeyPressed(Key.B))
                    {
                        background.LoadTexture();
                    }

                    if (KeyboardInput.KeyPressed(Key.Delete) && MessageBox.Show("Are you sure you want to delete this layer?", "Please confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        DeleteLayer(ActiveLayer);
                    }
                }
                else
                {
                    if (KeyboardInput.KeyPressed(Key.G))
                    {
                        showGrid = !showGrid;
                    }

                    if (KeyboardInput.KeyPressed(Key.B))
                    {
                        background.show = !background.show;
                    }

                    if (KeyboardInput.KeyPressed(Key.L))
                    {
                        preview = !preview;
                    }

                    if (KeyboardInput.KeyPressed(Key.H))
                    {
                        hideVertices = !hideVertices;
                    }

                    if (KeyboardInput.KeyPressed(Key.Z))
                    {
                        hideSolids = !hideSolids;
                    }

                    if (KeyboardInput.KeyPressed(Key.F1))
                    {
                        if (dataForm == null)
                        {
                            dataForm = new LevelDataForm(this);
                            dataForm.Show();
                        }
                        else
                        {
                            dataForm.Dispose();
                            dataForm = null;
                        }
                    }

                    if (KeyboardInput.KeyPressed(Key.F2))
                    {
                        List <EventObject> events = new List <EventObject>();

                        foreach (EditorObject o in ActiveObjects)
                        {
                            if ((o is EventObject) && o.Selected)
                            {
                                events.Add(o as EventObject);
                            }
                        }

                        if (events.Count > 0)
                        {
                            new EventForm(events.ToArray()).Show();
                        }
                    }

                    if (KeyboardInput.KeyPressed(Key.Delete))
                    {
                        DeleteSelected();
                    }
                }

                if (KeyboardInput.KeyPressed(Key.Minus))
                {
                    MoveSelected(1);
                }
                if (KeyboardInput.KeyPressed(Key.Slash))
                {
                    MoveSelected(-1);
                }

                if (MouseInput.ButtonPressed(MouseButton.Right))
                {
                    DeselectAll();
                }
                if (MouseInput.ButtonPressed(MouseButton.Left) && !CurrentManipulator.Hovered && !templateMenu.Hovered)
                {
                    Vertex       v     = GetVertexAt(MouseInput.Current.Position);
                    EditorObject obj   = GetObjectAt(MouseInput.Current.Position);
                    Layer        layer = GetHoveredLayer();

                    if (layer != null)
                    {
                        SetActiveLayer(layer);
                    }
                    if (v != null)
                    {
                        Select(v);
                    }
                    else if (obj != null)
                    {
                        obj.Select();
                    }
                    else
                    {
                        selectionBox = new SelectionBox(MouseInput.Current.Position, this);
                    }
                }

                if (MouseInput.ButtonReleased(MouseButton.Left) && selectionBox != null)
                {
                    if (KeyboardInput.Current[Key.LControl])
                    {
                        Deselect(selectionBox.GetObjects().ToArray());
                    }
                    else
                    {
                        Select(selectionBox.GetObjects().ToArray());
                    }

                    selectionBox.Dispose();
                    selectionBox = null;
                }

                if (selectionBox != null)
                {
                    selectionBox.Logic();
                }

                ActiveLayer.Logic();
            }
        }
Beispiel #17
0
 public void DuplicateSelected()
 {
     ActiveLayer.DuplicateSelected();
 }
Beispiel #18
0
 public void CreateObject(EditorObject obj)
 {
     ActiveLayer.CreateObject(obj);
 }
Beispiel #19
0
 public void ClearLayer()
 {
     ActiveLayer.RemoveAllComponents();
 }
        /// <summary>
        /// Draws the control.
        /// </summary>
        protected override void Draw()
        {
            // Clear to the default control background color.
            Color backColor = new Color(BackColor.R, BackColor.G, BackColor.B);

            GraphicsDevice.Clear(backColor);

            if (ShowScripts)
            {
                Helper.DrawScripts();
            }
            else
            {
                Update(new GameTime());

                Matrix TransformationMatrix = Matrix.CreateTranslation(-Camera.X, -Camera.Y, 0);

                g.Begin(SpriteSortMode.FrontToBack, null, null, null, null, null, TransformationMatrix);

                foreach (Layer ActiveLayer in ActiveFightingZone.ListLayer)
                {
                    foreach (Prop ActiveProp in ActiveLayer.ListProp)
                    {
                        ActiveProp.BeginDraw(g);
                    }
                }

                g.End();
                GraphicsDevice.SetRenderTarget(null);

                if (ActiveFightingZone.Background != null)
                {
                    ActiveFightingZone.Background.Draw(g, Width, Height);
                }

                g.Begin(SpriteSortMode.Deferred, null, null, null, null, null, TransformationMatrix);

                foreach (Layer ActiveLayer in ActiveFightingZone.ListLayer)
                {
                    if (!DisplayOtherLayers && SelectedLayer != ActiveLayer)
                    {
                        continue;
                    }

                    ActiveLayer.Draw(g);

                    foreach (Prop ActiveProp in ActiveLayer.ListProp)
                    {
                        g.Draw(sprPixel, new Rectangle((int)ActiveProp._Position.X + 13, (int)ActiveProp._Position.Y, 6, 20), Color.Black);
                        g.Draw(sprPixel, new Rectangle((int)ActiveProp._Position.X + 13, (int)ActiveProp._Position.Y + 24, 6, 6), Color.Black);
                    }

                    foreach (SpawnPoint ActiveSpawn in ActiveLayer.ListSpawnPointTeam)
                    {
                        g.Draw(sprPixel, new Rectangle((int)ActiveSpawn.SpawnLocation.X + 13, (int)ActiveSpawn.SpawnLocation.Y, 6, 20), Color.Black);
                        g.Draw(sprPixel, new Rectangle((int)ActiveSpawn.SpawnLocation.X + 13, (int)ActiveSpawn.SpawnLocation.Y + 24, 6, 6), Color.Black);
                    }

                    foreach (Polygon ActivePolygon in ActiveLayer.ListWorldCollisionPolygon)
                    {
                        PolygonTriangle.Draw(g, GraphicsDevice, sprPixel, new PolygonTriangle(PolygonTriangle.SelectionTypes.None, ActivePolygon, 0, 0));
                    }

                    if (SelectedAnimation != null)
                    {
                        Vector2 Position1 = SelectedAnimation.Position - SelectedAnimation.Origin;
                        Vector2 Position2 = Position1 + new Vector2(SelectedAnimation.PositionRectangle.Width, 0);
                        Vector2 Position3 = Position1 + new Vector2(0, SelectedAnimation.PositionRectangle.Height);
                        Vector2 Position4 = Position1 + new Vector2(SelectedAnimation.PositionRectangle.Width, SelectedAnimation.PositionRectangle.Height);

                        g.DrawLine(sprPixel, Position1, Position2, Color.Red);
                        g.DrawLine(sprPixel, Position1, Position3, Color.Red);
                        g.DrawLine(sprPixel, Position2, Position4, Color.Red);
                        g.DrawLine(sprPixel, Position3, Position4, Color.Red);
                    }

                    if (SelectedProp != null)
                    {
                        Vector2 Position1 = SelectedProp._Position;
                        Vector2 Position2 = Position1 + new Vector2(32, 0);
                        Vector2 Position3 = Position1 + new Vector2(0, 32);
                        Vector2 Position4 = Position1 + new Vector2(32, 32);

                        g.DrawLine(sprPixel, Position1, Position2, Color.Red);
                        g.DrawLine(sprPixel, Position1, Position3, Color.Red);
                        g.DrawLine(sprPixel, Position2, Position4, Color.Red);
                        g.DrawLine(sprPixel, Position3, Position4, Color.Red);
                    }

                    if (SelectedSpawn != null)
                    {
                        Vector2 Position1 = SelectedSpawn.SpawnLocation;
                        Vector2 Position2 = Position1 + new Vector2(32, 0);
                        Vector2 Position3 = Position1 + new Vector2(0, 32);
                        Vector2 Position4 = Position1 + new Vector2(32, 32);

                        g.DrawLine(sprPixel, Position1, Position2, Color.Red);
                        g.DrawLine(sprPixel, Position1, Position3, Color.Red);
                        g.DrawLine(sprPixel, Position2, Position4, Color.Red);
                        g.DrawLine(sprPixel, Position3, Position4, Color.Red);
                    }

                    //Draw selected polygons.
                    PolygonEffect.Texture = sprRedTexture;
                    PolygonEffect.CurrentTechnique.Passes[0].Apply();
                    GraphicsDevice.RasterizerState = RasterizerState.CullNone;

                    Polygon ActiveGroundPolygon;

                    for (int V = 0; V < ActiveLayer.GroundLevelCollision.ArrayVertex.Length - 1; V++)
                    {
                        ActiveGroundPolygon = ActiveLayer.GroundLevelCollision;

                        g.Draw(sprPixel, new Rectangle((int)ActiveGroundPolygon.ArrayVertex[V].X - 2, (int)ActiveGroundPolygon.ArrayVertex[V].Y - 2, 5, 5), Color.Red);
                        g.DrawLine(sprPixel, ActiveGroundPolygon.ArrayVertex[V], ActiveGroundPolygon.ArrayVertex[V + 1], Color.Red);
                    }

                    ActiveGroundPolygon = ActiveLayer.GroundLevelCollision;
                    g.Draw(sprPixel, new Rectangle((int)ActiveGroundPolygon.ArrayVertex[ActiveGroundPolygon.ArrayVertex.Length - 1].X - 2,
                                                   (int)ActiveGroundPolygon.ArrayVertex[ActiveGroundPolygon.ArrayVertex.Length - 1].Y - 2, 5, 5), Color.Red);
                }

                foreach (Layer ActiveLayer in ActiveFightingZone.ListLayer)
                {
                    foreach (Prop ActiveProp in ActiveLayer.ListProp)
                    {
                        ActiveProp.EndDraw(g);
                    }
                }

                if (SelectedPolygonTriangle != null)
                {
                    g.End();
                    g.Begin(SpriteSortMode.Deferred, null, null, null, null, null, TransformationMatrix);

                    PolygonEffect.Texture = sprRedTexture;
                    PolygonEffect.CurrentTechnique.Passes[0].Apply();
                    GraphicsDevice.RasterizerState = RasterizerState.CullNone;
                    SelectedPolygonTriangle.Draw(g, GraphicsDevice, sprPixel);
                    if (SelectedPolygonTriangle.ActivePolygon != null)
                    {
                        SelectedPolygonTriangle.ActivePolygon.Draw(GraphicsDevice);
                    }
                }

                g.DrawLine(sprPixel, new Vector2(ActiveFightingZone.CameraBounds.X, ActiveFightingZone.CameraBounds.Y), new Vector2(ActiveFightingZone.CameraBounds.Right, ActiveFightingZone.CameraBounds.Y), Color.Red);
                g.DrawLine(sprPixel, new Vector2(ActiveFightingZone.CameraBounds.Right, ActiveFightingZone.CameraBounds.Y), new Vector2(ActiveFightingZone.CameraBounds.Right, ActiveFightingZone.CameraBounds.Bottom), Color.Red);
                g.DrawLine(sprPixel, new Vector2(ActiveFightingZone.CameraBounds.X, ActiveFightingZone.CameraBounds.Y), new Vector2(ActiveFightingZone.CameraBounds.X, ActiveFightingZone.CameraBounds.Bottom), Color.Red);
                g.DrawLine(sprPixel, new Vector2(ActiveFightingZone.CameraBounds.X, ActiveFightingZone.CameraBounds.Bottom), new Vector2(ActiveFightingZone.CameraBounds.Right, ActiveFightingZone.CameraBounds.Bottom), Color.Red);

                Thread.Sleep(15);

                g.End();
            }
        }