public override void Draw(SpriteBatch spriteBatch, GameTime gameTime) { var size = Scale(16 * 3); _background.Draw(spriteBatch, new Rectangle(Bound.X + Scale(4), Bound.Y + Scale(4), Bound.Width - Scale(8), Bound.Height - Scale(8)), Color.White); spriteBatch.DrawBox(Bound, size); base.Draw(spriteBatch, gameTime); }
public void Display(SpriteBatch spriteBatch) { var entities = ECSCore.pool.GetEntities <Component_Collision_Box>(); Box box; Color color; foreach (var e in entities) { box = e.Get <Component_Collision_Box>().box; color = ECSCore.collisionPool.HasCollision(e) ? Color.Red : Color.LawnGreen; spriteBatch.DrawBox(box, color); spriteBatch.DrawLine(box.Center, box.Center + box.LocalXAxis * (box.Size.X * 1.5f), ColorScheme.UISelect, 1); spriteBatch.DrawLine(box.Center, box.Center + box.LocalYAxis * (box.Size.Y * 1.5f), ColorScheme.UISelect, 1); spriteBatch.DrawPoint(box.ClosestPointTo(Input.MousePos), Color.Red, 5); } }
public override void Draw(GameTime gameTime) { spriteBatch.Begin(); for (int i = 0; i < 10 && i < chat.Count; i++) { spriteBatch.DrawText(chat[chat.Count - i - 1].Message, new Vector2(screen.X / 2, screen.Y * 2 / 3f) + new Vector2(0, font.SpriteFont.LineSpacing * i), true, font, Color.Black); } var grp = new Vector2(screen.X - 100, screen.Y - 100); var size = (int)Card.TurnedCard.TextureOrigin.X * 2; //spriteBatch.DrawRectangle(grp-new Vector2(100,30), 100, 40, Sync.OwnFraction.Color); spriteBatch.DrawProgressBar(grp + new Vector2(0, 62 + font.SpriteFont.LineSpacing / 2), size, (int)MathHelper.Clamp((int)(size * (gameTime.TotalGameTime - Map.TurnBegin).TotalSeconds / Map.TurnDuration.TotalSeconds), 0, size), 4, Color.DarkGray, Sync.OwnFraction.Color, true); spriteBatch.DrawText(Map.Turn.ToString(), grp + new Vector2(0, 60), true, font, Color.White); for (int i = 0; i < Sync.OwnFraction.Deck.Count; i++) { var pos = new Vector2(screen.X - 100, screen.Y - 100 - i / 3f); if (i == Sync.OwnFraction.Deck.Count - 1) { pos = pos.Round(); } Sync.OwnFraction.Deck[i].Draw(spriteBatch, pos, false, true, i); } var hand = grp - new Vector2(100, 0); for (int i = 0; i < Card.AllCards.Count; i++) { var count = Sync.OwnFraction.CountHandCards(Card.AllCards[i]); if (count > 0) { for (int i2 = count - 1; i2 >= 0; i2--) { Card.AllCards[i].Draw(spriteBatch, hand.Round() + new Vector2(0, i2 * 2), false, false, i2); } var counterColor = Color.Lerp(Card.AllCards[i].Color.Inverse(), Color.Black, 0.4f); spriteBatch.DrawText(count.ToString(), hand, true, font, counterColor); hand -= new Vector2(Card.TurnedCard.TextureOrigin.X * 2.3f, 0); } } if (selectedCard != null) { spriteBatch.DrawLine(startDragPosition, Mouse.Position, selectedCard.Color); } if (Key.KeysPressed.Contains(Keys.Tab)) { var pos = screen / 2 - new Vector2(0, screen.Y / 3); var offset = new Vector2(0, font.SpriteFont.LineSpacing); spriteBatch.DrawBox(pos - new Vector2(200, 20), 400, (int)((3 + Sync.PlayersByConnection.Count) * offset.Y), Color.White, Color.Black); spriteBatch.DrawText("Connected Players:", pos, true, font, Color.Black); pos += offset * 1.5f; spriteBatch.DrawText(Sync.OwnFraction.Name + " (you)", pos, true, font, Sync.OwnFraction.Color); pos += offset; foreach (var players in Sync.PlayersByConnection) { var ping = (int)(players.Key.AverageRoundtripTime * 1000); var timeOffset = (int)players.Key.RemoteTimeOffset * 1000; var status = players.Key.Status; spriteBatch.DrawText(ping + " " + players.Value.Name + " (" + status + ")", pos, true, font, players.Value.Color); pos += offset; } } spriteBatch.End(); base.Draw(gameTime); }