public override void DrawExtra(CustomSpriteBatch g, Texture2D sprPixel) { base.DrawExtra(g, sprPixel); for (int C = 0; C < ListCurrentChainSplinePoints.Count; C++) { g.Draw(sprPixel, new Rectangle((int)ListCurrentChainSplinePoints[C].X - 2, (int)ListCurrentChainSplinePoints[C].Y - 2, 5, 5), Color.Red); if (C >= 1) { g.DrawLine(sprPixel, new Vector2(ListCurrentChainSplinePoints[C - 1].X, ListCurrentChainSplinePoints[C - 1].Y), new Vector2(ListCurrentChainSplinePoints[C].X, ListCurrentChainSplinePoints[C].Y), Color.LightGreen); } else { g.DrawLine(sprPixel, new Vector2(PositionOld.X, PositionOld.Y), new Vector2(ListCurrentChainSplinePoints[C].X, ListCurrentChainSplinePoints[C].Y), Color.LightGreen); } } }
public virtual void DrawExtra(CustomSpriteBatch g, Texture2D sprPixel) { int Index = SpawnFrame; while (Index >= 0) { VisibleAnimationObjectKeyFrame ActiveKeyFrame = DicAnimationKeyFrame[Index]; Vector2 ActivePosition = ActiveKeyFrame.Position; if (ActiveKeyFrame.NextKeyFrame >= 0 && DicAnimationKeyFrame.ContainsKey(ActiveKeyFrame.NextKeyFrame)) { VisibleAnimationObjectKeyFrame NextKeyFrame = DicAnimationKeyFrame[ActiveKeyFrame.NextKeyFrame]; if (ActiveKeyFrame.ListSpecialEffectNode.Count > 0) { Vector2 NextPos = Vector2.Zero; for (int N = 0; N < ActiveKeyFrame.ListSpecialEffectNode.Count; N++) { NextPos = ActiveKeyFrame.ListSpecialEffectNode[N]; g.Draw(sprPixel, new Rectangle((int)ActiveKeyFrame.ListSpecialEffectNode[N].X, (int)ActiveKeyFrame.ListSpecialEffectNode[N].Y, 1, 1), Color.White); g.Draw(sprPixel, new Rectangle((int)ActiveKeyFrame.ListSpecialEffectNode[N].X - 2, (int)ActiveKeyFrame.ListSpecialEffectNode[N].Y - 2, 5, 5), Color.LightGreen); g.DrawLine(sprPixel, new Vector2(ActivePosition.X, ActivePosition.Y), new Vector2(NextPos.X, NextPos.Y), Color.LightGreen); ActivePosition = NextPos; } g.DrawLine(sprPixel, new Vector2(NextPos.X, NextPos.Y), new Vector2(NextKeyFrame.Position.X, NextKeyFrame.Position.Y), Color.LightGreen); } } Index = DicAnimationKeyFrame[Index].NextKeyFrame; } }
private void DrawUpgradeBar(CustomSpriteBatch g, int Y, int UpgradeCount, int UpgradesToBuy) { int UpgradeWidth = 15; int BoxWidth = UpgradeWidth * 10; int BoxHeight = UpgradeWidth; int BoxX = 300; int BoxY = Y + 8; g.DrawLine(sprPixel, new Vector2(BoxX, BoxY), new Vector2(BoxX - 1 + BoxWidth, BoxY), Color.White); g.DrawLine(sprPixel, new Vector2(BoxX, BoxY + BoxHeight), new Vector2(BoxX - 1 + BoxWidth, BoxY + BoxHeight), Color.White); g.Draw(sprPixel, new Rectangle(BoxX, BoxY + 1, UpgradeCount * UpgradeWidth, BoxHeight - 1), Color.Red); g.Draw(sprPixel, new Rectangle(BoxX + UpgradeCount * UpgradeWidth, BoxY + 1, UpgradesToBuy * UpgradeWidth, BoxHeight - 1), Color.Cyan); for (int i = 0; i <= 10; ++i) { g.DrawLine(sprPixel, new Vector2(BoxX + i * UpgradeWidth, BoxY), new Vector2(BoxX + i * UpgradeWidth, BoxY + BoxHeight), Color.White); } }
public override void Draw(CustomSpriteBatch g, bool IsInEditMode) { if (IsInEditMode) { foreach (Polygon ActivePolygon in ListCollisionPolygon) { for (int I = 0; I < ActivePolygon.ArrayIndex.Length; I += 3) { Vector2 Vertex1 = ActivePolygon.ArrayVertex[ActivePolygon.ArrayIndex[I]]; Vector2 Vertex2 = ActivePolygon.ArrayVertex[ActivePolygon.ArrayIndex[I + 1]]; Vector2 Vertex3 = ActivePolygon.ArrayVertex[ActivePolygon.ArrayIndex[I + 2]]; g.DrawLine(GameScreen.sprPixel, Vertex1, Vertex2, Color.Black, 1); g.DrawLine(GameScreen.sprPixel, Vertex2, Vertex3, Color.Black, 1); g.DrawLine(GameScreen.sprPixel, Vertex3, Vertex1, Color.Black, 1); } for (int V = 0; V < ActivePolygon.ArrayVertex.Length; V++) { g.Draw(GameScreen.sprPixel, new Rectangle((int)ActivePolygon.ArrayVertex[V].X - 2, (int)ActivePolygon.ArrayVertex[V].Y - 2, 5, 5), Color.Black); } } } }
public override void Draw(CustomSpriteBatch g, bool IsInEditMode) { foreach (Polygon ActivePolygon in ListPolygon) { ActivePolygon.Draw(g.GraphicsDevice); } if (IsInEditMode) { foreach (Polygon ActivePolygon in ListPolygon) { for (int I = 0; I < ActivePolygon.ArrayIndex.Length; I += 3) { Vector2 Vertex1 = ActivePolygon.ArrayVertex[ActivePolygon.ArrayIndex[I]]; Vector2 Vertex2 = ActivePolygon.ArrayVertex[ActivePolygon.ArrayIndex[I + 1]]; Vector2 Vertex3 = ActivePolygon.ArrayVertex[ActivePolygon.ArrayIndex[I + 2]]; g.DrawLine(GameScreen.sprPixel, Vertex1, Vertex2, Color.Black, 1); g.DrawLine(GameScreen.sprPixel, Vertex2, Vertex3, Color.Black, 1); g.DrawLine(GameScreen.sprPixel, Vertex3, Vertex1, Color.Black, 1); } } } }
public override void DrawRegular(CustomSpriteBatch g) { base.DrawRegular(g); if (Trail != null) { Trail.Draw(g, Vector2.Zero, Collision.ListCollisionPolygon[0].Center, Speed, Angle); } else if (ActiveProjectileInfo.TrailType == 1) { g.DrawLine(GameScreen.sprPixel, Collision.Position, Collision.Position + Speed, Color.FromNonPremultiplied(255, 255, 255, 127), 1); } if (ProjectileAnimation != null) { ProjectileAnimation.Draw(g); } }
public void DrawNextPositionForMakers(CustomSpriteBatch g, Texture2D sprPixel) { int Index = SpawnFrame; while (Index >= 0) { g.Draw(sprPixel, new Rectangle((int)DicAnimationKeyFrame[Index].Position.X - 2, (int)DicAnimationKeyFrame[Index].Position.Y - 2, 5, 5), Color.Black); Vector2 ActivePosition = DicAnimationKeyFrame[Index].Position; if (DicAnimationKeyFrame[Index].NextKeyFrame >= 0) { g.DrawLine(sprPixel, new Vector2(ActivePosition.X, ActivePosition.Y), new Vector2(DicAnimationKeyFrame[DicAnimationKeyFrame[Index].NextKeyFrame].Position.X, DicAnimationKeyFrame[DicAnimationKeyFrame[Index].NextKeyFrame].Position.Y), Color.Black); } Index = DicAnimationKeyFrame[Index].NextKeyFrame; } }
public override void Draw(CustomSpriteBatch g) { for (int P = 0; P < ListProjectile.Count; ++P) { ListProjectile[P].Draw(g); } g.DrawLine(sprPixel, SandboxCollisionBox.ArrayVertex[0], SandboxCollisionBox.ArrayVertex[1], Color.Black); g.DrawLine(sprPixel, SandboxCollisionBox.ArrayVertex[1], SandboxCollisionBox.ArrayVertex[2], Color.Black); g.DrawLine(sprPixel, SandboxCollisionBox.ArrayVertex[2], SandboxCollisionBox.ArrayVertex[3], Color.Black); g.DrawLine(sprPixel, SandboxCollisionBox.ArrayVertex[3], SandboxCollisionBox.ArrayVertex[0], Color.Black); g.DrawLine(sprPixel, EnemyCollisionBox.ArrayVertex[0], SandboxCollisionBox.ArrayVertex[1], Color.Red); g.DrawLine(sprPixel, EnemyCollisionBox.ArrayVertex[1], SandboxCollisionBox.ArrayVertex[2], Color.Red); g.DrawLine(sprPixel, EnemyCollisionBox.ArrayVertex[2], SandboxCollisionBox.ArrayVertex[3], Color.Red); g.DrawLine(sprPixel, EnemyCollisionBox.ArrayVertex[3], SandboxCollisionBox.ArrayVertex[0], Color.Red); g.Draw(sprPixel, new Rectangle(RestartButtonX, RestartButtonY, 30, 30), Color.Green); g.Draw(sprPixel, new Rectangle(CloseButtonX, CloseButtonY, 30, 30), Color.Red); }
public void DrawNextPositions(CustomSpriteBatch g, Texture2D sprPixel, Color DrawColor) { int Index = SpawnFrame; while (Index >= 0) { VisibleAnimationObjectKeyFrame ActiveKeyFrame = DicAnimationKeyFrame[Index]; g.Draw(sprPixel, new Rectangle((int)ActiveKeyFrame.Position.X - 2, (int)ActiveKeyFrame.Position.Y - 2, 5, 5), null, DrawColor, 0, Vector2.Zero, SpriteEffects.None, 0.1f); Vector2 ActivePosition = ActiveKeyFrame.Position; if (ActiveKeyFrame.NextKeyFrame >= 0 && DicAnimationKeyFrame.ContainsKey(ActiveKeyFrame.NextKeyFrame)) { VisibleAnimationObjectKeyFrame NextKeyFrame = DicAnimationKeyFrame[ActiveKeyFrame.NextKeyFrame]; g.DrawLine(sprPixel, new Vector2(ActivePosition.X, ActivePosition.Y), new Vector2(NextKeyFrame.Position.X, NextKeyFrame.Position.Y), Color.Black); } Index = DicAnimationKeyFrame[Index].NextKeyFrame; } }
/// <summary> /// Draws the control. /// </summary> protected override void Draw() { Update(new GameTime()); // Clear to the default control background color. Color backColor = new Color(BackColor.R, BackColor.G, BackColor.B); GraphicsDevice.Clear(backColor); Matrix TransformationMatrix = Matrix.CreateTranslation(-ActiveFightingZone.Camera.X, -ActiveFightingZone.Camera.Y, 0); g.Begin(SpriteSortMode.Deferred, null, null, null, null, null, TransformationMatrix); foreach (Prop ActivePolygon in ActiveFightingZone.ListProp) { g.Draw(sprPixel, new Rectangle((int)ActivePolygon.Position.X + 13, (int)ActivePolygon.Position.Y, 6, 20), Color.Black); g.Draw(sprPixel, new Rectangle((int)ActivePolygon.Position.X + 13, (int)ActivePolygon.Position.Y + 24, 6, 6), Color.Black); } foreach (Polygon ActivePolygon in ActiveFightingZone.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); } //Draw selected polygons. PolygonEffect.Texture = sprRedTexture; PolygonEffect.CurrentTechnique.Passes[0].Apply(); GraphicsDevice.RasterizerState = RasterizerState.CullNone; if (SelectedPolygonTriangle != null) { SelectedPolygonTriangle.Draw(g, GraphicsDevice, sprPixel); } 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(); }
/// <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(); } }