
Nathan Hüsken
But this does not do the accumulation every frame, but whenever an event happens.
That wire by itself does the accumulation at every frame, so you probably have an inhibiting wire earlier in the chain.
Let me restate my problem. My wire is this:
pos = accum (+) 0.0 . speed
and all I do is putStrLn the output at every frame.
As a side note, see testWire and testWireM in Control.Wire.Session. =)
If withing one frame where speed has the value (1) several events are sent over the wire (for example several keyup and keydown events for an unrelated key), then pos gets incremented for one for each of this events. So I have to prevent the accumulation if the event is not NoEvent.
That's because you're using constant time deltas. Even if your time frame has a constant rate you should still make use of your time deltas. In particular notice that Netwire can deal with time deltas of 0. Then instead of accum you would use integral_. Greets, Ertugrul -- Not to be or to be and (not to be or to be and (not to be or to be and (not to be or to be and ... that is the list monad.