aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2024-01-19 22:54:28 -0500
committerSam Anthony <sam@samanthony.xyz>2024-01-19 22:54:28 -0500
commitcb4343f838b008e3f4da2bf85937ed86cd1805e1 (patch)
tree4251616277835db0810c38bfa3357606455a674d
parent95944c92c6d9171e3a8a2619e62bbfa29d48bfef (diff)
downloadvolute-cb4343f838b008e3f4da2bf85937ed86cd1805e1.zip
add VE row
-rw-r--r--gui/widget/widget.go5
-rw-r--r--main.go20
2 files changed, 17 insertions, 8 deletions
diff --git a/gui/widget/widget.go b/gui/widget/widget.go
index 6da7aaf..cbc837e 100644
--- a/gui/widget/widget.go
+++ b/gui/widget/widget.go
@@ -14,6 +14,7 @@ import (
var (
FOCUS_COLOR = color.RGBA{179, 217, 255, 255}
+ GREEN = color.RGBA{51, 102, 0, 255}
BLACK = color.Gray{0}
WHITE = color.Gray{255}
)
@@ -39,9 +40,9 @@ func Input(val chan<- uint, r image.Rectangle, focusChan <-chan bool, env gui.En
redraw := func(text []byte, focus bool) func(draw.Image) image.Rectangle {
return func(drw draw.Image) image.Rectangle {
if focus {
- drawText(text, drw, r, BLACK, FOCUS_COLOR)
+ drawText(text, drw, r, GREEN, FOCUS_COLOR)
} else {
- drawText(text, drw, r, BLACK, WHITE)
+ drawText(text, drw, r, GREEN, WHITE)
}
return r
}
diff --git a/main.go b/main.go
index 9c16af1..8ab0ecd 100644
--- a/main.go
+++ b/main.go
@@ -28,14 +28,16 @@ func run() {
var (
displacementChan = make(chan uint)
rpmChan = make([]chan uint, POINTS)
- focus = NewFocus(1 + POINTS)
+ veChan = make([]chan uint, POINTS)
+ focus = NewFocus(1 + 2*POINTS)
)
for i := 0; i < POINTS; i++ {
rpmChan[i] = make(chan uint)
+ veChan[i] = make(chan uint)
}
bounds := layout.Grid{
- Rows: []int{2, 8, 8},
+ Rows: []int{2, 7, 7},
Background: color.Gray{255},
Gap: 1,
Split: split,
@@ -53,13 +55,19 @@ func run() {
focus.widgets[0],
mux.MakeEnv(),
)
-
go widget.Label("speed (rpm)", bounds[2], mux.MakeEnv())
- for i := 0; i < len(rpmChan); i++ {
+ go widget.Label("VE (%)", bounds[3+POINTS], mux.MakeEnv())
+ for i := 0; i < POINTS; i++ {
go widget.Input(
rpmChan[i],
- bounds[i+3],
- focus.widgets[i+1],
+ bounds[3+i],
+ focus.widgets[1+i],
+ mux.MakeEnv(),
+ )
+ go widget.Input(
+ veChan[i],
+ bounds[3+POINTS+1+i],
+ focus.widgets[1+POINTS+i],
mux.MakeEnv(),
)
}