diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/draci/draci.cpp | 6 | ||||
-rw-r--r-- | engines/draci/font.cpp | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp index 58f5261193..13e5ffae6a 100644 --- a/engines/draci/draci.cpp +++ b/engines/draci/draci.cpp @@ -136,8 +136,12 @@ int DraciEngine::go() { testString = "I'm smaller than the font above me."; font.drawString(surf, testString, (320 - font.getStringWidth(testString, 1)) / 2, 150, 1); - _system->unlockScreen(); + // Overflow handling test + testString = "Checking overflooooooooooooooooooooooooow..."; + font.drawString(surf, testString, 50, 170, 1); + + _system->unlockScreen(); _system->updateScreen(); // Draw and animate the dragon diff --git a/engines/draci/font.cpp b/engines/draci/font.cpp index 9f91e466ea..4ef1b578db 100644 --- a/engines/draci/font.cpp +++ b/engines/draci/font.cpp @@ -166,6 +166,12 @@ void DraciFont::drawString(Graphics::Surface *dst, Common::String &str, uint len = str.size(); for (unsigned int i = 0; i < len; ++i) { + + // Return early if there's no more space on the screen + if (curx >= dst->w) { + return; + } + drawChar(dst, str[i], curx, y); curx += getCharWidth(str[i]) + spacing; } |