Misc - EventHandler, EventCollection

This commit is contained in:
Pontus Fransson 2014-01-31 13:06:11 +01:00
parent 8ee8374169
commit d6769ac62f
6 changed files with 148 additions and 4 deletions

View File

@ -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)
{
}

View File

@ -0,0 +1,31 @@
#ifndef EVENT_BUTTON_COLLECTION_H
#define EVENT_BUTTON_COLLECTION_H
#include "../../Input/L_inputClass.h"
#include "EventButton.h"
#include <vector>
namespace Oyster
{
namespace Event
{
class EventButtonCollection
{
public:
EventButtonCollection();
~EventButtonCollection();
void Update(InputClass* inputObject);
EventButton* AddButton(EventButton* button);
private:
std::vector<EventButton*> buttons;
};
}
}
#endif

View File

@ -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*/);
{
}

View File

@ -0,0 +1,35 @@
#ifndef EVENT_HANDLER_H
#define EVENT_HANDLER_H
#include "../../Input/L_inputClass.h"
#include "EventButtonCollection.h"
#include "EventButton.h"
#include <vector>
namespace Oyster
{
namespace Event
{
class EventHandler
{
EventHandler();
~EventHandler();
EventHandler& Instance();
void Update(InputClass* inputObject);
EventButtonCollection* CreateCollection();
EventButtonCollection* GetCollection(/*ID*/);
private:
std::vector<EventButtonCollection*> collections;
};
}
}
#endif

View File

@ -146,7 +146,9 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="MessageHandler\MessageHandler.cpp" />
<ClCompile Include="EventHandler\EventButton.cpp" />
<ClCompile Include="EventHandler\EventButtonCollection.cpp" />
<ClCompile Include="EventHandler\EventHandler.cpp" />
<ClCompile Include="Packing\Packing.cpp" />
<ClCompile Include="Resource\Loaders\ByteLoader.cpp" />
<ClCompile Include="Resource\Loaders\CustomLoader.cpp" />
@ -163,9 +165,11 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="DynamicArray.h" />
<ClInclude Include="EventHandler\EventButton.h" />
<ClInclude Include="EventHandler\EventButtonCollection.h" />
<ClInclude Include="GID.h" />
<ClInclude Include="IQueue.h" />
<ClInclude Include="MessageHandler\MessageHandler.h" />
<ClInclude Include="EventHandler\EventHandler.h" />
<ClInclude Include="OysterCallback.h" />
<ClInclude Include="Packing\Packing.h" />
<ClInclude Include="PostBox\IPostBox.h" />

View File

@ -51,7 +51,13 @@
<ClCompile Include="Packing\Packing.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MessageHandler\MessageHandler.cpp">
<ClCompile Include="EventHandler\EventHandler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="EventHandler\EventButton.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="EventHandler\EventButtonCollection.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
@ -119,7 +125,13 @@
<ClInclude Include="Packing\Packing.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MessageHandler\MessageHandler.h">
<ClInclude Include="EventHandler\EventHandler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="EventHandler\EventButton.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="EventHandler\EventButtonCollection.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>