From 50d28a5784163fe6186bfc6147f9386700a67281 Mon Sep 17 00:00:00 2001 From: Pontus Fransson Date: Tue, 4 Feb 2014 08:46:20 +0100 Subject: [PATCH] Misc - Still having problems with template with eventhandler. --- Code/Misc/EventHandler/EventButton.h | 2 +- .../EventHandler/EventButtonCollection.cpp | 14 -------------- .../Misc/EventHandler/EventButtonCollection.h | 19 +++++++++++++++---- Code/Misc/EventHandler/IEventButton.h | 2 -- Code/Misc/Misc.vcxproj | 2 +- Code/Misc/Misc.vcxproj.filters | 10 +++++----- 6 files changed, 22 insertions(+), 27 deletions(-) diff --git a/Code/Misc/EventHandler/EventButton.h b/Code/Misc/EventHandler/EventButton.h index 6a0a2cfb..e8fbc690 100644 --- a/Code/Misc/EventHandler/EventButton.h +++ b/Code/Misc/EventHandler/EventButton.h @@ -58,7 +58,7 @@ namespace Oyster { this->privData.ID = privData.currID; this->privData.currID += 1; - this->privData.owner = NULL; + //this->privData.owner = NULL; this->privData.EventFunc = NULL; } diff --git a/Code/Misc/EventHandler/EventButtonCollection.cpp b/Code/Misc/EventHandler/EventButtonCollection.cpp index a6e4ed40..7908816e 100644 --- a/Code/Misc/EventHandler/EventButtonCollection.cpp +++ b/Code/Misc/EventHandler/EventButtonCollection.cpp @@ -22,20 +22,6 @@ void EventButtonCollection::Update(InputClass* inputObject) } } -template -void EventButtonCollection::AddButton(Owner a) -{ - //buttons.push_back(button); -} - -template -EventButton& EventButtonCollection::CreateButton() -{ - EventButton temp; - buttons.push_back((IEventButton)&temp); - return temp; -} - EventCollectionState EventButtonCollection::GetState() const { return collectionState; diff --git a/Code/Misc/EventHandler/EventButtonCollection.h b/Code/Misc/EventHandler/EventButtonCollection.h index 2a3faf35..130d59fa 100644 --- a/Code/Misc/EventHandler/EventButtonCollection.h +++ b/Code/Misc/EventHandler/EventButtonCollection.h @@ -29,11 +29,22 @@ namespace Oyster void Update(InputClass* inputObject); - template - void AddButton(Owner a); + template + void AddButton(EventButton& button) + { + EventButton* b = new EventButton(); + buttons.size(); + buttons.push_back((IEventButton*)b); + //buttons.push_back((IEventButton*)&button); + } - template - EventButton& CreateButton(); + template + EventButton& CreateButton() + { + EventButton temp; + buttons.push_back(&temp); + return temp; + } EventCollectionState GetState() const; void SetState(const EventCollectionState state); diff --git a/Code/Misc/EventHandler/IEventButton.h b/Code/Misc/EventHandler/IEventButton.h index 236ab73c..92c58c10 100644 --- a/Code/Misc/EventHandler/IEventButton.h +++ b/Code/Misc/EventHandler/IEventButton.h @@ -8,9 +8,7 @@ namespace Oyster { class IEventButton { - public: - enum ButtonState { Button_Clicked, diff --git a/Code/Misc/Misc.vcxproj b/Code/Misc/Misc.vcxproj index 51b905d2..f3e58e56 100644 --- a/Code/Misc/Misc.vcxproj +++ b/Code/Misc/Misc.vcxproj @@ -166,10 +166,10 @@ + - diff --git a/Code/Misc/Misc.vcxproj.filters b/Code/Misc/Misc.vcxproj.filters index f8309aed..edcf0e99 100644 --- a/Code/Misc/Misc.vcxproj.filters +++ b/Code/Misc/Misc.vcxproj.filters @@ -51,10 +51,10 @@ Source Files - + Source Files - + Source Files @@ -122,15 +122,15 @@ Header Files - - Header Files - Header Files Header Files + + Header Files + Header Files