<div dir="ltr">Hi. I'm trying to do a simulation using Netwire 5 and SDL but as I've just started with Netwire I'm not sure if I'm doing it correctly regarding the input events. Suppose I have a game which consists in moving a single pixel around the screen. To make this game, I created these simple wires:<div><div>    readEvent :: Wire s e IO a SDL.Event</div><div>(SDL.Event can be SDL.NoEvent or an event just like Netwire's events, so I guess they can be easily converted)</div><div><br></div><div>    inputLogic :: Wire s m SDL.Event Position</div><div>(it keeps the position as an internal state and updates it according to the event)</div><div><br></div><div>    render :: Wire s e IO Position ( )</div><div>(just writes the pixel to the screen)</div><div><br></div><div>And finally the game can be expressed using Arrow notation as:</div><div>    readEvent>>>inputLogic>>>render</div><div><br></div><div><div>It works. But the thing here is that events like mouse movement are generated way faster than frames. To solve this, inputLogic should read all the input events until there are none and only then render the frame. I'm unable to do this using Wires. I've tried to make some kind of loop with ArrowLoop but I failed. I did came up with this solution, creating different wires:</div><div>    readEvents :: Wire s e IO a [SDL.Event]</div><div>(it populates the list until there are no more events)</div><div><br></div>    inputLogic' :: Wire s m [SDL.Event] Position</div><div><br></div><div><div>And the game is:</div><div>    readEvents>>>inputLogic'>>>render<br></div><div><br></div><div>Which does the expected behaviour but it doesn't seem a good approach to me. These new wires aren't as basic as the first ones. Is this the best way to do it? Does anybody has a better idea?</div></div></div><div><br></div><div>Any advice will be considerably appreciated.</div><div>Martín</div></div>