1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00
xn65/framework/pipeline/compiler.cpp

38 lines
943 B
C++
Raw Normal View History

2024-08-07 15:23:31 -03:00
#include "xna/pipeline/compiler.hpp"
2024-09-06 21:22:38 -03:00
#include "xna/pipeline/writer.hpp"
2024-08-07 15:23:31 -03:00
namespace xna {
2024-09-06 21:22:38 -03:00
ContentCompiler::ContentCompiler() {
const auto writers = typeWriterFactory->Initialize();
2024-08-07 15:23:31 -03:00
2024-09-06 21:22:38 -03:00
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();
}
2024-08-07 15:23:31 -03:00
}