Some ConsoleWrapper changes

Posted on

Have spent a bit of time working on ConsoleWrapper today:

  • Fixed a major memory leak that was causing memory usage to climb indefinitely, until it caused ConsoleWrapper to crash. This was obviously a Bad Thing™. Memory usage now sits at a comfortable ~24MB on startup, and doesn’t increase significantly with use.
  • Added a new built-in command (i.e. that doesn’t utilise CMD) for viewing images inline within ConsoleWrapper. Usage is VIEW IMAGENAME, where IMAGENAME is a valid image path. If the image is too large, it will automatically be resized to be visible within ConsoleWrapper. Here’s a screenshot with a couple of images displaying inline. Screenshot taken during animating from the top of the stream to the bottom, which is the cause of the funny-looking angle, and edge jaggies:
Some ConsoleWrapper changes /2010/04/consolewrapper-viewimage1.jpg

Click through to see full size. As an aside, looking at that less-than-savoury edge antialiasing, I’m kind of tempted to implement some AA. An easier way would be to just put a black border into the texture though. Maybe something for next update.

Also evident in this screenshot, is the new feature whereby strings are rendered as individual letters, each letter being a sprite. Unfortunately, this means kerning is lost, and the string renders with significant whitespace between each character. This is something I am working to fix, but seems to be related to .NET’s Graphics library overestimating font sizes when performing a MeasureString operation.

Using sprites has also seemed to result in sub-par performance (i.e. lower performance than the old method of using pre-rendered full string textures), and I’m not entirely sure why — it was meant to increase performance, if anything. This is especially noticeable when rendering large swathes of text, such as from a DIR command on a large directory. Definitely something else to work on improving and optimising.

Note that I haven’t put out a compiled release of this yet, but the latest source is available as always on SourceForge.