mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +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:
@@ -13,7 +13,7 @@
|
||||
#include "CGuiHandler.h"
|
||||
#include "WindowHandler.h"
|
||||
#include "Shortcut.h"
|
||||
#include "../renderSDL/SDL_Extensions.h"
|
||||
#include "../render/Canvas.h"
|
||||
#include "../windows/CMessage.h"
|
||||
#include "../CMT.h"
|
||||
|
||||
@@ -53,7 +53,7 @@ CIntObject::~CIntObject()
|
||||
parent_m->removeChild(this);
|
||||
}
|
||||
|
||||
void CIntObject::show(SDL_Surface * to)
|
||||
void CIntObject::show(Canvas & to)
|
||||
{
|
||||
if(defActions & UPDATE)
|
||||
for(auto & elem : children)
|
||||
@@ -61,7 +61,7 @@ void CIntObject::show(SDL_Surface * to)
|
||||
elem->show(to);
|
||||
}
|
||||
|
||||
void CIntObject::showAll(SDL_Surface * to)
|
||||
void CIntObject::showAll(Canvas & to)
|
||||
{
|
||||
if(defActions & SHOWALL)
|
||||
{
|
||||
@@ -100,16 +100,6 @@ void CIntObject::deactivate()
|
||||
elem->deactivate();
|
||||
}
|
||||
|
||||
void CIntObject::printAtMiddleLoc(const std::string & text, const Point &p, EFonts font, const SDL_Color & kolor, SDL_Surface * dst)
|
||||
{
|
||||
graphics->fonts[font]->renderTextCenter(dst, text, kolor, pos.topLeft() + p);
|
||||
}
|
||||
|
||||
void CIntObject::printAtMiddleWBLoc( const std::string & text, const Point &p, EFonts font, int charpr, const SDL_Color & kolor, SDL_Surface * dst)
|
||||
{
|
||||
graphics->fonts[font]->renderTextLinesCenter(dst, CMessage::breakText(text, charpr, font), kolor, pos.topLeft() + p);
|
||||
}
|
||||
|
||||
void CIntObject::addUsedEvents(ui16 newActions)
|
||||
{
|
||||
if (isActive())
|
||||
@@ -226,9 +216,15 @@ void CIntObject::redraw()
|
||||
}
|
||||
else
|
||||
{
|
||||
showAll(screenBuf);
|
||||
Canvas buffer = Canvas::createFromSurface(screenBuf);
|
||||
|
||||
showAll(buffer);
|
||||
if(screenBuf != screen)
|
||||
showAll(screen);
|
||||
{
|
||||
Canvas screenBuffer = Canvas::createFromSurface(screen);
|
||||
|
||||
showAll(screenBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user