I'm making an XNA game console which should draw the output lines as they are added. I want to draw only the last 10 lines and I can't figure out how to produce the actual output string.
I was trying to use StringBuilder
to collect all lines in it and then read the last lines into a String
, but it turns out StringBuilder
doesn't have a specific line retrieval method. I tried using String[]
, but it adds significant lag increasing over time. How should I do this?
If you no longer need messages older than 10 lines, you could use a typed Queue .
Depending on how you're rendering it, it might be the easiest way of managing that data.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.