Misc - Changed to no template/template
This commit is contained in:
parent
d5f285c089
commit
dbe8b4706b
|
@ -9,11 +9,8 @@ namespace Oyster
|
||||||
{
|
{
|
||||||
namespace Event
|
namespace Event
|
||||||
{
|
{
|
||||||
|
struct IButton
|
||||||
template <class T>
|
|
||||||
class EventButton
|
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
enum ButtonState
|
enum ButtonState
|
||||||
{
|
{
|
||||||
Button_Clicked,
|
Button_Clicked,
|
||||||
|
@ -21,6 +18,12 @@ namespace Oyster
|
||||||
Button_Hold,
|
Button_Hold,
|
||||||
Button_Smashed,
|
Button_Smashed,
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
template <class T>
|
||||||
|
class EventButton :public IButton
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
struct ButtonEvent
|
struct ButtonEvent
|
||||||
{
|
{
|
||||||
ButtonState state;
|
ButtonState state;
|
||||||
|
|
|
@ -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);
|
buttons.push_back(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventButton& EventButtonCollection::CreateButton()
|
template <class Owner>
|
||||||
|
EventButton<Owner>& EventButtonCollection::CreateButton()
|
||||||
{
|
{
|
||||||
EventButton temp;
|
EventButton temp;
|
||||||
buttons.push_back(&temp);
|
buttons.push_back(&temp);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "../../Input/L_inputClass.h"
|
#include "../../Input/L_inputClass.h"
|
||||||
|
|
||||||
|
#include "IEventButton.h"
|
||||||
#include "EventButton.h"
|
#include "EventButton.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -28,8 +29,11 @@ namespace Oyster
|
||||||
|
|
||||||
void Update(InputClass* inputObject);
|
void Update(InputClass* inputObject);
|
||||||
|
|
||||||
void AddButton(EventButton& button);
|
template <class Owner>
|
||||||
EventButton& CreateButton();
|
void AddButton(EventButton<Owner>& button);
|
||||||
|
|
||||||
|
template <class Owner>
|
||||||
|
EventButton<Owner>& CreateButton();
|
||||||
|
|
||||||
EventCollectionState GetState() const;
|
EventCollectionState GetState() const;
|
||||||
void SetState(const EventCollectionState state);
|
void SetState(const EventCollectionState state);
|
||||||
|
@ -38,7 +42,7 @@ namespace Oyster
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<EventButton*> buttons;
|
std::vector<IEventButton*> buttons;
|
||||||
EventCollectionState collectionState;
|
EventCollectionState collectionState;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -146,7 +146,6 @@
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="EventHandler\EventButton.cpp" />
|
|
||||||
<ClCompile Include="EventHandler\EventButtonCollection.cpp" />
|
<ClCompile Include="EventHandler\EventButtonCollection.cpp" />
|
||||||
<ClCompile Include="EventHandler\EventHandler.cpp" />
|
<ClCompile Include="EventHandler\EventHandler.cpp" />
|
||||||
<ClCompile Include="Packing\Packing.cpp" />
|
<ClCompile Include="Packing\Packing.cpp" />
|
||||||
|
|
|
@ -54,9 +54,6 @@
|
||||||
<ClCompile Include="EventHandler\EventHandler.cpp">
|
<ClCompile Include="EventHandler\EventHandler.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="EventHandler\EventButton.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="EventHandler\EventButtonCollection.cpp">
|
<ClCompile Include="EventHandler\EventButtonCollection.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
Loading…
Reference in New Issue