summary refs log tree commit diff stats
path: root/tools
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-01-31 08:36:12 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-01-31 08:36:12 -0500
commitf59ed06f7810c68c854b2513b3125cf0e5586204 (patch)
treef5dd16e96658e35be0d86302c0566fa9b92e0667 /tools
parent91ab255073eb0701b22a1daf343e1a463f5d8a1b (diff)
downloadtanetane-f59ed06f7810c68c854b2513b3125cf0e5586204.tar.gz
tanetane-f59ed06f7810c68c854b2513b3125cf0e5586204.tar.bz2
tanetane-f59ed06f7810c68c854b2513b3125cf0e5586204.zip
Added datafile format
Diffstat (limited to 'tools')
-rw-r--r--tools/sprite_dumper/main.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/sprite_dumper/main.cpp b/tools/sprite_dumper/main.cpp index 4183e43..c87f544 100644 --- a/tools/sprite_dumper/main.cpp +++ b/tools/sprite_dumper/main.cpp
@@ -277,6 +277,7 @@ struct SpriteSheet {
277 for (int i=0; i<sprites.size(); i++) { 277 for (int i=0; i<sprites.size(); i++) {
278 const Palette& palette = palettes.GetPalette(i); 278 const Palette& palette = palettes.GetPalette(i);
279 FrameOutput f = sprites[i].render(m3, palette, gfxPtr); 279 FrameOutput f = sprites[i].render(m3, palette, gfxPtr);
280
280 if (f.width > maxWidth) maxWidth = f.width; 281 if (f.width > maxWidth) maxWidth = f.width;
281 if (f.height > maxHeight) maxHeight = f.height; 282 if (f.height > maxHeight) maxHeight = f.height;
282 frames.push_back(std::move(f)); 283 frames.push_back(std::move(f));
@@ -286,6 +287,12 @@ struct SpriteSheet {
286 int sheetWidth; 287 int sheetWidth;
287 int sheetHeight; 288 int sheetHeight;
288 289
290 std::ofstream datafile("out.txt");
291 datafile << maxWidth << "," << maxHeight << " cell size" << std::endl;
292 datafile << FRAMES_PER_ROW << " frames per row" << std::endl;
293 datafile << frames.size() << " frames" << std::endl;
294 datafile << std::endl;
295
289 if (frames.size() < FRAMES_PER_ROW) { 296 if (frames.size() < FRAMES_PER_ROW) {
290 sheetWidth = frames.size() * maxWidth; 297 sheetWidth = frames.size() * maxWidth;
291 sheetHeight = maxHeight; 298 sheetHeight = maxHeight;
@@ -298,6 +305,7 @@ struct SpriteSheet {
298 for (int i=0; i<frames.size(); i++) { 305 for (int i=0; i<frames.size(); i++) {
299 const FrameOutput& f = frames.at(i); 306 const FrameOutput& f = frames.at(i);
300 sheet.composite(f.image, (i%FRAMES_PER_ROW)*maxWidth, (i/FRAMES_PER_ROW)*maxHeight, Magick::OverCompositeOp); 307 sheet.composite(f.image, (i%FRAMES_PER_ROW)*maxWidth, (i/FRAMES_PER_ROW)*maxHeight, Magick::OverCompositeOp);
308 datafile << f.width << "," << f.height << "," << f.centerX << "," << f.centerY << std::endl;
301 } 309 }
302 310
303 return sheet; 311 return sheet;