Misc - Changed to no template/template

This commit is contained in:
Pontus Fransson 2014-01-31 15:06:30 +01:00
parent d5f285c089
commit dbe8b4706b
5 changed files with 18 additions and 13 deletions

View File

@ -9,11 +9,8 @@ namespace Oyster
{
namespace Event
{
template <class T>
class EventButton
struct IButton
{
private:
enum ButtonState
{
Button_Clicked,
@ -21,6 +18,12 @@ namespace Oyster
Button_Hold,
Button_Smashed,
};
};
template <class T>
class EventButton :public IButton
{
private:
struct ButtonEvent
{
ButtonState state;

View File

@ -22,12 +22,14 @@ void EventButtonCollection::Update(InputClass* inputObject)
}
}
void EventButtonCollection::AddButton(EventButton& button)
template <class Owner>
void EventButtonCollection::AddButton(EventButton<Owner>& button)
{
buttons.push_back(button);
}
EventButton& EventButtonCollection::CreateButton()
template <class Owner>
EventButton<Owner>& EventButtonCollection::CreateButton()
{
EventButton temp;
buttons.push_back(&temp);

View File

@ -3,6 +3,7 @@
#include "../../Input/L_inputClass.h"
#include "IEventButton.h"
#include "EventButton.h"
#include <vector>
@ -28,8 +29,11 @@ namespace Oyster
void Update(InputClass* inputObject);
void AddButton(EventButton& button);
EventButton& CreateButton();
template <class Owner>
void AddButton(EventButton<Owner>& button);
template <class Owner>
EventButton<Owner>& CreateButton();
EventCollectionState GetState() const;
void SetState(const EventCollectionState state);
@ -38,7 +42,7 @@ namespace Oyster
void Clear();
private:
std::vector<EventButton*> buttons;
std::vector<IEventButton*> buttons;
EventCollectionState collectionState;
};

View File

@ -146,7 +146,6 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="EventHandler\EventButton.cpp" />
<ClCompile Include="EventHandler\EventButtonCollection.cpp" />
<ClCompile Include="EventHandler\EventHandler.cpp" />
<ClCompile Include="Packing\Packing.cpp" />

View File

@ -54,9 +54,6 @@
<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>