~whereswaldon/chipalee

69d4c29e6ce76e832ab22dbe77a47ff46ec312a2 — Chris Waldon 1 year, 9 months ago 4d55832
main: prevent pipes from overlapping

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

M main.go
M main.go => main.go +2 -2
@@ 362,7 362,7 @@ func run(w *app.Window) error {
						Keys: keySet,
					}.Add(gtx.Ops)

					width := float32(gtx.Constraints.Max.X) / float32(len(players))
					width := float32(math.Round(float64(float32(gtx.Constraints.Max.X) / float32(len(players)))))
					rect := clip.Rect{
						Max: image.Point{
							X: int(width),


@@ 372,7 372,7 @@ func run(w *app.Window) error {
					lowestFreq := freqs[0]
					for i, pipe := range players {
						if pipe.playing {
							offset := op.Offset(f32.Point{X: width * float32(i)}).Push(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)
							height := int(math.Round(float64(gtx.Constraints.Max.Y) * proportion))