reference manager for physics communication
This commit is contained in:
parent
0db45bd63f
commit
e2c90a467b
|
@ -170,6 +170,7 @@
|
||||||
<ClInclude Include="Level.h" />
|
<ClInclude Include="Level.h" />
|
||||||
<ClInclude Include="Object.h" />
|
<ClInclude Include="Object.h" />
|
||||||
<ClInclude Include="Player.h" />
|
<ClInclude Include="Player.h" />
|
||||||
|
<ClInclude Include="RefManager.h" />
|
||||||
<ClInclude Include="StaticObject.h" />
|
<ClInclude Include="StaticObject.h" />
|
||||||
<ClInclude Include="Weapon.h" />
|
<ClInclude Include="Weapon.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -180,6 +181,7 @@
|
||||||
<ClCompile Include="Level.cpp" />
|
<ClCompile Include="Level.cpp" />
|
||||||
<ClCompile Include="Object.cpp" />
|
<ClCompile Include="Object.cpp" />
|
||||||
<ClCompile Include="Player.cpp" />
|
<ClCompile Include="Player.cpp" />
|
||||||
|
<ClCompile Include="RefManager.cpp" />
|
||||||
<ClCompile Include="StaticObject.cpp" />
|
<ClCompile Include="StaticObject.cpp" />
|
||||||
<ClCompile Include="TestGLMain.cpp" />
|
<ClCompile Include="TestGLMain.cpp" />
|
||||||
<ClCompile Include="Weapon.cpp" />
|
<ClCompile Include="Weapon.cpp" />
|
||||||
|
|
|
@ -39,6 +39,9 @@
|
||||||
<ClInclude Include="DynamicObject.h">
|
<ClInclude Include="DynamicObject.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="RefManager.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Game.cpp">
|
<ClCompile Include="Game.cpp">
|
||||||
|
@ -68,5 +71,8 @@
|
||||||
<ClCompile Include="TestGLMain.cpp">
|
<ClCompile Include="TestGLMain.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="RefManager.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -0,0 +1,26 @@
|
||||||
|
#include "RefManager.h"
|
||||||
|
|
||||||
|
using namespace GameLogic;
|
||||||
|
|
||||||
|
typedef std::pair<Oyster::Physics::ICustomBody*, Object*> mapData;
|
||||||
|
|
||||||
|
RefManager::RefManager(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RefManager::~RefManager(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Object* RefManager::GetMap(Oyster::Physics::ICustomBody *body)
|
||||||
|
{
|
||||||
|
return mapper[body];
|
||||||
|
}
|
||||||
|
|
||||||
|
void RefManager::AddMapping(Oyster::Physics::ICustomBody *body, Object *obj)
|
||||||
|
{
|
||||||
|
mapper.insert(mapData(body,obj));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
#ifndef REFMANAGER_H
|
||||||
|
#define REFMANAGER_H
|
||||||
|
|
||||||
|
#include<map>
|
||||||
|
#include "Object.h"
|
||||||
|
#include "PhysicsAPI.h"
|
||||||
|
|
||||||
|
namespace GameLogic
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class RefManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RefManager(void);
|
||||||
|
~RefManager(void);
|
||||||
|
|
||||||
|
Object* GetMap(Oyster::Physics::ICustomBody *body);
|
||||||
|
void AddMapping(Oyster::Physics::ICustomBody *body, Object *obj);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::map<Oyster::Physics::ICustomBody*,Object*> mapper; //shall be pointer from physics that map to an object
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif
|
Loading…
Reference in New Issue