[Haskell-beginners] firering event in netwire
Nathan Hüsken
nathan.huesken at posteo.de
Mon Oct 1 14:12:11 CEST 2012
On 10/01/2012 01:58 PM, Ertugrul Söylemez wrote:
>> Now I want to integrate this speed (frame based):
>>
>> pos = accum (+) . speed
>
> This should be a type error. Rather:
>
> pos = accum (+) initialPos . speed
>
>
Yes of course.
>> 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.
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.
Regards,
Nathan
More information about the Beginners
mailing list