mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-03 07:59:38 +00:00
MACVENTURE: Fix console drawing bug
This commit is contained in:
parent
4f6609f704
commit
560185903c
@ -639,7 +639,7 @@ void Gui::drawConsoleWindow() {
|
||||
|
||||
Graphics::ManagedSurface *srf = _outConsoleWindow->getSurface();
|
||||
BorderBounds bounds = borderBounds(getWindowData(kOutConsoleWindow).type);
|
||||
_consoleText->renderInto(srf, bounds.leftOffset);
|
||||
_consoleText->renderInto(srf, bounds, kConsoleLeftOffset);
|
||||
}
|
||||
|
||||
void Gui::drawObjectsInWindow(const WindowData &targetData, Graphics::ManagedSurface *surface) {
|
||||
@ -651,10 +651,7 @@ void Gui::drawObjectsInWindow(const WindowData &targetData, Graphics::ManagedSur
|
||||
if (targetData.children.size() == 0) return;
|
||||
|
||||
Graphics::ManagedSurface *composeSurface = new Graphics::ManagedSurface();
|
||||
composeSurface->create(
|
||||
surface->w - border.leftOffset - border.rightOffset,
|
||||
surface->h - border.topOffset - border.bottomOffset,
|
||||
surface->format);
|
||||
createInnerSurface(composeSurface, surface, border);
|
||||
composeSurface->clear(kColorGreen);
|
||||
|
||||
for (uint i = 0; i < targetData.children.size(); i++) {
|
||||
@ -879,6 +876,13 @@ void Gui::saveInto(int slot) {
|
||||
_engine->preparedToRun();
|
||||
}
|
||||
|
||||
void Gui::createInnerSurface(Graphics::ManagedSurface *innerSurface, Graphics::ManagedSurface *outerSurface, const BorderBounds &borders) {
|
||||
innerSurface->create(
|
||||
outerSurface->w - borders.leftOffset - borders.rightOffset,
|
||||
outerSurface->h - borders.topOffset - borders.bottomOffset,
|
||||
outerSurface->format);
|
||||
}
|
||||
|
||||
void Gui::moveDraggedObject(Common::Point target) {
|
||||
ensureAssetLoaded(_draggedObj.id);
|
||||
_draggedObj.pos = target + _draggedObj.mouseOffset;
|
||||
|
@ -161,6 +161,8 @@ public:
|
||||
void loadGame(int slot);
|
||||
void saveInto(int slot);
|
||||
|
||||
void createInnerSurface(Graphics::ManagedSurface *innerSurface, Graphics::ManagedSurface *outerSurface, const BorderBounds &borders);
|
||||
|
||||
|
||||
private: // Attributes
|
||||
|
||||
@ -377,6 +379,10 @@ static void cursorTimerHandler(void *refCon) {
|
||||
}
|
||||
|
||||
|
||||
enum {
|
||||
kConsoleLeftOffset = 2
|
||||
};
|
||||
|
||||
class ConsoleText {
|
||||
|
||||
public:
|
||||
@ -407,14 +413,23 @@ public:
|
||||
updateScroll();
|
||||
}
|
||||
|
||||
void renderInto(Graphics::ManagedSurface *target, uint leftOffset) {
|
||||
void renderInto(Graphics::ManagedSurface *target, const BorderBounds borders, int textOffset) {
|
||||
target->fillRect(target->getBounds(), kColorWhite);
|
||||
|
||||
Graphics::ManagedSurface *composeSurface = new Graphics::ManagedSurface();
|
||||
_gui->createInnerSurface(composeSurface, target, borders);
|
||||
composeSurface->clear(kColorGreen);
|
||||
|
||||
const Graphics::Font *font = &_gui->getCurrentFont();
|
||||
uint y = target->h - font->getFontHeight();
|
||||
for (uint i = _scrollPos; i != 0; i--) {
|
||||
font->drawString(target, _lines[i], leftOffset, y, font->getStringWidth(_lines[i]), kColorBlack);
|
||||
font->drawString(target, _lines[i], textOffset, y, font->getStringWidth(_lines[i]), kColorBlack);
|
||||
y -= font->getFontHeight();
|
||||
}
|
||||
|
||||
Common::Point composePosition = Common::Point(borders.leftOffset, borders.topOffset);
|
||||
target->transBlitFrom(*composeSurface, composePosition, kColorGreen);
|
||||
delete composeSurface;
|
||||
}
|
||||
|
||||
void updateScroll() {
|
||||
|
Loading…
Reference in New Issue
Block a user