Files
ArchezandGarrett Cox 8cec7afa25 Bump lus with packages, new namespace, and global factories (#292)
* imgui

* detangle zapdutils

* ship namespace

* register global factories

* readfb

* deps

* bump submodules

* keyframe

* bump modules
2024-05-22 09:05:03 -05:00

25 lines
725 B
C++

#include "2s2h/resource/importer/BackgroundFactory.h"
#include "2s2h/resource/type/Background.h"
#include "spdlog/spdlog.h"
namespace SOH {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryBackgroundV0::ReadResource(std::shared_ptr<Ship::File> file) {
if (!FileHasValidFormatAndReader(file)) {
return nullptr;
}
auto background = std::make_shared<Background>(file->InitData);
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
uint32_t dataSize = reader->ReadUInt32();
background->Data.reserve(dataSize);
for (uint32_t i = 0; i < dataSize; i++) {
background->Data.push_back(reader->ReadUByte());
}
return background;
}
} // namespace SOH