/////////////////////// // Sam Svensson 2013 // /////////////////////// #include "../../Input/L_inputClass.h" #include namespace Oyster { namespace Event { template class EventButton { private: enum ButtonState { Button_Clicked, Button_Hover, Button_Hold, Button_Smashed, }; struct ButtonEvent { ButtonState state; EventButton &sender; T owner; }; struct PrivData { static unsigned int currID; unsigned int ID; T owner; void (*EventFunc)( ButtonEvent e ); }; PrivData privData; public: EventButton(); EventButton(T owner); EventButton(void (*EventFunc)( ButtonEvent e)); EventButton(void (*EventFunc)( ButtonEvent e), T owner); ~EventButton(); void checkCollision(InputClass *input); void SetEventFunc(void (*EventFunc)( ButtonEvent e )); //? unsigned int GetID(); T& GetOwner(); }; template EventButton::EventButton() { this->privData.ID = privData.currID; this->privData.currID += 1; this->privData.owner = NULL; this->privData.EventFunc = NULL; } template EventButton::EventButton(T owner) { this->privData.ID = privData.currID; this->privData.currID += 1; this->privData.owner = owner; this->privData.EventFunc = NULL; } template EventButton::EventButton(void (*EventFunc)( ButtonEvent e)) { this->privData.ID = privData.currID; this->privData.currID += 1; this->privData.owner = NULL; this->privData.EventFunc = EventFunc; } template EventButton::EventButton(void (*EventFunc)( ButtonEvent e), T owner) { this->privData.ID = privData.currID; this->privData.currID += 1; this->privData.owner = owner; this->privData.EventFunc = EventFunc; } template EventButton~EventButton() { } template void EventButton::checkCollision(InputClass *input) { //??????????????? TODO: everything } template void EventButton::SetEventFunc(void (*EventFunc)( ButtonEvent e )) { this->privData.EventFunc = EventFunc; } template unsigned int EventButton::GetID() { return this->privData.ID; } template T& EventButton::GetOwner() { return this->privData.owner; } } }