public void DrawGrid() { #if EDITOR && WINDOWS if (UseGrid.get() && GridSize.get().X > 0 && GridSize.get().Y > 0) { Vector2 StartPos = new Vector2( (float)Math.Floor(DrawCamera.getTopLeftCorner().X / GridSize.get().X) * GridSize.get().X , (float)Math.Floor(DrawCamera.getTopLeftCorner().Y / GridSize.get().Y) * GridSize.get().Y ); //StartPos.X = Math.Max(StartPos.X, MinBoundary.X()); //StartPos.Y = Math.Max(StartPos.Y, MinBoundary.Y()); Vector2 EndPos = DrawCamera.getBottomRightCorner(); //EndPos.X = Math.Min(EndPos.X, MaxBoundary.X()); //EndPos.Y = Math.Min(EndPos.Y, MaxBoundary.Y()); for (float x = StartPos.X; x < EndPos.X; x += GridSize.get().X) { if (x >= MinBoundary.X() && x <= MaxBoundary.X()) { Render.DrawLine(new Vector2(x, Math.Max(StartPos.Y, MinBoundary.Y())), new Vector2(x, Math.Min(EndPos.Y, MaxBoundary.Y())), GridColor * 0.5f, 1 / DrawCamera.getZoom()); } } for (float y = StartPos.Y; y < EndPos.Y; y += GridSize.get().Y) { if (y >= MinBoundary.Y() && y <= MaxBoundary.Y()) { Render.DrawLine(new Vector2(Math.Max(StartPos.X, MinBoundary.X()), y), new Vector2(Math.Min(EndPos.X, MaxBoundary.X()), y), GridColor * 0.5f, 1 / DrawCamera.getZoom()); } } } Render.DrawOutlineRect(MinBoundary.get(), MaxBoundary.get(), 1 / DrawCamera.getZoom(), Color.Red); #endif }
public virtual void DrawTechTree(Vector2 Position, float Alpha, PlayerShip Ship) { if (!GetUnitImagePath().Equals("")) { if (!SortedTextures.ContainsKey(GetImagePath())) { SortedTextures.Add(GetImagePath(), AssetManager.Load <Texture2D>("Textures/ShipGame/TurretPictures/" + GetImagePath())); } } else { if (!SortedTextures.ContainsKey(GetUnitImagePath())) { SortedTextures.Add(GetUnitImagePath(), AssetManager.Load <Texture2D>("Textures/ShipGame/UnitPictures/" + GetUnitImagePath())); } } Color col = new Color(((Color.White * (1 - RedFlashAlpha)).ToVector3() + (Color.Red * RedFlashAlpha).ToVector3())) * (Alpha) * Alpha; Rectangle r = new Rectangle((int)Position.X, (int)Position.Y, (int)TechTreeGroup.CellSize.X, (int)TechTreeGroup.CellSize.Y); Render.DrawSolidRect(r, Color.Black * Alpha); Render.DrawSprite(SortedTextures[GetImagePath()], Position + TechTreeGroup.CellSize / 2, TechTreeGroup.CellSize, 0, col); Render.DrawOutlineRect(r, 3, col); Render.DrawShadowedText(Name, Position, col); }
public virtual void DrawAsForm(Vector2 Position, Vector2 Size) { Color col = (SpecialColor ? MyColor : GameFormsManager.PlayerColors[MyPlayer.PlayerNumber]); Render.DrawSprite(FormBoxTexture, Position, Size * 1.2f, 0, col * (0.5f * Alpha)); Render.DrawOutlineRect(Position - Size / 2, Position + Size / 2, 2, col * (1.5f * Alpha)); }
public static void Draw() { if (performanceDisplay != PerformanceDisplay.None) { if (performanceDisplay == PerformanceDisplay.BorderTest) { Load(); Game1.spriteBatch.Begin(); Render.DrawOutlineRect(InnerBorderTestRectangle, 3, Color.Yellow); Render.DrawOutlineRect(OuterBorderTestRectangle, 3, Color.Red); Game1.spriteBatch.End(); } else { frameCounter++; Load(); string fps = string.Format("fps: {0}", frameRate); Game1.spriteBatch.Begin(); Render.DrawShadowedText(Font, fps, new Vector2(32), Vector2.One); if (performanceDisplay == PerformanceDisplay.Extended) { Vector2 DrawPos = new Vector2(32, 64); Render.DrawShadowedText(Font, "DrawCalls: " + Render.DrawCalls, DrawPos, Vector2.One); DrawPos += new Vector2(0, 32); Render.DrawShadowedText(Font, "Objects: " + GameManager.GetLevel().getCurrentScene().Children.Count, DrawPos, Vector2.One); DrawPos += new Vector2(0, 32); Render.DrawShadowedText(Font, "EffectUpdates: " + Render.EffectUpdateCalls, DrawPos, Vector2.One); DrawPos += new Vector2(0, 32); Render.DrawShadowedText(Font, Render.RenderTime.get(), DrawPos, Vector2.One); if (GameManager.GetLevel().MyScene != null) { foreach (StopwatchWrapper sw in GameManager.GetLevel().MyScene.Watches) { DrawPos += new Vector2(0, 32); Render.DrawShadowedText(Font, sw.get(), DrawPos, Vector2.One); } } } Game1.spriteBatch.End(); Render.DrawCalls = 0; } } }
public void DrawAsHierarchy() { Game1.spriteBatch.DrawString(TopHierarchyParent.Font, Name.get(), HierarchyTextPosition, EditorSelected ? TopHierarchyParent.SelectedTextColor : TopHierarchyParent.HighlightedObject == this ? TopHierarchyParent.HighlightedTextColor : TopHierarchyParent.TextColor); Game1.spriteBatch.Draw(TopHierarchyParent.LineTexture, HierarchyHorizontalLine, TopHierarchyParent.LineColor); if (HierarchyDragRectangle.Contains(TopHierarchyParent.RelativeMouse) && MouseManager.DraggedObject == this) { MouseManager.DraggedMouseAlpha = 1; } if ((HierarchyDragRectangle.Contains(TopHierarchyParent.RelativeMouse) && MouseManager.DraggedObject == null)) { Render.DrawOutlineRect(HierarchyDragRectangle, 1, TopHierarchyParent.LineColor); } else if (MouseManager.DraggedObject == this) { Render.DrawOutlineRect(HierarchyDragRectangle, 1, TopHierarchyParent.LineColor * Math.Max(0.1f, MouseManager.DraggedMouseAlpha)); } else { Render.DrawOutlineRect(HierarchyDragRectangle, 1, TopHierarchyParent.LineColor * 0.1f); if (TopHierarchyParent.HighlightedObject == this && MouseManager.DraggedObject != null && MouseManager.DraggedObject.GetType().IsSubclassOf(typeof(GameObject))) { Render.DrawSolidRect(HierarchyDropRectangle, TopHierarchyParent.LineColor); } } if (HierarchyChildren.Count() > 0) { Game1.spriteBatch.Draw(TopHierarchyParent.LineTexture, HierarchyBoxOutline, TopHierarchyParent.LineColor); Game1.spriteBatch.Draw(TopHierarchyParent.LineTexture, HierarchyBox, TopHierarchyParent.BoxColor); Game1.spriteBatch.Draw(TopHierarchyParent.LineTexture, HierarchyPlusHorizontal, TopHierarchyParent.LineColor); if (!HierarchyExpanded) { Game1.spriteBatch.Draw(TopHierarchyParent.LineTexture, HierarchyPlusVerticle, TopHierarchyParent.LineColor); } else { Game1.spriteBatch.Draw(TopHierarchyParent.LineTexture, HierarchyVerticleLine, TopHierarchyParent.LineColor); } } if (HierarchyExpanded) { foreach (GameObject Child in HierarchyChildren) { Child.DrawAsHierarchy(); } } }
public override void DrawFromMiniMap(Vector2 Position, float Size, Vector2 Min, Vector2 Max) { if (this.Position.X() > Max.X || this.Position.Y() > Max.Y || this.Position.X() < Min.X || this.Position.Y() < Min.Y) { return; } Vector2 MapPosition = (this.Position.get() - Min) / (Max - Min) * Size + Position; if (SizeMult > 0) { Render.DrawOutlineRect(MapPosition - new Vector2(SizeMult * 4) - new Vector2(3), MapPosition + new Vector2(SizeMult * 4) - new Vector2(3), 2, TeamInfo.GetColor(GetTeam())); } Render.DrawSprite(Render.BlankTexture, MapPosition - new Vector2(2), new Vector2(4), 0, TeamInfo.GetColor(GetTeam())); }
public static void Draw() { if (DraggedObject == null || !DraggedObject.GetType().IsSubclassOf(typeof(GameObject))) { return; } DraggedMouseAlpha = Math.Max(DraggedMouseAlpha, Math.Min(1, (Vector2.Distance(MousePosition, DraggedMousePosition)) / 64)); GameObject o = (GameObject)DraggedObject; Vector2 Size = Font.MeasureString(o.Name.get()); Size += Vector2.One * 6; //Render.DrawSolidRect(MousePosition - Size / 2, MousePosition + Size / 2, Color.DarkGray * Alpha); ; Game1.spriteBatch.DrawString(Font, o.Name.get(), MousePosition - Size / 2 + Vector2.One * 3, Color.White * DraggedMouseAlpha); Render.DrawOutlineRect(MousePosition - Size / 2, MousePosition + Size / 2, 1, Color.Black * DraggedMouseAlpha); }
public override void DrawAsForm(Vector2 Position, Vector2 Size) { Render.DrawSprite(HudItem.GlowTexture, Position, Size * 3, 0, Color.Black * (Alpha - 0.5f)); Render.DrawShadowedText(Font.get(), Text.get(), Position - Font.get().MeasureString(Text.get()) / 2, Vector2.Zero, MyColor.getAsColor() * Alpha, Color.Black * Alpha); Render.DrawOutlineRect(Position - Size / 2, Position + Size / 2, 2, Color.White * Alpha); if (FlashAlpha > 0) { Render.DrawSolidRect(Position - Size / 2, Position + Size / 2, Color.White * FlashAlpha * Alpha); } if (ErrorAlpha > 0) { Render.DrawSolidRect(Position - Size / 2, Position + Size / 2, Color.Red * ErrorAlpha * Alpha); } base.DrawAsForm(Position, Size); }
public override void DrawTechTree(Vector2 Position, float Alpha, PlayerShip Ship) { if (!SortedTextures.ContainsKey(GetImagePath())) { SortedTextures.Add(GetImagePath(), AssetManager.Load <Texture2D>("Textures/ShipGame/TurretPictures/" + GetImagePath())); } int CardCost = CardCellsCost; if (FactionCostIncreases.ContainsKey(Ship.FactionNumber)) { CardCost += CardCellsCostIncrease * FactionCostIncreases[Ship.FactionNumber]; } Color col = new Color(((Color.White * (1 - RedFlashAlpha)).ToVector3() + (Color.Red * RedFlashAlpha).ToVector3())) * (Alpha) * Alpha; Rectangle r = new Rectangle((int)Position.X, (int)Position.Y, (int)TechTreeGroup.CellSize.X, (int)TechTreeGroup.CellSize.Y); Render.DrawSolidRect(r, Color.Black * Alpha * 0.4f); Render.DrawSprite(SortedTextures[GetImagePath()], Position + TechTreeGroup.CellSize / 2, TechTreeGroup.CellSize, 0, col); Render.DrawOutlineRect(r, 3, col); Render.DrawShadowedText(Name + "\n$ " + CardCost.ToString(), Position, col); }
public override void Draw() { Render.DrawOutlineRect(ParentShip.sceneView.Size / 2 - ParentShip.sceneView.Size / 2 * Size, ParentShip.sceneView.Size / 2 + ParentShip.sceneView.Size / 2 * Size, 1, Color.White * Alpha); }
public override void DrawAsForm(Vector2 Position, Vector2 Size) { Vector2 FormSize = Size * Alpha * 1.5f; float FormAlpha = Alpha * DistanceAlpha; Render.DrawSprite(WaveCard.UnitPicker, Position, Size * new Vector2((Rand.F() + 6) / 7 * 4, 2.5f), Rotation.get(), MyColor * FormAlpha * 2); Render.DrawSprite(WaveCard.UnitBox, Position, FormSize * 1.25f, Rotation.get(), MyColor * (FormAlpha * FormAlpha * 0.3f * (4 + Rand.F()))); Render.DrawSprite(WaveCard.UnitPicker, Position, FormSize * new Vector2((Rand.F() + 6) / 7, 1), Rotation.get(), MyColor * (FormAlpha * FormAlpha * 0.3f * (4 + Rand.F()))); Render.DrawSprite(MyTexture, Position, FormSize, Rotation.get(), Color.White * FormAlpha); if (FlashAlpha > 0) { Render.DrawSprite(HudItem.GlowTexture, Position, FormSize * 2, Rotation.get(), MyColor * 1.5f * FlashAlpha * FormAlpha); } if (ErrorAlpha > 0) { Render.DrawSprite(HudItem.GlowTexture, Position, FormSize * 2, Rotation.get(), Color.Red * 1.5f * ErrorAlpha * FormAlpha); Render.DrawSprite(FactionEvent.LossTexture, Position, FormSize, Rotation.get(), Color.Red * 1.5f * ErrorAlpha * FormAlpha); } if (SelectedAlpha > 0) { Render.DrawSprite(FactionEvent.ReadyTexture, Position, FormSize * SelectedAlpha, Rotation.get(), MyColor * SelectedAlpha * 2 * FormAlpha); Render.DrawSprite(HudItem.GlowTexture, Position, FormSize, Rotation.get(), MyColor * SelectedAlpha * FormAlpha * 1.5f); } if (FormAlpha > 0.5 && Font.get() != null) { float DrawHeight = Position.Y - Size.Y / 2; float FontHeight = Font.get().MeasureString(Name.get()).Y; DrawHeight -= FontHeight * 2; string CostString = ""; if (MyCard.FactionCostIncreases.ContainsKey(ParentShip.FactionNumber)) { CostString = "$" + (MyCard.CardCellsCost + MyCard.CardCellsCostIncrease * MyCard.FactionCostIncreases[ParentShip.FactionNumber]).ToString(); } else { CostString = "$" + (MyCard.CardCellsCost).ToString(); } Render.DrawShadowedText(Font.get(), Text.get(), new Vector2(Position.X - Font.get().MeasureString(Text.get()).X / 2, DrawHeight), Vector2.One * 2, Color.White * (FormAlpha - 0.5f) * 2, Color.Black * (FormAlpha - 0.5f) * 2); DrawHeight -= FontHeight; Render.DrawShadowedText(Font.get(), CostString, new Vector2(Position.X - Font.get().MeasureString(CostString).X / 2, DrawHeight), Vector2.One * 2, Color.White * (FormAlpha - 0.5f) * 2, Color.Black * (FormAlpha - 0.5f) * 2); if (FactionManager.GetFaction(ParentShip.FactionNumber).PickingCards) { Vector2 s = Font.get().MeasureString(MyCard.Caption); DrawHeight -= s.Y + 20; //DrawHeight += 2 * FontHeight; Render.DrawSprite(HudItem.GlowTexture, new Vector2(Position.X, DrawHeight + s.Y / 2), s * 6, 0, Color.Black * (FormAlpha - 0.5f) * 2); Render.DrawShadowedText(Font.get(), MyCard.Caption, new Vector2(Position.X - Font.get().MeasureString(MyCard.Caption).X / 2, DrawHeight), Vector2.One * 2, Color.White * (FormAlpha - 0.5f) * 2, Color.Black * (FormAlpha - 0.5f) * 2); } if (!MyCard.StrongVs.Equals("")) { Render.DrawSprite(MyCard.GetStrongTexture(), Position - Size * 3 / 8 * new Vector2(1, -1), Size / 2, 0, Color.White * (FormAlpha * FormAlpha)); Render.DrawShadowedText(Font.get(), MyCard.StrongVs, new Vector2(Position.X - Size.X * 1 / 8, Position.Y - Font.get().MeasureString(MyCard.StrongVs).Y * 3 / 4 + Size.Y / 2), Vector2.One * 2, Color.White * (FormAlpha - 0.5f) * 2, Color.Black * (FormAlpha - 0.5f) * 2); } } Render.DrawOutlineRect(Position - FormSize * (FormAlpha - 0.5f), Position + FormSize * (FormAlpha - 0.5f), 2 * FormAlpha, Color.White * (FormAlpha * FormAlpha * FormAlpha)); base.DrawAsForm(Position, FormSize); }
public override void Draw2D(GameObjectTag DrawTag) { if (Alpha == 0) { return; } float Size = InterpolatedDifference.X * SizeMult; Vector2 Position = (InterpolatedPositionL + InterpolatedPositionR) / 2 - new Vector2(Size / 2); if (CurrentIcon == null) { if (NeutralManager.MyPattern.CurrentCard.MyIconTexture == null) { switch (NeutralManager.MyPattern.CurrentCard.Type) { case "Light": CurrentIcon = WaveCard.LightIcon; break; case "Medium": CurrentIcon = WaveCard.MediumIcon; break; case "Heavy": CurrentIcon = WaveCard.HeavyIcon; break; } } else { CurrentIcon = NeutralManager.MyPattern.CurrentCard.MyIconTexture; } } Render.DrawSprite(CurrentIcon, Position + new Vector2(Size) / 2, new Vector2(Size * Alpha), 0, Color.White * 0.5f * Alpha); Render.DrawShadowedText(WaveFont, CurrentString, Position + new Vector2(Size / 4, Size), Vector2.One, CurrentColor * SizeMult * Alpha, Color.Black * SizeMult * Alpha); return; Render.DrawSprite(Render.BlankTexture, Position + new Vector2(Size) / 2, new Vector2(Size), 0, Color.Black * 0.3f); foreach (WallChain n in GameManager.GetLevel().getCurrentScene().Enumerate(typeof(WallChain))) { n.DrawFromMiniMap(Position, Size, Min, Max); } foreach (BasicShipGameObject u in AllUnits) { u.DrawFromMiniMap(Position, Size, Min, Max); } Render.DrawOutlineRect(Position, Position + new Vector2(Size), 1, Color.White); //Render.DrawSprite(HudWaveText, Position + new Vector2(Size / 3, Size * 1.1f), new Vector2(Size * 0.6f, Size * 0.2f), 0); //DigitRenderer.DrawDigits(WaveManager.CurrentWave, 2, Position + new Vector2(Size / 1.5f, Size * 1.1f), new Vector2(Size * 0.25f, Size * 0.15f), Color.White); base.Draw2D(DrawTag); }