package main import ( "strconv" "fyne.io/fyne/v2" "fyne.io/fyne/v2/app" "fyne.io/fyne/v2/container" "fyne.io/fyne/v2/widget" "git.martyn.berlin/martyn/fyne-widgets/pkg/multisyswebcam" "git.martyn.berlin/martyn/fyne-widgets/pkg/layouts" ) var multisysWebcamID int var multisysWebcamLabel *widget.Label var multisysWebcamWidget *multisyswebcam.MultisysWebcam func switchMultisysWebcam(id int) { multisysWebcamLabel.Text = "Webcam: " + strconv.Itoa(id) multisysWebcamLabel.Refresh() multisysWebcamWidget.MultisysWebcamID = int64(id) multisysWebcamWidget.Refresh() } func incWebCamID() { multisysWebcamID = multisysWebcamID + 1 switchMultisysWebcam(multisysWebcamID) } func decWebCamID() { multisysWebcamID = multisysWebcamID - 1 switchMultisysWebcam(multisysWebcamID) } func main() { a := app.New() w := a.NewWindow("MultisysWebcam") multisysWebcamWidget = multisyswebcam.NewMultisysWebcam() layout := layouts.NewFloatingControlsLayout() layout.FloatingControlsLocation = layouts.FloatingControlsCenter multisysWebcamWidget.System = multisyswebcam.WebcamSystemGoCV multisysWebcamID = 0 multisysWebcamWidget.UpdateFPS = 50 multisysWebcamLabel = widget.NewLabel("Webcam: 0") buttons := container.NewHBox(multisysWebcamLabel, widget.NewButton("-", decWebCamID), widget.NewButton("+", incWebCamID)) w.SetContent(container.New(&layout, multisysWebcamWidget, buttons)) w.Resize(fyne.NewSize(640, 480)) w.ShowAndRun() }