Esempio n. 1
0
        private void drawTextBox(SpriteBatchWrapper sprites, Vector2 center, int boxWidth)
        {
            int textboxWidth = (boxWidth * 8) / 10;
            int textHeight = sprites.getHeightOfText("Foo", 1.0f, INPUT_FONT_NAME);
            int textBoxHeight = textHeight + (textHeight / 5);
            int textboxX = (int) center.X - ((boxWidth * 4) / 10);
            int textX = textboxX + 15;
            int textboxY = (int) center.Y;
            int textY = textboxY + (textHeight / 10);
            int visibleChars = 32;

            sprites.drawColorAt(Color.Black, 1.0f, textboxWidth, textBoxHeight, textboxX, textboxY);

            String textToDraw = this.text;

            bool cutoff = this.text.Length > visibleChars;
            if (cutoff) {
                textToDraw = this.text.Substring(
                    this.text.Length - visibleChars);
                sprites.drawColorAt(Color.Orange, 1.0f, 5, textBoxHeight, textboxX, textboxY);
            }

            if (this.showCursor) {
                textToDraw += "_";
            }
            sprites.drawTextAt(textToDraw, textX, textY, 1.0f, Color.Orange, INPUT_FONT_NAME);
        }
Esempio n. 2
0
 private void drawBox(SpriteBatchWrapper sprites, int boxWidth, int boxHeight, int boxX, int boxY)
 {
     sprites.drawColorAt(new Color(.2f, .2f, .2f), 1.0f,
         boxWidth, boxHeight,
         boxX, boxY);
 }