1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +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

@@ -23,7 +23,7 @@
#include "../gui/Shortcut.h"
#include "../windows/InfoWindows.h"
#include "../render/CAnimation.h"
#include "../renderSDL/SDL_Extensions.h"
#include "../render/Canvas.h"
#include "../../lib/CConfigHandler.h"
#include "../../lib/CGeneralTextHandler.h"
@@ -285,13 +285,13 @@ void CButton::setPlayerColor(PlayerColor player)
image->playerColored(player);
}
void CButton::showAll(SDL_Surface * to)
void CButton::showAll(Canvas & to)
{
CIntObject::showAll(to);
auto borderColor = stateToBorderColor[getState()];
if (borderColor)
CSDL_Ext::drawBorder(to, pos.x-1, pos.y-1, pos.w+2, pos.h+2, *borderColor);
to.drawBorder(Rect::createAround(pos, 1), *borderColor);
}
std::pair<std::string, std::string> CButton::tooltip()
@@ -783,9 +783,9 @@ void CSlider::setAmount( int to )
vstd::amax(positions, 0);
}
void CSlider::showAll(SDL_Surface * to)
void CSlider::showAll(Canvas & to)
{
CSDL_Ext::fillRect(to, pos, Colors::BLACK);
to.drawColor(pos, Colors::BLACK);
CIntObject::showAll(to);
}