summaryrefslogtreecommitdiff
path: root/status/00-status.go
diff options
context:
space:
mode:
Diffstat (limited to 'status/00-status.go')
-rw-r--r--status/00-status.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/status/00-status.go b/status/00-status.go
index d508eab..e88011d 100644
--- a/status/00-status.go
+++ b/status/00-status.go
@@ -1,12 +1,14 @@
package status // import "hhvn.uk/hbspbar/status"
import (
+ "fmt"
"time"
"sync"
"image"
- "hhvn.uk/hbspbar/config"
"hhvn.uk/hbspbar/drw"
+ "hhvn.uk/hbspbar/config"
+ "hhvn.uk/hbspbar/common"
)
var Status map[int]*status
@@ -75,10 +77,26 @@ func newUpdate(name string) (*status) {
return &s
}
+func checkError(name string, err error) {
+ if err == nil { return }
+
+ common.Error("status \"%s\": %s\n", name, err)
+
+ u := newUpdate(name)
+ u.drawText(0, Red, fmt.Sprintf("[err: %s]", name))
+ updates <- u
+
+ sleep(5)
+}
+
func sleep(s int) {
time.Sleep(time.Duration(s) * time.Second)
}
+func blendGYR(percent int) uint32 {
+ return drw.Blend3(Green, Yellow, Red, percent)
+}
+
func (s *status) furthest(x int) {
if x > s.W {
s.W = x