2021-08-13 14:52:58 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "2d/CCSpriteSheetLoader.h"
|
|
|
|
#include "base/CCValue.h"
|
|
|
|
#include "base/CCData.h"
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
NS_AX_BEGIN
|
2021-08-13 14:52:58 +08:00
|
|
|
|
|
|
|
class PlistSpriteSheetLoader : public SpriteSheetLoader
|
|
|
|
{
|
|
|
|
public:
|
2021-08-17 12:04:45 +08:00
|
|
|
static constexpr uint32_t FORMAT = SpriteSheetFormat::PLIST;
|
2021-08-13 14:52:58 +08:00
|
|
|
|
2021-08-17 12:04:45 +08:00
|
|
|
uint32_t getFormat() override { return FORMAT; }
|
2021-12-26 23:26:34 +08:00
|
|
|
void load(std::string_view filePath, SpriteFrameCache& cache) override;
|
|
|
|
void load(std::string_view filePath, Texture2D* texture, SpriteFrameCache& cache) override;
|
|
|
|
void load(std::string_view filePath, std::string_view textureFileName, SpriteFrameCache& cache) override;
|
2021-08-13 14:52:58 +08:00
|
|
|
void load(const Data& content, Texture2D* texture, SpriteFrameCache& cache) override;
|
2021-12-26 23:26:34 +08:00
|
|
|
void reload(std::string_view filePath, SpriteFrameCache& cache) override;
|
2021-08-13 14:52:58 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/*Adds multiple Sprite Frames with a dictionary. The texture will be associated with the created sprite frames.
|
|
|
|
*/
|
2021-12-25 10:04:45 +08:00
|
|
|
void addSpriteFramesWithDictionary(ValueMap& dictionary,
|
|
|
|
Texture2D* texture,
|
2021-12-26 23:26:34 +08:00
|
|
|
std::string_view plist,
|
2021-12-25 10:04:45 +08:00
|
|
|
SpriteFrameCache& cache);
|
2021-08-13 14:52:58 +08:00
|
|
|
|
|
|
|
/*Adds multiple Sprite Frames with a dictionary. The texture will be associated with the created sprite frames.
|
|
|
|
*/
|
2021-12-25 10:04:45 +08:00
|
|
|
void addSpriteFramesWithDictionary(ValueMap& dict,
|
2021-12-26 23:26:34 +08:00
|
|
|
std::string_view texturePath,
|
|
|
|
std::string_view plist,
|
2021-12-25 10:04:45 +08:00
|
|
|
SpriteFrameCache& cache);
|
|
|
|
|
|
|
|
void reloadSpriteFramesWithDictionary(ValueMap& dict,
|
|
|
|
Texture2D* texture,
|
2021-12-26 23:26:34 +08:00
|
|
|
std::string_view plist,
|
2021-12-25 10:04:45 +08:00
|
|
|
SpriteFrameCache& cache);
|
2021-08-13 14:52:58 +08:00
|
|
|
};
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
NS_AX_END
|