Implementing a timer in Traveller game

2019-05-24 13:54发布

问题:

This problem is a continuation of what I started here. I'm using the asteroid example as a model to work from.

The problem I want to talk about here is the one of a timer. The asteroids example uses the event0 function to make one, which relies on the Graphics.UI.WX library. I don't want to use WX for this project. Could someone tell me what event0 is doing generally, so that I can figure out what I need to do to make a similar function?

回答1:

To bind reactive-banana to an external event-based framework, be it WX or any other, have a look at the Reactive.Banana.Frameworks module.

The event0 function from reactive-banana-wx is just a thin wrapper over the fromAddHandler function from said module. The example code for reactive-banana demonstrates its use.