Skip to content

Commit

Permalink
Added Button widget and removed Launcher widget, as it's now obsolete
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed Jul 19, 2019
1 parent 88c2cd9 commit 307cf96
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 55 deletions.
30 changes: 30 additions & 0 deletions widget_button.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package main

import (
"image"
"log"

"github.com/golang/freetype"
"github.com/muesli/streamdeck"
)

type ButtonWidget struct {
BaseWidget
icon string
label string
}

func (w *ButtonWidget) Update(dev *streamdeck.Device) {
img := image.NewRGBA(image.Rect(0, 0, 72, 72))
if w.label != "" {
drawImage(img, w.icon, 48, 12, 4)
drawString(img, ttfFont, w.label, 8, freetype.Pt(-1, img.Bounds().Dx()-6))
} else {
drawImage(img, w.icon, 64, 4, 4)
}

err := dev.SetImage(w.key, img)
if err != nil {
log.Fatal(err)
}
}
55 changes: 0 additions & 55 deletions widget_launcher.go

This file was deleted.

0 comments on commit 307cf96

Please sign in to comment.