diff options
| -rw-r--r-- | gui/widget/widget.go | 5 | ||||
| -rw-r--r-- | main.go | 20 |
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 } @@ -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(), ) } |