From d6769ac62f145283088d0d2d56b2a884ecf5baf2 Mon Sep 17 00:00:00 2001 From: Pontus Fransson Date: Fri, 31 Jan 2014 13:06:11 +0100 Subject: [PATCH] Misc - EventHandler, EventCollection --- .../EventHandler/EventButtonCollection.cpp | 25 +++++++++++++ .../Misc/EventHandler/EventButtonCollection.h | 31 ++++++++++++++++ Code/Misc/EventHandler/EventHandler.cpp | 37 +++++++++++++++++++ Code/Misc/EventHandler/EventHandler.h | 35 ++++++++++++++++++ Code/Misc/Misc.vcxproj | 8 +++- Code/Misc/Misc.vcxproj.filters | 16 +++++++- 6 files changed, 148 insertions(+), 4 deletions(-) diff --git a/Code/Misc/EventHandler/EventButtonCollection.cpp b/Code/Misc/EventHandler/EventButtonCollection.cpp index e69de29b..b3d37bfe 100644 --- a/Code/Misc/EventHandler/EventButtonCollection.cpp +++ b/Code/Misc/EventHandler/EventButtonCollection.cpp @@ -0,0 +1,25 @@ +#include "EventButtonCollection.h" + +using namespace Oyster::Event; + +EventButtonCollection::EventButtonCollection() +{ + +} + +EventButtonCollection::~EventButtonCollection() +{ +} + +void EventButtonCollection::Update(InputClass* inputObject) +{ + for(int i = 0; i < buttons.size(); i++) + { + buttons.at(i)->Update(inputObject); + } +} + +EventButton* EventButtonCollection::AddButton(EventButton* button) +{ + +} \ No newline at end of file diff --git a/Code/Misc/EventHandler/EventButtonCollection.h b/Code/Misc/EventHandler/EventButtonCollection.h index e69de29b..31201f9c 100644 --- a/Code/Misc/EventHandler/EventButtonCollection.h +++ b/Code/Misc/EventHandler/EventButtonCollection.h @@ -0,0 +1,31 @@ +#ifndef EVENT_BUTTON_COLLECTION_H +#define EVENT_BUTTON_COLLECTION_H + +#include "../../Input/L_inputClass.h" + +#include "EventButton.h" + +#include + +namespace Oyster +{ + namespace Event + { + class EventButtonCollection + { + public: + EventButtonCollection(); + ~EventButtonCollection(); + + void Update(InputClass* inputObject); + + EventButton* AddButton(EventButton* button); + + private: + std::vector buttons; + + }; + } +} + +#endif \ No newline at end of file diff --git a/Code/Misc/EventHandler/EventHandler.cpp b/Code/Misc/EventHandler/EventHandler.cpp index e69de29b..8f6705df 100644 --- a/Code/Misc/EventHandler/EventHandler.cpp +++ b/Code/Misc/EventHandler/EventHandler.cpp @@ -0,0 +1,37 @@ +#include "EventHandler.h" + +using namespace Oyster::Event; + +EventHandler EvtHandler; + +EventHandler& EventHandler::Instance() +{ + return EvtHandler; +} + +EventHandler::EventHandler() +{ + +} + +EventHandler::~EventHandler() +{ +} + +void EventHandler::Update(InputClass* inputObject) +{ + for(int i = 0; i < collections.size(); i++) + { + collections.at(i)->Update(inputObject); + } +} + +EventButtonCollection* EventHandler::CreateCollection() +{ + +} + +EventButtonCollection* EventHandler::GetCollection(/*ID*/); +{ + +} \ No newline at end of file diff --git a/Code/Misc/EventHandler/EventHandler.h b/Code/Misc/EventHandler/EventHandler.h index e69de29b..c3ecc0a2 100644 --- a/Code/Misc/EventHandler/EventHandler.h +++ b/Code/Misc/EventHandler/EventHandler.h @@ -0,0 +1,35 @@ +#ifndef EVENT_HANDLER_H +#define EVENT_HANDLER_H + +#include "../../Input/L_inputClass.h" + +#include "EventButtonCollection.h" +#include "EventButton.h" + +#include + +namespace Oyster +{ + namespace Event + { + class EventHandler + { + EventHandler(); + ~EventHandler(); + + EventHandler& Instance(); + + void Update(InputClass* inputObject); + + EventButtonCollection* CreateCollection(); + EventButtonCollection* GetCollection(/*ID*/); + + + private: + std::vector collections; + + }; + } +} + +#endif \ No newline at end of file diff --git a/Code/Misc/Misc.vcxproj b/Code/Misc/Misc.vcxproj index 46b85f01..52b7c96c 100644 --- a/Code/Misc/Misc.vcxproj +++ b/Code/Misc/Misc.vcxproj @@ -146,7 +146,9 @@ - + + + @@ -163,9 +165,11 @@ + + - + diff --git a/Code/Misc/Misc.vcxproj.filters b/Code/Misc/Misc.vcxproj.filters index 92a559df..d4874b4c 100644 --- a/Code/Misc/Misc.vcxproj.filters +++ b/Code/Misc/Misc.vcxproj.filters @@ -51,7 +51,13 @@ Source Files - + + Source Files + + + Source Files + + Source Files @@ -119,7 +125,13 @@ Header Files - + + Header Files + + + Header Files + + Header Files