added collisionManager

also some changes around the place
This commit is contained in:
Erik Persson 2013-11-26 09:19:59 +01:00
parent 220f1da8b6
commit 2859588d20
7 changed files with 62 additions and 18 deletions

View File

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

View File

@ -0,0 +1,30 @@
#ifndef COLLISIONMANAGER_H
#define COLLISIONMANAGER_H
#include "Object.h"
#include "PhysicsAPI.h"
#include "RefManager.h"
#include "DynamicObject.h"
#include "Player.h"
namespace GameLogic
{
class CollisionManager
{
public:
CollisionManager(void);
~CollisionManager(void);
void ColisionEvent(Oyster::Physics::ICustomBody &obj1, Oyster::Physics::ICustomBody &obj2);
void PlayerVBox(Player &player, DynamicObject &box);
private:
};
}
#endif

View File

@ -8,21 +8,21 @@ namespace GameLogic
{ {
class Game class Game
{ {
private: public:
Game();
~Game();
void Init();
void StartGame();
void Update();
void Render();
private: private:
Level* level; Level* level;
Player* player; Player* player;
public:
Game();
~Game();
void Init();
void StartGame();
void Update();
void Render();
}; };
} }
#endif #endif

View File

@ -17,7 +17,7 @@ namespace GameLogic
Object(void); Object(void);
virtual ~Object(void); virtual ~Object(void);
Utility::DynamicMemory::UniquePointer<Oyster::Graphics::Render::Model> model;
void Render(); void Render();
private: private:
@ -25,9 +25,9 @@ namespace GameLogic
protected: protected:
//either a model pointer or an ID to an arraypos filled with models that are to be rendered //either a model pointer or an ID to an arraypos filled with models that are to be rendered
//rigidBody //rigidBody
unsigned int ref;
::Utility::DynamicMemory::UniquePointer<Oyster::Physics::ICustomBody> rigidBody;
Utility::DynamicMemory::UniquePointer<Oyster::Physics::ICustomBody> rigidBody;
Utility::DynamicMemory::UniquePointer<Oyster::Graphics::Render::Model> model;
}; };
} }

View File

@ -46,7 +46,9 @@ Player::Player(void)
{ {
life = 10; life = 10;
UniquePointer<ICustomBody> rigidBody = API::Instance().CreateSimpleRigidBody(); rigidBody = API::Instance().CreateSimpleRigidBody();
//ref = API::Instance().AddObject(rigidBody); //ref = API::Instance().AddObject(rigidBody);
////ref = API::Instance().AddObject(API::Instance().CreateSimpleRigidBody()); ////ref = API::Instance().AddObject(API::Instance().CreateSimpleRigidBody());
//const ICustomBody* rB; //const ICustomBody* rB;

View File

@ -13,14 +13,14 @@ RefManager::~RefManager(void)
{ {
} }
Object* RefManager::GetMap(Oyster::Physics::ICustomBody *body) Object* RefManager::GetMap(Oyster::Physics::ICustomBody &body)
{ {
return mapper[body]; return mapper[&body];
} }
void RefManager::AddMapping(Oyster::Physics::ICustomBody *body, Object *obj) void RefManager::AddMapping(Oyster::Physics::ICustomBody &body, Object &obj)
{ {
mapper.insert(mapData(body,obj)); mapper.insert(mapData(&body,&obj));
} }

View File

@ -16,8 +16,8 @@ namespace GameLogic
RefManager(void); RefManager(void);
~RefManager(void); ~RefManager(void);
Object* GetMap(Oyster::Physics::ICustomBody *body); Object* GetMap(Oyster::Physics::ICustomBody &body);
void AddMapping(Oyster::Physics::ICustomBody *body, Object *obj); void AddMapping(Oyster::Physics::ICustomBody &body, Object &obj);
private: private: