private void calculateBounds() { labelPos = hitbox.Location; textPos = labelPos; textPos.X += labelDim.X; labelBounds = labelPatch.getPaddedBounds(labelPos, labelDim, scale); textBounds = textPatch.getPaddedBounds(textPos, textDim, scale); }
private void calculateBounds() { if (patch == null) { return; } contentBounds = patch.getPaddedBounds(position.ToPoint(), dimensions, scale); }
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); }
private void calculateBounds() { contentBounds = patch.getPaddedBounds(hitbox.Location, hitbox.Size, scale); }