예제 #1
0
        /// <summary>
        /// The button is created using game coordinates.
        /// </summary>
        /// <param name="position"></param>
        /// <param name="text"></param>
        /// <param name="convertCoordinates"></param>
        public TextButton(Vector2 position, string text, bool convertCoordinates = true)
        {
            Text = text;
            int width = Width;

            if (convertCoordinates)
            {
                position.X = (int)position.X * 2;
                position.Y = (int)position.Y * 2;
            }

            CollRectangle = new Rectangle((int)position.X, (int)position.Y, width,
                                          Height);
            SourceRectangle = new Rectangle(112, 32, Width, Height);
            Font            = FontHelper.ChooseBestFont(CollRectangle.Height);
        }
예제 #2
0
 /// <summary>
 /// Creates a textbox in the specified location that takes in input when selected.
 /// </summary>
 /// <param name="x">The x coordinate.</param>
 /// <param name="y">The y coordinate.</param>
 /// <param name="width">THe width of the textbox.</param>
 public Textbox(int x, int y, int width, int height)
 {
     _white        = ContentHelper.LoadTexture("Tiles/white");
     _font         = FontHelper.ChooseBestFont(height);
     DrawRectangle = new Rectangle(x, y, width, height);
 }