- for (int i(0); s[i] && (maxChars <= 0 || i < maxChars); ++i, position += step) {
- DrawChar(s[i], dest, position);
+ Vector<int> lineBreak(0, CharHeight());
+ for (int i(0), col(0); s[i] && (maxWidth <= 0 || col < maxWidth); ++i) {
+ if (s[i] == '\n') {
+ lineHead += lineBreak;
+ position = lineHead;
+ col = 0;
+ } else {
+ DrawChar(s[i], dest, position);
+ position += step;
+ ++col;
+ }
+ }
+}
+
+void Font::DrawStringRight(const char *s, SDL_Surface *dest, const Vector<int> &positionIn, int maxWidth) const {
+ // NOTE: this does not handle line breaks
+ if (!sprite) return;
+
+ int length(0);
+ while (length < maxWidth && s[length] != '\0') {
+ ++length;