1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00
xn65/sources/pipeline/compiler.cpp
2024-11-08 11:13:44 -03:00

38 lines
933 B
C++

#include "pipeline/compiler.hpp"
#include "pipeline/writer.hpp"
namespace xna {
ContentCompiler::ContentCompiler() {
const auto writers = typeWriterFactory->Initialize();
for (auto& writer : writers)
AddTypeWriter(writer);
for (auto& dic : writerInstances) {
auto& writer = dic.second;
AddTypeWriter(writer);
}
}
void ContentCompiler::Compile(
P_Stream const& output,
Object& value,
TargetPlatform targetPlatform,
GraphicsProfile targetProfile,
bool compressContent,
String const& rootDirectory,
String const& referenceRelocationPath) {
if (compressContent)
compressContent = ShouldCompressContent(targetPlatform, value);
auto _this = shared_from_this();
auto contentWriter = unew<ContentWriter>(
_this, output, targetPlatform,
targetProfile, compressContent,
rootDirectory, referenceRelocationPath);
contentWriter->WriteObject(value);
contentWriter->FlushOutput();
}
}