diff --git a/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.CompactPalette;1 b/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.CompactPalette;1 new file mode 100644 index 0000000..ef34e1e --- /dev/null +++ b/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.CompactPalette;1 @@ -0,0 +1,23 @@ +O1;net.drinkingtea.ox.TypeDescriptor;1;{ + "fieldList" : + [ + { + "fieldName" : "pages", + "subscriptLevels" : 2, + "subscriptStack" : + [ + { + "subscriptType" : 4 + }, + { + "subscriptType" : 4 + } + ], + "typeId" : "B.uint16;0" + } + ], + "preloadable" : true, + "primitiveType" : 5, + "typeName" : "net.drinkingtea.nostalgia.gfx.CompactPalette", + "typeVersion" : 1 +} \ No newline at end of file diff --git a/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.CompactTileSheet;1 b/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.CompactTileSheet;1 new file mode 100644 index 0000000..277efdd --- /dev/null +++ b/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.CompactTileSheet;1 @@ -0,0 +1,28 @@ +O1;net.drinkingtea.ox.TypeDescriptor;1;{ + "fieldList" : + [ + { + "fieldName" : "bpp", + "typeId" : "B.int8;0" + }, + { + "fieldName" : "defaultPalette", + "typeId" : "net.drinkingtea.ox.FileAddress;1" + }, + { + "fieldName" : "pixels", + "subscriptLevels" : 1, + "subscriptStack" : + [ + { + "subscriptType" : 4 + } + ], + "typeId" : "B.uint8;0" + } + ], + "preloadable" : true, + "primitiveType" : 5, + "typeName" : "net.drinkingtea.nostalgia.gfx.CompactTileSheet", + "typeVersion" : 1 +} \ No newline at end of file diff --git a/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.Palette.PalettePage;2 b/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.Palette.PalettePage;2 new file mode 100644 index 0000000..5b26ee3 --- /dev/null +++ b/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.Palette.PalettePage;2 @@ -0,0 +1,23 @@ +O1;net.drinkingtea.ox.TypeDescriptor;1;{ + "fieldList" : + [ + { + "fieldName" : "name", + "typeId" : "net.drinkingtea.ox.BasicString#8#;1" + }, + { + "fieldName" : "colors", + "subscriptLevels" : 1, + "subscriptStack" : + [ + { + "subscriptType" : 4 + } + ], + "typeId" : "net.drinkingtea.nostalgia.gfx.PaletteColor;2" + } + ], + "primitiveType" : 5, + "typeName" : "net.drinkingtea.nostalgia.gfx.Palette.PalettePage", + "typeVersion" : 2 +} \ No newline at end of file diff --git a/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.Palette;5 b/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.Palette;5 new file mode 100644 index 0000000..797c7ce --- /dev/null +++ b/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.Palette;5 @@ -0,0 +1,31 @@ +O1;net.drinkingtea.ox.TypeDescriptor;1;{ + "fieldList" : + [ + { + "fieldName" : "colorNames", + "subscriptLevels" : 1, + "subscriptStack" : + [ + { + "subscriptType" : 4 + } + ], + "typeId" : "net.drinkingtea.ox.BasicString#8#;1" + }, + { + "fieldName" : "pages", + "subscriptLevels" : 1, + "subscriptStack" : + [ + { + "subscriptType" : 4 + } + ], + "typeId" : "net.drinkingtea.nostalgia.gfx.Palette.PalettePage;2" + } + ], + "preloadable" : true, + "primitiveType" : 5, + "typeName" : "net.drinkingtea.nostalgia.gfx.Palette", + "typeVersion" : 5 +} \ No newline at end of file diff --git a/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.PaletteColor;2 b/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.PaletteColor;2 new file mode 100644 index 0000000..24ca751 --- /dev/null +++ b/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.PaletteColor;2 @@ -0,0 +1,24 @@ +O1;net.drinkingtea.ox.TypeDescriptor;1;{ + "fieldList" : + [ + { + "fieldName" : "r", + "typeId" : "B.uint8;0" + }, + { + "fieldName" : "g", + "typeId" : "B.uint8;0" + }, + { + "fieldName" : "b", + "typeId" : "B.uint8;0" + }, + { + "fieldName" : "a", + "typeId" : "B.uint8;0" + } + ], + "primitiveType" : 5, + "typeName" : "net.drinkingtea.nostalgia.gfx.PaletteColor", + "typeVersion" : 2 +} \ No newline at end of file diff --git a/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.TileSheet.SubSheet;5 b/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.TileSheet.SubSheet;5 new file mode 100644 index 0000000..03740cf --- /dev/null +++ b/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.TileSheet.SubSheet;5 @@ -0,0 +1,46 @@ +O1;net.drinkingtea.ox.TypeDescriptor;1;{ + "fieldList" : + [ + { + "fieldName" : "id", + "typeId" : "B.int32;0" + }, + { + "fieldName" : "name", + "typeId" : "net.drinkingtea.ox.BasicString#8#;1" + }, + { + "fieldName" : "rows", + "typeId" : "B.int32;0" + }, + { + "fieldName" : "columns", + "typeId" : "B.int32;0" + }, + { + "fieldName" : "subsheets", + "subscriptLevels" : 1, + "subscriptStack" : + [ + { + "subscriptType" : 4 + } + ], + "typeId" : "net.drinkingtea.nostalgia.gfx.TileSheet.SubSheet;5" + }, + { + "fieldName" : "pixels", + "subscriptLevels" : 1, + "subscriptStack" : + [ + { + "subscriptType" : 4 + } + ], + "typeId" : "B.uint8;0" + } + ], + "primitiveType" : 5, + "typeName" : "net.drinkingtea.nostalgia.gfx.TileSheet.SubSheet", + "typeVersion" : 5 +} \ No newline at end of file diff --git a/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.TileSheet;5 b/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.TileSheet;5 new file mode 100644 index 0000000..a789389 --- /dev/null +++ b/deps/nostalgia/sample_project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.TileSheet;5 @@ -0,0 +1,24 @@ +O1;net.drinkingtea.ox.TypeDescriptor;1;{ + "fieldList" : + [ + { + "fieldName" : "bpp", + "typeId" : "B.int8;0" + }, + { + "fieldName" : "idIt", + "typeId" : "B.int32;0" + }, + { + "fieldName" : "defaultPalette", + "typeId" : "net.drinkingtea.ox.BasicString#8#;1" + }, + { + "fieldName" : "subsheet", + "typeId" : "net.drinkingtea.nostalgia.gfx.TileSheet.SubSheet;5" + } + ], + "primitiveType" : 5, + "typeName" : "net.drinkingtea.nostalgia.gfx.TileSheet", + "typeVersion" : 5 +} \ No newline at end of file diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp index fce0783..4809aa1 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp @@ -36,21 +36,12 @@ OX_MODEL_BEGIN(TileSheetEditorConfig) OX_MODEL_END() static ox::Vector normalizePixelSizes( - ox::Vector const&inPixels, - int const bpp) noexcept { - uint_t const bytesPerTile = bpp == 8 ? PixelsPerTile : PixelsPerTile / 2; + ox::Vector const&inPixels) noexcept { ox::Vector outPixels; - if (bytesPerTile == 64) { // 8 BPP - outPixels.resize(inPixels.size()); - for (std::size_t i = 0; i < inPixels.size(); ++i) { - outPixels[i] = inPixels[i]; - } - } else { // 4 BPP - outPixels.resize(inPixels.size() * 2); - for (std::size_t i = 0; i < inPixels.size(); ++i) { - outPixels[i * 2 + 0] = inPixels[i] & 0xF; - outPixels[i * 2 + 1] = inPixels[i] >> 4; - } + outPixels.reserve(inPixels.size()); + outPixels.resize(inPixels.size()); + for (std::size_t i = 0; i < inPixels.size(); ++i) { + outPixels[i] = inPixels[i]; } return outPixels; } @@ -409,12 +400,11 @@ void TileSheetEditorImGui::showSubsheetEditor() noexcept { ox::Error TileSheetEditorImGui::exportSubhseetToPng(int const scale) const noexcept { OX_REQUIRE(path, studio::saveFile({{"PNG", "png"}})); // subsheet to png - auto const&img = m_model.img(); auto const&s = m_model.activeSubSheet(); auto const&pal = m_model.pal(); auto const width = s.columns * TileWidth; auto const height = s.rows * TileHeight; - auto pixels = normalizePixelSizes(s.pixels, img.bpp); + auto pixels = normalizePixelSizes(s.pixels); pixels = normalizePixelArrangement(pixels, s.columns, scale); auto const err = toPngFile( path,