~whereswaldon/chipalee

b0042dccb494b7ef7beda28c0c88916082168440 — Chris Waldon 1 year, 9 months ago 7c1d363
main: always show pipes

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
1 files changed, 13 insertions(+), 13 deletions(-)

M main.go
M main.go => main.go +13 -13
@@ 455,20 455,20 @@ func run(w *app.Window) error {
					}
					lowestFreq := freqs[0]
					for i, pipe := range players {
						offset := op.Offset(f32.Point{X: float32(math.Round(float64(width * float32(i))))}).Push(gtx.Ops)
						rect := rect
						proportion := 1 / (pipe.freq / lowestFreq)
						heightF := float64(gtx.Constraints.Max.Y) * proportion
						height := int(math.Round(heightF))
						gap := gtx.Constraints.Max.Y - height
						rect.Min.Y = gap

						lightFill := pipe.col
						lightFill.A = 50
						paint.FillShape(gtx.Ops, lightFill, rect.Op())

						if pipe.playing {
							op.InvalidateOp{}.Add(gtx.Ops)
							offset := op.Offset(f32.Point{X: float32(math.Round(float64(width * float32(i))))}).Push(gtx.Ops)
							rect := rect
							proportion := 1 / (pipe.freq / lowestFreq)
							heightF := float64(gtx.Constraints.Max.Y) * proportion
							height := int(math.Round(heightF))
							gap := gtx.Constraints.Max.Y - height
							rect.Min.Y = gap

							lightFill := pipe.col
							lightFill.A = 100
							paint.FillShape(gtx.Ops, lightFill, rect.Op())

							duration := float64(gtx.Now.Sub(pipe.since).Milliseconds()) / 2000
							if duration > 1 {
								duration = 1


@@ 481,8 481,8 @@ func run(w *app.Window) error {
							rect.Min.Y = gap

							paint.FillShape(gtx.Ops, pipe.col, rect.Op())
							offset.Pop()
						}
						offset.Pop()
					}
				}
				// This editor is needed for JS to properly deliver key events