mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-13 11:40:38 +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:
parent
b04b11b9d1
commit
8ea0ecaec1
@ -40,8 +40,6 @@
|
|||||||
#include "../lib/ScriptHandler.h"
|
#include "../lib/ScriptHandler.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <SDL_surface.h>
|
|
||||||
|
|
||||||
void ClientCommandManager::handleQuitCommand()
|
void ClientCommandManager::handleQuitCommand()
|
||||||
{
|
{
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
@ -174,21 +172,6 @@ void ClientCommandManager::handleRedrawCommand()
|
|||||||
GH.windows().totalRedraw();
|
GH.windows().totalRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientCommandManager::handleScreenCommand()
|
|
||||||
{
|
|
||||||
printCommandMessage("Screenbuf points to ");
|
|
||||||
|
|
||||||
if(screenBuf == screen)
|
|
||||||
printCommandMessage("screen", ELogLevel::ERROR);
|
|
||||||
else if(screenBuf == screen2)
|
|
||||||
printCommandMessage("screen2", ELogLevel::ERROR);
|
|
||||||
else
|
|
||||||
printCommandMessage("?!?", ELogLevel::ERROR);
|
|
||||||
|
|
||||||
SDL_SaveBMP(screen, "Screen_c.bmp");
|
|
||||||
SDL_SaveBMP(screen2, "Screen2_c.bmp");
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClientCommandManager::handleNotDialogCommand()
|
void ClientCommandManager::handleNotDialogCommand()
|
||||||
{
|
{
|
||||||
LOCPLINT->showingDialog->setn(false);
|
LOCPLINT->showingDialog->setn(false);
|
||||||
@ -527,9 +510,6 @@ void ClientCommandManager::processCommand(const std::string & message, bool call
|
|||||||
else if(commandName == "redraw")
|
else if(commandName == "redraw")
|
||||||
handleRedrawCommand();
|
handleRedrawCommand();
|
||||||
|
|
||||||
else if(commandName == "screen")
|
|
||||||
handleScreenCommand();
|
|
||||||
|
|
||||||
else if(commandName == "not dialog")
|
else if(commandName == "not dialog")
|
||||||
handleNotDialogCommand();
|
handleNotDialogCommand();
|
||||||
|
|
||||||
|
@ -45,9 +45,6 @@ class ClientCommandManager //take mantis #2292 issue about account if thinking a
|
|||||||
// Redraw the current screen
|
// Redraw the current screen
|
||||||
void handleRedrawCommand();
|
void handleRedrawCommand();
|
||||||
|
|
||||||
// Prints information about current screen, and saves both screens as .bmp in root folder
|
|
||||||
void handleScreenCommand();
|
|
||||||
|
|
||||||
// Set the state indicating if dialog box is active to "no"
|
// Set the state indicating if dialog box is active to "no"
|
||||||
void handleNotDialogCommand();
|
void handleNotDialogCommand();
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "../gui/CGuiHandler.h"
|
#include "../gui/CGuiHandler.h"
|
||||||
#include "../gui/Shortcut.h"
|
#include "../gui/Shortcut.h"
|
||||||
#include "../gui/WindowHandler.h"
|
#include "../gui/WindowHandler.h"
|
||||||
|
#include "../render/Canvas.h"
|
||||||
#include "../CMT.h"
|
#include "../CMT.h"
|
||||||
#include "../PlayerLocalState.h"
|
#include "../PlayerLocalState.h"
|
||||||
#include "../CPlayerInterface.h"
|
#include "../CPlayerInterface.h"
|
||||||
@ -133,13 +134,13 @@ void AdventureMapInterface::deactivate()
|
|||||||
CCS->curh->set(Cursor::Map::POINTER);
|
CCS->curh->set(Cursor::Map::POINTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdventureMapInterface::showAll(SDL_Surface * to)
|
void AdventureMapInterface::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::showAll(to);
|
CIntObject::showAll(to);
|
||||||
LOCPLINT->cingconsole->show(to);
|
LOCPLINT->cingconsole->show(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdventureMapInterface::show(SDL_Surface * to)
|
void AdventureMapInterface::show(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::show(to);
|
CIntObject::show(to);
|
||||||
LOCPLINT->cingconsole->show(to);
|
LOCPLINT->cingconsole->show(to);
|
||||||
@ -396,7 +397,8 @@ void AdventureMapInterface::onPlayerTurnStarted(PlayerColor playerID)
|
|||||||
widget->getInfoBar()->showDate();
|
widget->getInfoBar()->showDate();
|
||||||
|
|
||||||
onHeroChanged(nullptr);
|
onHeroChanged(nullptr);
|
||||||
showAll(screen);
|
Canvas canvas = Canvas::createFromSurface(screen);
|
||||||
|
showAll(canvas);
|
||||||
mapAudio->onPlayerTurnStarted();
|
mapAudio->onPlayerTurnStarted();
|
||||||
|
|
||||||
if(settings["session"]["autoSkip"].Bool() && !GH.isKeyboardShiftDown())
|
if(settings["session"]["autoSkip"].Bool() && !GH.isKeyboardShiftDown())
|
||||||
|
@ -94,8 +94,8 @@ protected:
|
|||||||
void deactivate() override;
|
void deactivate() override;
|
||||||
|
|
||||||
void tick(uint32_t msPassed) override;
|
void tick(uint32_t msPassed) override;
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
|
|
||||||
void keyPressed(EShortcut key) override;
|
void keyPressed(EShortcut key) override;
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ void CAdventureMapIcon::setPlayer(const PlayerColor & player)
|
|||||||
image->setFrame(index + player.getNum() * iconsPerPlayer);
|
image->setFrame(index + player.getNum() * iconsPerPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAdventureMapOverlayWidget::show(SDL_Surface * to)
|
void CAdventureMapOverlayWidget::show(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::showAll(to);
|
CIntObject::showAll(to);
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ class CAdventureMapContainerWidget : public CIntObject
|
|||||||
class CAdventureMapOverlayWidget : public CAdventureMapContainerWidget
|
class CAdventureMapOverlayWidget : public CAdventureMapContainerWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Small helper class that provides player-colorable icon using animation file
|
/// Small helper class that provides player-colorable icon using animation file
|
||||||
|
@ -19,7 +19,9 @@
|
|||||||
#include "../gui/CGuiHandler.h"
|
#include "../gui/CGuiHandler.h"
|
||||||
#include "../gui/WindowHandler.h"
|
#include "../gui/WindowHandler.h"
|
||||||
#include "../gui/Shortcut.h"
|
#include "../gui/Shortcut.h"
|
||||||
|
#include "../gui/TextAlignment.h"
|
||||||
#include "../render/Colors.h"
|
#include "../render/Colors.h"
|
||||||
|
#include "../render/Canvas.h"
|
||||||
#include "../adventureMap/AdventureMapInterface.h"
|
#include "../adventureMap/AdventureMapInterface.h"
|
||||||
#include "../windows/CMessage.h"
|
#include "../windows/CMessage.h"
|
||||||
|
|
||||||
@ -35,12 +37,12 @@ CInGameConsole::CInGameConsole()
|
|||||||
type |= REDRAW_PARENT;
|
type |= REDRAW_PARENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInGameConsole::showAll(SDL_Surface * to)
|
void CInGameConsole::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
show(to);
|
show(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInGameConsole::show(SDL_Surface * to)
|
void CInGameConsole::show(Canvas & to)
|
||||||
{
|
{
|
||||||
if (LOCPLINT->cingconsole != this)
|
if (LOCPLINT->cingconsole != this)
|
||||||
return;
|
return;
|
||||||
@ -53,8 +55,7 @@ void CInGameConsole::show(SDL_Surface * to)
|
|||||||
Point leftBottomCorner(0, pos.h);
|
Point leftBottomCorner(0, pos.h);
|
||||||
Point textPosition(leftBottomCorner.x + 50, leftBottomCorner.y - texts.size() * 20 - 80 + number * 20);
|
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++;
|
number++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,8 +45,8 @@ public:
|
|||||||
void print(const std::string & txt);
|
void print(const std::string & txt);
|
||||||
|
|
||||||
void tick(uint32_t msPassed) override;
|
void tick(uint32_t msPassed) override;
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
void keyPressed(EShortcut key) override;
|
void keyPressed(EShortcut key) override;
|
||||||
void textInputed(const std::string & enteredText) override;
|
void textInputed(const std::string & enteredText) override;
|
||||||
void textEdited(const std::string & enteredText) override;
|
void textEdited(const std::string & enteredText) override;
|
||||||
|
@ -36,7 +36,7 @@ CInfoBar::CVisibleInfo::CVisibleInfo()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInfoBar::CVisibleInfo::show(SDL_Surface * to)
|
void CInfoBar::CVisibleInfo::show(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::show(to);
|
CIntObject::show(to);
|
||||||
for(auto object : forceRefresh)
|
for(auto object : forceRefresh)
|
||||||
|
@ -46,7 +46,7 @@ private:
|
|||||||
static constexpr int offset_x = 8;
|
static constexpr int offset_x = 8;
|
||||||
static constexpr int offset_y = 12;
|
static constexpr int offset_y = 12;
|
||||||
|
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<CPicture> background;
|
std::shared_ptr<CPicture> background;
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "../CPlayerInterface.h"
|
#include "../CPlayerInterface.h"
|
||||||
#include "../PlayerLocalState.h"
|
#include "../PlayerLocalState.h"
|
||||||
#include "../gui/CGuiHandler.h"
|
#include "../gui/CGuiHandler.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
#include "../render/Canvas.h"
|
||||||
|
|
||||||
#include "../../lib/CGeneralTextHandler.h"
|
#include "../../lib/CGeneralTextHandler.h"
|
||||||
#include "../../lib/CHeroHandler.h"
|
#include "../../lib/CHeroHandler.h"
|
||||||
@ -92,9 +92,9 @@ CList::CList(int Size, Rect widgetDimensions)
|
|||||||
pos.h = widgetDimensions.h;
|
pos.h = widgetDimensions.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CList::showAll(SDL_Surface * to)
|
void CList::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CSDL_Ext::fillRect(to, pos, Colors::BLACK);
|
to.drawColor(pos, Colors::BLACK);
|
||||||
CIntObject::showAll(to);
|
CIntObject::showAll(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ public:
|
|||||||
void selectNext();
|
void selectNext();
|
||||||
void selectPrev();
|
void selectPrev();
|
||||||
|
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// List of heroes which is shown at the right of the adventure map screen
|
/// List of heroes which is shown at the right of the adventure map screen
|
||||||
|
@ -82,10 +82,9 @@ CMinimapInstance::CMinimapInstance(CMinimap *Parent, int Level):
|
|||||||
redrawMinimap();
|
redrawMinimap();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMinimapInstance::showAll(SDL_Surface * to)
|
void CMinimapInstance::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
Canvas target(to);
|
to.drawScaled(*minimap, pos.topLeft(), pos.dimensions());
|
||||||
target.drawScaled(*minimap, pos.topLeft(), pos.dimensions());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CMinimap::CMinimap(const Rect & position)
|
CMinimap::CMinimap(const Rect & position)
|
||||||
@ -164,15 +163,13 @@ void CMinimap::mouseMoved(const Point & cursorPosition)
|
|||||||
moveAdvMapSelection();
|
moveAdvMapSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMinimap::showAll(SDL_Surface * to)
|
void CMinimap::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CSDL_Ext::CClipRectGuard guard(to, pos);
|
CSDL_Ext::CClipRectGuard guard(to.getInternalSurface(), pos);
|
||||||
CIntObject::showAll(to);
|
CIntObject::showAll(to);
|
||||||
|
|
||||||
if(minimap)
|
if(minimap)
|
||||||
{
|
{
|
||||||
Canvas target(to);
|
|
||||||
|
|
||||||
int3 mapSizes = LOCPLINT->cb->getMapSize();
|
int3 mapSizes = LOCPLINT->cb->getMapSize();
|
||||||
|
|
||||||
//draw radar
|
//draw radar
|
||||||
@ -184,7 +181,7 @@ void CMinimap::showAll(SDL_Surface * to)
|
|||||||
screenArea.h * pos.h / mapSizes.y - 1
|
screenArea.h * pos.h / mapSizes.y - 1
|
||||||
};
|
};
|
||||||
|
|
||||||
Canvas clippedTarget(target, pos);
|
Canvas clippedTarget(to, pos);
|
||||||
clippedTarget.drawBorderDashed(radar, CSDL_Ext::fromSDL(Colors::PURPLE));
|
clippedTarget.drawBorderDashed(radar, CSDL_Ext::fromSDL(Colors::PURPLE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ class CMinimapInstance : public CIntObject
|
|||||||
public:
|
public:
|
||||||
CMinimapInstance(CMinimap * parent, int level);
|
CMinimapInstance(CMinimap * parent, int level);
|
||||||
|
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
void refreshTile(const int3 & pos);
|
void refreshTile(const int3 & pos);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ public:
|
|||||||
void update();
|
void update();
|
||||||
void setAIRadar(bool on);
|
void setAIRadar(bool on);
|
||||||
|
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
|
|
||||||
void updateTiles(std::unordered_set<int3> positions);
|
void updateTiles(std::unordered_set<int3> positions);
|
||||||
};
|
};
|
||||||
|
@ -12,8 +12,10 @@
|
|||||||
|
|
||||||
#include "../CGameInfo.h"
|
#include "../CGameInfo.h"
|
||||||
#include "../CPlayerInterface.h"
|
#include "../CPlayerInterface.h"
|
||||||
|
#include "../render/Canvas.h"
|
||||||
#include "../render/Colors.h"
|
#include "../render/Colors.h"
|
||||||
#include "../gui/CGuiHandler.h"
|
#include "../gui/CGuiHandler.h"
|
||||||
|
#include "../gui/TextAlignment.h"
|
||||||
#include "../widgets/Images.h"
|
#include "../widgets/Images.h"
|
||||||
|
|
||||||
#include "../../CCallback.h"
|
#include "../../CCallback.h"
|
||||||
@ -67,24 +69,20 @@ std::string CResDataBar::buildDateString()
|
|||||||
return boost::str(formatted);
|
return boost::str(formatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CResDataBar::draw(SDL_Surface * to)
|
void CResDataBar::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
|
CIntObject::showAll(to);
|
||||||
|
|
||||||
//TODO: all this should be labels, but they require proper text update on change
|
//TODO: all this should be labels, but they require proper text update on change
|
||||||
for (auto & entry : resourcePositions)
|
for (auto & entry : resourcePositions)
|
||||||
{
|
{
|
||||||
std::string text = std::to_string(LOCPLINT->cb->getResourceAmount(entry.first));
|
std::string text = std::to_string(LOCPLINT->cb->getResourceAmount(entry.first));
|
||||||
|
|
||||||
graphics->fonts[FONT_SMALL]->renderTextLeft(to, text, Colors::WHITE, pos.topLeft() + entry.second);
|
to.drawText(pos.topLeft() + entry.second, FONT_SMALL, Colors::WHITE, ETextAlignment::TOPLEFT, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (datePosition)
|
if (datePosition)
|
||||||
graphics->fonts[FONT_SMALL]->renderTextLeft(to, buildDateString(), Colors::WHITE, pos.topLeft() + *datePosition);
|
to.drawText(pos.topLeft() + *datePosition, FONT_SMALL, Colors::WHITE, ETextAlignment::TOPLEFT, buildDateString());
|
||||||
}
|
|
||||||
|
|
||||||
void CResDataBar::showAll(SDL_Surface * to)
|
|
||||||
{
|
|
||||||
CIntObject::showAll(to);
|
|
||||||
draw(to);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CResDataBar::colorize(PlayerColor player)
|
void CResDataBar::colorize(PlayerColor player)
|
||||||
|
@ -27,7 +27,6 @@ class CResDataBar : public CIntObject
|
|||||||
std::map<GameResID, Point> resourcePositions;
|
std::map<GameResID, Point> resourcePositions;
|
||||||
std::optional<Point> datePosition;
|
std::optional<Point> datePosition;
|
||||||
|
|
||||||
void draw(SDL_Surface * to);
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// For dynamically-sized UI windows, e.g. adventure map interface
|
/// For dynamically-sized UI windows, e.g. adventure map interface
|
||||||
@ -40,6 +39,6 @@ public:
|
|||||||
void setResourcePosition(const GameResID & resource, const Point & position);
|
void setResourcePosition(const GameResID & resource, const Point & position);
|
||||||
|
|
||||||
void colorize(PlayerColor player);
|
void colorize(PlayerColor player);
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -606,7 +606,7 @@ bool BattleFieldController::stackCountOutsideHex(const BattleHex & number) const
|
|||||||
return stackCountOutsideHexes[number];
|
return stackCountOutsideHexes[number];
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleFieldController::showAll(SDL_Surface * to)
|
void BattleFieldController::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
show(to);
|
show(to);
|
||||||
}
|
}
|
||||||
@ -619,10 +619,9 @@ void BattleFieldController::tick(uint32_t msPassed)
|
|||||||
owner.projectilesController->tick(msPassed);
|
owner.projectilesController->tick(msPassed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleFieldController::show(SDL_Surface * to)
|
void BattleFieldController::show(Canvas & to)
|
||||||
{
|
{
|
||||||
Canvas canvas(to);
|
CSDL_Ext::CClipRectGuard guard(to.getInternalSurface(), pos);
|
||||||
CSDL_Ext::CClipRectGuard guard(to, pos);
|
|
||||||
|
|
||||||
renderBattlefield(canvas);
|
renderBattlefield(to);
|
||||||
}
|
}
|
||||||
|
@ -68,8 +68,8 @@ class BattleFieldController : public CIntObject
|
|||||||
void clickRight(tribool down, bool previousState) override;
|
void clickRight(tribool down, bool previousState) override;
|
||||||
void activate() override;
|
void activate() override;
|
||||||
|
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
void tick(uint32_t msPassed) override;
|
void tick(uint32_t msPassed) override;
|
||||||
public:
|
public:
|
||||||
BattleFieldController(BattleInterface & owner);
|
BattleFieldController(BattleInterface & owner);
|
||||||
|
@ -163,7 +163,7 @@ public:
|
|||||||
|
|
||||||
const CGHeroInstance *getActiveHero(); //returns hero that can currently cast a spell
|
const CGHeroInstance *getActiveHero(); //returns hero that can currently cast a spell
|
||||||
|
|
||||||
void showInterface(SDL_Surface * to);
|
void showInterface(Canvas & to);
|
||||||
|
|
||||||
void setHeroAnimation(ui8 side, EHeroAnimType phase);
|
void setHeroAnimation(ui8 side, EHeroAnimType phase);
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
#include "../windows/CSpellWindow.h"
|
#include "../windows/CSpellWindow.h"
|
||||||
#include "../render/CAnimation.h"
|
#include "../render/CAnimation.h"
|
||||||
#include "../adventureMap/CInGameConsole.h"
|
#include "../adventureMap/CInGameConsole.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
|
||||||
|
|
||||||
#include "../../CCallback.h"
|
#include "../../CCallback.h"
|
||||||
#include "../../lib/CStack.h"
|
#include "../../lib/CStack.h"
|
||||||
@ -52,7 +51,7 @@
|
|||||||
#include "../../lib/mapObjects/CGTownInstance.h"
|
#include "../../lib/mapObjects/CGTownInstance.h"
|
||||||
#include "../../lib/TextOperations.h"
|
#include "../../lib/TextOperations.h"
|
||||||
|
|
||||||
void BattleConsole::showAll(SDL_Surface * to)
|
void BattleConsole::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::showAll(to);
|
CIntObject::showAll(to);
|
||||||
|
|
||||||
@ -62,10 +61,10 @@ void BattleConsole::showAll(SDL_Surface * to)
|
|||||||
auto visibleText = getVisibleText();
|
auto visibleText = getVisibleText();
|
||||||
|
|
||||||
if(visibleText.size() > 0)
|
if(visibleText.size() > 0)
|
||||||
graphics->fonts[FONT_SMALL]->renderTextCenter(to, visibleText[0], Colors::WHITE, line1);
|
to.drawText(line1, FONT_SMALL, Colors::WHITE, ETextAlignment::CENTER, visibleText[0]);
|
||||||
|
|
||||||
if(visibleText.size() > 1)
|
if(visibleText.size() > 1)
|
||||||
graphics->fonts[FONT_SMALL]->renderTextCenter(to, visibleText[1], Colors::WHITE, line2);
|
to.drawText(line2, FONT_SMALL, Colors::WHITE, ETextAlignment::CENTER, visibleText[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> BattleConsole::getVisibleText()
|
std::vector<std::string> BattleConsole::getVisibleText()
|
||||||
@ -580,10 +579,10 @@ void BattleResultWindow::activate()
|
|||||||
CIntObject::activate();
|
CIntObject::activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleResultWindow::show(SDL_Surface * to)
|
void BattleResultWindow::show(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::show(to);
|
CIntObject::show(to);
|
||||||
CCS->videoh->update(pos.x + 107, pos.y + 70, to, true, false);
|
CCS->videoh->update(pos.x + 107, pos.y + 70, to.getInternalSurface(), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleResultWindow::buttonPressed(int button)
|
void BattleResultWindow::buttonPressed(int button)
|
||||||
@ -651,7 +650,7 @@ StackQueue::StackQueue(bool Embedded, BattleInterface & owner)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StackQueue::show(SDL_Surface * to)
|
void StackQueue::show(Canvas & to)
|
||||||
{
|
{
|
||||||
auto unitIdsToHighlight = owner.stacksController->getHoveredStacksUnitIds();
|
auto unitIdsToHighlight = owner.stacksController->getHoveredStacksUnitIds();
|
||||||
|
|
||||||
@ -789,10 +788,10 @@ void StackQueue::StackBox::toggleHighlight(bool value)
|
|||||||
highlighted = value;
|
highlighted = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StackQueue::StackBox::show(SDL_Surface *to)
|
void StackQueue::StackBox::show(Canvas & to)
|
||||||
{
|
{
|
||||||
if(highlighted)
|
if(highlighted)
|
||||||
CSDL_Ext::drawBorder(to, background->pos.x, background->pos.y, background->pos.w, background->pos.h, { 0, 255, 255, 255 }, 2);
|
to.drawBorder(background->pos, Colors::CYAN, 2);
|
||||||
|
|
||||||
CIntObject::show(to);
|
CIntObject::show(to);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@ class Unit;
|
|||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
|
||||||
class Canvas;
|
class Canvas;
|
||||||
struct SDL_Surface;
|
|
||||||
class BattleInterface;
|
class BattleInterface;
|
||||||
class CPicture;
|
class CPicture;
|
||||||
class CFilledTexture;
|
class CFilledTexture;
|
||||||
@ -70,7 +69,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
BattleConsole(std::shared_ptr<CPicture> backgroundSource, const Point & objectPos, const Point & imagePos, const Point &size);
|
BattleConsole(std::shared_ptr<CPicture> backgroundSource, const Point & objectPos, const Point & imagePos, const Point &size);
|
||||||
|
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
void deactivate() override;
|
void deactivate() override;
|
||||||
|
|
||||||
bool addText(const std::string &text); //adds text at the last position; returns false if failed (e.g. text longer than 70 characters)
|
bool addText(const std::string &text); //adds text at the last position; returns false if failed (e.g. text longer than 70 characters)
|
||||||
@ -158,7 +157,7 @@ public:
|
|||||||
std::function<void(int result)> resultCallback; //callback receiving which button was pressed
|
std::function<void(int result)> resultCallback; //callback receiving which button was pressed
|
||||||
|
|
||||||
void activate() override;
|
void activate() override;
|
||||||
void show(SDL_Surface * to = 0) override;
|
void show(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Shows the stack queue
|
/// Shows the stack queue
|
||||||
@ -181,7 +180,7 @@ class StackQueue : public CIntObject
|
|||||||
void toggleHighlight(bool value);
|
void toggleHighlight(bool value);
|
||||||
std::optional<uint32_t> getBoundUnitID() const;
|
std::optional<uint32_t> getBoundUnitID() const;
|
||||||
|
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int QUEUE_SIZE = 10;
|
static const int QUEUE_SIZE = 10;
|
||||||
@ -200,5 +199,5 @@ public:
|
|||||||
void update();
|
void update();
|
||||||
std::optional<uint32_t> getHoveredUnitIdIfAny() const;
|
std::optional<uint32_t> getHoveredUnitIdIfAny() const;
|
||||||
|
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include "../gui/CGuiHandler.h"
|
#include "../gui/CGuiHandler.h"
|
||||||
#include "../render/Colors.h"
|
#include "../render/Colors.h"
|
||||||
#include "../render/Canvas.h"
|
#include "../render/Canvas.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
|
||||||
|
|
||||||
#include "../../CCallback.h"
|
#include "../../CCallback.h"
|
||||||
#include "../../lib/spells/ISpellMechanics.h"
|
#include "../../lib/spells/ISpellMechanics.h"
|
||||||
|
@ -555,15 +555,15 @@ std::optional<uint32_t> BattleWindow::getQueueHoveredUnitId()
|
|||||||
return queue->getHoveredUnitIdIfAny();
|
return queue->getHoveredUnitIdIfAny();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleWindow::showAll(SDL_Surface *to)
|
void BattleWindow::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::showAll(to);
|
CIntObject::showAll(to);
|
||||||
|
|
||||||
if (GH.screenDimensions().x != 800 || GH.screenDimensions().y !=600)
|
if (GH.screenDimensions().x != 800 || GH.screenDimensions().y !=600)
|
||||||
CMessage::drawBorder(owner.curInt->playerID, to, pos.w+28, pos.h+29, pos.x-14, pos.y-15);
|
CMessage::drawBorder(owner.curInt->playerID, to.getInternalSurface(), pos.w+28, pos.h+29, pos.x-14, pos.y-15);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleWindow::show(SDL_Surface *to)
|
void BattleWindow::show(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::show(to);
|
CIntObject::show(to);
|
||||||
LOCPLINT->cingconsole->show(to);
|
LOCPLINT->cingconsole->show(to);
|
||||||
|
@ -87,8 +87,8 @@ public:
|
|||||||
void keyPressed(EShortcut key) override;
|
void keyPressed(EShortcut key) override;
|
||||||
bool captureThisKey(EShortcut key) override;
|
bool captureThisKey(EShortcut key) override;
|
||||||
void clickRight(tribool down, bool previousState) override;
|
void clickRight(tribool down, bool previousState) override;
|
||||||
void show(SDL_Surface *to) override;
|
void show(Canvas & to) override;
|
||||||
void showAll(SDL_Surface *to) override;
|
void showAll(Canvas & to) override;
|
||||||
|
|
||||||
/// Toggle UI to displaying tactics phase
|
/// Toggle UI to displaying tactics phase
|
||||||
void tacticPhaseStarted();
|
void tacticPhaseStarted();
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include "../CGameInfo.h"
|
#include "../CGameInfo.h"
|
||||||
#include "../render/Colors.h"
|
#include "../render/Colors.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
|
||||||
#include "../renderSDL/ScreenHandler.h"
|
#include "../renderSDL/ScreenHandler.h"
|
||||||
#include "../CMT.h"
|
#include "../CMT.h"
|
||||||
#include "../CPlayerInterface.h"
|
#include "../CPlayerInterface.h"
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "CGuiHandler.h"
|
#include "CGuiHandler.h"
|
||||||
#include "WindowHandler.h"
|
#include "WindowHandler.h"
|
||||||
#include "Shortcut.h"
|
#include "Shortcut.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
#include "../render/Canvas.h"
|
||||||
#include "../windows/CMessage.h"
|
#include "../windows/CMessage.h"
|
||||||
#include "../CMT.h"
|
#include "../CMT.h"
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ CIntObject::~CIntObject()
|
|||||||
parent_m->removeChild(this);
|
parent_m->removeChild(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIntObject::show(SDL_Surface * to)
|
void CIntObject::show(Canvas & to)
|
||||||
{
|
{
|
||||||
if(defActions & UPDATE)
|
if(defActions & UPDATE)
|
||||||
for(auto & elem : children)
|
for(auto & elem : children)
|
||||||
@ -61,7 +61,7 @@ void CIntObject::show(SDL_Surface * to)
|
|||||||
elem->show(to);
|
elem->show(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIntObject::showAll(SDL_Surface * to)
|
void CIntObject::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
if(defActions & SHOWALL)
|
if(defActions & SHOWALL)
|
||||||
{
|
{
|
||||||
@ -100,16 +100,6 @@ void CIntObject::deactivate()
|
|||||||
elem->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)
|
void CIntObject::addUsedEvents(ui16 newActions)
|
||||||
{
|
{
|
||||||
if (isActive())
|
if (isActive())
|
||||||
@ -226,9 +216,15 @@ void CIntObject::redraw()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
showAll(screenBuf);
|
Canvas buffer = Canvas::createFromSurface(screenBuf);
|
||||||
|
|
||||||
|
showAll(buffer);
|
||||||
if(screenBuf != screen)
|
if(screenBuf != screen)
|
||||||
showAll(screen);
|
{
|
||||||
|
Canvas screenBuffer = Canvas::createFromSurface(screen);
|
||||||
|
|
||||||
|
showAll(screenBuffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
#include "../../lib/Rect.h"
|
#include "../../lib/Rect.h"
|
||||||
#include "EventsReceiver.h"
|
#include "EventsReceiver.h"
|
||||||
|
|
||||||
struct SDL_Surface;
|
|
||||||
class CGuiHandler;
|
class CGuiHandler;
|
||||||
class CPicture;
|
class CPicture;
|
||||||
|
class Canvas;
|
||||||
|
|
||||||
class IUpdateable
|
class IUpdateable
|
||||||
{
|
{
|
||||||
@ -31,8 +31,8 @@ public:
|
|||||||
virtual void deactivate()=0;
|
virtual void deactivate()=0;
|
||||||
|
|
||||||
virtual void redraw()=0;
|
virtual void redraw()=0;
|
||||||
virtual void show(SDL_Surface * to) = 0;
|
virtual void show(Canvas & to) = 0;
|
||||||
virtual void showAll(SDL_Surface * to) = 0;
|
virtual void showAll(Canvas & to) = 0;
|
||||||
|
|
||||||
virtual void onScreenResize() = 0;
|
virtual void onScreenResize() = 0;
|
||||||
virtual ~IShowActivatable() = default;
|
virtual ~IShowActivatable() = default;
|
||||||
@ -90,9 +90,9 @@ public:
|
|||||||
void deactivate() override;
|
void deactivate() override;
|
||||||
|
|
||||||
//called each frame to update screen
|
//called each frame to update screen
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
//called on complete redraw only
|
//called on complete redraw only
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
//request complete redraw of this object
|
//request complete redraw of this object
|
||||||
void redraw() override;
|
void redraw() override;
|
||||||
|
|
||||||
@ -112,10 +112,6 @@ public:
|
|||||||
void addChild(CIntObject *child, bool adjustPosition = false);
|
void addChild(CIntObject *child, bool adjustPosition = false);
|
||||||
void removeChild(CIntObject *child, bool adjustPosition = false);
|
void removeChild(CIntObject *child, bool adjustPosition = false);
|
||||||
|
|
||||||
/// functions for printing text.
|
|
||||||
/// Deprecated. Use CLabel where possible instead
|
|
||||||
void printAtMiddleLoc(const std::string & text, const Point &p, EFonts font, const SDL_Color & color, SDL_Surface * dst);
|
|
||||||
void printAtMiddleWBLoc(const std::string & text, const Point &p, EFonts font, int charsPerLine, const SDL_Color & color, SDL_Surface * dst);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Class for binding keys to left mouse button clicks
|
/// Class for binding keys to left mouse button clicks
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#include "../renderSDL/CursorHardware.h"
|
#include "../renderSDL/CursorHardware.h"
|
||||||
#include "../render/CAnimation.h"
|
#include "../render/CAnimation.h"
|
||||||
#include "../render/IImage.h"
|
#include "../render/IImage.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
|
||||||
|
|
||||||
#include "../../lib/CConfigHandler.h"
|
#include "../../lib/CConfigHandler.h"
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "../CMT.h"
|
#include "../CMT.h"
|
||||||
#include "../CGameInfo.h"
|
#include "../CGameInfo.h"
|
||||||
|
#include "../render/Canvas.h"
|
||||||
#include "../render/Colors.h"
|
#include "../render/Colors.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
#include "../renderSDL/SDL_Extensions.h"
|
||||||
|
|
||||||
@ -92,8 +93,10 @@ void WindowHandler::totalRedraw()
|
|||||||
{
|
{
|
||||||
CSDL_Ext::fillSurface(screen2, Colors::BLACK);
|
CSDL_Ext::fillSurface(screen2, Colors::BLACK);
|
||||||
|
|
||||||
|
Canvas target = Canvas::createFromSurface(screen2);
|
||||||
|
|
||||||
for(auto & elem : windowsStack)
|
for(auto & elem : windowsStack)
|
||||||
elem->showAll(screen2);
|
elem->showAll(target);
|
||||||
CSDL_Ext::blitAt(screen2, 0, 0, screen);
|
CSDL_Ext::blitAt(screen2, 0, 0, screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,8 +105,11 @@ void WindowHandler::simpleRedraw()
|
|||||||
//update only top interface and draw background
|
//update only top interface and draw background
|
||||||
if(windowsStack.size() > 1)
|
if(windowsStack.size() > 1)
|
||||||
CSDL_Ext::blitAt(screen2, 0, 0, screen); //blit background
|
CSDL_Ext::blitAt(screen2, 0, 0, screen); //blit background
|
||||||
|
|
||||||
|
Canvas target = Canvas::createFromSurface(screen);
|
||||||
|
|
||||||
if(!windowsStack.empty())
|
if(!windowsStack.empty())
|
||||||
windowsStack.back()->show(screen); //blit active interface/window
|
windowsStack.back()->show(target); //blit active interface/window
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowHandler::onScreenResize()
|
void WindowHandler::onScreenResize()
|
||||||
|
@ -18,7 +18,6 @@ struct CampaignRegions;
|
|||||||
|
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
|
||||||
struct SDL_Surface;
|
|
||||||
class CButton;
|
class CButton;
|
||||||
class CTextBox;
|
class CTextBox;
|
||||||
class CToggleGroup;
|
class CToggleGroup;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "../CServerHandler.h"
|
#include "../CServerHandler.h"
|
||||||
#include "../gui/CGuiHandler.h"
|
#include "../gui/CGuiHandler.h"
|
||||||
#include "../gui/Shortcut.h"
|
#include "../gui/Shortcut.h"
|
||||||
|
#include "../render/Canvas.h"
|
||||||
#include "../widgets/CComponent.h"
|
#include "../widgets/CComponent.h"
|
||||||
#include "../widgets/Buttons.h"
|
#include "../widgets/Buttons.h"
|
||||||
#include "../widgets/MiscWidgets.h"
|
#include "../widgets/MiscWidgets.h"
|
||||||
@ -111,7 +112,7 @@ CCampaignScreen::CCampaignButton::CCampaignButton(const JsonNode & config)
|
|||||||
graphicsCompleted = std::make_shared<CPicture>("CAMPCHK");
|
graphicsCompleted = std::make_shared<CPicture>("CAMPCHK");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCampaignScreen::CCampaignButton::show(SDL_Surface * to)
|
void CCampaignScreen::CCampaignButton::show(Canvas & to)
|
||||||
{
|
{
|
||||||
if(status == CCampaignScreen::DISABLED)
|
if(status == CCampaignScreen::DISABLED)
|
||||||
return;
|
return;
|
||||||
@ -124,7 +125,7 @@ void CCampaignScreen::CCampaignButton::show(SDL_Surface * to)
|
|||||||
if(CCS->videoh->fname != video)
|
if(CCS->videoh->fname != video)
|
||||||
CCS->videoh->open(video);
|
CCS->videoh->open(video);
|
||||||
|
|
||||||
CCS->videoh->update(pos.x, pos.y, to, true, false); // plays sequentially frame by frame, starts at the beginning when the video is over
|
CCS->videoh->update(pos.x, pos.y, to.getInternalSurface(), true, false); // plays sequentially frame by frame, starts at the beginning when the video is over
|
||||||
}
|
}
|
||||||
else if(CCS->videoh->fname == video) // When you got out of the bounds of the button then close the video
|
else if(CCS->videoh->fname == video) // When you got out of the bounds of the button then close the video
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,6 @@ VCMI_LIB_NAMESPACE_END
|
|||||||
class CLabel;
|
class CLabel;
|
||||||
class CPicture;
|
class CPicture;
|
||||||
class CButton;
|
class CButton;
|
||||||
struct SDL_Surface;
|
|
||||||
|
|
||||||
class CCampaignScreen : public CWindowObject
|
class CCampaignScreen : public CWindowObject
|
||||||
{
|
{
|
||||||
@ -46,7 +45,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
CCampaignButton(const JsonNode & config);
|
CCampaignButton(const JsonNode & config);
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<std::shared_ptr<CCampaignButton>> campButtons;
|
std::vector<std::shared_ptr<CCampaignButton>> campButtons;
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "../gui/ShortcutHandler.h"
|
#include "../gui/ShortcutHandler.h"
|
||||||
#include "../gui/Shortcut.h"
|
#include "../gui/Shortcut.h"
|
||||||
#include "../gui/WindowHandler.h"
|
#include "../gui/WindowHandler.h"
|
||||||
|
#include "../render/Canvas.h"
|
||||||
#include "../widgets/CComponent.h"
|
#include "../widgets/CComponent.h"
|
||||||
#include "../widgets/Buttons.h"
|
#include "../widgets/Buttons.h"
|
||||||
#include "../widgets/MiscWidgets.h"
|
#include "../widgets/MiscWidgets.h"
|
||||||
@ -102,10 +103,10 @@ std::shared_ptr<CIntObject> CMenuScreen::createTab(size_t index)
|
|||||||
return std::make_shared<CMenuEntry>(this, config["items"].Vector()[index]);
|
return std::make_shared<CMenuEntry>(this, config["items"].Vector()[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMenuScreen::show(SDL_Surface * to)
|
void CMenuScreen::show(Canvas & to)
|
||||||
{
|
{
|
||||||
if(!config["video"].isNull())
|
if(!config["video"].isNull())
|
||||||
CCS->videoh->update((int)config["video"]["x"].Float() + pos.x, (int)config["video"]["y"].Float() + pos.y, to, true, false);
|
CCS->videoh->update((int)config["video"]["x"].Float() + pos.x, (int)config["video"]["y"].Float() + pos.y, to.getInternalSurface(), true, false);
|
||||||
CIntObject::show(to);
|
CIntObject::show(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,10 +335,12 @@ void CMainMenu::update()
|
|||||||
// Handles mouse and key input
|
// Handles mouse and key input
|
||||||
GH.handleEvents();
|
GH.handleEvents();
|
||||||
|
|
||||||
|
Canvas canvas = Canvas::createFromSurface(screen);
|
||||||
|
|
||||||
// check for null othervice crash on finishing a campaign
|
// check for null othervice crash on finishing a campaign
|
||||||
// /FIXME: find out why GH.windows().listInt is empty to begin with
|
// /FIXME: find out why GH.windows().listInt is empty to begin with
|
||||||
if(GH.windows().topWindow<CIntObject>())
|
if(GH.windows().topWindow<CIntObject>())
|
||||||
GH.windows().topWindow<CIntObject>()->show(screen);
|
GH.windows().topWindow<CIntObject>()->show(canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainMenu::openLobby(ESelectionScreen screenType, bool host, const std::vector<std::string> * names, ELoadMode loadMode)
|
void CMainMenu::openLobby(ESelectionScreen screenType, bool host, const std::vector<std::string> * names, ELoadMode loadMode)
|
||||||
@ -576,7 +579,7 @@ CLoadingScreen::~CLoadingScreen()
|
|||||||
loadingThread.join();
|
loadingThread.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLoadingScreen::showAll(SDL_Surface * to)
|
void CLoadingScreen::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
//FIXME: filling screen with transparency? BLACK intended?
|
//FIXME: filling screen with transparency? BLACK intended?
|
||||||
//Rect rect(0, 0, to->w, to->h);
|
//Rect rect(0, 0, to->w, to->h);
|
||||||
|
@ -54,7 +54,7 @@ public:
|
|||||||
|
|
||||||
CMenuScreen(const JsonNode & configNode);
|
CMenuScreen(const JsonNode & configNode);
|
||||||
|
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
void activate() override;
|
void activate() override;
|
||||||
void deactivate() override;
|
void deactivate() override;
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ public:
|
|||||||
CLoadingScreen(std::function<void()> loader);
|
CLoadingScreen(std::function<void()> loader);
|
||||||
~CLoadingScreen();
|
~CLoadingScreen();
|
||||||
|
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::shared_ptr<CMainMenu> CMM;
|
extern std::shared_ptr<CMainMenu> CMM;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include "../CVideoHandler.h"
|
#include "../CVideoHandler.h"
|
||||||
#include "../gui/CGuiHandler.h"
|
#include "../gui/CGuiHandler.h"
|
||||||
#include "../widgets/TextControls.h"
|
#include "../widgets/TextControls.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
#include "../render/Canvas.h"
|
||||||
|
|
||||||
#include "../../lib/mapping/CCampaignHandler.h"
|
#include "../../lib/mapping/CCampaignHandler.h"
|
||||||
|
|
||||||
@ -38,13 +38,13 @@ CPrologEpilogVideo::CPrologEpilogVideo(CCampaignScenario::SScenarioPrologEpilog
|
|||||||
text->scrollTextTo(-100);
|
text->scrollTextTo(-100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPrologEpilogVideo::show(SDL_Surface * to)
|
void CPrologEpilogVideo::show(Canvas & to)
|
||||||
{
|
{
|
||||||
CSDL_Ext::fillRect(to, pos, Colors::BLACK);
|
to.drawColor(pos, Colors::BLACK);
|
||||||
//BUG: some videos are 800x600 in size while some are 800x400
|
//BUG: some videos are 800x600 in size while some are 800x400
|
||||||
//VCMI should center them in the middle of the screen. Possible but needs modification
|
//VCMI should center them in the middle of the screen. Possible but needs modification
|
||||||
//of video player API which I'd like to avoid until we'll get rid of Windows-specific player
|
//of video player API which I'd like to avoid until we'll get rid of Windows-specific player
|
||||||
CCS->videoh->update(pos.x, pos.y, to, true, false);
|
CCS->videoh->update(pos.x, pos.y, to.getInternalSurface(), true, false);
|
||||||
|
|
||||||
//move text every 5 calls/frames; seems to be good enough
|
//move text every 5 calls/frames; seems to be good enough
|
||||||
++positionCounter;
|
++positionCounter;
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
#include "../../lib/mapping/CCampaignHandler.h"
|
#include "../../lib/mapping/CCampaignHandler.h"
|
||||||
|
|
||||||
class CMultiLineLabel;
|
class CMultiLineLabel;
|
||||||
struct SDL_Surface;
|
|
||||||
|
|
||||||
class CPrologEpilogVideo : public CWindowObject
|
class CPrologEpilogVideo : public CWindowObject
|
||||||
{
|
{
|
||||||
@ -27,5 +26,5 @@ public:
|
|||||||
CPrologEpilogVideo(CCampaignScenario::SScenarioPrologEpilog _spe, std::function<void()> callback);
|
CPrologEpilogVideo(CCampaignScenario::SScenarioPrologEpilog _spe, std::function<void()> callback);
|
||||||
|
|
||||||
void clickLeft(tribool down, bool previousState) override;
|
void clickLeft(tribool down, bool previousState) override;
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
@ -34,7 +34,7 @@ CreditsScreen::CreditsScreen(Rect rect)
|
|||||||
credits->scrollTextTo(-600); // move all text below the screen
|
credits->scrollTextTo(-600); // move all text below the screen
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreditsScreen::show(SDL_Surface * to)
|
void CreditsScreen::show(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::show(to);
|
CIntObject::show(to);
|
||||||
positionCounter++;
|
positionCounter++;
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
#include "../windows/CWindowObject.h"
|
#include "../windows/CWindowObject.h"
|
||||||
|
|
||||||
class CMultiLineLabel;
|
class CMultiLineLabel;
|
||||||
struct SDL_Surface;
|
|
||||||
|
|
||||||
class CreditsScreen : public CIntObject
|
class CreditsScreen : public CIntObject
|
||||||
{
|
{
|
||||||
@ -21,7 +20,7 @@ class CreditsScreen : public CIntObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
CreditsScreen(Rect rect);
|
CreditsScreen(Rect rect);
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
void clickLeft(tribool down, bool previousState) override;
|
void clickLeft(tribool down, bool previousState) override;
|
||||||
void clickRight(tribool down, bool previousState) override;
|
void clickRight(tribool down, bool previousState) override;
|
||||||
};
|
};
|
||||||
|
@ -68,23 +68,21 @@ void BasicMapView::tick(uint32_t msPassed)
|
|||||||
controller->tick(msPassed);
|
controller->tick(msPassed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasicMapView::show(SDL_Surface * to)
|
void BasicMapView::show(Canvas & to)
|
||||||
{
|
{
|
||||||
Canvas target(to);
|
CSDL_Ext::CClipRectGuard guard(to.getInternalSurface(), pos);
|
||||||
CSDL_Ext::CClipRectGuard guard(to, pos);
|
render(to, false);
|
||||||
render(target, false);
|
|
||||||
|
|
||||||
controller->afterRender();
|
controller->afterRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasicMapView::showAll(SDL_Surface * to)
|
void BasicMapView::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
Canvas target(to);
|
CSDL_Ext::CClipRectGuard guard(to.getInternalSurface(), pos);
|
||||||
CSDL_Ext::CClipRectGuard guard(to, pos);
|
render(to, true);
|
||||||
render(target, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::show(SDL_Surface * to)
|
void MapView::show(Canvas & to)
|
||||||
{
|
{
|
||||||
actions->setContext(controller->getContext());
|
actions->setContext(controller->getContext());
|
||||||
BasicMapView::show(to);
|
BasicMapView::show(to);
|
||||||
|
@ -38,8 +38,8 @@ public:
|
|||||||
~BasicMapView() override;
|
~BasicMapView() override;
|
||||||
|
|
||||||
void tick(uint32_t msPassed) override;
|
void tick(uint32_t msPassed) override;
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Main class that represents visible section of adventure map
|
/// Main class that represents visible section of adventure map
|
||||||
@ -51,7 +51,7 @@ class MapView : public BasicMapView
|
|||||||
bool isSwiping;
|
bool isSwiping;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
|
|
||||||
MapView(const Point & offset, const Point & dimensions);
|
MapView(const Point & offset, const Point & dimensions);
|
||||||
|
|
||||||
|
@ -31,6 +31,13 @@ Canvas::Canvas(const Canvas & other):
|
|||||||
surface->refcount++;
|
surface->refcount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Canvas::Canvas(Canvas && other):
|
||||||
|
surface(other.surface),
|
||||||
|
renderArea(other.renderArea)
|
||||||
|
{
|
||||||
|
surface->refcount++;
|
||||||
|
}
|
||||||
|
|
||||||
Canvas::Canvas(const Canvas & other, const Rect & newClipRect):
|
Canvas::Canvas(const Canvas & other, const Rect & newClipRect):
|
||||||
Canvas(other)
|
Canvas(other)
|
||||||
{
|
{
|
||||||
@ -45,6 +52,11 @@ Canvas::Canvas(const Point & size):
|
|||||||
SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_NONE);
|
SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Canvas Canvas::createFromSurface(SDL_Surface * surface)
|
||||||
|
{
|
||||||
|
return Canvas(surface);
|
||||||
|
}
|
||||||
|
|
||||||
void Canvas::applyTransparency(bool on)
|
void Canvas::applyTransparency(bool on)
|
||||||
{
|
{
|
||||||
if (on)
|
if (on)
|
||||||
@ -115,6 +127,13 @@ void Canvas::drawLineDashed(const Point & from, const Point & dest, const ColorR
|
|||||||
CSDL_Ext::drawLineDashed(surface, renderArea.topLeft() + from, renderArea.topLeft() + dest, CSDL_Ext::toSDL(color));
|
CSDL_Ext::drawLineDashed(surface, renderArea.topLeft() + from, renderArea.topLeft() + dest, CSDL_Ext::toSDL(color));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Canvas::drawBorder(const Rect & target, const SDL_Color & color, uint width)
|
||||||
|
{
|
||||||
|
Rect realTarget = target + renderArea.topLeft();
|
||||||
|
|
||||||
|
CSDL_Ext::drawBorder(surface, realTarget.x, realTarget.y, realTarget.w, realTarget.h, color, width);
|
||||||
|
}
|
||||||
|
|
||||||
void Canvas::drawBorderDashed(const Rect & target, const ColorRGBA & color)
|
void Canvas::drawBorderDashed(const Rect & target, const ColorRGBA & color)
|
||||||
{
|
{
|
||||||
Rect realTarget = target + renderArea.topLeft();
|
Rect realTarget = target + renderArea.topLeft();
|
||||||
@ -145,3 +164,14 @@ void Canvas::drawText(const Point & position, const EFonts & font, const SDL_Col
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Canvas::drawColor(const Rect & target, const SDL_Color & color)
|
||||||
|
{
|
||||||
|
Rect realTarget = target + renderArea.topLeft();
|
||||||
|
|
||||||
|
CSDL_Ext::fillRect(surface, realTarget, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Surface * Canvas::getInternalSurface()
|
||||||
|
{
|
||||||
|
return surface;
|
||||||
|
}
|
||||||
|
@ -27,21 +27,29 @@ class Canvas
|
|||||||
/// Current rendering area, all rendering operations will be moved into selected area
|
/// Current rendering area, all rendering operations will be moved into selected area
|
||||||
Rect renderArea;
|
Rect renderArea;
|
||||||
|
|
||||||
public:
|
|
||||||
Canvas & operator = (const Canvas & other) = delete;
|
|
||||||
|
|
||||||
/// constructs canvas using existing surface. Caller maintains ownership on the surface
|
/// constructs canvas using existing surface. Caller maintains ownership on the surface
|
||||||
explicit Canvas(SDL_Surface * surface);
|
explicit Canvas(SDL_Surface * surface);
|
||||||
|
|
||||||
/// copy contructor
|
/// copy contructor
|
||||||
Canvas(const Canvas & other);
|
Canvas(const Canvas & other);
|
||||||
|
|
||||||
|
public:
|
||||||
|
Canvas & operator = (const Canvas & other) = delete;
|
||||||
|
Canvas & operator = (Canvas && other) = delete;
|
||||||
|
|
||||||
|
/// move contructor
|
||||||
|
Canvas(Canvas && other);
|
||||||
|
|
||||||
/// creates canvas that only covers specified subsection of a surface
|
/// creates canvas that only covers specified subsection of a surface
|
||||||
Canvas(const Canvas & other, const Rect & clipRect);
|
Canvas(const Canvas & other, const Rect & clipRect);
|
||||||
|
|
||||||
/// constructs canvas of specified size
|
/// constructs canvas of specified size
|
||||||
explicit Canvas(const Point & size);
|
explicit Canvas(const Point & size);
|
||||||
|
|
||||||
|
/// constructs canvas using existing surface. Caller maintains ownership on the surface
|
||||||
|
/// Compatibility method. AVOID USAGE. To be removed once SDL abstraction layer is finished.
|
||||||
|
static Canvas createFromSurface(SDL_Surface * surface);
|
||||||
|
|
||||||
~Canvas();
|
~Canvas();
|
||||||
|
|
||||||
/// if set to true, drawing this canvas onto another canvas will use alpha channel information
|
/// if set to true, drawing this canvas onto another canvas will use alpha channel information
|
||||||
@ -74,6 +82,9 @@ public:
|
|||||||
/// renders dashed, 1-pixel wide line with specified color
|
/// renders dashed, 1-pixel wide line with specified color
|
||||||
void drawLineDashed(const Point & from, const Point & dest, const ColorRGBA & color);
|
void drawLineDashed(const Point & from, const Point & dest, const ColorRGBA & color);
|
||||||
|
|
||||||
|
/// renders rectangular, solid-color border in specified location
|
||||||
|
void drawBorder(const Rect & target, const SDL_Color & color, uint width = 1);
|
||||||
|
|
||||||
/// renders rectangular, dashed border in specified location
|
/// renders rectangular, dashed border in specified location
|
||||||
void drawBorderDashed(const Rect & target, const ColorRGBA & color);
|
void drawBorderDashed(const Rect & target, const ColorRGBA & color);
|
||||||
|
|
||||||
@ -82,4 +93,10 @@ public:
|
|||||||
|
|
||||||
/// renders multiple lines of text with specified parameters
|
/// renders multiple lines of text with specified parameters
|
||||||
void drawText(const Point & position, const EFonts & font, const SDL_Color & colorDest, ETextAlignment alignment, const std::vector<std::string> & text );
|
void drawText(const Point & position, const EFonts & font, const SDL_Color & colorDest, ETextAlignment alignment, const std::vector<std::string> & text );
|
||||||
|
|
||||||
|
/// fills selected area with solid color, ignoring any transparency
|
||||||
|
void drawColor(const Rect & target, const SDL_Color & color);
|
||||||
|
|
||||||
|
/// Compatibility method. AVOID USAGE. To be removed once SDL abstraction layer is finished.
|
||||||
|
SDL_Surface * getInternalSurface();
|
||||||
};
|
};
|
||||||
|
@ -17,6 +17,7 @@ const SDL_Color Colors::YELLOW = { 229, 215, 123, SDL_ALPHA_OPAQUE };
|
|||||||
const SDL_Color Colors::WHITE = { 255, 243, 222, SDL_ALPHA_OPAQUE };
|
const SDL_Color Colors::WHITE = { 255, 243, 222, SDL_ALPHA_OPAQUE };
|
||||||
const SDL_Color Colors::METALLIC_GOLD = { 173, 142, 66, SDL_ALPHA_OPAQUE };
|
const SDL_Color Colors::METALLIC_GOLD = { 173, 142, 66, SDL_ALPHA_OPAQUE };
|
||||||
const SDL_Color Colors::GREEN = { 0, 255, 0, SDL_ALPHA_OPAQUE };
|
const SDL_Color Colors::GREEN = { 0, 255, 0, SDL_ALPHA_OPAQUE };
|
||||||
|
const SDL_Color Colors::CYAN = { 0, 255, 255, SDL_ALPHA_OPAQUE };
|
||||||
const SDL_Color Colors::ORANGE = { 232, 184, 32, SDL_ALPHA_OPAQUE };
|
const SDL_Color Colors::ORANGE = { 232, 184, 32, SDL_ALPHA_OPAQUE };
|
||||||
const SDL_Color Colors::BRIGHT_YELLOW = { 242, 226, 110, SDL_ALPHA_OPAQUE };
|
const SDL_Color Colors::BRIGHT_YELLOW = { 242, 226, 110, SDL_ALPHA_OPAQUE };
|
||||||
const SDL_Color Colors::DEFAULT_KEY_COLOR = {0, 255, 255, SDL_ALPHA_OPAQUE};
|
const SDL_Color Colors::DEFAULT_KEY_COLOR = {0, 255, 255, SDL_ALPHA_OPAQUE};
|
||||||
|
@ -44,6 +44,8 @@ public:
|
|||||||
/// Minimap border
|
/// Minimap border
|
||||||
static const SDL_Color PURPLE;
|
static const SDL_Color PURPLE;
|
||||||
|
|
||||||
|
static const SDL_Color CYAN;
|
||||||
|
|
||||||
static const SDL_Color BLACK;
|
static const SDL_Color BLACK;
|
||||||
|
|
||||||
static const SDL_Color TRANSPARENCY;
|
static const SDL_Color TRANSPARENCY;
|
||||||
|
@ -110,8 +110,6 @@ SDL_Surface * CSDL_Ext::createSurfaceWithBpp(int width, int height)
|
|||||||
|
|
||||||
void CSDL_Ext::blitAt(SDL_Surface * src, int x, int y, SDL_Surface * dst)
|
void CSDL_Ext::blitAt(SDL_Surface * src, int x, int y, SDL_Surface * dst)
|
||||||
{
|
{
|
||||||
if(!dst)
|
|
||||||
dst = screen;
|
|
||||||
CSDL_Ext::blitSurface(src, dst, Point(x, y));
|
CSDL_Ext::blitSurface(src, dst, Point(x, y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "../gui/Shortcut.h"
|
#include "../gui/Shortcut.h"
|
||||||
#include "../windows/InfoWindows.h"
|
#include "../windows/InfoWindows.h"
|
||||||
#include "../render/CAnimation.h"
|
#include "../render/CAnimation.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
#include "../render/Canvas.h"
|
||||||
|
|
||||||
#include "../../lib/CConfigHandler.h"
|
#include "../../lib/CConfigHandler.h"
|
||||||
#include "../../lib/CGeneralTextHandler.h"
|
#include "../../lib/CGeneralTextHandler.h"
|
||||||
@ -285,13 +285,13 @@ void CButton::setPlayerColor(PlayerColor player)
|
|||||||
image->playerColored(player);
|
image->playerColored(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CButton::showAll(SDL_Surface * to)
|
void CButton::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::showAll(to);
|
CIntObject::showAll(to);
|
||||||
|
|
||||||
auto borderColor = stateToBorderColor[getState()];
|
auto borderColor = stateToBorderColor[getState()];
|
||||||
if (borderColor)
|
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()
|
std::pair<std::string, std::string> CButton::tooltip()
|
||||||
@ -783,9 +783,9 @@ void CSlider::setAmount( int to )
|
|||||||
vstd::amax(positions, 0);
|
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);
|
CIntObject::showAll(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ VCMI_LIB_NAMESPACE_BEGIN
|
|||||||
class Rect;
|
class Rect;
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
|
||||||
struct SDL_Surface;
|
|
||||||
class CAnimImage;
|
class CAnimImage;
|
||||||
class CLabel;
|
class CLabel;
|
||||||
class CAnimation;
|
class CAnimation;
|
||||||
@ -106,7 +105,7 @@ public:
|
|||||||
void clickRight(tribool down, bool previousState) override;
|
void clickRight(tribool down, bool previousState) override;
|
||||||
void clickLeft(tribool down, bool previousState) override;
|
void clickLeft(tribool down, bool previousState) override;
|
||||||
void hover (bool on) override;
|
void hover (bool on) override;
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
|
|
||||||
/// generates tooltip that can be passed into constructor
|
/// generates tooltip that can be passed into constructor
|
||||||
static std::pair<std::string, std::string> tooltip();
|
static std::pair<std::string, std::string> tooltip();
|
||||||
@ -274,7 +273,7 @@ public:
|
|||||||
void wheelScrolled(bool down, bool in) override;
|
void wheelScrolled(bool down, bool in) override;
|
||||||
void clickLeft(tribool down, bool previousState) override;
|
void clickLeft(tribool down, bool previousState) override;
|
||||||
void mouseMoved (const Point & cursorPosition) override;
|
void mouseMoved (const Point & cursorPosition) override;
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
|
|
||||||
/// @param position coordinates of slider
|
/// @param position coordinates of slider
|
||||||
/// @param length length of slider ribbon, including left/right buttons
|
/// @param length length of slider ribbon, including left/right buttons
|
||||||
|
@ -16,14 +16,13 @@
|
|||||||
#include "CComponent.h"
|
#include "CComponent.h"
|
||||||
|
|
||||||
#include "../windows/GUIClasses.h"
|
#include "../windows/GUIClasses.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
#include "../render/Canvas.h"
|
||||||
|
#include "../render/Colors.h"
|
||||||
#include "../CPlayerInterface.h"
|
#include "../CPlayerInterface.h"
|
||||||
#include "../CGameInfo.h"
|
#include "../CGameInfo.h"
|
||||||
|
|
||||||
#include "../../CCallback.h"
|
#include "../../CCallback.h"
|
||||||
|
|
||||||
#include "../../lib/CGeneralTextHandler.h"
|
#include "../../lib/CGeneralTextHandler.h"
|
||||||
|
|
||||||
#include "../../lib/mapObjects/CGHeroInstance.h"
|
#include "../../lib/mapObjects/CGHeroInstance.h"
|
||||||
|
|
||||||
void CArtPlace::setInternals(const CArtifactInstance * artInst)
|
void CArtPlace::setInternals(const CArtifactInstance * artInst)
|
||||||
@ -206,7 +205,7 @@ void CHeroArtPlace::clickRight(tribool down, bool previousState)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHeroArtPlace::showAll(SDL_Surface* to)
|
void CHeroArtPlace::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
if(ourArt)
|
if(ourArt)
|
||||||
{
|
{
|
||||||
@ -214,21 +213,7 @@ void CHeroArtPlace::showAll(SDL_Surface* to)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(marked && isActive())
|
if(marked && isActive())
|
||||||
{
|
to.drawBorder(pos, Colors::BRIGHT_YELLOW);
|
||||||
// Draw vertical bars.
|
|
||||||
for(int i = 0; i < pos.h; ++i)
|
|
||||||
{
|
|
||||||
CSDL_Ext::putPixelWithoutRefresh(to, pos.x, pos.y + i, 240, 220, 120);
|
|
||||||
CSDL_Ext::putPixelWithoutRefresh(to, pos.x + pos.w - 1, pos.y + i, 240, 220, 120);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw horizontal bars.
|
|
||||||
for(int i = 0; i < pos.w; ++i)
|
|
||||||
{
|
|
||||||
CSDL_Ext::putPixelWithoutRefresh(to, pos.x + i, pos.y, 240, 220, 120);
|
|
||||||
CSDL_Ext::putPixelWithoutRefresh(to, pos.x + i, pos.y + pos.h - 1, 240, 220, 120);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHeroArtPlace::setArtifact(const CArtifactInstance * art)
|
void CHeroArtPlace::setArtifact(const CArtifactInstance * art)
|
||||||
|
@ -80,7 +80,7 @@ public:
|
|||||||
bool isMarked() const;
|
bool isMarked() const;
|
||||||
void clickLeft(tribool down, bool previousState) override;
|
void clickLeft(tribool down, bool previousState) override;
|
||||||
void clickRight(tribool down, bool previousState) override;
|
void clickRight(tribool down, bool previousState) override;
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
void setArtifact(const CArtifactInstance * art) override;
|
void setArtifact(const CArtifactInstance * art) override;
|
||||||
void addCombinedArtInfo(std::map<const CArtifact*, int> & arts);
|
void addCombinedArtInfo(std::map<const CArtifact*, int> & arts);
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#include "Buttons.h"
|
#include "Buttons.h"
|
||||||
|
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
|
||||||
#include "../CPlayerInterface.h"
|
#include "../CPlayerInterface.h"
|
||||||
#include "../CGameInfo.h"
|
#include "../CGameInfo.h"
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "../gui/CursorHandler.h"
|
#include "../gui/CursorHandler.h"
|
||||||
#include "../gui/TextAlignment.h"
|
#include "../gui/TextAlignment.h"
|
||||||
#include "../gui/Shortcut.h"
|
#include "../gui/Shortcut.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
#include "../render/Canvas.h"
|
||||||
#include "../windows/CMessage.h"
|
#include "../windows/CMessage.h"
|
||||||
#include "../windows/InfoWindows.h"
|
#include "../windows/InfoWindows.h"
|
||||||
#include "../widgets/TextControls.h"
|
#include "../widgets/TextControls.h"
|
||||||
@ -302,12 +302,12 @@ void CSelectableComponent::select(bool on)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSelectableComponent::showAll(SDL_Surface * to)
|
void CSelectableComponent::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CComponent::showAll(to);
|
CComponent::showAll(to);
|
||||||
if(selected)
|
if(selected)
|
||||||
{
|
{
|
||||||
CSDL_Ext::drawBorder(to, Rect::createAround(image->pos, 1), Colors::BRIGHT_YELLOW);
|
to.drawBorder(Rect::createAround(image->pos, 1), Colors::BRIGHT_YELLOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public:
|
|||||||
bool selected; //if true, this component is selected
|
bool selected; //if true, this component is selected
|
||||||
std::function<void()> onSelect; //function called on selection change
|
std::function<void()> onSelect; //function called on selection change
|
||||||
|
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
void select(bool on);
|
void select(bool on);
|
||||||
|
|
||||||
void clickLeft(tribool down, bool previousState) override; //call-in
|
void clickLeft(tribool down, bool previousState) override; //call-in
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
#include "../gui/CGuiHandler.h"
|
#include "../gui/CGuiHandler.h"
|
||||||
#include "../gui/WindowHandler.h"
|
#include "../gui/WindowHandler.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
|
||||||
#include "../windows/CCreatureWindow.h"
|
#include "../windows/CCreatureWindow.h"
|
||||||
#include "../windows/GUIClasses.h"
|
#include "../windows/GUIClasses.h"
|
||||||
#include "../CGameInfo.h"
|
#include "../CGameInfo.h"
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "../renderSDL/SDL_Extensions.h"
|
#include "../renderSDL/SDL_Extensions.h"
|
||||||
#include "../render/IImage.h"
|
#include "../render/IImage.h"
|
||||||
#include "../render/CAnimation.h"
|
#include "../render/CAnimation.h"
|
||||||
|
#include "../render/Canvas.h"
|
||||||
#include "../render/ColorFilter.h"
|
#include "../render/ColorFilter.h"
|
||||||
|
|
||||||
#include "../battle/BattleInterface.h"
|
#include "../battle/BattleInterface.h"
|
||||||
@ -77,16 +78,21 @@ CPicture::CPicture(std::shared_ptr<IImage> image, const Rect &SrcRect, int x, in
|
|||||||
pos.h = srcRect->h;
|
pos.h = srcRect->h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPicture::show(SDL_Surface * to)
|
void CPicture::show(Canvas & to)
|
||||||
{
|
{
|
||||||
if (visible && needRefresh)
|
if (visible && needRefresh)
|
||||||
showAll(to);
|
showAll(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPicture::showAll(SDL_Surface * to)
|
void CPicture::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
if(bg && visible)
|
if(bg && visible)
|
||||||
bg->draw(to, pos.x, pos.y, srcRect.has_value() ? &srcRect.value() : nullptr);
|
{
|
||||||
|
if (srcRect.has_value())
|
||||||
|
to.draw(bg, pos.topLeft(), *srcRect);
|
||||||
|
else
|
||||||
|
to.draw(bg, pos.topLeft());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPicture::setAlpha(int value)
|
void CPicture::setAlpha(int value)
|
||||||
@ -125,14 +131,14 @@ CFilledTexture::CFilledTexture(std::shared_ptr<IImage> image, Rect position, Rec
|
|||||||
pos.h = position.h;
|
pos.h = position.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFilledTexture::showAll(SDL_Surface *to)
|
void CFilledTexture::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CSDL_Ext::CClipRectGuard guard(to, pos);
|
CSDL_Ext::CClipRectGuard guard(to.getInternalSurface(), pos);
|
||||||
|
|
||||||
for (int y=pos.top(); y < pos.bottom(); y+= imageArea.h)
|
for (int y=pos.top(); y < pos.bottom(); y+= imageArea.h)
|
||||||
{
|
{
|
||||||
for (int x=pos.left(); x < pos.right(); x+= imageArea.w)
|
for (int x=pos.left(); x < pos.right(); x+= imageArea.w)
|
||||||
texture->draw(to, x, y, &imageArea);
|
to.draw(texture, Point(x,y), imageArea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +247,7 @@ CAnimImage::~CAnimImage()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAnimImage::showAll(SDL_Surface * to)
|
void CAnimImage::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
if(!visible)
|
if(!visible)
|
||||||
return;
|
return;
|
||||||
@ -260,10 +266,10 @@ void CAnimImage::showAll(SDL_Surface * to)
|
|||||||
if(isScaled())
|
if(isScaled())
|
||||||
{
|
{
|
||||||
auto scaled = img->scaleFast(scaledSize);
|
auto scaled = img->scaleFast(scaledSize);
|
||||||
scaled->draw(to, pos.x, pos.y);
|
to.draw(scaled, pos.topLeft());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
img->draw(to, pos.x, pos.y);
|
to.draw(img, pos.topLeft());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -388,7 +394,7 @@ void CShowableAnim::clipRect(int posX, int posY, int width, int height)
|
|||||||
pos.h = height;
|
pos.h = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CShowableAnim::show(SDL_Surface * to)
|
void CShowableAnim::show(Canvas & to)
|
||||||
{
|
{
|
||||||
if ( flags & BASE )// && frame != first) // FIXME: results in graphical glytch in Fortress, upgraded hydra's dwelling
|
if ( flags & BASE )// && frame != first) // FIXME: results in graphical glytch in Fortress, upgraded hydra's dwelling
|
||||||
blitImage(first, group, to);
|
blitImage(first, group, to);
|
||||||
@ -410,22 +416,21 @@ void CShowableAnim::tick(uint32_t msPassed)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CShowableAnim::showAll(SDL_Surface * to)
|
void CShowableAnim::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
if ( flags & BASE )// && frame != first)
|
if ( flags & BASE )// && frame != first)
|
||||||
blitImage(first, group, to);
|
blitImage(first, group, to);
|
||||||
blitImage(frame, group, to);
|
blitImage(frame, group, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CShowableAnim::blitImage(size_t frame, size_t group, SDL_Surface *to)
|
void CShowableAnim::blitImage(size_t frame, size_t group, Canvas & to)
|
||||||
{
|
{
|
||||||
assert(to);
|
|
||||||
Rect src( xOffset, yOffset, pos.w, pos.h);
|
Rect src( xOffset, yOffset, pos.w, pos.h);
|
||||||
auto img = anim->getImage(frame, group);
|
auto img = anim->getImage(frame, group);
|
||||||
if(img)
|
if(img)
|
||||||
{
|
{
|
||||||
img->setAlpha(alpha);
|
img->setAlpha(alpha);
|
||||||
img->draw(to, pos.x, pos.y, &src);
|
to.draw(img, pos.topLeft(), src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ VCMI_LIB_NAMESPACE_BEGIN
|
|||||||
class Rect;
|
class Rect;
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
|
||||||
struct SDL_Surface;
|
|
||||||
struct SDL_Color;
|
struct SDL_Color;
|
||||||
class CAnimImage;
|
class CAnimImage;
|
||||||
class CLabel;
|
class CLabel;
|
||||||
@ -61,8 +60,8 @@ public:
|
|||||||
void scaleTo(Point size);
|
void scaleTo(Point size);
|
||||||
void colorize(PlayerColor player);
|
void colorize(PlayerColor player);
|
||||||
|
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// area filled with specific texture
|
/// area filled with specific texture
|
||||||
@ -76,7 +75,7 @@ public:
|
|||||||
CFilledTexture(std::string imageName, Rect position);
|
CFilledTexture(std::string imageName, Rect position);
|
||||||
CFilledTexture(std::shared_ptr<IImage> image, Rect position, Rect imageArea);
|
CFilledTexture(std::shared_ptr<IImage> image, Rect position, Rect imageArea);
|
||||||
|
|
||||||
void showAll(SDL_Surface *to) override;
|
void showAll(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FilledTexturePlayerColored : public CFilledTexture
|
class FilledTexturePlayerColored : public CFilledTexture
|
||||||
@ -124,7 +123,7 @@ public:
|
|||||||
/// returns true if image has player-colored effect applied
|
/// returns true if image has player-colored effect applied
|
||||||
bool isPlayerColored() const;
|
bool isPlayerColored() const;
|
||||||
|
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Base class for displaying animation, used as superclass for different animations
|
/// Base class for displaying animation, used as superclass for different animations
|
||||||
@ -154,7 +153,7 @@ protected:
|
|||||||
ui8 flags;//Flags from EFlags enum
|
ui8 flags;//Flags from EFlags enum
|
||||||
|
|
||||||
//blit image with optional rotation, fitting into rect, etc
|
//blit image with optional rotation, fitting into rect, etc
|
||||||
void blitImage(size_t frame, size_t group, SDL_Surface *to);
|
void blitImage(size_t frame, size_t group, Canvas & to);
|
||||||
|
|
||||||
//For clipping in rect, offsets of picture coordinates
|
//For clipping in rect, offsets of picture coordinates
|
||||||
int xOffset, yOffset;
|
int xOffset, yOffset;
|
||||||
@ -188,8 +187,8 @@ public:
|
|||||||
void setDuration(int durationMs);
|
void setDuration(int durationMs);
|
||||||
|
|
||||||
//show current frame and increase counter
|
//show current frame and increase counter
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
void tick(uint32_t msPassed) override;
|
void tick(uint32_t msPassed) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "../widgets/TextControls.h"
|
#include "../widgets/TextControls.h"
|
||||||
#include "../windows/CCastleInterface.h"
|
#include "../windows/CCastleInterface.h"
|
||||||
#include "../windows/InfoWindows.h"
|
#include "../windows/InfoWindows.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
#include "../render/Canvas.h"
|
||||||
|
|
||||||
#include "../../CCallback.h"
|
#include "../../CCallback.h"
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ LRClickableAreaOpenTown::LRClickableAreaOpenTown(const Rect & Pos, const CGTownI
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMinorResDataBar::show(SDL_Surface * to)
|
void CMinorResDataBar::show(Canvas & to)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ std::string CMinorResDataBar::buildDateString()
|
|||||||
return boost::str(formatted);
|
return boost::str(formatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMinorResDataBar::showAll(SDL_Surface * to)
|
void CMinorResDataBar::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::showAll(to);
|
CIntObject::showAll(to);
|
||||||
|
|
||||||
@ -204,9 +204,14 @@ void CMinorResDataBar::showAll(SDL_Surface * to)
|
|||||||
{
|
{
|
||||||
std::string text = std::to_string(LOCPLINT->cb->getResourceAmount(i));
|
std::string text = std::to_string(LOCPLINT->cb->getResourceAmount(i));
|
||||||
|
|
||||||
graphics->fonts[FONT_SMALL]->renderTextCenter(to, text, Colors::WHITE, Point(pos.x + 50 + 76 * GameResID(i), pos.y + pos.h/2));
|
Point target(pos.x + 50 + 76 * GameResID(i), pos.y + pos.h/2);
|
||||||
|
|
||||||
|
to.drawText(target, FONT_SMALL, Colors::WHITE, ETextAlignment::CENTER, text);
|
||||||
}
|
}
|
||||||
graphics->fonts[FONT_SMALL]->renderTextCenter(to, buildDateString(), Colors::WHITE, Point(pos.x+545+(pos.w-545)/2,pos.y+pos.h/2));
|
|
||||||
|
Point target(pos.x+545+(pos.w-545)/2,pos.y+pos.h/2);
|
||||||
|
|
||||||
|
to.drawText(target, FONT_SMALL, Colors::WHITE, ETextAlignment::CENTER, buildDateString());
|
||||||
}
|
}
|
||||||
|
|
||||||
CMinorResDataBar::CMinorResDataBar()
|
CMinorResDataBar::CMinorResDataBar()
|
||||||
@ -466,7 +471,7 @@ CCreaturePic::CCreaturePic(int x, int y, const CCreature * cre, bool Big, bool A
|
|||||||
pos.h = bg->pos.h;
|
pos.h = bg->pos.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCreaturePic::show(SDL_Surface * to)
|
void CCreaturePic::show(Canvas & to)
|
||||||
{
|
{
|
||||||
// redraw everything in a proper order
|
// redraw everything in a proper order
|
||||||
bg->showAll(to);
|
bg->showAll(to);
|
||||||
|
@ -107,7 +107,7 @@ private:
|
|||||||
std::shared_ptr<CCreatureAnim> anim; //displayed animation
|
std::shared_ptr<CCreatureAnim> anim; //displayed animation
|
||||||
std::shared_ptr<CLabel> amount;
|
std::shared_ptr<CLabel> amount;
|
||||||
|
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
public:
|
public:
|
||||||
CCreaturePic(int x, int y, const CCreature * cre, bool Big=true, bool Animated=true);
|
CCreaturePic(int x, int y, const CCreature * cre, bool Big=true, bool Animated=true);
|
||||||
void setAmount(int newAmount);
|
void setAmount(int newAmount);
|
||||||
@ -120,8 +120,8 @@ class CMinorResDataBar : public CIntObject
|
|||||||
|
|
||||||
std::string buildDateString();
|
std::string buildDateString();
|
||||||
public:
|
public:
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
CMinorResDataBar();
|
CMinorResDataBar();
|
||||||
~CMinorResDataBar();
|
~CMinorResDataBar();
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,6 @@ VCMI_LIB_NAMESPACE_BEGIN
|
|||||||
class Rect;
|
class Rect;
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
|
||||||
struct SDL_Surface;
|
|
||||||
class CAnimImage;
|
class CAnimImage;
|
||||||
class CSlider;
|
class CSlider;
|
||||||
class CLabel;
|
class CLabel;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "../windows/CMessage.h"
|
#include "../windows/CMessage.h"
|
||||||
#include "../adventureMap/CInGameConsole.h"
|
#include "../adventureMap/CInGameConsole.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
#include "../renderSDL/SDL_Extensions.h"
|
||||||
|
#include "../render/Canvas.h"
|
||||||
|
|
||||||
#include "../../lib/TextOperations.h"
|
#include "../../lib/TextOperations.h"
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ std::string CLabel::visibleText()
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLabel::showAll(SDL_Surface * to)
|
void CLabel::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::showAll(to);
|
CIntObject::showAll(to);
|
||||||
|
|
||||||
@ -137,7 +138,7 @@ void CMultiLineLabel::setText(const std::string & Txt)
|
|||||||
CLabel::setText(Txt);
|
CLabel::setText(Txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTextContainer::blitLine(SDL_Surface * to, Rect destRect, std::string what)
|
void CTextContainer::blitLine(Canvas & to, Rect destRect, std::string what)
|
||||||
{
|
{
|
||||||
const auto f = graphics->fonts[font];
|
const auto f = graphics->fonts[font];
|
||||||
Point where = destRect.topLeft();
|
Point where = destRect.topLeft();
|
||||||
@ -180,9 +181,10 @@ void CTextContainer::blitLine(SDL_Surface * to, Rect destRect, std::string what)
|
|||||||
std::string toPrint = what.substr(begin, end - begin);
|
std::string toPrint = what.substr(begin, end - begin);
|
||||||
|
|
||||||
if(currDelimeter % 2) // Enclosed in {} text - set to yellow
|
if(currDelimeter % 2) // Enclosed in {} text - set to yellow
|
||||||
f->renderTextLeft(to, toPrint, Colors::YELLOW, where);
|
to.drawText(where, font, Colors::YELLOW, ETextAlignment::TOPLEFT, toPrint);
|
||||||
else // Non-enclosed text, use default color
|
else // Non-enclosed text, use default color
|
||||||
f->renderTextLeft(to, toPrint, color, where);
|
to.drawText(where, font, color, ETextAlignment::TOPLEFT, toPrint);
|
||||||
|
|
||||||
begin = end;
|
begin = end;
|
||||||
|
|
||||||
where.x += (int)f->getStringWidth(toPrint);
|
where.x += (int)f->getStringWidth(toPrint);
|
||||||
@ -198,7 +200,7 @@ CTextContainer::CTextContainer(ETextAlignment alignment, EFonts font, SDL_Color
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMultiLineLabel::showAll(SDL_Surface * to)
|
void CMultiLineLabel::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::showAll(to);
|
CIntObject::showAll(to);
|
||||||
|
|
||||||
@ -224,7 +226,7 @@ void CMultiLineLabel::showAll(SDL_Surface * to)
|
|||||||
Point lineStart = getTextLocation().topLeft() - visibleSize + Point(0, beginLine * (int)f->getLineHeight());
|
Point lineStart = getTextLocation().topLeft() - visibleSize + Point(0, beginLine * (int)f->getLineHeight());
|
||||||
Point lineSize = Point(getTextLocation().w, (int)f->getLineHeight());
|
Point lineSize = Point(getTextLocation().w, (int)f->getLineHeight());
|
||||||
|
|
||||||
CSDL_Ext::CClipRectGuard guard(to, getTextLocation()); // to properly trim text that is too big to fit
|
CSDL_Ext::CClipRectGuard guard(to.getInternalSurface(), getTextLocation()); // to properly trim text that is too big to fit
|
||||||
|
|
||||||
for(int i = beginLine; i < std::min(totalLines, endLine); i++)
|
for(int i = beginLine; i < std::min(totalLines, endLine); i++)
|
||||||
{
|
{
|
||||||
@ -437,7 +439,7 @@ CGStatusBar::~CGStatusBar()
|
|||||||
assert(GH.statusbar().get() != this);
|
assert(GH.statusbar().get() != this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGStatusBar::show(SDL_Surface * to)
|
void CGStatusBar::show(Canvas & to)
|
||||||
{
|
{
|
||||||
showAll(to);
|
showAll(to);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ protected:
|
|||||||
/// returns size of border, for left- or right-aligned text
|
/// returns size of border, for left- or right-aligned text
|
||||||
virtual Point getBorderSize() = 0;
|
virtual Point getBorderSize() = 0;
|
||||||
/// do actual blitting of line. Text "what" will be placed at "where" and aligned according to alignment
|
/// do actual blitting of line. Text "what" will be placed at "where" and aligned according to alignment
|
||||||
void blitLine(SDL_Surface * to, Rect where, std::string what);
|
void blitLine(Canvas & to, Rect where, std::string what);
|
||||||
|
|
||||||
CTextContainer(ETextAlignment alignment, EFonts font, SDL_Color color);
|
CTextContainer(ETextAlignment alignment, EFonts font, SDL_Color color);
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ public:
|
|||||||
|
|
||||||
CLabel(int x = 0, int y = 0, EFonts Font = FONT_SMALL, ETextAlignment Align = ETextAlignment::TOPLEFT,
|
CLabel(int x = 0, int y = 0, EFonts Font = FONT_SMALL, ETextAlignment Align = ETextAlignment::TOPLEFT,
|
||||||
const SDL_Color & Color = Colors::WHITE, const std::string & Text = "");
|
const SDL_Color & Color = Colors::WHITE, const std::string & Text = "");
|
||||||
void showAll(SDL_Surface * to) override; //shows statusbar (with current text)
|
void showAll(Canvas & to) override; //shows statusbar (with current text)
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Small helper class to manage group of similar labels
|
/// Small helper class to manage group of similar labels
|
||||||
@ -94,7 +94,7 @@ public:
|
|||||||
CMultiLineLabel(Rect position, EFonts Font = FONT_SMALL, ETextAlignment Align = ETextAlignment::TOPLEFT, const SDL_Color & Color = Colors::WHITE, const std::string & Text = "");
|
CMultiLineLabel(Rect position, EFonts Font = FONT_SMALL, ETextAlignment Align = ETextAlignment::TOPLEFT, const SDL_Color & Color = Colors::WHITE, const std::string & Text = "");
|
||||||
|
|
||||||
void setText(const std::string & Txt) override;
|
void setText(const std::string & Txt) override;
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
|
|
||||||
void setVisibleSize(Rect visibleSize, bool redrawElement = true);
|
void setVisibleSize(Rect visibleSize, bool redrawElement = true);
|
||||||
// scrolls text visible in widget. Positive value will move text up
|
// scrolls text visible in widget. Positive value will move text up
|
||||||
@ -150,7 +150,7 @@ public:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
void activate() override;
|
void activate() override;
|
||||||
void deactivate() override;
|
void deactivate() override;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "../widgets/CComponent.h"
|
#include "../widgets/CComponent.h"
|
||||||
#include "../widgets/Buttons.h"
|
#include "../widgets/Buttons.h"
|
||||||
#include "../widgets/TextControls.h"
|
#include "../widgets/TextControls.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
#include "../render/Canvas.h"
|
||||||
#include "../render/IImage.h"
|
#include "../render/IImage.h"
|
||||||
#include "../render/ColorFilter.h"
|
#include "../render/ColorFilter.h"
|
||||||
#include "../adventureMap/AdventureMapInterface.h"
|
#include "../adventureMap/AdventureMapInterface.h"
|
||||||
@ -162,7 +162,7 @@ void CBuildingRect::clickRight(tribool down, bool previousState)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBuildingRect::show(SDL_Surface * to)
|
void CBuildingRect::show(Canvas & to)
|
||||||
{
|
{
|
||||||
uint32_t stageDelay = BUILDING_APPEAR_TIMEPOINT;
|
uint32_t stageDelay = BUILDING_APPEAR_TIMEPOINT;
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ void CBuildingRect::show(SDL_Surface * to)
|
|||||||
if(stateTimeCounter >= BUILD_ANIMATION_FINISHED_TIMEPOINT)
|
if(stateTimeCounter >= BUILD_ANIMATION_FINISHED_TIMEPOINT)
|
||||||
{
|
{
|
||||||
if(parent->selectedBuilding == this)
|
if(parent->selectedBuilding == this)
|
||||||
border->draw(to, pos.x, pos.y);
|
to.draw(border, pos.topLeft());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ void CBuildingRect::show(SDL_Surface * to)
|
|||||||
else
|
else
|
||||||
border->adjustPalette(baseBorder, 0);
|
border->adjustPalette(baseBorder, 0);
|
||||||
|
|
||||||
border->draw(to, pos.x, pos.y);
|
to.draw(border, pos.topLeft());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,14 +210,14 @@ void CBuildingRect::tick(uint32_t msPassed)
|
|||||||
stateTimeCounter += msPassed;
|
stateTimeCounter += msPassed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBuildingRect::showAll(SDL_Surface * to)
|
void CBuildingRect::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
if (stateTimeCounter == 0)
|
if (stateTimeCounter == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CShowableAnim::showAll(to);
|
CShowableAnim::showAll(to);
|
||||||
if(!isActive() && parent->selectedBuilding == this && border)
|
if(!isActive() && parent->selectedBuilding == this && border)
|
||||||
border->draw(to, pos.x, pos.y);
|
to.draw(border, pos.topLeft());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CBuildingRect::getSubtitle()//hover text for building
|
std::string CBuildingRect::getSubtitle()//hover text for building
|
||||||
|
@ -70,8 +70,8 @@ public:
|
|||||||
void clickRight(tribool down, bool previousState) override;
|
void clickRight(tribool down, bool previousState) override;
|
||||||
void mouseMoved (const Point & cursorPosition) override;
|
void mouseMoved (const Point & cursorPosition) override;
|
||||||
void tick(uint32_t msPassed) override;
|
void tick(uint32_t msPassed) override;
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Dwelling info box - right-click screen for dwellings
|
/// Dwelling info box - right-click screen for dwellings
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "../widgets/ObjectLists.h"
|
#include "../widgets/ObjectLists.h"
|
||||||
#include "../gui/CGuiHandler.h"
|
#include "../gui/CGuiHandler.h"
|
||||||
#include "../gui/Shortcut.h"
|
#include "../gui/Shortcut.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
|
||||||
|
|
||||||
#include "../../CCallback.h"
|
#include "../../CCallback.h"
|
||||||
#include "../../lib/CStack.h"
|
#include "../../lib/CStack.h"
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "../widgets/CComponent.h"
|
#include "../widgets/CComponent.h"
|
||||||
#include "../widgets/TextControls.h"
|
#include "../widgets/TextControls.h"
|
||||||
#include "../widgets/Buttons.h"
|
#include "../widgets/Buttons.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
|
||||||
#include "../render/CAnimation.h"
|
#include "../render/CAnimation.h"
|
||||||
|
|
||||||
#include "../../CCallback.h"
|
#include "../../CCallback.h"
|
||||||
|
@ -23,7 +23,6 @@ class CGHeroInstance;
|
|||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
|
||||||
class CButton;
|
class CButton;
|
||||||
struct SDL_Surface;
|
|
||||||
class CHeroWindow;
|
class CHeroWindow;
|
||||||
class LClickableAreaHero;
|
class LClickableAreaHero;
|
||||||
class LRClickableAreaWText;
|
class LRClickableAreaWText;
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "../widgets/MiscWidgets.h"
|
#include "../widgets/MiscWidgets.h"
|
||||||
#include "../widgets/Buttons.h"
|
#include "../widgets/Buttons.h"
|
||||||
#include "../widgets/ObjectLists.h"
|
#include "../widgets/ObjectLists.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
|
||||||
|
|
||||||
#include "../../CCallback.h"
|
#include "../../CCallback.h"
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "../gui/CGuiHandler.h"
|
#include "../gui/CGuiHandler.h"
|
||||||
#include "../render/CAnimation.h"
|
#include "../render/CAnimation.h"
|
||||||
#include "../render/IImage.h"
|
#include "../render/IImage.h"
|
||||||
|
#include "../render/Canvas.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
#include "../renderSDL/SDL_Extensions.h"
|
||||||
|
|
||||||
#include <SDL_surface.h>
|
#include <SDL_surface.h>
|
||||||
@ -46,7 +47,7 @@ public:
|
|||||||
std::shared_ptr<CComponent> comp;
|
std::shared_ptr<CComponent> comp;
|
||||||
|
|
||||||
//blit component with image centered at this position
|
//blit component with image centered at this position
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
|
|
||||||
//ComponentResolved();
|
//ComponentResolved();
|
||||||
ComponentResolved(std::shared_ptr<CComponent> Comp);
|
ComponentResolved(std::shared_ptr<CComponent> Comp);
|
||||||
@ -420,7 +421,7 @@ ComponentResolved::~ComponentResolved()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComponentResolved::showAll(SDL_Surface *to)
|
void ComponentResolved::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::showAll(to);
|
CIntObject::showAll(to);
|
||||||
comp->showAll(to);
|
comp->showAll(to);
|
||||||
@ -500,7 +501,9 @@ void ComponentsToBlit::blitCompsOnSur( bool blitOr, int inter, int &curh, SDL_Su
|
|||||||
cur->moveTo(Point(curw, curh));
|
cur->moveTo(Point(curw, curh));
|
||||||
|
|
||||||
//blit component
|
//blit component
|
||||||
cur->showAll(ret);
|
Canvas canvas = Canvas::createFromSurface(ret);
|
||||||
|
|
||||||
|
cur->showAll(canvas);
|
||||||
curw += cur->pos.w;
|
curw += cur->pos.w;
|
||||||
|
|
||||||
//if there is subsequent component blit "or"
|
//if there is subsequent component blit "or"
|
||||||
|
@ -69,12 +69,12 @@ CPuzzleWindow::CPuzzleWindow(const int3 & GrailPos, double discoveredRatio)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPuzzleWindow::showAll(SDL_Surface * to)
|
void CPuzzleWindow::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CWindowObject::showAll(to);
|
CWindowObject::showAll(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPuzzleWindow::show(SDL_Surface * to)
|
void CPuzzleWindow::show(Canvas & to)
|
||||||
{
|
{
|
||||||
static int animSpeed = 2;
|
static int animSpeed = 2;
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@ private:
|
|||||||
ui8 currentAlpha;
|
ui8 currentAlpha;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
|
|
||||||
CPuzzleWindow(const int3 & grailPos, double discoveredRatio);
|
CPuzzleWindow(const int3 & grailPos, double discoveredRatio);
|
||||||
};
|
};
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "../adventureMap/AdventureMapInterface.h"
|
#include "../adventureMap/AdventureMapInterface.h"
|
||||||
#include "../widgets/Buttons.h"
|
#include "../widgets/Buttons.h"
|
||||||
#include "../adventureMap/CMinimap.h"
|
#include "../adventureMap/CMinimap.h"
|
||||||
|
#include "../render/Canvas.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
#include "../renderSDL/SDL_Extensions.h"
|
||||||
|
|
||||||
#include "../../CCallback.h"
|
#include "../../CCallback.h"
|
||||||
@ -43,7 +44,7 @@ void CQuestLabel::clickLeft(tribool down, bool previousState)
|
|||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CQuestLabel::showAll(SDL_Surface * to)
|
void CQuestLabel::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CMultiLineLabel::showAll (to);
|
CMultiLineLabel::showAll (to);
|
||||||
}
|
}
|
||||||
@ -60,9 +61,9 @@ void CQuestIcon::clickLeft(tribool down, bool previousState)
|
|||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CQuestIcon::showAll(SDL_Surface * to)
|
void CQuestIcon::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CSDL_Ext::CClipRectGuard guard(to, parent->pos);
|
CSDL_Ext::CClipRectGuard guard(to.getInternalSurface(), parent->pos);
|
||||||
CAnimImage::showAll(to);
|
CAnimImage::showAll(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +110,7 @@ void CQuestMinimap::iconClicked()
|
|||||||
//moveAdvMapSelection();
|
//moveAdvMapSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CQuestMinimap::showAll(SDL_Surface * to)
|
void CQuestMinimap::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::showAll(to); // blitting IntObject directly to hide radar
|
CIntObject::showAll(to); // blitting IntObject directly to hide radar
|
||||||
// for (auto pic : icons)
|
// for (auto pic : icons)
|
||||||
@ -201,7 +202,7 @@ void CQuestLog::recreateLabelList()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CQuestLog::showAll(SDL_Surface * to)
|
void CQuestLog::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CWindowObject::showAll(to);
|
CWindowObject::showAll(to);
|
||||||
if(questIndex >= 0 && questIndex < labels.size())
|
if(questIndex >= 0 && questIndex < labels.size())
|
||||||
@ -210,7 +211,7 @@ void CQuestLog::showAll(SDL_Surface * to)
|
|||||||
Rect rect = Rect::createAround(labels[questIndex]->pos, 1);
|
Rect rect = Rect::createAround(labels[questIndex]->pos, 1);
|
||||||
rect.x -= 2; // Adjustment needed as we want selection box on top of border in graphics
|
rect.x -= 2; // Adjustment needed as we want selection box on top of border in graphics
|
||||||
rect.w += 2;
|
rect.w += 2;
|
||||||
CSDL_Ext::drawBorder(to, rect, Colors::METALLIC_GOLD);
|
to.drawBorder(rect, Colors::METALLIC_GOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
CQuestLabel(Rect position, EFonts Font = FONT_SMALL, ETextAlignment Align = ETextAlignment::TOPLEFT, const SDL_Color &Color = Colors::WHITE, const std::string &Text = "")
|
CQuestLabel(Rect position, EFonts Font = FONT_SMALL, ETextAlignment Align = ETextAlignment::TOPLEFT, const SDL_Color &Color = Colors::WHITE, const std::string &Text = "")
|
||||||
: CMultiLineLabel (position, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, Text){};
|
: CMultiLineLabel (position, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, Text){};
|
||||||
void clickLeft(tribool down, bool previousState) override;
|
void clickLeft(tribool down, bool previousState) override;
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CQuestIcon : public CAnimImage
|
class CQuestIcon : public CAnimImage
|
||||||
@ -57,7 +57,7 @@ public:
|
|||||||
CQuestIcon(const std::string &defname, int index, int x=0, int y=0);
|
CQuestIcon(const std::string &defname, int index, int x=0, int y=0);
|
||||||
|
|
||||||
void clickLeft(tribool down, bool previousState) override;
|
void clickLeft(tribool down, bool previousState) override;
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CQuestMinimap : public CMinimap
|
class CQuestMinimap : public CMinimap
|
||||||
@ -76,7 +76,7 @@ public:
|
|||||||
void update();
|
void update();
|
||||||
void addQuestMarks (const QuestInfo * q);
|
void addQuestMarks (const QuestInfo * q);
|
||||||
|
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CQuestLog : public CWindowObject
|
class CQuestLog : public CWindowObject
|
||||||
@ -107,5 +107,5 @@ public:
|
|||||||
void recreateLabelList();
|
void recreateLabelList();
|
||||||
void recreateQuestList (int pos);
|
void recreateQuestList (int pos);
|
||||||
void toggleComplete(bool on);
|
void toggleComplete(bool on);
|
||||||
void showAll (SDL_Surface * to) override;
|
void showAll (Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include "../widgets/TextControls.h"
|
#include "../widgets/TextControls.h"
|
||||||
#include "../adventureMap/AdventureMapInterface.h"
|
#include "../adventureMap/AdventureMapInterface.h"
|
||||||
#include "../render/CAnimation.h"
|
#include "../render/CAnimation.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
|
||||||
|
|
||||||
#include "../../CCallback.h"
|
#include "../../CCallback.h"
|
||||||
|
|
||||||
@ -307,7 +306,7 @@ void CSpellWindow::fRcornerb()
|
|||||||
computeSpellsPerArea();
|
computeSpellsPerArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSpellWindow::show(SDL_Surface * to)
|
void CSpellWindow::show(Canvas & to)
|
||||||
{
|
{
|
||||||
statusBar->show(to);
|
statusBar->show(to);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ class CSpell;
|
|||||||
|
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
|
||||||
struct SDL_Surface;
|
|
||||||
class IImage;
|
class IImage;
|
||||||
class CAnimImage;
|
class CAnimImage;
|
||||||
class CPicture;
|
class CPicture;
|
||||||
@ -114,5 +113,5 @@ public:
|
|||||||
|
|
||||||
void keyPressed(EShortcut key) override;
|
void keyPressed(EShortcut key) override;
|
||||||
|
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "../gui/CGuiHandler.h"
|
#include "../gui/CGuiHandler.h"
|
||||||
#include "../gui/CursorHandler.h"
|
#include "../gui/CursorHandler.h"
|
||||||
#include "../widgets/Images.h"
|
#include "../widgets/Images.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
#include "../render/Canvas.h"
|
||||||
#include "../gui/TextAlignment.h"
|
#include "../gui/TextAlignment.h"
|
||||||
#include "../gui/Shortcut.h"
|
#include "../gui/Shortcut.h"
|
||||||
#include "../gui/WindowHandler.h"
|
#include "../gui/WindowHandler.h"
|
||||||
@ -127,7 +127,7 @@ int CTradeWindow::CTradeableItem::getIndex()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTradeWindow::CTradeableItem::showAll(SDL_Surface * to)
|
void CTradeWindow::CTradeableItem::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CTradeWindow *mw = dynamic_cast<CTradeWindow *>(parent);
|
CTradeWindow *mw = dynamic_cast<CTradeWindow *>(parent);
|
||||||
assert(mw);
|
assert(mw);
|
||||||
@ -168,7 +168,7 @@ void CTradeWindow::CTradeableItem::showAll(SDL_Surface * to)
|
|||||||
CIntObject::showAll(to);
|
CIntObject::showAll(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
printAtMiddleLoc(subtitle, posToSubCenter, FONT_SMALL, Colors::WHITE, to);
|
to.drawText(pos.topLeft() + posToSubCenter, FONT_SMALL, Colors::WHITE, ETextAlignment::CENTER, subtitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTradeWindow::CTradeableItem::clickLeft(tribool down, bool previousState)
|
void CTradeWindow::CTradeableItem::clickLeft(tribool down, bool previousState)
|
||||||
@ -224,7 +224,7 @@ void CTradeWindow::CTradeableItem::clickLeft(tribool down, bool previousState)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTradeWindow::CTradeableItem::showAllAt(const Point &dstPos, const std::string &customSub, SDL_Surface * to)
|
void CTradeWindow::CTradeableItem::showAllAt(const Point &dstPos, const std::string &customSub, Canvas & to)
|
||||||
{
|
{
|
||||||
Rect oldPos = pos;
|
Rect oldPos = pos;
|
||||||
std::string oldSub = subtitle;
|
std::string oldSub = subtitle;
|
||||||
@ -576,14 +576,14 @@ void CTradeWindow::initSubs(bool Left)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTradeWindow::showAll(SDL_Surface * to)
|
void CTradeWindow::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CWindowObject::showAll(to);
|
CWindowObject::showAll(to);
|
||||||
|
|
||||||
if(hRight)
|
if(hRight)
|
||||||
CSDL_Ext::drawBorder(to, hRight->pos.x-1, hRight->pos.y-1, hRight->pos.w+2, hRight->pos.h+2, Colors::BRIGHT_YELLOW);
|
to.drawBorder(Rect::createAround(hRight->pos, 1), Colors::BRIGHT_YELLOW, 2);
|
||||||
if(hLeft && hLeft->type != ARTIFACT_INSTANCE)
|
if(hLeft && hLeft->type != ARTIFACT_INSTANCE)
|
||||||
CSDL_Ext::drawBorder(to, hLeft->pos.x-1, hLeft->pos.y-1, hLeft->pos.w+2, hLeft->pos.h+2, Colors::BRIGHT_YELLOW);
|
to.drawBorder(Rect::createAround(hLeft->pos, 1), Colors::BRIGHT_YELLOW, 2);
|
||||||
|
|
||||||
if(readyToTrade)
|
if(readyToTrade)
|
||||||
{
|
{
|
||||||
@ -1466,7 +1466,7 @@ void CAltarWindow::artifactPicked()
|
|||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAltarWindow::showAll(SDL_Surface * to)
|
void CAltarWindow::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CTradeWindow::showAll(to);
|
CTradeWindow::showAll(to);
|
||||||
if(mode == EMarketMode::ARTIFACT_EXP && arts)
|
if(mode == EMarketMode::ARTIFACT_EXP && arts)
|
||||||
@ -1479,7 +1479,8 @@ void CAltarWindow::showAll(SDL_Surface * to)
|
|||||||
int dmp, val;
|
int dmp, val;
|
||||||
market->getOffer(pickedArt->getTypeId(), 0, dmp, val, EMarketMode::ARTIFACT_EXP);
|
market->getOffer(pickedArt->getTypeId(), 0, dmp, val, EMarketMode::ARTIFACT_EXP);
|
||||||
val = static_cast<int>(hero->calculateXp(val));
|
val = static_cast<int>(hero->calculateXp(val));
|
||||||
printAtMiddleLoc(std::to_string(val), Point(304, 498), FONT_SMALL, Colors::WHITE, to);
|
|
||||||
|
to.drawText(Point(304, 498), FONT_SMALL, Colors::WHITE, ETextAlignment::CENTER, std::to_string(val));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,11 +54,11 @@ public:
|
|||||||
CFunctionList<void()> callback;
|
CFunctionList<void()> callback;
|
||||||
bool downSelection;
|
bool downSelection;
|
||||||
|
|
||||||
void showAllAt(const Point & dstPos, const std::string & customSub, SDL_Surface * to);
|
void showAllAt(const Point & dstPos, const std::string & customSub, Canvas & to);
|
||||||
|
|
||||||
void clickRight(tribool down, bool previousState) override;
|
void clickRight(tribool down, bool previousState) override;
|
||||||
void hover(bool on) override;
|
void hover(bool on) override;
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
void clickLeft(tribool down, bool previousState) override;
|
void clickLeft(tribool down, bool previousState) override;
|
||||||
std::string getName(int number = -1) const;
|
std::string getName(int number = -1) const;
|
||||||
CTradeableItem(Point pos, EType Type, int ID, bool Left, int Serial);
|
CTradeableItem(Point pos, EType Type, int ID, bool Left, int Serial);
|
||||||
@ -86,7 +86,7 @@ public:
|
|||||||
|
|
||||||
CTradeWindow(std::string bgName, const IMarket * Market, const CGHeroInstance * Hero, EMarketMode::EMarketMode Mode); //c
|
CTradeWindow(std::string bgName, const IMarket * Market, const CGHeroInstance * Hero, EMarketMode::EMarketMode Mode); //c
|
||||||
|
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
|
|
||||||
void initSubs(bool Left);
|
void initSubs(bool Left);
|
||||||
void initTypes();
|
void initTypes();
|
||||||
@ -169,7 +169,7 @@ public:
|
|||||||
void putOnAltar(int backpackIndex);
|
void putOnAltar(int backpackIndex);
|
||||||
bool putOnAltar(std::shared_ptr<CTradeableItem> altarSlot, const CArtifactInstance * art);
|
bool putOnAltar(std::shared_ptr<CTradeableItem> altarSlot, const CArtifactInstance * art);
|
||||||
void makeDeal();
|
void makeDeal();
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
|
|
||||||
void blockTrade();
|
void blockTrade();
|
||||||
void sliderMoved(int to);
|
void sliderMoved(int to);
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
#include "../battle/BattleInterface.h"
|
#include "../battle/BattleInterface.h"
|
||||||
#include "../battle/BattleInterfaceClasses.h"
|
#include "../battle/BattleInterfaceClasses.h"
|
||||||
#include "../windows/CMessage.h"
|
#include "../windows/CMessage.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
|
||||||
#include "../renderSDL/SDL_PixelAccess.h"
|
#include "../renderSDL/SDL_PixelAccess.h"
|
||||||
#include "../render/IImage.h"
|
#include "../render/IImage.h"
|
||||||
|
#include "../render/Canvas.h"
|
||||||
|
|
||||||
#include "../CGameInfo.h"
|
#include "../CGameInfo.h"
|
||||||
#include "../CPlayerInterface.h"
|
#include "../CPlayerInterface.h"
|
||||||
@ -224,15 +224,15 @@ void CWindowObject::setShadow(bool on)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindowObject::showAll(SDL_Surface *to)
|
void CWindowObject::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
auto color = LOCPLINT ? LOCPLINT->playerID : PlayerColor(1);
|
auto color = LOCPLINT ? LOCPLINT->playerID : PlayerColor(1);
|
||||||
if(settings["session"]["spectate"].Bool())
|
if(settings["session"]["spectate"].Bool())
|
||||||
color = PlayerColor(1); // TODO: Spectator shouldn't need special code for UI colors
|
color = PlayerColor(1); // TODO: Spectator shouldn't need special code for UI colors
|
||||||
|
|
||||||
CIntObject::showAll(to);
|
CIntObject::showAll(to);
|
||||||
if ((options & BORDERED) && (pos.h != to->h || pos.w != to->w))
|
if ((options & BORDERED) && (pos.dimensions() != GH.screenDimensions()))
|
||||||
CMessage::drawBorder(color, to, pos.w+28, pos.h+29, pos.x-14, pos.y-15);
|
CMessage::drawBorder(color, to.getInternalSurface(), pos.w+28, pos.h+29, pos.x-14, pos.y-15);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindowObject::clickRight(tribool down, bool previousState)
|
void CWindowObject::clickRight(tribool down, bool previousState)
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
CWindowObject(int options, std::string imageName = "");
|
CWindowObject(int options, std::string imageName = "");
|
||||||
~CWindowObject();
|
~CWindowObject();
|
||||||
|
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CStatusbarWindow : public CWindowObject
|
class CStatusbarWindow : public CWindowObject
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
#include "../widgets/ObjectLists.h"
|
#include "../widgets/ObjectLists.h"
|
||||||
|
|
||||||
#include "../lobby/CSavingScreen.h"
|
#include "../lobby/CSavingScreen.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
#include "../render/Canvas.h"
|
||||||
#include "../render/CAnimation.h"
|
#include "../render/CAnimation.h"
|
||||||
#include "../CMT.h"
|
#include "../CMT.h"
|
||||||
|
|
||||||
@ -68,8 +68,6 @@
|
|||||||
#include "../lib/StartInfo.h"
|
#include "../lib/StartInfo.h"
|
||||||
#include "../lib/TextOperations.h"
|
#include "../lib/TextOperations.h"
|
||||||
|
|
||||||
#include <SDL_surface.h>
|
|
||||||
|
|
||||||
CRecruitmentWindow::CCreatureCard::CCreatureCard(CRecruitmentWindow * window, const CCreature * crea, int totalAmount)
|
CRecruitmentWindow::CCreatureCard::CCreatureCard(CRecruitmentWindow * window, const CCreature * crea, int totalAmount)
|
||||||
: CIntObject(LCLICK | RCLICK),
|
: CIntObject(LCLICK | RCLICK),
|
||||||
parent(window),
|
parent(window),
|
||||||
@ -102,13 +100,13 @@ void CRecruitmentWindow::CCreatureCard::clickRight(tribool down, bool previousSt
|
|||||||
GH.windows().createAndPushWindow<CStackWindow>(creature, true);
|
GH.windows().createAndPushWindow<CStackWindow>(creature, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRecruitmentWindow::CCreatureCard::showAll(SDL_Surface * to)
|
void CRecruitmentWindow::CCreatureCard::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::showAll(to);
|
CIntObject::showAll(to);
|
||||||
if(selected)
|
if(selected)
|
||||||
CSDL_Ext::drawBorder(to, pos, Colors::RED);
|
to.drawBorder(pos, Colors::RED);
|
||||||
else
|
else
|
||||||
CSDL_Ext::drawBorder(to, pos, Colors::YELLOW);
|
to.drawBorder(pos, Colors::YELLOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRecruitmentWindow::select(std::shared_ptr<CCreatureCard> card)
|
void CRecruitmentWindow::select(std::shared_ptr<CCreatureCard> card)
|
||||||
@ -178,22 +176,24 @@ void CRecruitmentWindow::buy()
|
|||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRecruitmentWindow::showAll(SDL_Surface * to)
|
void CRecruitmentWindow::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CWindowObject::showAll(to);
|
CWindowObject::showAll(to);
|
||||||
|
|
||||||
|
Rect(172, 222, 67, 42) + pos.topLeft();
|
||||||
|
|
||||||
// recruit\total values
|
// recruit\total values
|
||||||
CSDL_Ext::drawBorder(to, pos.x + 172, pos.y + 222, 67, 42, Colors::YELLOW);
|
to.drawBorder(Rect(172, 222, 67, 42) + pos.topLeft(), Colors::YELLOW);
|
||||||
CSDL_Ext::drawBorder(to, pos.x + 246, pos.y + 222, 67, 42, Colors::YELLOW);
|
to.drawBorder(Rect(246, 222, 67, 42) + pos.topLeft(), Colors::YELLOW);
|
||||||
|
|
||||||
//cost boxes
|
//cost boxes
|
||||||
CSDL_Ext::drawBorder(to, pos.x + 64, pos.y + 222, 99, 76, Colors::YELLOW);
|
to.drawBorder(Rect( 64, 222, 99, 76) + pos.topLeft(), Colors::YELLOW);
|
||||||
CSDL_Ext::drawBorder(to, pos.x + 322, pos.y + 222, 99, 76, Colors::YELLOW);
|
to.drawBorder(Rect(322, 222, 99, 76) + pos.topLeft(), Colors::YELLOW);
|
||||||
|
|
||||||
//buttons borders
|
//buttons borders
|
||||||
CSDL_Ext::drawBorder(to, pos.x + 133, pos.y + 312, 66, 34, Colors::METALLIC_GOLD);
|
to.drawBorder(Rect(133, 312, 66, 34) + pos.topLeft(), Colors::METALLIC_GOLD);
|
||||||
CSDL_Ext::drawBorder(to, pos.x + 211, pos.y + 312, 66, 34, Colors::METALLIC_GOLD);
|
to.drawBorder(Rect(211, 312, 66, 34) + pos.topLeft(), Colors::METALLIC_GOLD);
|
||||||
CSDL_Ext::drawBorder(to, pos.x + 289, pos.y + 312, 66, 34, Colors::METALLIC_GOLD);
|
to.drawBorder(Rect(289, 312, 66, 34) + pos.topLeft(), Colors::METALLIC_GOLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
CRecruitmentWindow::CRecruitmentWindow(const CGDwelling * Dwelling, int Level, const CArmedInstance * Dst, const std::function<void(CreatureID,int)> & Recruit, int y_offset):
|
CRecruitmentWindow::CRecruitmentWindow(const CGDwelling * Dwelling, int Level, const CArmedInstance * Dst, const std::function<void(CreatureID,int)> & Recruit, int y_offset):
|
||||||
@ -454,11 +454,13 @@ CTavernWindow::CTavernWindow(const CGObjectInstance * TavernObj)
|
|||||||
h1 = std::make_shared<HeroPortrait>(selected, 0, 72, 299, h[0]);
|
h1 = std::make_shared<HeroPortrait>(selected, 0, 72, 299, h[0]);
|
||||||
h2 = std::make_shared<HeroPortrait>(selected, 1, 162, 299, h[1]);
|
h2 = std::make_shared<HeroPortrait>(selected, 1, 162, 299, h[1]);
|
||||||
|
|
||||||
title = std::make_shared<CLabel>(200, 35, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[37]);
|
title = std::make_shared<CLabel>(197, 32, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[37]);
|
||||||
cost = std::make_shared<CLabel>(320, 328, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, std::to_string(GameConstants::HERO_GOLD_COST));
|
cost = std::make_shared<CLabel>(320, 328, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, std::to_string(GameConstants::HERO_GOLD_COST));
|
||||||
|
heroDescription = std::make_shared<CTextBox>("", Rect(30, 373, 233, 35), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE);
|
||||||
|
heroesForHire = std::make_shared<CLabel>(145, 283, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[38]);
|
||||||
|
|
||||||
auto rumorText = boost::str(boost::format(CGI->generaltexth->allTexts[216]) % LOCPLINT->cb->getTavernRumor(tavernObj));
|
auto rumorText = boost::str(boost::format(CGI->generaltexth->allTexts[216]) % LOCPLINT->cb->getTavernRumor(tavernObj));
|
||||||
rumor = std::make_shared<CTextBox>(rumorText, Rect(32, 190, 330, 68), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE);
|
rumor = std::make_shared<CTextBox>(rumorText, Rect(32, 188, 330, 66), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE);
|
||||||
|
|
||||||
statusbar = CGStatusBar::create(std::make_shared<CPicture>(background->getSurface(), Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26));
|
statusbar = CGStatusBar::create(std::make_shared<CPicture>(background->getSurface(), Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26));
|
||||||
cancel = std::make_shared<CButton>(Point(310, 428), "ICANCEL.DEF", CButton::tooltip(CGI->generaltexth->tavernInfo[7]), std::bind(&CTavernWindow::close, this), EShortcut::GLOBAL_CANCEL);
|
cancel = std::make_shared<CButton>(Point(310, 428), "ICANCEL.DEF", CButton::tooltip(CGI->generaltexth->tavernInfo[7]), std::bind(&CTavernWindow::close, this), EShortcut::GLOBAL_CANCEL);
|
||||||
@ -516,27 +518,31 @@ CTavernWindow::~CTavernWindow()
|
|||||||
CCS->videoh->close();
|
CCS->videoh->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTavernWindow::show(SDL_Surface * to)
|
void CTavernWindow::show(Canvas & to)
|
||||||
{
|
{
|
||||||
CWindowObject::show(to);
|
CWindowObject::show(to);
|
||||||
|
|
||||||
CCS->videoh->update(pos.x+70, pos.y+56, to, true, false);
|
|
||||||
if(selected >= 0)
|
if(selected >= 0)
|
||||||
{
|
{
|
||||||
auto sel = selected ? h2 : h1;
|
auto sel = selected ? h2 : h1;
|
||||||
|
|
||||||
if (selected != oldSelected && !recruit->isBlocked())
|
if(selected != oldSelected)
|
||||||
{
|
{
|
||||||
// Selected hero just changed. Update RECRUIT button hover text if recruitment is allowed.
|
// Selected hero just changed. Update RECRUIT button hover text if recruitment is allowed.
|
||||||
oldSelected = selected;
|
oldSelected = selected;
|
||||||
|
|
||||||
|
heroDescription->setText(sel->description);
|
||||||
|
|
||||||
//Recruit %s the %s
|
//Recruit %s the %s
|
||||||
recruit->addHoverText(CButton::NORMAL, boost::str(boost::format(CGI->generaltexth->tavernInfo[3]) % sel->h->getNameTranslated() % sel->h->type->heroClass->getNameTranslated()));
|
if (!recruit->isBlocked())
|
||||||
|
recruit->addHoverText(CButton::NORMAL, boost::str(boost::format(CGI->generaltexth->tavernInfo[3]) % sel->h->getNameTranslated() % sel->h->type->heroClass->getNameTranslated()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printAtMiddleWBLoc(sel->description, Point(146, 395), FONT_SMALL, 200, Colors::WHITE, to);
|
to.drawBorder(Rect::createAround(sel->pos, 2), Colors::BRIGHT_YELLOW, 2);
|
||||||
CSDL_Ext::drawBorder(to,sel->pos.x-2,sel->pos.y-2,sel->pos.w+4,sel->pos.h+4,Colors::BRIGHT_YELLOW);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CCS->videoh->update(pos.x+70, pos.y+56, to.getInternalSurface(), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTavernWindow::HeroPortrait::clickLeft(tribool down, bool previousState)
|
void CTavernWindow::HeroPortrait::clickLeft(tribool down, bool previousState)
|
||||||
@ -1270,7 +1276,7 @@ int CUniversityWindow::CItem::state()
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CUniversityWindow::CItem::showAll(SDL_Surface * to)
|
void CUniversityWindow::CItem::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
//TODO: update when state actually changes
|
//TODO: update when state actually changes
|
||||||
auto stateIndex = state();
|
auto stateIndex = state();
|
||||||
|
@ -62,7 +62,7 @@ class CRecruitmentWindow : public CStatusbarWindow
|
|||||||
|
|
||||||
void clickLeft(tribool down, bool previousState) override;
|
void clickLeft(tribool down, bool previousState) override;
|
||||||
void clickRight(tribool down, bool previousState) override;
|
void clickRight(tribool down, bool previousState) override;
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::function<void(CreatureID,int)> onRecruit; //void (int ID, int amount) <-- call to recruit creatures
|
std::function<void(CreatureID,int)> onRecruit; //void (int ID, int amount) <-- call to recruit creatures
|
||||||
@ -89,7 +89,7 @@ class CRecruitmentWindow : public CStatusbarWindow
|
|||||||
void buy();
|
void buy();
|
||||||
void sliderMoved(int to);
|
void sliderMoved(int to);
|
||||||
|
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
public:
|
public:
|
||||||
const CGDwelling * const dwelling;
|
const CGDwelling * const dwelling;
|
||||||
CRecruitmentWindow(const CGDwelling * Dwelling, int Level, const CArmedInstance * Dst, const std::function<void(CreatureID,int)> & Recruit, int y_offset = 0);
|
CRecruitmentWindow(const CGDwelling * Dwelling, int Level, const CArmedInstance * Dst, const std::function<void(CreatureID,int)> & Recruit, int y_offset = 0);
|
||||||
@ -233,6 +233,9 @@ public:
|
|||||||
|
|
||||||
std::shared_ptr<CLabel> title;
|
std::shared_ptr<CLabel> title;
|
||||||
std::shared_ptr<CLabel> cost;
|
std::shared_ptr<CLabel> cost;
|
||||||
|
std::shared_ptr<CLabel> heroesForHire;
|
||||||
|
std::shared_ptr<CTextBox> heroDescription;
|
||||||
|
|
||||||
std::shared_ptr<CTextBox> rumor;
|
std::shared_ptr<CTextBox> rumor;
|
||||||
|
|
||||||
CTavernWindow(const CGObjectInstance * TavernObj);
|
CTavernWindow(const CGObjectInstance * TavernObj);
|
||||||
@ -240,7 +243,7 @@ public:
|
|||||||
|
|
||||||
void recruitb();
|
void recruitb();
|
||||||
void thievesguildb();
|
void thievesguildb();
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCallback;
|
class CCallback;
|
||||||
@ -414,7 +417,7 @@ class CUniversityWindow : public CStatusbarWindow
|
|||||||
int ID;//id of selected skill
|
int ID;//id of selected skill
|
||||||
CUniversityWindow * parent;
|
CUniversityWindow * parent;
|
||||||
|
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
void clickLeft(tribool down, bool previousState) override;
|
void clickLeft(tribool down, bool previousState) override;
|
||||||
void clickRight(tribool down, bool previousState) override;
|
void clickRight(tribool down, bool previousState) override;
|
||||||
void hover(bool on) override;
|
void hover(bool on) override;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "../battle/BattleInterfaceClasses.h"
|
#include "../battle/BattleInterfaceClasses.h"
|
||||||
#include "../adventureMap/AdventureMapInterface.h"
|
#include "../adventureMap/AdventureMapInterface.h"
|
||||||
#include "../windows/CMessage.h"
|
#include "../windows/CMessage.h"
|
||||||
|
#include "../render/Canvas.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
#include "../renderSDL/SDL_Extensions.h"
|
||||||
#include "../gui/CursorHandler.h"
|
#include "../gui/CursorHandler.h"
|
||||||
#include "../gui/Shortcut.h"
|
#include "../gui/Shortcut.h"
|
||||||
@ -41,10 +42,10 @@
|
|||||||
|
|
||||||
#include <SDL_surface.h>
|
#include <SDL_surface.h>
|
||||||
|
|
||||||
void CSimpleWindow::show(SDL_Surface * to)
|
void CSimpleWindow::show(Canvas & to)
|
||||||
{
|
{
|
||||||
if(bitmap)
|
if(bitmap)
|
||||||
CSDL_Ext::blitAt(bitmap,pos.x,pos.y,to);
|
CSDL_Ext::blitAt(bitmap, pos.x, pos.y, to.getInternalSurface());
|
||||||
}
|
}
|
||||||
CSimpleWindow::~CSimpleWindow()
|
CSimpleWindow::~CSimpleWindow()
|
||||||
{
|
{
|
||||||
@ -168,14 +169,14 @@ void CInfoWindow::close()
|
|||||||
LOCPLINT->showingDialog->setn(false);
|
LOCPLINT->showingDialog->setn(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInfoWindow::show(SDL_Surface * to)
|
void CInfoWindow::show(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::show(to);
|
CIntObject::show(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
CInfoWindow::~CInfoWindow() = default;
|
CInfoWindow::~CInfoWindow() = default;
|
||||||
|
|
||||||
void CInfoWindow::showAll(SDL_Surface * to)
|
void CInfoWindow::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
CSimpleWindow::show(to);
|
CSimpleWindow::show(to);
|
||||||
CIntObject::showAll(to);
|
CIntObject::showAll(to);
|
||||||
@ -261,9 +262,9 @@ void CInfoPopup::close()
|
|||||||
WindowBase::close();
|
WindowBase::close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInfoPopup::show(SDL_Surface * to)
|
void CInfoPopup::show(Canvas & to)
|
||||||
{
|
{
|
||||||
CSDL_Ext::blitAt(bitmap,pos.x,pos.y,to);
|
CSDL_Ext::blitAt(bitmap,pos.x,pos.y,to.getInternalSurface());
|
||||||
}
|
}
|
||||||
|
|
||||||
CInfoPopup::~CInfoPopup()
|
CInfoPopup::~CInfoPopup()
|
||||||
|
@ -36,7 +36,7 @@ class CSimpleWindow : public WindowBase
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SDL_Surface * bitmap; //background
|
SDL_Surface * bitmap; //background
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
CSimpleWindow():bitmap(nullptr){};
|
CSimpleWindow():bitmap(nullptr){};
|
||||||
virtual ~CSimpleWindow();
|
virtual ~CSimpleWindow();
|
||||||
};
|
};
|
||||||
@ -54,8 +54,8 @@ public:
|
|||||||
|
|
||||||
virtual void close();
|
virtual void close();
|
||||||
|
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
void sliderMoved(int to);
|
void sliderMoved(int to);
|
||||||
|
|
||||||
CInfoWindow(std::string Text, PlayerColor player, const TCompsInfo & comps = TCompsInfo(), const TButtonsInfo & Buttons = TButtonsInfo());
|
CInfoWindow(std::string Text, PlayerColor player, const TCompsInfo & comps = TCompsInfo(), const TButtonsInfo & Buttons = TButtonsInfo());
|
||||||
@ -102,7 +102,7 @@ public:
|
|||||||
bool free; //TODO: comment me
|
bool free; //TODO: comment me
|
||||||
SDL_Surface * bitmap; //popup background
|
SDL_Surface * bitmap; //popup background
|
||||||
void close() override;
|
void close() override;
|
||||||
void show(SDL_Surface * to) override;
|
void show(Canvas & to) override;
|
||||||
CInfoPopup(SDL_Surface * Bitmap, int x, int y, bool Free=false);
|
CInfoPopup(SDL_Surface * Bitmap, int x, int y, bool Free=false);
|
||||||
CInfoPopup(SDL_Surface * Bitmap, const Point &p, ETextAlignment alignment, bool Free=false);
|
CInfoPopup(SDL_Surface * Bitmap, const Point &p, ETextAlignment alignment, bool Free=false);
|
||||||
CInfoPopup(SDL_Surface * Bitmap = nullptr, bool Free = false);
|
CInfoPopup(SDL_Surface * Bitmap = nullptr, bool Free = false);
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "filesystem/ResourceID.h"
|
#include "filesystem/ResourceID.h"
|
||||||
#include "gui/CGuiHandler.h"
|
#include "gui/CGuiHandler.h"
|
||||||
#include "gui/WindowHandler.h"
|
#include "gui/WindowHandler.h"
|
||||||
|
#include "render/Canvas.h"
|
||||||
#include "lobby/CSavingScreen.h"
|
#include "lobby/CSavingScreen.h"
|
||||||
#include "widgets/Buttons.h"
|
#include "widgets/Buttons.h"
|
||||||
#include "widgets/Images.h"
|
#include "widgets/Images.h"
|
||||||
@ -147,14 +148,14 @@ void SettingsMainWindow::closeAndPushEvent(EUserEvent code)
|
|||||||
GH.pushUserEvent(code);
|
GH.pushUserEvent(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsMainWindow::showAll(SDL_Surface *to)
|
void SettingsMainWindow::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
auto color = LOCPLINT ? LOCPLINT->playerID : PlayerColor(1);
|
auto color = LOCPLINT ? LOCPLINT->playerID : PlayerColor(1);
|
||||||
if(settings["session"]["spectate"].Bool())
|
if(settings["session"]["spectate"].Bool())
|
||||||
color = PlayerColor(1); // TODO: Spectator shouldn't need special code for UI colors
|
color = PlayerColor(1); // TODO: Spectator shouldn't need special code for UI colors
|
||||||
|
|
||||||
CIntObject::showAll(to);
|
CIntObject::showAll(to);
|
||||||
CMessage::drawBorder(color, to, pos.w+28, pos.h+29, pos.x-14, pos.y-15);
|
CMessage::drawBorder(color, to.getInternalSurface(), pos.w+28, pos.h+29, pos.x-14, pos.y-15);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsMainWindow::onScreenResize()
|
void SettingsMainWindow::onScreenResize()
|
||||||
|
@ -41,7 +41,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
SettingsMainWindow(BattleInterface * parentBattleInterface = nullptr);
|
SettingsMainWindow(BattleInterface * parentBattleInterface = nullptr);
|
||||||
|
|
||||||
void showAll(SDL_Surface * to) override;
|
void showAll(Canvas & to) override;
|
||||||
void onScreenResize() override;
|
void onScreenResize() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,8 +42,6 @@ namespace BitmapHandler
|
|||||||
|
|
||||||
QImage loadH3PCX(ui8 * pcx, size_t size)
|
QImage loadH3PCX(ui8 * pcx, size_t size)
|
||||||
{
|
{
|
||||||
//SDL_Surface * ret;
|
|
||||||
|
|
||||||
Epcxformat format;
|
Epcxformat format;
|
||||||
int it = 0;
|
int it = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user