1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-01 23:12:49 +02:00

show/showAll methods now use Canvas instead of SDL_Surface

- added compatibility method to Canvas to allow SDL_Surface access
- added drawBorder method to Canvas to replace CSDL_Ext method
- added drawColor method to Canvas to replace CSDL_Ext method
- minor changes to Tavern and Trade windows to adapt to new API
This commit is contained in:
Ivan Savenko
2023-06-02 16:42:18 +03:00
parent b04b11b9d1
commit 8ea0ecaec1
84 changed files with 338 additions and 326 deletions

View File

@@ -19,7 +19,9 @@
#include "../gui/CGuiHandler.h"
#include "../gui/WindowHandler.h"
#include "../gui/Shortcut.h"
#include "../gui/TextAlignment.h"
#include "../render/Colors.h"
#include "../render/Canvas.h"
#include "../adventureMap/AdventureMapInterface.h"
#include "../windows/CMessage.h"
@@ -35,12 +37,12 @@ CInGameConsole::CInGameConsole()
type |= REDRAW_PARENT;
}
void CInGameConsole::showAll(SDL_Surface * to)
void CInGameConsole::showAll(Canvas & to)
{
show(to);
}
void CInGameConsole::show(SDL_Surface * to)
void CInGameConsole::show(Canvas & to)
{
if (LOCPLINT->cingconsole != this)
return;
@@ -53,8 +55,7 @@ void CInGameConsole::show(SDL_Surface * to)
Point leftBottomCorner(0, pos.h);
Point textPosition(leftBottomCorner.x + 50, leftBottomCorner.y - texts.size() * 20 - 80 + number * 20);
graphics->fonts[FONT_MEDIUM]->renderTextLeft(to, text.text, Colors::GREEN, pos.topLeft() + textPosition );
to.drawText(pos.topLeft() + textPosition, FONT_MEDIUM, Colors::GREEN, ETextAlignment::TOPLEFT, text.text);
number++;
}
}