Я пытаюсь сделать appication в monogame windows. У меня есть длинный текст, который будет отображаться на экране. Я попытался отобразить его на экране с помощью spriteBatch.Drawstring, в какой-то степени был успешным. Но текст не вписывался в требуемую область. Я последовал за this учебником. Мне нужен вертикальный свиток, который будет реализован, чтобы весь текст находился внутри моей желаемой области. Может кто-нибудь предложить какую-то помощь. Это мой текущий код:Monogame windows - сделать прокручиваемый текст
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
_boxTexture = new SolidColorTexture(GraphicsDevice, Color.Red);
_borderRectangle = new Rectangle(100, 100, 500, 500);
_textboxRectangle = new Rectangle(105, 105, 490, 490);
_font = Content.Load<SpriteFont>("Rockwell");
_text = "He determined to drop his litigation with the monastry, and relinguish his claims to the wood-cuting and fishery rihgts at once. He was the more ready to do this becuase the rights had becom much less valuable, and he had indeed the vaguest idea where the wood and river in quedtion were.";
}
private String parseText(String text)
{
String line = String.Empty;
String returnString = String.Empty;
String[] wordArray = text.Split(' ');
foreach (String word in wordArray)
{
if (font.MeasureString(line + word).Length() > textBox.Width)
{
returnString = returnString + line + '\n';
line = String.Empty;
}
line = line + word + ' ';
}
return returnString + line;
}
и внутри функции рисования:
spriteBatch.DrawString(font, parseText(text), new Vector2(textBox.X, textBox.Y), Color.White);