[nostalgia/core] Move Nostalgia graphics type models to new setTypeInfo
This commit is contained in:
parent
be16229bf7
commit
8e297f32d4
@ -28,11 +28,13 @@ using Color16 = uint16_t;
|
|||||||
using Color32 = uint32_t;
|
using Color32 = uint32_t;
|
||||||
|
|
||||||
struct NostalgiaPalette {
|
struct NostalgiaPalette {
|
||||||
|
static constexpr auto TypeName = "nostalgia::core::NostalgiaPalette";
|
||||||
static constexpr auto Fields = 1;
|
static constexpr auto Fields = 1;
|
||||||
ox::Vector<Color16> colors;
|
ox::Vector<Color16> colors;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NostalgiaGraphic {
|
struct NostalgiaGraphic {
|
||||||
|
static constexpr auto TypeName = "nostalgia::core::NostalgiaGraphic";
|
||||||
static constexpr auto Fields = 6;
|
static constexpr auto Fields = 6;
|
||||||
int8_t bpp = 0;
|
int8_t bpp = 0;
|
||||||
// rows and columns are really only used by TileSheetEditor
|
// rows and columns are really only used by TileSheetEditor
|
||||||
@ -45,14 +47,14 @@ struct NostalgiaGraphic {
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ox::Error model(T *io, NostalgiaPalette *pal) {
|
ox::Error model(T *io, NostalgiaPalette *pal) {
|
||||||
io->setTypeInfo("nostalgia::core::NostalgiaPalette", NostalgiaPalette::Fields);
|
io->template setTypeInfo<NostalgiaPalette>();
|
||||||
oxReturnError(io->field("colors", &pal->colors));
|
oxReturnError(io->field("colors", &pal->colors));
|
||||||
return OxError(0);
|
return OxError(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ox::Error model(T *io, NostalgiaGraphic *ng) {
|
ox::Error model(T *io, NostalgiaGraphic *ng) {
|
||||||
io->setTypeInfo("nostalgia::core::NostalgiaGraphic", NostalgiaGraphic::Fields);
|
io->template setTypeInfo<NostalgiaGraphic>();
|
||||||
oxReturnError(io->field("bpp", &ng->bpp));
|
oxReturnError(io->field("bpp", &ng->bpp));
|
||||||
oxReturnError(io->field("rows", &ng->rows));
|
oxReturnError(io->field("rows", &ng->rows));
|
||||||
oxReturnError(io->field("columns", &ng->columns));
|
oxReturnError(io->field("columns", &ng->columns));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user