1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Added RenderHandler that acts as factory for images and animations

This commit is contained in:
Ivan Savenko
2023-09-04 18:01:44 +03:00
parent 3f921fa771
commit 1d0e696db6
38 changed files with 246 additions and 126 deletions

View File

@@ -0,0 +1,40 @@
/*
* RenderHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdInc.h"
#include "RenderHandler.h"
#include "../render/CAnimation.h"
#include "SDLImage.h"
std::shared_ptr<IImage> RenderHandler::loadImage(const ImagePath & path)
{
return loadImage(path, EImageBlitMode::ALPHA);
}
std::shared_ptr<IImage> RenderHandler::loadImage(const ImagePath & path, EImageBlitMode mode)
{
return std::make_shared<SDLImage>(path, mode);
}
std::shared_ptr<IImage> RenderHandler::createImage(SDL_Surface * source)
{
return std::make_shared<SDLImage>(source, EImageBlitMode::ALPHA);
}
std::shared_ptr<CAnimation> RenderHandler::loadAnimation(const AnimationPath & path)
{
return std::make_shared<CAnimation>(path);
}
std::shared_ptr<CAnimation> RenderHandler::createAnimation()
{
return std::make_shared<CAnimation>();
}