diff --git a/izapple2fyne/fyneKeyboard.go b/izapple2fyne/fyneKeyboard.go index 46f260e..893c508 100644 --- a/izapple2fyne/fyneKeyboard.go +++ b/izapple2fyne/fyneKeyboard.go @@ -9,18 +9,17 @@ import ( ) type keyboard struct { - a *izapple2.Apple2 + s *state keyChannel *izapple2.KeyboardChannel controlLeft bool controlRight bool - showPages bool } -func newKeyboard(a *izapple2.Apple2) *keyboard { +func newKeyboard(s *state) *keyboard { var k keyboard - k.a = a - k.keyChannel = izapple2.NewKeyboardChannel(a) + k.s = s + k.keyChannel = izapple2.NewKeyboardChannel(s.a) return &k } @@ -95,34 +94,34 @@ func (k *keyboard) putKey(keyEvent *fyne.KeyEvent) { // Control of the emulator case fyne.KeyF1: if ctrl { - k.a.SendCommand(izapple2.CommandReset) + k.s.a.SendCommand(izapple2.CommandReset) } case fyne.KeyF5: if ctrl { - k.a.SendCommand(izapple2.CommandShowSpeed) + k.s.a.SendCommand(izapple2.CommandShowSpeed) } else { - k.a.SendCommand(izapple2.CommandToggleSpeed) + k.s.a.SendCommand(izapple2.CommandToggleSpeed) } case fyne.KeyF6: - k.a.SendCommand(izapple2.CommandToggleColor) + k.s.a.SendCommand(izapple2.CommandToggleColor) case fyne.KeyF7: - k.showPages = !k.showPages + k.s.showPages = !k.s.showPages case fyne.KeyF9: - k.a.SendCommand(izapple2.CommandDumpDebugInfo) + k.s.a.SendCommand(izapple2.CommandDumpDebugInfo) case fyne.KeyF10: - k.a.SendCommand(izapple2.CommandNextCharGenPage) + k.s.a.SendCommand(izapple2.CommandNextCharGenPage) case fyne.KeyF11: - k.a.SendCommand(izapple2.CommandToggleCPUTrace) + k.s.a.SendCommand(izapple2.CommandToggleCPUTrace) case fyne.KeyF12: case fyne.KeyPrintScreen: - err := izapple2.SaveSnapshot(k.a, "snapshot.png") + err := izapple2.SaveSnapshot(k.s.a, "snapshot.png") if err != nil { fmt.Printf("Error saving snapshoot: %v.\n.", err) } else { fmt.Println("Saving snapshot") } case fyne.KeyPause: - k.a.SendCommand(izapple2.CommandPauseUnpauseEmulator) + k.s.a.SendCommand(izapple2.CommandPauseUnpauseEmulator) } // Missing values 91 to 95. Usually control for [\]^_ diff --git a/izapple2fyne/main.go b/izapple2fyne/main.go index e61d5e4..bcd7eaa 100644 --- a/izapple2fyne/main.go +++ b/izapple2fyne/main.go @@ -1,6 +1,8 @@ package main import ( + "fmt" + "image" "time" "github.com/ivanizag/izapple2" @@ -12,42 +14,90 @@ import ( "fyne.io/fyne/canvas" "fyne.io/fyne/driver/desktop" "fyne.io/fyne/layout" + "fyne.io/fyne/theme" "fyne.io/fyne/widget" ) +type state struct { + a *izapple2.Apple2 + + showPages bool +} + func main() { - a := izapple2.MainApple() - if a != nil { - if a.IsProfiling() { + var s state + s.a = izapple2.MainApple() + if s.a != nil { + if s.a.IsProfiling() { // See the log with: // go tool pprof --pdf ~/go/bin/izapple2sdl /tmp/profile329536248/cpu.pprof > profile.pdf defer profile.Start().Stop() } - fyneRun(a) + fyneRun(&s) } } -func fyneRun(a *izapple2.Apple2) { +func fyneRun(s *state) { app := app.New() // app.SetIcon(xxx) - window := app.NewWindow("iz-" + a.Name) + window := app.NewWindow("iz-" + s.a.Name) // window.SetIcon(xxx) + bottom := widget.NewToolbar( + widget.NewToolbarAction( + theme.NewThemedResource(resourceRestartSvg, nil), func() { + s.a.SendCommand(izapple2.CommandReset) + }), + widget.NewToolbarAction( + theme.NewThemedResource(resourcePauseSvg, nil), func() { + s.a.SendCommand(izapple2.CommandPauseUnpauseEmulator) + }), + widget.NewToolbarAction( + theme.NewThemedResource(resourceFastForwardSvg, nil), func() { + s.a.SendCommand(izapple2.CommandToggleSpeed) + }), + widget.NewToolbarSeparator(), + widget.NewToolbarAction( + theme.NewThemedResource(resourcePaletteSvg, nil), func() { + s.a.SendCommand(izapple2.CommandToggleColor) + }), + widget.NewToolbarAction( + theme.NewThemedResource(resourceLayersTripleSvg, nil), func() { + s.showPages = !s.showPages + if !s.showPages { + window.SetTitle("iz-" + s.a.Name) + } + }), + widget.NewToolbarAction( + theme.NewThemedResource(resourceCameraSvg, nil), func() { + err := izapple2.SaveSnapshot(s.a, "snapshot.png") + if err != nil { + app.SendNotification(fyne.NewNotification(window.Title(), + fmt.Sprintf("Error saving snapshoot: %v.\n.", err))) + } else { + app.SendNotification(fyne.NewNotification(window.Title(), + "Saving snapshot on 'snapshot.png'")) + } + }), + widget.NewToolbarSpacer(), + widget.NewToolbarAction(theme.ViewFullScreenIcon(), func() { + window.SetFullScreen(!window.FullScreen()) + }), + ) + screen := canvas.NewImageFromImage(nil) - top := widget.NewLabel("Top") - bottom := widget.NewLabel("Bottom") - right := widget.NewLabel("Right") + screen.SetMinSize(fyne.NewSize(380, 192)) container := fyne.NewContainerWithLayout( - layout.NewBorderLayout(top, bottom, nil, right), - screen, top, bottom, right, + layout.NewBorderLayout(nil, bottom, nil, nil), + screen, bottom, ) window.SetContent(container) window.SetPadded(false) - registerKeyboardEvents(a, window.Canvas()) + registerKeyboardEvents(s, window.Canvas()) - go a.Run() + go s.a.Run() ticker := time.NewTicker(60 * time.Millisecond) done := make(chan bool) @@ -57,8 +107,14 @@ func fyneRun(a *izapple2.Apple2) { case <-done: return case <-ticker.C: - if !a.IsPaused() { - img := a.Snapshot() + if !s.a.IsPaused() { + var img *image.RGBA + if s.showPages { + img = s.a.SnapshotParts() + window.SetTitle(fmt.Sprintf("%v %v %vx%v", s.a.Name, s.a.VideoModeName(), img.Rect.Dx()/2, img.Rect.Dy()/2)) + } else { + img = s.a.Snapshot() + } screen.Image = img canvas.Refresh(screen) } @@ -75,8 +131,8 @@ func fyneRun(a *izapple2.Apple2) { } -func registerKeyboardEvents(a *izapple2.Apple2, canvas fyne.Canvas) { - kp := newKeyboard(a) +func registerKeyboardEvents(s *state, canvas fyne.Canvas) { + kp := newKeyboard(s) // Koyboard events canvas.SetOnTypedKey(func(ke *fyne.KeyEvent) { diff --git a/izapple2fyne/notes.md b/izapple2fyne/notes.md new file mode 100644 index 0000000..3b44b38 --- /dev/null +++ b/izapple2fyne/notes.md @@ -0,0 +1,13 @@ +# Fyne + +- Tooltip on widgets. As there is a Hoverable, it would be nice to have Tooltipable¿? and check on mouse move. +``` +type Tooltipable interface { + Tooltip() string +} +``` + +- Text on the toolabar items, at least tooltips +- Missing keys for Pause and for PrintScreen. +- RunOnMain() +- Buttons with state: pressed, disabled diff --git a/izapple2fyne/resources.go b/izapple2fyne/resources.go new file mode 100644 index 0000000..dd98c4d --- /dev/null +++ b/izapple2fyne/resources.go @@ -0,0 +1,43 @@ +package main + +import "fyne.io/fyne" + +var resourceCameraSvg = &fyne.StaticResource{ + StaticName: "camera.svg", + StaticContent: []byte{ + 60, 63, 120, 109, 108, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 48, 34, 32, 101, 110, 99, 111, 100, 105, 110, 103, 61, 34, 85, 84, 70, 45, 56, 34, 63, 62, 60, 33, 68, 79, 67, 84, 89, 80, 69, 32, 115, 118, 103, 32, 80, 85, 66, 76, 73, 67, 32, 34, 45, 47, 47, 87, 51, 67, 47, 47, 68, 84, 68, 32, 83, 86, 71, 32, 49, 46, 49, 47, 47, 69, 78, 34, 32, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 71, 114, 97, 112, 104, 105, 99, 115, 47, 83, 86, 71, 47, 49, 46, 49, 47, 68, 84, 68, 47, 115, 118, 103, 49, 49, 46, 100, 116, 100, 34, 62, 60, 115, 118, 103, 32, 120, 109, 108, 110, 115, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 50, 48, 48, 48, 47, 115, 118, 103, 34, 32, 120, 109, 108, 110, 115, 58, 120, 108, 105, 110, 107, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 49, 57, 57, 57, 47, 120, 108, 105, 110, 107, 34, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 49, 34, 32, 119, 105, 100, 116, 104, 61, 34, 50, 52, 34, 32, 104, 101, 105, 103, 104, 116, 61, 34, 50, 52, 34, 32, 118, 105, 101, 119, 66, 111, 120, 61, 34, 48, 32, 48, 32, 50, 52, 32, 50, 52, 34, 62, 60, 112, 97, 116, 104, 32, 100, 61, 34, 77, 52, 44, 52, 72, 55, 76, 57, 44, 50, 72, 49, 53, 76, 49, 55, 44, 52, 72, 50, 48, 65, 50, 44, 50, 32, 48, 32, 48, 44, 49, 32, 50, 50, 44, 54, 86, 49, 56, 65, 50, 44, 50, 32, 48, 32, 48, 44, 49, 32, 50, 48, 44, 50, 48, 72, 52, 65, 50, 44, 50, 32, 48, 32, 48, 44, 49, 32, 50, 44, 49, 56, 86, 54, 65, 50, 44, 50, 32, 48, 32, 48, 44, 49, 32, 52, 44, 52, 77, 49, 50, 44, 55, 65, 53, 44, 53, 32, 48, 32, 48, 44, 48, 32, 55, 44, 49, 50, 65, 53, 44, 53, 32, 48, 32, 48, 44, 48, 32, 49, 50, 44, 49, 55, 65, 53, 44, 53, 32, 48, 32, 48, 44, 48, 32, 49, 55, 44, 49, 50, 65, 53, 44, 53, 32, 48, 32, 48, 44, 48, 32, 49, 50, 44, 55, 77, 49, 50, 44, 57, 65, 51, 44, 51, 32, 48, 32, 48, 44, 49, 32, 49, 53, 44, 49, 50, 65, 51, 44, 51, 32, 48, 32, 48, 44, 49, 32, 49, 50, 44, 49, 53, 65, 51, 44, 51, 32, 48, 32, 48, 44, 49, 32, 57, 44, 49, 50, 65, 51, 44, 51, 32, 48, 32, 48, 44, 49, 32, 49, 50, 44, 57, 90, 34, 32, 47, 62, 60, 47, 115, 118, 103, 62}} + +var resourceFastForwardSvg = &fyne.StaticResource{ + StaticName: "fast-forward.svg", + StaticContent: []byte{ + 60, 63, 120, 109, 108, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 48, 34, 32, 101, 110, 99, 111, 100, 105, 110, 103, 61, 34, 85, 84, 70, 45, 56, 34, 63, 62, 60, 33, 68, 79, 67, 84, 89, 80, 69, 32, 115, 118, 103, 32, 80, 85, 66, 76, 73, 67, 32, 34, 45, 47, 47, 87, 51, 67, 47, 47, 68, 84, 68, 32, 83, 86, 71, 32, 49, 46, 49, 47, 47, 69, 78, 34, 32, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 71, 114, 97, 112, 104, 105, 99, 115, 47, 83, 86, 71, 47, 49, 46, 49, 47, 68, 84, 68, 47, 115, 118, 103, 49, 49, 46, 100, 116, 100, 34, 62, 60, 115, 118, 103, 32, 120, 109, 108, 110, 115, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 50, 48, 48, 48, 47, 115, 118, 103, 34, 32, 120, 109, 108, 110, 115, 58, 120, 108, 105, 110, 107, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 49, 57, 57, 57, 47, 120, 108, 105, 110, 107, 34, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 49, 34, 32, 119, 105, 100, 116, 104, 61, 34, 50, 52, 34, 32, 104, 101, 105, 103, 104, 116, 61, 34, 50, 52, 34, 32, 118, 105, 101, 119, 66, 111, 120, 61, 34, 48, 32, 48, 32, 50, 52, 32, 50, 52, 34, 62, 60, 112, 97, 116, 104, 32, 100, 61, 34, 77, 49, 51, 44, 54, 86, 49, 56, 76, 50, 49, 46, 53, 44, 49, 50, 77, 52, 44, 49, 56, 76, 49, 50, 46, 53, 44, 49, 50, 76, 52, 44, 54, 86, 49, 56, 90, 34, 32, 47, 62, 60, 47, 115, 118, 103, 62}} + +var resourceFormatFontSvg = &fyne.StaticResource{ + StaticName: "format-font.svg", + StaticContent: []byte{ + 60, 63, 120, 109, 108, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 48, 34, 32, 101, 110, 99, 111, 100, 105, 110, 103, 61, 34, 85, 84, 70, 45, 56, 34, 63, 62, 60, 33, 68, 79, 67, 84, 89, 80, 69, 32, 115, 118, 103, 32, 80, 85, 66, 76, 73, 67, 32, 34, 45, 47, 47, 87, 51, 67, 47, 47, 68, 84, 68, 32, 83, 86, 71, 32, 49, 46, 49, 47, 47, 69, 78, 34, 32, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 71, 114, 97, 112, 104, 105, 99, 115, 47, 83, 86, 71, 47, 49, 46, 49, 47, 68, 84, 68, 47, 115, 118, 103, 49, 49, 46, 100, 116, 100, 34, 62, 60, 115, 118, 103, 32, 120, 109, 108, 110, 115, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 50, 48, 48, 48, 47, 115, 118, 103, 34, 32, 120, 109, 108, 110, 115, 58, 120, 108, 105, 110, 107, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 49, 57, 57, 57, 47, 120, 108, 105, 110, 107, 34, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 49, 34, 32, 119, 105, 100, 116, 104, 61, 34, 50, 52, 34, 32, 104, 101, 105, 103, 104, 116, 61, 34, 50, 52, 34, 32, 118, 105, 101, 119, 66, 111, 120, 61, 34, 48, 32, 48, 32, 50, 52, 32, 50, 52, 34, 62, 60, 112, 97, 116, 104, 32, 100, 61, 34, 77, 49, 55, 44, 56, 72, 50, 48, 86, 50, 48, 72, 50, 49, 86, 50, 49, 72, 49, 55, 86, 50, 48, 72, 49, 56, 86, 49, 55, 72, 49, 52, 76, 49, 50, 46, 53, 44, 50, 48, 72, 49, 52, 86, 50, 49, 72, 49, 48, 86, 50, 48, 72, 49, 49, 76, 49, 55, 44, 56, 77, 49, 56, 44, 57, 76, 49, 52, 46, 53, 44, 49, 54, 72, 49, 56, 86, 57, 77, 53, 44, 51, 72, 49, 48, 67, 49, 49, 46, 49, 49, 44, 51, 32, 49, 50, 44, 51, 46, 56, 57, 32, 49, 50, 44, 53, 86, 49, 54, 72, 57, 86, 49, 49, 72, 54, 86, 49, 54, 72, 51, 86, 53, 67, 51, 44, 51, 46, 56, 57, 32, 51, 46, 56, 57, 44, 51, 32, 53, 44, 51, 77, 54, 44, 53, 86, 57, 72, 57, 86, 53, 72, 54, 90, 34, 32, 47, 62, 60, 47, 115, 118, 103, 62}} + +var resourceLayersTripleSvg = &fyne.StaticResource{ + StaticName: "layers-triple.svg", + StaticContent: []byte{ + 60, 63, 120, 109, 108, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 48, 34, 32, 101, 110, 99, 111, 100, 105, 110, 103, 61, 34, 85, 84, 70, 45, 56, 34, 63, 62, 60, 33, 68, 79, 67, 84, 89, 80, 69, 32, 115, 118, 103, 32, 80, 85, 66, 76, 73, 67, 32, 34, 45, 47, 47, 87, 51, 67, 47, 47, 68, 84, 68, 32, 83, 86, 71, 32, 49, 46, 49, 47, 47, 69, 78, 34, 32, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 71, 114, 97, 112, 104, 105, 99, 115, 47, 83, 86, 71, 47, 49, 46, 49, 47, 68, 84, 68, 47, 115, 118, 103, 49, 49, 46, 100, 116, 100, 34, 62, 60, 115, 118, 103, 32, 120, 109, 108, 110, 115, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 50, 48, 48, 48, 47, 115, 118, 103, 34, 32, 120, 109, 108, 110, 115, 58, 120, 108, 105, 110, 107, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 49, 57, 57, 57, 47, 120, 108, 105, 110, 107, 34, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 49, 34, 32, 119, 105, 100, 116, 104, 61, 34, 50, 52, 34, 32, 104, 101, 105, 103, 104, 116, 61, 34, 50, 52, 34, 32, 118, 105, 101, 119, 66, 111, 120, 61, 34, 48, 32, 48, 32, 50, 52, 32, 50, 52, 34, 62, 60, 112, 97, 116, 104, 32, 100, 61, 34, 77, 49, 50, 32, 48, 76, 51, 32, 55, 76, 52, 46, 54, 51, 32, 56, 46, 50, 55, 76, 49, 50, 32, 49, 52, 76, 49, 57, 46, 51, 54, 32, 56, 46, 50, 55, 76, 50, 49, 32, 55, 76, 49, 50, 32, 48, 77, 49, 57, 46, 51, 55, 32, 49, 48, 46, 55, 51, 76, 49, 50, 32, 49, 54, 46, 52, 55, 76, 52, 46, 54, 50, 32, 49, 48, 46, 55, 52, 76, 51, 32, 49, 50, 76, 49, 50, 32, 49, 57, 76, 50, 49, 32, 49, 50, 76, 49, 57, 46, 51, 55, 32, 49, 48, 46, 55, 51, 77, 49, 57, 46, 51, 55, 32, 49, 53, 46, 55, 51, 76, 49, 50, 32, 50, 49, 46, 52, 55, 76, 52, 46, 54, 50, 32, 49, 53, 46, 55, 52, 76, 51, 32, 49, 55, 76, 49, 50, 32, 50, 52, 76, 50, 49, 32, 49, 55, 76, 49, 57, 46, 51, 55, 32, 49, 53, 46, 55, 51, 90, 34, 32, 47, 62, 60, 47, 115, 118, 103, 62}} + +var resourcePaletteSvg = &fyne.StaticResource{ + StaticName: "palette.svg", + StaticContent: []byte{ + 60, 63, 120, 109, 108, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 48, 34, 32, 101, 110, 99, 111, 100, 105, 110, 103, 61, 34, 85, 84, 70, 45, 56, 34, 63, 62, 60, 33, 68, 79, 67, 84, 89, 80, 69, 32, 115, 118, 103, 32, 80, 85, 66, 76, 73, 67, 32, 34, 45, 47, 47, 87, 51, 67, 47, 47, 68, 84, 68, 32, 83, 86, 71, 32, 49, 46, 49, 47, 47, 69, 78, 34, 32, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 71, 114, 97, 112, 104, 105, 99, 115, 47, 83, 86, 71, 47, 49, 46, 49, 47, 68, 84, 68, 47, 115, 118, 103, 49, 49, 46, 100, 116, 100, 34, 62, 60, 115, 118, 103, 32, 120, 109, 108, 110, 115, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 50, 48, 48, 48, 47, 115, 118, 103, 34, 32, 120, 109, 108, 110, 115, 58, 120, 108, 105, 110, 107, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 49, 57, 57, 57, 47, 120, 108, 105, 110, 107, 34, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 49, 34, 32, 119, 105, 100, 116, 104, 61, 34, 50, 52, 34, 32, 104, 101, 105, 103, 104, 116, 61, 34, 50, 52, 34, 32, 118, 105, 101, 119, 66, 111, 120, 61, 34, 48, 32, 48, 32, 50, 52, 32, 50, 52, 34, 62, 60, 112, 97, 116, 104, 32, 100, 61, 34, 77, 49, 55, 46, 53, 44, 49, 50, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 49, 32, 49, 54, 44, 49, 48, 46, 53, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 49, 32, 49, 55, 46, 53, 44, 57, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 49, 32, 49, 57, 44, 49, 48, 46, 53, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 49, 32, 49, 55, 46, 53, 44, 49, 50, 77, 49, 52, 46, 53, 44, 56, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 49, 32, 49, 51, 44, 54, 46, 53, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 49, 32, 49, 52, 46, 53, 44, 53, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 49, 32, 49, 54, 44, 54, 46, 53, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 49, 32, 49, 52, 46, 53, 44, 56, 77, 57, 46, 53, 44, 56, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 49, 32, 56, 44, 54, 46, 53, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 49, 32, 57, 46, 53, 44, 53, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 49, 32, 49, 49, 44, 54, 46, 53, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 49, 32, 57, 46, 53, 44, 56, 77, 54, 46, 53, 44, 49, 50, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 49, 32, 53, 44, 49, 48, 46, 53, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 49, 32, 54, 46, 53, 44, 57, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 49, 32, 56, 44, 49, 48, 46, 53, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 49, 32, 54, 46, 53, 44, 49, 50, 77, 49, 50, 44, 51, 65, 57, 44, 57, 32, 48, 32, 48, 44, 48, 32, 51, 44, 49, 50, 65, 57, 44, 57, 32, 48, 32, 48, 44, 48, 32, 49, 50, 44, 50, 49, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 48, 32, 49, 51, 46, 53, 44, 49, 57, 46, 53, 67, 49, 51, 46, 53, 44, 49, 57, 46, 49, 49, 32, 49, 51, 46, 51, 53, 44, 49, 56, 46, 55, 54, 32, 49, 51, 46, 49, 49, 44, 49, 56, 46, 53, 67, 49, 50, 46, 56, 56, 44, 49, 56, 46, 50, 51, 32, 49, 50, 46, 55, 51, 44, 49, 55, 46, 56, 56, 32, 49, 50, 46, 55, 51, 44, 49, 55, 46, 53, 65, 49, 46, 53, 44, 49, 46, 53, 32, 48, 32, 48, 44, 49, 32, 49, 52, 46, 50, 51, 44, 49, 54, 72, 49, 54, 65, 53, 44, 53, 32, 48, 32, 48, 44, 48, 32, 50, 49, 44, 49, 49, 67, 50, 49, 44, 54, 46, 53, 56, 32, 49, 54, 46, 57, 55, 44, 51, 32, 49, 50, 44, 51, 90, 34, 32, 47, 62, 60, 47, 115, 118, 103, 62}} + +var resourcePauseSvg = &fyne.StaticResource{ + StaticName: "pause.svg", + StaticContent: []byte{ + 60, 63, 120, 109, 108, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 48, 34, 32, 101, 110, 99, 111, 100, 105, 110, 103, 61, 34, 85, 84, 70, 45, 56, 34, 63, 62, 60, 33, 68, 79, 67, 84, 89, 80, 69, 32, 115, 118, 103, 32, 80, 85, 66, 76, 73, 67, 32, 34, 45, 47, 47, 87, 51, 67, 47, 47, 68, 84, 68, 32, 83, 86, 71, 32, 49, 46, 49, 47, 47, 69, 78, 34, 32, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 71, 114, 97, 112, 104, 105, 99, 115, 47, 83, 86, 71, 47, 49, 46, 49, 47, 68, 84, 68, 47, 115, 118, 103, 49, 49, 46, 100, 116, 100, 34, 62, 60, 115, 118, 103, 32, 120, 109, 108, 110, 115, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 50, 48, 48, 48, 47, 115, 118, 103, 34, 32, 120, 109, 108, 110, 115, 58, 120, 108, 105, 110, 107, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 49, 57, 57, 57, 47, 120, 108, 105, 110, 107, 34, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 49, 34, 32, 119, 105, 100, 116, 104, 61, 34, 50, 52, 34, 32, 104, 101, 105, 103, 104, 116, 61, 34, 50, 52, 34, 32, 118, 105, 101, 119, 66, 111, 120, 61, 34, 48, 32, 48, 32, 50, 52, 32, 50, 52, 34, 62, 60, 112, 97, 116, 104, 32, 100, 61, 34, 77, 49, 52, 44, 49, 57, 72, 49, 56, 86, 53, 72, 49, 52, 77, 54, 44, 49, 57, 72, 49, 48, 86, 53, 72, 54, 86, 49, 57, 90, 34, 32, 47, 62, 60, 47, 115, 118, 103, 62}} + +var resourceResourcesMd = &fyne.StaticResource{ + StaticName: "resources.md", + StaticContent: []byte{ + 35, 32, 82, 101, 115, 111, 117, 114, 99, 101, 115, 10, 10, 35, 35, 32, 83, 111, 117, 114, 99, 101, 115, 10, 10, 45, 32, 70, 114, 111, 109, 32, 104, 116, 116, 112, 115, 58, 47, 47, 109, 97, 116, 101, 114, 105, 97, 108, 100, 101, 115, 105, 103, 110, 105, 99, 111, 110, 115, 46, 99, 111, 109, 47, 105, 99, 111, 110, 123, 105, 99, 111, 110, 45, 110, 97, 109, 101, 125, 58, 10, 32, 32, 32, 32, 45, 32, 114, 101, 115, 116, 97, 114, 116, 10, 32, 32, 32, 32, 45, 32, 102, 97, 115, 116, 45, 102, 111, 114, 119, 97, 114, 100, 10, 32, 32, 32, 32, 45, 32, 112, 97, 117, 115, 101, 10, 32, 32, 32, 32, 45, 32, 112, 97, 108, 101, 116, 116, 101, 10, 32, 32, 32, 32, 45, 32, 108, 97, 121, 101, 114, 115, 45, 116, 114, 105, 112, 108, 101, 10, 32, 32, 32, 32, 45, 32, 102, 111, 114, 109, 97, 116, 45, 102, 111, 110, 116, 10, 10, 35, 35, 32, 66, 117, 105, 108, 100, 105, 110, 103, 32, 114, 101, 115, 111, 117, 114, 99, 101, 115, 46, 103, 111, 10, 10, 96, 96, 96, 10, 126, 47, 103, 111, 47, 98, 105, 110, 47, 102, 121, 110, 101, 32, 98, 117, 110, 100, 108, 101, 32, 114, 101, 115, 111, 117, 114, 99, 101, 115, 32, 62, 32, 114, 101, 115, 111, 117, 114, 99, 101, 115, 46, 103, 111, 10, 96, 96, 96, 10}} + +var resourceRestartSvg = &fyne.StaticResource{ + StaticName: "restart.svg", + StaticContent: []byte{ + 60, 63, 120, 109, 108, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 48, 34, 32, 101, 110, 99, 111, 100, 105, 110, 103, 61, 34, 85, 84, 70, 45, 56, 34, 63, 62, 60, 33, 68, 79, 67, 84, 89, 80, 69, 32, 115, 118, 103, 32, 80, 85, 66, 76, 73, 67, 32, 34, 45, 47, 47, 87, 51, 67, 47, 47, 68, 84, 68, 32, 83, 86, 71, 32, 49, 46, 49, 47, 47, 69, 78, 34, 32, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 71, 114, 97, 112, 104, 105, 99, 115, 47, 83, 86, 71, 47, 49, 46, 49, 47, 68, 84, 68, 47, 115, 118, 103, 49, 49, 46, 100, 116, 100, 34, 62, 60, 115, 118, 103, 32, 120, 109, 108, 110, 115, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 50, 48, 48, 48, 47, 115, 118, 103, 34, 32, 120, 109, 108, 110, 115, 58, 120, 108, 105, 110, 107, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 49, 57, 57, 57, 47, 120, 108, 105, 110, 107, 34, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 49, 34, 32, 119, 105, 100, 116, 104, 61, 34, 50, 52, 34, 32, 104, 101, 105, 103, 104, 116, 61, 34, 50, 52, 34, 32, 118, 105, 101, 119, 66, 111, 120, 61, 34, 48, 32, 48, 32, 50, 52, 32, 50, 52, 34, 62, 60, 112, 97, 116, 104, 32, 100, 61, 34, 77, 49, 50, 44, 52, 67, 49, 52, 46, 49, 44, 52, 32, 49, 54, 46, 49, 44, 52, 46, 56, 32, 49, 55, 46, 54, 44, 54, 46, 51, 67, 50, 48, 46, 55, 44, 57, 46, 52, 32, 50, 48, 46, 55, 44, 49, 52, 46, 53, 32, 49, 55, 46, 54, 44, 49, 55, 46, 54, 67, 49, 53, 46, 56, 44, 49, 57, 46, 53, 32, 49, 51, 46, 51, 44, 50, 48, 46, 50, 32, 49, 48, 46, 57, 44, 49, 57, 46, 57, 76, 49, 49, 46, 52, 44, 49, 55, 46, 57, 67, 49, 51, 46, 49, 44, 49, 56, 46, 49, 32, 49, 52, 46, 57, 44, 49, 55, 46, 53, 32, 49, 54, 46, 50, 44, 49, 54, 46, 50, 67, 49, 56, 46, 53, 44, 49, 51, 46, 57, 32, 49, 56, 46, 53, 44, 49, 48, 46, 49, 32, 49, 54, 46, 50, 44, 55, 46, 55, 67, 49, 53, 46, 49, 44, 54, 46, 54, 32, 49, 51, 46, 53, 44, 54, 32, 49, 50, 44, 54, 86, 49, 48, 46, 54, 76, 55, 44, 53, 46, 54, 76, 49, 50, 44, 48, 46, 54, 86, 52, 77, 54, 46, 51, 44, 49, 55, 46, 54, 67, 51, 46, 55, 44, 49, 53, 32, 51, 46, 51, 44, 49, 49, 32, 53, 46, 49, 44, 55, 46, 57, 76, 54, 46, 54, 44, 57, 46, 52, 67, 53, 46, 53, 44, 49, 49, 46, 54, 32, 53, 46, 57, 44, 49, 52, 46, 52, 32, 55, 46, 56, 44, 49, 54, 46, 50, 67, 56, 46, 51, 44, 49, 54, 46, 55, 32, 56, 46, 57, 44, 49, 55, 46, 49, 32, 57, 46, 54, 44, 49, 55, 46, 52, 76, 57, 44, 49, 57, 46, 52, 67, 56, 44, 49, 57, 32, 55, 46, 49, 44, 49, 56, 46, 52, 32, 54, 46, 51, 44, 49, 55, 46, 54, 90, 34, 32, 47, 62, 60, 47, 115, 118, 103, 62}} diff --git a/izapple2fyne/resources/camera.svg b/izapple2fyne/resources/camera.svg new file mode 100644 index 0000000..5222ea3 --- /dev/null +++ b/izapple2fyne/resources/camera.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/izapple2fyne/resources/fast-forward.svg b/izapple2fyne/resources/fast-forward.svg new file mode 100644 index 0000000..bfe744f --- /dev/null +++ b/izapple2fyne/resources/fast-forward.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/izapple2fyne/resources/format-font.svg b/izapple2fyne/resources/format-font.svg new file mode 100644 index 0000000..c88cb71 --- /dev/null +++ b/izapple2fyne/resources/format-font.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/izapple2fyne/resources/layers-triple.svg b/izapple2fyne/resources/layers-triple.svg new file mode 100644 index 0000000..d853541 --- /dev/null +++ b/izapple2fyne/resources/layers-triple.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/izapple2fyne/resources/palette.svg b/izapple2fyne/resources/palette.svg new file mode 100644 index 0000000..ebf6936 --- /dev/null +++ b/izapple2fyne/resources/palette.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/izapple2fyne/resources/pause.svg b/izapple2fyne/resources/pause.svg new file mode 100644 index 0000000..37ed32d --- /dev/null +++ b/izapple2fyne/resources/pause.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/izapple2fyne/resources/resources.md b/izapple2fyne/resources/resources.md new file mode 100644 index 0000000..8cd76c2 --- /dev/null +++ b/izapple2fyne/resources/resources.md @@ -0,0 +1,18 @@ +# Resources + +## Sources + +- From https://materialdesignicons.com/icon{icon-name}: + - restart + - fast-forward + - pause + - palette + - layers-triple + - format-font + - camera + +## Building resources.go + +``` +~/go/bin/fyne bundle resources > resources.go +``` diff --git a/izapple2fyne/resources/restart.svg b/izapple2fyne/resources/restart.svg new file mode 100644 index 0000000..2d36f8a --- /dev/null +++ b/izapple2fyne/resources/restart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/screen.go b/screen.go index 9413113..bca01e7 100644 --- a/screen.go +++ b/screen.go @@ -1,7 +1,6 @@ package izapple2 import ( - "fmt" "image" "image/color" "image/png" @@ -225,7 +224,6 @@ func SaveSnapshot(a *Apple2, filename string) error { func squarishPixelsFilter(in *image.RGBA) *image.RGBA { b := in.Bounds() factor := 1200 / b.Dx() - fmt.Println(factor) size := image.Rect(0, 0, factor*b.Dx(), b.Dy()) out := image.NewRGBA(size) for x := b.Min.X; x < b.Max.X; x++ {