Event Engine
Monkey Forums/Monkey Programming/Event Engine| 
 | ||
| How do I manage events in Monkey? For instance, I had been dabbling in Corona SDK and it lets me poll objects to see if they've experienced an event (such as a touch). setEventBehavior( MyObject, "touch", MyTouchFunctionForMyObject ) Is that something that might eventually be added to Monkey, or is it roll-your-own? I've been using Diddy significantly for my first minor project (solely to get used to Monkey). Does it have an events system of which I'm not aware? :) MyDiddyObject.onTouch( RunThisFunctionWhenTouched ) | 
| 
 | ||
| Unfortunately since Monkey does not support function pointers (or any kind of pointer), making an event-based system would prove tricky.  I suppose I could take a look at it, but I'm not making any promises. :) | 
| 
 | ||
| Hi, > Is that something that might eventually be added to Monkey, or is it roll-your-own? Definitely roll-your-own right now - there's no GUI or retained mode sprite system in Mojo. You can use objects or interfaces for functions pointers, eg: 
'function
Interface TouchHandler
   Method OnTouchDown( finger )
End
Class Gadget
   ''function pointer'
   Field touchHandler:TouchHandler
   Method SetTouchHandler( handler:TouchHandler )
End
Class Actor Implements TouchHandler
   Method OnTouchDown( finger )
       'blah!
   End
End
 |