[IFont_s] Font_s interface added
This commit is contained in:
parent
509740b747
commit
f6d367e28b
@ -425,6 +425,7 @@ namespace Components
|
|||||||
// Register asset interfaces
|
// Register asset interfaces
|
||||||
if (ZoneBuilder::IsEnabled())
|
if (ZoneBuilder::IsEnabled())
|
||||||
{
|
{
|
||||||
|
AssetHandler::RegisterInterface(new Assets::IFont_s());
|
||||||
AssetHandler::RegisterInterface(new Assets::IXModel());
|
AssetHandler::RegisterInterface(new Assets::IXModel());
|
||||||
AssetHandler::RegisterInterface(new Assets::IFxWorld());
|
AssetHandler::RegisterInterface(new Assets::IFxWorld());
|
||||||
AssetHandler::RegisterInterface(new Assets::IMapEnts());
|
AssetHandler::RegisterInterface(new Assets::IMapEnts());
|
||||||
|
@ -74,6 +74,7 @@ namespace Components
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "AssetInterfaces/IFont_s.hpp"
|
||||||
#include "AssetInterfaces/IXModel.hpp"
|
#include "AssetInterfaces/IXModel.hpp"
|
||||||
#include "AssetInterfaces/IFxWorld.hpp"
|
#include "AssetInterfaces/IFxWorld.hpp"
|
||||||
#include "AssetInterfaces/IMapEnts.hpp"
|
#include "AssetInterfaces/IMapEnts.hpp"
|
||||||
|
51
src/Components/Modules/AssetInterfaces/IFont_s.cpp
Normal file
51
src/Components/Modules/AssetInterfaces/IFont_s.cpp
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#include "STDInclude.hpp"
|
||||||
|
|
||||||
|
namespace Assets
|
||||||
|
{
|
||||||
|
void IFont_s::mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
||||||
|
{
|
||||||
|
Game::Font_s *asset = header.font;
|
||||||
|
|
||||||
|
if (asset->image)
|
||||||
|
{
|
||||||
|
builder->loadAsset(Game::ASSET_TYPE_MATERIAL, asset->image);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asset->glowImage)
|
||||||
|
{
|
||||||
|
builder->loadAsset(Game::ASSET_TYPE_MATERIAL, asset->glowImage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFont_s::save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
||||||
|
{
|
||||||
|
AssertSize(Game::Font_s, 24);
|
||||||
|
AssertSize(Game::FontEntry, 24);
|
||||||
|
|
||||||
|
Utils::Stream* buffer = builder->getBuffer();
|
||||||
|
Game::Font_s* asset = header.font;
|
||||||
|
Game::Font_s* dest = buffer->dest<Game::Font_s>();
|
||||||
|
|
||||||
|
buffer->save(asset);
|
||||||
|
|
||||||
|
buffer->pushBlock(Game::XFILE_BLOCK_VIRTUAL);
|
||||||
|
|
||||||
|
if (asset->name)
|
||||||
|
{
|
||||||
|
buffer->saveString(asset->name);
|
||||||
|
Utils::Stream::ClearPointer(&dest->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
dest->image = builder->saveSubAsset(Game::ASSET_TYPE_MATERIAL, asset->image).material;
|
||||||
|
dest->glowImage = builder->saveSubAsset(Game::ASSET_TYPE_MATERIAL, asset->glowImage).material;
|
||||||
|
|
||||||
|
if (asset->characters)
|
||||||
|
{
|
||||||
|
buffer->align(Utils::Stream::ALIGN_4);
|
||||||
|
buffer->saveArray(asset->characters, asset->entries);
|
||||||
|
Utils::Stream::ClearPointer(&dest->characters);
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer->popBlock();
|
||||||
|
}
|
||||||
|
}
|
14
src/Components/Modules/AssetInterfaces/IFont_s.hpp
Normal file
14
src/Components/Modules/AssetInterfaces/IFont_s.hpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace Assets
|
||||||
|
{
|
||||||
|
class IFont_s : public Components::AssetHandler::IAsset
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_FONT; };
|
||||||
|
|
||||||
|
virtual void save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
|
||||||
|
virtual void mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
|
||||||
|
// virtual void load(Game::XAssetHeader* header, std::string name, Components::ZoneBuilder::Zone* builder) override;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user