Original Post
I want to use it to automatically route messages to their correct handlers, but I have no idea how. Here's the source: I get the feeling I'm missing something really obvious here. I remember seeing a thread a while back on this topic, but with search disabled it would be somewhat difficult to track it down. Any ideas?
class EventHandler
{
public:
void HandleEvent(Event * event)
{
//I want the event to go to the correct handler, or the default if none else is available.
CheckEvent(event);
}
void CheckEvent(Event * event)
{
printf("Event/CheckEvent(%s)\n",event->GetName());
}
void CheckEvent(MouseClick * event)
{
printf("MouseClick/CheckEvent(%s)\n",event->GetName());
}
void CheckEvent(KeyDown * event)
{
printf("KeyDown/CheckEvent(%s)\n",event->GetName());
}
};