Commit b2ccd289 authored by simon's avatar simon
Browse files

expose events parameters

parent 1485da79
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ type event interface {

type HatChangeEvent struct {
	time time.Duration
	x, y float32
	X,Y float32
}

func (b HatChangeEvent) Moment() time.Duration {
+2 −2
Original line number Diff line number Diff line
@@ -28,8 +28,8 @@ func TestJoysticksCapture(t *testing.T) {
		case <-events[1]:
			play(NewSound(NewTone(f, float64(x)), time.Second/3))
		case h := <-events[2]:
			x = h.(HatChangeEvent).x/2 + .5
			f = time.Duration(100*math.Pow(2, float64(h.(HatChangeEvent).y))) * time.Second / 44000
			x = h.(HatChangeEvent).X/2 + .5
			f = time.Duration(100*math.Pow(2, float64(h.(HatChangeEvent).Y))) * time.Second / 44000
		}
	}
}