Misc - EventHandler, EventCollection
This commit is contained in:
parent
8ee8374169
commit
d6769ac62f
|
@ -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)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -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
|
|
@ -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*/);
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -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
|
|
@ -146,7 +146,9 @@
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<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="Packing\Packing.cpp" />
|
||||||
<ClCompile Include="Resource\Loaders\ByteLoader.cpp" />
|
<ClCompile Include="Resource\Loaders\ByteLoader.cpp" />
|
||||||
<ClCompile Include="Resource\Loaders\CustomLoader.cpp" />
|
<ClCompile Include="Resource\Loaders\CustomLoader.cpp" />
|
||||||
|
@ -163,9 +165,11 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="DynamicArray.h" />
|
<ClInclude Include="DynamicArray.h" />
|
||||||
|
<ClInclude Include="EventHandler\EventButton.h" />
|
||||||
|
<ClInclude Include="EventHandler\EventButtonCollection.h" />
|
||||||
<ClInclude Include="GID.h" />
|
<ClInclude Include="GID.h" />
|
||||||
<ClInclude Include="IQueue.h" />
|
<ClInclude Include="IQueue.h" />
|
||||||
<ClInclude Include="MessageHandler\MessageHandler.h" />
|
<ClInclude Include="EventHandler\EventHandler.h" />
|
||||||
<ClInclude Include="OysterCallback.h" />
|
<ClInclude Include="OysterCallback.h" />
|
||||||
<ClInclude Include="Packing\Packing.h" />
|
<ClInclude Include="Packing\Packing.h" />
|
||||||
<ClInclude Include="PostBox\IPostBox.h" />
|
<ClInclude Include="PostBox\IPostBox.h" />
|
||||||
|
|
|
@ -51,7 +51,13 @@
|
||||||
<ClCompile Include="Packing\Packing.cpp">
|
<ClCompile Include="Packing\Packing.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</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>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -119,7 +125,13 @@
|
||||||
<ClInclude Include="Packing\Packing.h">
|
<ClInclude Include="Packing\Packing.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</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>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
Loading…
Reference in New Issue