diff options
Diffstat (limited to 'engines/wage/gui-console.cpp')
-rw-r--r-- | engines/wage/gui-console.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp index 8b6fe43a17..2476a8c7fb 100644 --- a/engines/wage/gui-console.cpp +++ b/engines/wage/gui-console.cpp @@ -51,24 +51,21 @@ #include "graphics/cursorman.h" #include "graphics/fonts/bdf.h" #include "graphics/palette.h" +#include "graphics/macgui/macwindow.h" +#include "graphics/macgui/macmenu.h" #include "wage/wage.h" #include "wage/design.h" #include "wage/entities.h" -#include "wage/macwindow.h" -#include "wage/macmenu.h" #include "wage/gui.h" #include "wage/world.h" namespace Wage { const Graphics::Font *Gui::getConsoleFont() { - char fontName[128]; Scene *scene = _engine->_world->_player->_currentScene; - snprintf(fontName, 128, "%s-%d", scene->getFontName(), scene->_fontSize); - - return _wm.getFont(fontName, Graphics::FontManager::kConsoleFont); + return _wm.getFont(scene->getFontName(), Graphics::FontManager::kConsoleFont); } void Gui::clearOutput() { @@ -309,7 +306,20 @@ void Gui::drawInput() { font->drawString(&_screen, _out[_inputTextLineNum], x, y, _screen.w, kColorBlack); - g_system->copyRectToScreen(_screen.getBasePtr(x, y), _screen.pitch, x, y, _consoleWindow->getInnerDimensions().width(), font->getFontHeight()); + int w = _consoleWindow->getInnerDimensions().width(); + int h = font->getFontHeight(); + if (x < 0) { + w += x; + x = 0; + } + if (y < 0) { + h += y; + y = 0; + } + if (x + w > _screen.w) w = _screen.w - x; + if (y + h > _screen.h) h = _screen.h - y; + if (w != 0 && h != 0) + g_system->copyRectToScreen(_screen.getBasePtr(x, y), _screen.pitch, x, y, w, h); } _cursorX = font->getStringWidth(_out[_inputTextLineNum]) + kConHPadding; |