I'm trying to code a scrollable chatbox which include the up arrow, down arrow, and obviously a scroll inbetween the 2 to scroll the chat. Let put the detail of how I'm going to set up it aside, I'm running into a few problem on how to render the text and doing text wrap to new line.
So far I have in mind is that:
Pseudo code:
class LogMessage
public LogMessage(string msg)
{
CutMessageIntoABunchOfListBasedOnMaximumLength() // this will cut the log message into individual smaller string which is just long enough to fit in a text of the same width.
}
Draw(); // draw all the string in the list of string
I'm not so sure how to code the CutMessageIntoABunchOfListBasedOnMaximumLength at all
is there a specific way to get the amount of character in a string given a font and charactersize and the width?
THis is the first time I ever tried to recreate a scroll chatbox so my structure might be terribly bad, if you have any suggestion on how to code this, please do so
Thank you