public void draw(SpriteBatch spriteBatch) { patch.draw(spriteBatch, position.ToPoint(), dimensions, scale); if (text != null) { Vector2 textPos = contentBounds.Location.ToVector2(); Vector2 diff = font.MeasureString(text) - contentBounds.Size.ToVector2(); textPos.Y -= (diff.Y / 2); switch (alignment) { case 'L': break; case 'C': textPos.X -= (diff.X / 2); break; case 'R': textPos.X -= diff.X; break; } spriteBatch.DrawString(font, text, textPos, colour); } }
public void draw(SpriteBatch spriteBatch) { patch.draw(spriteBatch, hitbox.Location, hitbox.Size, scale); if (text != null) { Vector2 diff = ScaleManager.LargeFont.MeasureString(text) - contentBounds.Size.ToVector2(); Vector2 textPos = contentBounds.Location.ToVector2() - (diff / 2); spriteBatch.DrawString(ScaleManager.LargeFont, text, textPos, Color.White); } }
public void draw(SpriteBatch spriteBatch) { patch.draw(spriteBatch, (position + patchOffset).ToPoint(), dimensions, scale); string drawText = text.Substring(0, charsToDraw); Rectangle contentBounds = patch.getPaddedBounds((position + patchOffset).ToPoint(), dimensions, scale); Vector2 diff = ScaleManager.LargeFont.MeasureString(drawText) - contentBounds.Size.ToVector2(); Vector2 textPos = contentBounds.Location.ToVector2() - (diff / 2f); spriteBatch.DrawString(ScaleManager.LargeFont, drawText, textPos, Color.White); }
public void draw(SpriteBatch spriteBatch) { labelPatch.draw(spriteBatch, labelPos, labelDim, scale); textPatch.draw(spriteBatch, textPos, textDim, scale); Vector2 lDiff = ScaleManager.LargeFont.MeasureString(label) - labelBounds.Size.ToVector2(); Vector2 lPos = labelBounds.Location.ToVector2() - (lDiff / 2); spriteBatch.DrawString(ScaleManager.LargeFont, label, lPos, Color.Black); if (text != null) { string drawText = text; if (text.Length > textWidth) { drawText = text.Substring(0, textWidth - 2) + "..."; } Vector2 tDiff = ScaleManager.LargeFont.MeasureString(drawText) - textBounds.Size.ToVector2(); Vector2 tPos = textBounds.Location.ToVector2() - (tDiff / 2); spriteBatch.DrawString(ScaleManager.LargeFont, drawText, tPos, Color.White); } }
public void draw(SpriteBatch spriteBatch) { tablePatch.draw(spriteBatch, position.ToPoint(), screenSize, (int)ScaleManager.CardScale); for (int i = 0; i < snap.Nodes.Length; i++) { spriteBatch.Draw(ContentStore.tableCardPlace, snap.Nodes[i], null, Color.White, snap.Rotations[i], cardPlaceOrigin, ScaleManager.CardScaleSmall, SpriteEffects.None, 1f); } spriteBatch.Draw(ContentStore.tableTrumpPlace, position + trumpOffset, null, Color.White, 0f, trumpPlaceOrigin, ScaleManager.CardScale, SpriteEffects.None, 1f); foreach (NamePlate plate in namePlates) { plate.draw(spriteBatch); } foreach (Card card in playedCards) { if (card == null) { continue; } card.draw(spriteBatch); } if (trump != null) { trump.draw(spriteBatch); } if (!MainGame.Instance.HostOnly) { tableTab.draw(spriteBatch); } if (!MainGame.Instance.HostOnly) { handTab.draw(spriteBatch); } }
public void draw(SpriteBatch spriteBatch) { trayPatch.draw(spriteBatch, position.ToPoint() + patchPos, patchSize, ScaleManager.InterfaceScale); scoreboard.draw(spriteBatch); scoreTab.draw(spriteBatch); }
public void draw(SpriteBatch spriteBatch) { patch.draw(spriteBatch, position.ToPoint() + patchPos, patchSize, ScaleManager.InterfaceScale); ticker.draw(spriteBatch); button.draw(spriteBatch); }