统一 Image 和 Sprite 语义到目前的 Image/Sprite 结构体而非之前的类定义

This commit is contained in:
2026-06-09 10:28:29 +08:00
parent 56eec9e9d2
commit feb088a854
16 changed files with 166786 additions and 167030 deletions
@@ -331,7 +331,7 @@ namespace
const std::vector<uint16_t>& atlas_pixels,
int32_t atlas_height)
{
std::ofstream file(OutputHeaderPath);
std::ofstream file(OutputHeaderPath, std::ios::binary);
if (!file.good())
{
std::cerr << "Open output header failed: " << OutputHeaderPath << std::endl;
@@ -342,7 +342,7 @@ namespace
file << "#pragma once\n";
file << "#include <cstdint>\n";
file << "#include \"Image.h\"\n";
file << "#include \"SpriteRegion.h\"\n\n";
file << "#include \"Sprite.h\"\n\n";
file << "namespace TomAtlas\n";
file << "{\n";
file << "\tstatic const int32_t tom_atlas_width = " << AtlasWidth << ";\n";
@@ -355,8 +355,15 @@ namespace
const size_t end = std::min(i + 12, atlas_pixels.size());
for (size_t j = i; j < end; ++j)
{
if (j > i)
{
file << " ";
}
WritePixel5551(file, atlas_pixels[j]);
file << ", ";
if (j + 1 < atlas_pixels.size())
{
file << ",";
}
}
file << "\n";
}
@@ -369,7 +376,7 @@ namespace
for (size_t i = 0; i < regions.size(); ++i)
{
const AtlasRegion& region = regions[i];
file << "\tstatic const RenderData::SpriteRegion "
file << "\tstatic const RenderData::Sprite "
<< region.source->region_name
<< "(&image, "
<< region.x << ", "