AmigaGuideDS Work Begun

Thought I’d have a play with the AmigaGuideDS idea. Stuff done so far:

  • Created a new VC++ project and added the TextWriter, Font and Bitmap classes from the ScrollingTextDS library;
  • Wrote a simple word wrapping routine;
  • Worked out how to get the STL string class to produce a char array;
  • Managed to get the program outputting a page of word-wrapped, scrollable text.

The only new thing here is the use of the string class. I tend to use the char type instead of string because that’s a bit closer to the hardware. In this particular case, though, speed doesn’t really matter, so I’m using the string class as it’s so much easier to manipulate.

To extract a char array from a string:

// Create a string
string myString;
myString = "some text";

// Create a char
char *myChar;

// Extract the char* from the string
myChar = (char*)myString.c_str();

The c_str() method produces a const char, so it has to be cast to a char to be useful in any of my existing classes.