From b1a8492a237b9bd0f49974275e31499143a8ce52 Mon Sep 17 00:00:00 2001 From: Jerome Le Saux Date: Sat, 4 May 2024 14:46:35 +0200 Subject: [PATCH] add: export palette when exporting sprite --- ui/martine-ui/export_sprite_board.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui/martine-ui/export_sprite_board.go b/ui/martine-ui/export_sprite_board.go index 6994b07..34faedb 100644 --- a/ui/martine-ui/export_sprite_board.go +++ b/ui/martine-ui/export_sprite_board.go @@ -13,11 +13,13 @@ import ( "fyne.io/fyne/v2/widget" wgt "github.com/jeromelesaux/fyne-io/widget" "github.com/jeromelesaux/martine/config" + "github.com/jeromelesaux/martine/constants" "github.com/jeromelesaux/martine/export" "github.com/jeromelesaux/martine/export/amsdos" "github.com/jeromelesaux/martine/export/ascii" "github.com/jeromelesaux/martine/export/compression" "github.com/jeromelesaux/martine/export/diskimage" + "github.com/jeromelesaux/martine/export/impdraw/palette" impPalette "github.com/jeromelesaux/martine/export/impdraw/palette" "github.com/jeromelesaux/martine/export/impdraw/tile" "github.com/jeromelesaux/martine/export/ocpartstudio/window" @@ -150,6 +152,13 @@ func (m *MartineUI) ExportSpriteBoard(s *menu.SpriteMenu) { code += routine } + kitPalette := palette.KitPalette{} + for i := 0; i < len(s.Palette()); i++ { + kitPalette.Colors[i] = constants.NewCpcPlusColor(s.Palette()[i]) + } + code += "palette:\n" + code += kitPalette.ToString() + if err := amsdos.SaveStringOSFile(s.ExportFolderPath+string(filepath.Separator)+"compiled_sprites.asm", code); err != nil { pi.Hide() dialog.NewError(err, m.window).Show()