2024-08-19 23:18:14 +02:00
|
|
|
/*
|
|
|
|
* AssetGenerator.h, 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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2025-01-29 10:03:58 +00:00
|
|
|
#include "ImageLocator.h"
|
|
|
|
|
2024-09-12 16:11:03 +00:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
class PlayerColor;
|
|
|
|
VCMI_LIB_NAMESPACE_END
|
|
|
|
|
2025-01-29 10:03:58 +00:00
|
|
|
class ISharedImage;
|
|
|
|
class CanvasImage;
|
|
|
|
|
2024-08-20 01:58:02 +02:00
|
|
|
class AssetGenerator
|
2024-08-19 23:18:14 +02:00
|
|
|
{
|
2024-08-29 00:37:39 +02:00
|
|
|
public:
|
2025-01-29 10:03:58 +00:00
|
|
|
using AnimationLayoutMap = std::map<size_t, std::vector<ImageLocator>>;
|
|
|
|
using CanvasPtr = std::shared_ptr<CanvasImage>;
|
|
|
|
|
|
|
|
AssetGenerator();
|
|
|
|
|
|
|
|
void initialize();
|
|
|
|
|
|
|
|
std::shared_ptr<ISharedImage> generateImage(const ImagePath & image);
|
|
|
|
|
|
|
|
std::map<ImagePath, std::shared_ptr<ISharedImage>> generateAllImages();
|
|
|
|
std::map<AnimationPath, AnimationLayoutMap> generateAllAnimations();
|
|
|
|
|
|
|
|
private:
|
|
|
|
using ImageGenerationFunctor = std::function<CanvasPtr()>;
|
|
|
|
|
|
|
|
struct PaletteAnimation
|
|
|
|
{
|
|
|
|
/// index of first color to cycle
|
|
|
|
int32_t start;
|
|
|
|
/// total numbers of colors to cycle
|
|
|
|
int32_t length;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::map<ImagePath, ImageGenerationFunctor> imageFiles;
|
|
|
|
std::map<AnimationPath, AnimationLayoutMap> animationFiles;
|
|
|
|
|
|
|
|
CanvasPtr createAdventureOptionsCleanBackground();
|
|
|
|
CanvasPtr createBigSpellBook();
|
|
|
|
CanvasPtr createPlayerColoredBackground(const PlayerColor & player);
|
|
|
|
CanvasPtr createCombatUnitNumberWindow(float multR, float multG, float multB);
|
|
|
|
CanvasPtr createCampaignBackground();
|
|
|
|
CanvasPtr createChroniclesCampaignImages(int chronicle);
|
|
|
|
CanvasPtr createPaletteShiftedImage(const AnimationPath & source, const std::vector<PaletteAnimation> & animation, int frameIndex, int paletteShiftCounter);
|
|
|
|
|
|
|
|
void createPaletteShiftedSprites();
|
|
|
|
void generatePaletteShiftedAnimation(const AnimationPath & source, const std::vector<PaletteAnimation> & animation);
|
|
|
|
|
2024-08-20 22:45:11 +02:00
|
|
|
};
|