Skip to content

Commit

Permalink
add: export palette when exporting sprite
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelesaux committed May 4, 2024
1 parent 3d83ec4 commit b1a8492
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ui/martine-ui/export_sprite_board.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit b1a8492

Please sign in to comment.