Misc - Still having problems with template with eventhandler.

This commit is contained in:
Pontus Fransson 2014-02-04 08:46:20 +01:00
parent 9671eb8ee9
commit 50d28a5784
6 changed files with 22 additions and 27 deletions

View File

@ -58,7 +58,7 @@ namespace Oyster
{ {
this->privData.ID = privData.currID; this->privData.ID = privData.currID;
this->privData.currID += 1; this->privData.currID += 1;
this->privData.owner = NULL; //this->privData.owner = NULL;
this->privData.EventFunc = NULL; this->privData.EventFunc = NULL;
} }

View File

@ -22,20 +22,6 @@ void EventButtonCollection::Update(InputClass* inputObject)
} }
} }
template <class Owner>
void EventButtonCollection::AddButton(Owner a)
{
//buttons.push_back(button);
}
template <class Owner>
EventButton<Owner>& EventButtonCollection::CreateButton()
{
EventButton temp;
buttons.push_back((IEventButton)&temp);
return temp;
}
EventCollectionState EventButtonCollection::GetState() const EventCollectionState EventButtonCollection::GetState() const
{ {
return collectionState; return collectionState;

View File

@ -29,11 +29,22 @@ namespace Oyster
void Update(InputClass* inputObject); void Update(InputClass* inputObject);
template <class Owner> template <typename Owner>
void AddButton(Owner a); void AddButton(EventButton<Owner>& button)
{
EventButton<Owner>* b = new EventButton<Owner>();
buttons.size();
buttons.push_back((IEventButton*)b);
//buttons.push_back((IEventButton*)&button);
}
template <class Owner> template <typename Owner>
EventButton<Owner>& CreateButton(); EventButton<Owner>& CreateButton()
{
EventButton<Owner> temp;
buttons.push_back(&temp);
return temp;
}
EventCollectionState GetState() const; EventCollectionState GetState() const;
void SetState(const EventCollectionState state); void SetState(const EventCollectionState state);

View File

@ -8,9 +8,7 @@ namespace Oyster
{ {
class IEventButton class IEventButton
{ {
public: public:
enum ButtonState enum ButtonState
{ {
Button_Clicked, Button_Clicked,

View File

@ -166,10 +166,10 @@
<ClInclude Include="DynamicArray.h" /> <ClInclude Include="DynamicArray.h" />
<ClInclude Include="EventHandler\EventButton.h" /> <ClInclude Include="EventHandler\EventButton.h" />
<ClInclude Include="EventHandler\EventButtonCollection.h" /> <ClInclude Include="EventHandler\EventButtonCollection.h" />
<ClInclude Include="EventHandler\EventHandler.h" />
<ClInclude Include="EventHandler\IEventButton.h" /> <ClInclude Include="EventHandler\IEventButton.h" />
<ClInclude Include="GID.h" /> <ClInclude Include="GID.h" />
<ClInclude Include="IQueue.h" /> <ClInclude Include="IQueue.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" />

View File

@ -51,10 +51,10 @@
<ClCompile Include="Packing\Packing.cpp"> <ClCompile Include="Packing\Packing.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="EventHandler\EventHandler.cpp"> <ClCompile Include="EventHandler\EventButtonCollection.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="EventHandler\EventButtonCollection.cpp"> <ClCompile Include="EventHandler\EventHandler.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
@ -122,15 +122,15 @@
<ClInclude Include="Packing\Packing.h"> <ClInclude Include="Packing\Packing.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="EventHandler\EventHandler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="EventHandler\EventButton.h"> <ClInclude Include="EventHandler\EventButton.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="EventHandler\EventButtonCollection.h"> <ClInclude Include="EventHandler\EventButtonCollection.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="EventHandler\EventHandler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="EventHandler\IEventButton.h"> <ClInclude Include="EventHandler\IEventButton.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>