예제 #1
0
        private void calculateBounds()
        {
            labelPos   = hitbox.Location;
            textPos    = labelPos;
            textPos.X += labelDim.X;

            labelBounds = labelPatch.getPaddedBounds(labelPos, labelDim, scale);
            textBounds  = textPatch.getPaddedBounds(textPos, textDim, scale);
        }
예제 #2
0
        private void calculateBounds()
        {
            if (patch == null)
            {
                return;
            }

            contentBounds = patch.getPaddedBounds(position.ToPoint(), dimensions, scale);
        }
예제 #3
0
        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);
        }
예제 #4
0
 private void calculateBounds()
 {
     contentBounds = patch.getPaddedBounds(hitbox.Location, hitbox.Size, scale);
 }