InteractiveScapeGmbH / TuioNet

MIT License
7 stars 1 forks source link

7 separate interfaces for tuio types #9

Closed eqbic closed 1 year ago

eqbic commented 1 year ago

Add separate interfaces for different TUIO types

This PR adds three separate interfaces for each tuio 1.1 type (cursor, object, blob). This is an extensions to the general ITuio11Listener interface. The advantage is that one does not need to implement interface methods for tuio types which are actually not necessary.

An example for the simpler way is shown in the Demo Project where the listener implements the ITuio11CursorListener and ITuio11ObjectListener

It is still possible to use the more general ITuio11Listener.

paul-peters commented 1 year ago

I'd suggest to name the callbacks in the partial interfaces identically to the callbacks in the ITuio11Listener interface. Then the interface definition would reduce to

public interface ITuio11Listener : ITuio11CursorListener, ITuio11ObjectListener, ITuio11BlobListener {}

And all places where you added another loop could be written like

foreach (var cursorListener in _cursorListeners.Union(_tuio11Listeners))
{
    cursorListener.RemoveCursor(tuioCursor);
}
paul-peters commented 1 year ago

This PR was declined in favor of a better C#ian way: https://github.com/InteractiveScapeGmbH/TuioNet/pull/10