diff --git a/Code/Misc/EventHandler/EventButton.h b/Code/Misc/EventHandler/EventButton.h index 189102cc..99eb9279 100644 --- a/Code/Misc/EventHandler/EventButton.h +++ b/Code/Misc/EventHandler/EventButton.h @@ -9,11 +9,8 @@ namespace Oyster { namespace Event { - - template - class EventButton + struct IButton { - private: enum ButtonState { Button_Clicked, @@ -21,6 +18,12 @@ namespace Oyster Button_Hold, Button_Smashed, }; + }; + template + class EventButton :public IButton + { + private: + struct ButtonEvent { ButtonState state; diff --git a/Code/Misc/EventHandler/EventButtonCollection.cpp b/Code/Misc/EventHandler/EventButtonCollection.cpp index 268712c5..859abc4d 100644 --- a/Code/Misc/EventHandler/EventButtonCollection.cpp +++ b/Code/Misc/EventHandler/EventButtonCollection.cpp @@ -22,12 +22,14 @@ void EventButtonCollection::Update(InputClass* inputObject) } } -void EventButtonCollection::AddButton(EventButton& button) +template +void EventButtonCollection::AddButton(EventButton& button) { buttons.push_back(button); } -EventButton& EventButtonCollection::CreateButton() +template +EventButton& EventButtonCollection::CreateButton() { EventButton temp; buttons.push_back(&temp); diff --git a/Code/Misc/EventHandler/EventButtonCollection.h b/Code/Misc/EventHandler/EventButtonCollection.h index 4368e195..9065ffc5 100644 --- a/Code/Misc/EventHandler/EventButtonCollection.h +++ b/Code/Misc/EventHandler/EventButtonCollection.h @@ -3,6 +3,7 @@ #include "../../Input/L_inputClass.h" +#include "IEventButton.h" #include "EventButton.h" #include @@ -28,8 +29,11 @@ namespace Oyster void Update(InputClass* inputObject); - void AddButton(EventButton& button); - EventButton& CreateButton(); + template + void AddButton(EventButton& button); + + template + EventButton& CreateButton(); EventCollectionState GetState() const; void SetState(const EventCollectionState state); @@ -38,7 +42,7 @@ namespace Oyster void Clear(); private: - std::vector buttons; + std::vector buttons; EventCollectionState collectionState; }; diff --git a/Code/Misc/Misc.vcxproj b/Code/Misc/Misc.vcxproj index 52b7c96c..76191ba0 100644 --- a/Code/Misc/Misc.vcxproj +++ b/Code/Misc/Misc.vcxproj @@ -146,7 +146,6 @@ - diff --git a/Code/Misc/Misc.vcxproj.filters b/Code/Misc/Misc.vcxproj.filters index d4874b4c..649b0e5b 100644 --- a/Code/Misc/Misc.vcxproj.filters +++ b/Code/Misc/Misc.vcxproj.filters @@ -54,9 +54,6 @@ Source Files - - Source Files - Source Files