public void Draw(InputDecorator inputField) { spriteBatch.Begin(); Texture2D rect = new Texture2D(spriteBatch.GraphicsDevice, inputField.Width, 20); Color[] colorData = new Color[rect.Width * rect.Height]; for (int i = 0; i < rect.Height * rect.Width; i++) { colorData[i] = Color.White; } rect.SetData(colorData); spriteBatch.Draw(rect, new Rectangle((int)inputField.GetPosition().X, (int)inputField.GetPosition().Y, rect.Width, rect.Height), Color.White); spriteBatch.DrawString(Game1.font, CharsToString(inputField.Content), inputField.GetPosition(), Color.Black); spriteBatch.End(); }
public void Draw(InputDecorator input) { spriteBatch.Begin(); Color[] colorData = new Color[input.Texture.Width * input.Texture.Height]; for (int i = 0; i < input.Texture.Height * input.Texture.Width; i++) { colorData[i] = input.BackgroundColor; } input.Texture.SetData(colorData); spriteBatch.Draw(input.Texture, new Rectangle((int)input.GetPosition().X, (int)input.GetPosition().Y, (int)input.Texture.Width, (int)input.Texture.Height), input.BackgroundColor); spriteBatch.DrawString(Game1.Font, CharsToString(input.Text), input.GetPosition(), input.TextColor); spriteBatch.End(); }