On Mon, May 18, 2015 at 2:36 PM, Edward Diener
On 5/18/2015 1:39 PM, Emil Dotchevski wrote:
On Mon, May 18, 2015 at 8:42 AM, Edward Diener
wrote: That's not where the confusion existed for me. Gavin Lambert explained why each signal must be a different type. I realized that a signal is a type, but not why the same signal could not be used for more than one event ( button down, button up etc. ).
The signal *is* the event though. So I guess I still don't understand. If you have two events, "button up" and "button down", then you need two Synapse signals or else you wouldn't be able to tell them apart.
Your synapse code evidently needs to tell them apart but from the end-user's perspective it isn't necessary, since the only thing he cares about is the parameter types being specified. If he has a signal of:
typedef void (*button_signal)(int,int) ;
why wouldn't he use it for both a button_up and a button_down event, since it has the correct number and type of parameters for both ?
I'm still trying to figure out what's the misunderstanding. Perhaps an
example will help, here is how you could use synapse::emit<> from a
WindowProc:
typedef struct button_down_(*button_down)(int,int);
typedef struct button_up_(*button_up)(int,int);
LRESULT CALLBACK
WindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
switch( uMsg )
{
case WM_LBUTTONDOWN:
synapse::emit