Merge branch 'GameLogicBranch' of https://github.com/dean11/Danbias into GameLogicBranch

This commit is contained in:
Linda Andersson 2013-11-26 09:17:25 +01:00
commit abfd3116ca
7 changed files with 107 additions and 0 deletions

View File

@ -178,6 +178,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>
@ -188,6 +189,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" />

View File

@ -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>

View File

@ -0,0 +1,15 @@
#include "GameMode.h"
using namespace GameLogic;
GameMode::GameMode(void)
{
}
GameMode::~GameMode(void)
{
}

17
Code/GameLogic/GameMode.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef GAMEMODE_H
#define GAMEMODE_H
namespace GameLogic
{
class GameMode
{
public:
GameMode(void);
~GameMode(void);
private:
//variabels that control what game rules the level runs on
};
}
#endif

View File

@ -1,6 +1,10 @@
#ifndef LEVEL_H #ifndef LEVEL_H
#define LEVEL_H #define LEVEL_H
#include "StaticObject.h"
#include "DynamicObject.h"
#include "GameMode.h"
namespace GameLogic namespace GameLogic
{ {
@ -12,6 +16,15 @@ namespace GameLogic
~Level(void); ~Level(void);
private: private:
StaticObject** staticObjects;
int nrOfStaticObjects;
DynamicObject** dynamicObjects;
int nrOfDynamicObjects;
GameMode* gameMode;
}; };

View File

@ -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));
}

View File

@ -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