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

This commit is contained in:
Linda Andersson 2013-11-28 11:27:02 +01:00
commit ac37ff90de
34 changed files with 206 additions and 190 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Bin/DLL/GameLogic_x86D.exp Normal file

Binary file not shown.

BIN
Bin/DLL/GameLogic_x86D.ilk Normal file

Binary file not shown.

BIN
Bin/DLL/GameLogic_x86D.pdb Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,49 +1,82 @@
#include "CollisionManager.h"
using namespace GameLogic;
CollisionManager::CollisionManager(void)
namespace GameLogic
{
refManager = new RefManager();
}
CollisionManager::~CollisionManager(void)
{
SAFE_DELETE(refManager);
}
void CollisionManager::ColisionEvent(Oyster::Physics::ICustomBody &obj1, Oyster::Physics::ICustomBody &obj2)
{
Object *realObj1 = refManager->GetMap(obj1);
Object *realObj2 = refManager->GetMap(obj2);
switch(realObj1->GetType())
namespace CollisionManager
{
case Object::OBJECT_TYPE_PLAYER:
if (realObj2->GetType() == Object::OBJECT_TYPE_BOX )
void ColisionEvent(Oyster::Physics::ICustomBody &obj1, Oyster::Physics::ICustomBody &obj2)
{
PlayerVBox(*((Player*)realObj1),*((DynamicObject*)realObj2));
//Object *realObj1 = refManager.GetMap(obj1);
//Object *realObj2 = refManager.GetMap(obj2);
//
//switch(realObj1->GetType())
//{
//case Object::OBJECT_TYPE_PLAYER:
// if (realObj2->GetType() == Object::OBJECT_TYPE_BOX )
// {
//CollisionManager::PlayerVBox(*((Player*)realObj1),*((DynamicObject*)realObj2));
// }
// break;
//case Object::OBJECT_TYPE_BOX:
// if (realObj2->GetType() == Object::OBJECT_TYPE_PLAYER)
// {
// CollisionManager::PlayerVBox(*((Player*)realObj2),*((DynamicObject*)realObj1));
// }
// break;
//}
}
break;
case Object::OBJECT_TYPE_BOX:
if (realObj2->GetType() == Object::OBJECT_TYPE_PLAYER)
void PlayerCollision(Oyster::Physics::ICustomBody &rigidBodyPlayer,Oyster::Physics::ICustomBody &obj)
{
PlayerVBox(*((Player*)realObj2),*((DynamicObject*)realObj1));
Player *player = ((Player*)GameLogic::RefManager::getInstance()->GetMap(rigidBodyPlayer));
Object *realObj = GameLogic::RefManager::getInstance()->GetMap(obj);
switch (realObj->GetType())
{
case Object::OBJECT_TYPE_BOX:
PlayerVBox(*player,(*(DynamicObject*) realObj));
break;
case Object::OBJECT_TYPE_PLAYER:
break;
}
//spela ljud? ta skada? etc etc
}
break;
void PlayerVBox(Player &player, DynamicObject &box)
{
//spela ljud? ta skada? etc etc
}
void BoxCollision(Oyster::Physics::ICustomBody &rigidBodyBox, Oyster::Physics::ICustomBody &obj)
{
DynamicObject *box = ((DynamicObject*)GameLogic::RefManager::getInstance()->GetMap(rigidBodyBox));
Object *realObj = GameLogic::RefManager::getInstance()->GetMap(obj);
switch (realObj->GetType())
{
case Object::OBJECT_TYPE_BOX:
break;
case Object::OBJECT_TYPE_PLAYER:
PlayerVBox(*(Player*)realObj,*box);
break;
}
}
}
}
void CollisionManager::PlayerVBox(Player &player, DynamicObject &box)
{
//spela ljud? ta skada? etc etc
}

View File

@ -10,19 +10,15 @@
namespace GameLogic
{
class CollisionManager
namespace CollisionManager
{
void PlayerCollision(Oyster::Physics::ICustomBody &rigidBodyPlayer,Oyster::Physics::ICustomBody &obj);
void BoxCollision(Oyster::Physics::ICustomBody &rigidBodyBox, Oyster::Physics::ICustomBody &obj);
public:
CollisionManager(void);
~CollisionManager(void);
private:
void ColisionEvent(Oyster::Physics::ICustomBody &obj1, Oyster::Physics::ICustomBody &obj2);
void PlayerVBox(Player &player, DynamicObject &box);
private:
RefManager *refManager;
void PlayerVBox(Player &player, DynamicObject &box);
void BoxVBox(DynamicObject &box1, DynamicObject &box2);
};

View File

@ -14,3 +14,8 @@ DynamicObject::DynamicObject(void)
DynamicObject::~DynamicObject(void)
{
}
void DynamicObject::Update()
{
//updatera objectet
}

View File

@ -1,3 +1,8 @@
//////////////////////////////////////////////////
//Created by Erik and Linda of the GameLogic team
//////////////////////////////////////////////////
#ifndef DYNAMICOBJECT_H
#define DYNAMICOBJECT_H
@ -14,6 +19,8 @@ namespace GameLogic
DynamicObject(void);
~DynamicObject(void);
void Update();
};
}

View File

@ -31,7 +31,5 @@ void Game::Update(keyInput keyPressed)
}
void Game::Render()
{
Oyster::Graphics::Model::Model* model_Arr;
model_Arr = player->Render();
Oyster::Graphics::API::RenderScene(model_Arr, 1);
player->Render();
}

View File

@ -1,3 +1,8 @@
//////////////////////////////////////////////////
//Created by Erik and Linda of the GameLogic team
//////////////////////////////////////////////////
#ifndef GAMEMODE_H
#define GAMEMODE_H

View File

@ -1,4 +1,6 @@
// Game Logic interface
//////////////////////////////////////////////////
//Created by Erik and Linda of the GameLogic team
//////////////////////////////////////////////////
#ifndef IGAME_H
#define IGAME_H

View File

@ -1,3 +1,8 @@
//////////////////////////////////////////////////
//Created by Erik and Linda of the GameLogic team
//////////////////////////////////////////////////
#ifndef LEVEL_H
#define LEVEL_H

View File

@ -1,5 +1,7 @@
#include "Object.h"
#include "OysterMath.h"
#include "DllInterfaces\GFXAPI.h"
#include "CollisionManager.h"
using namespace GameLogic;
@ -8,60 +10,40 @@ using namespace Oyster::Math;
using namespace Oyster::Graphics::Model;
using namespace Utility::DynamicMemory;
using namespace Oyster::Physics;
Object::Object(void)
{
model = new Model();
model = Oyster::Graphics::API::CreateModel(L"bth.obj");
/*struct float4
{
float x,y,z,w;
};
ICustomBody* temp = rigidBody = API::Instance().CreateSimpleRigidBody().Release();
float4 mesh[] =
{
{-1.0f,1.0f,0.0f,1.0f},
{1.0f,1.0f,0.0f,1.0f},
{1.0f,-1.0f,0.0f,1.0f},
};
Oyster::Graphics::Buffer::BUFFER_INIT_DESC desc;
desc.ElementSize= sizeof(float4);
desc.NumElements = 3;
desc.InitData=mesh;
desc.Type = Oyster::Graphics::Buffer::BUFFER_TYPE::VERTEX_BUFFER;
desc.Usage = Oyster::Graphics::Buffer::BUFFER_USAGE::BUFFER_USAGE_IMMUTABLE;
Oyster::Graphics::Buffer *b = new Oyster::Graphics::Buffer();
b->Init(desc);
ModelInfo* modelInfo = new ModelInfo();
modelInfo->Vertices = *b;
modelInfo->Indexed = false;
modelInfo->VertexCount = 3;
rigidBody->SetCenter(Float3(50,0,0));
rigidBody->SetMass_KeepMomentum(30);
rigidBody->SetSize(Float3(2,2,2));
rigidBody->SetSubscription(true);
rigidBody->SetMomentOfInertiaTensor_KeepMomentum(Float4x4(MomentOfInertia::CreateCuboidMatrix(30, 2, 2, 2)));
Float4x4 matrix = Float4x4::identity;
GameLogic::RefManager::getInstance()->AddMapping(*rigidBody, *this);
model->World = &matrix;
model->info = modelInfo;
model->Visible = true;*/
}
Object::~Object(void)
{
//SAFE_DELETE(model->info);
Oyster::Graphics::API::DeleteModel(model);
Oyster::Graphics::API::DeleteModel(model);
}
Model* Object::Render()
void Object::Render()
{
//model->info->Vertices.Apply(0);
this->rigidBody->GetOrientation(model->WorldMatrix);
return model;
Oyster::Graphics::API::RenderScene(model, 1);
}
Object::OBJECT_TYPE Object::GetType()

View File

@ -1,3 +1,8 @@
//////////////////////////////////////////////////
//Created by Erik and Linda of the GameLogic team
//////////////////////////////////////////////////
#ifndef OBJECT_H
#define OBJECT_H
@ -8,6 +13,7 @@
#include "Utilities.h"
namespace GameLogic
{
class Object
@ -22,7 +28,7 @@ namespace GameLogic
OBJECT_TYPE_BOX,
};
Oyster::Graphics::Model::Model* Render();
void Render();
OBJECT_TYPE GetType();
@ -33,8 +39,9 @@ namespace GameLogic
//either a model pointer or an ID to an arraypos filled with models that are to be rendered
//rigidBody
Oyster::Physics::ICustomBody* rigidBody;
Oyster::Graphics::Model::Model* model;
Oyster::Physics::ICustomBody *rigidBody;
Oyster::Graphics::Model::Model *model;
};
}

View File

@ -13,16 +13,6 @@ Player::Player(void)
:Object()
{
life = 100;
Oyster::Physics::ICustomBody* temp = rigidBody = API::Instance().CreateSimpleRigidBody().Release();
rigidBody->SetCenter(Oyster::Math::Float3(50,0,0));
rigidBody->SetMass_KeepMomentum(30);
rigidBody->SetSize(Oyster::Math::Float3(2,2,2));
rigidBody->SetSubscription(true);
rigidBody->SetMomentOfInertiaTensor_KeepMomentum(Oyster::Math::Float4x4( Oyster::Physics::MomentOfInertia::CreateCuboidMatrix(30, 2, 2, 2)));
//API::Instance().AddObject(temp);
}

View File

@ -1,3 +1,8 @@
//////////////////////////////////////////////////
//Created by Erik and Linda of the GameLogic team
//////////////////////////////////////////////////
#ifndef PLAYER_H
#define PLAYER_H

View File

@ -4,6 +4,8 @@ using namespace GameLogic;
typedef std::pair<Oyster::Physics::ICustomBody*, Object*> mapData;
RefManager* RefManager::instance = 0;
RefManager::RefManager(void)
{
}
@ -13,6 +15,25 @@ RefManager::~RefManager(void)
{
}
void RefManager::Release()
{
if (instance)
{
delete instance;
instance = NULL;
}
}
RefManager* RefManager::getInstance( )
{
if (!instance)
{
instance = new RefManager();
};
return instance;
}
Object* RefManager::GetMap(Oyster::Physics::ICustomBody &body)
{
return mapper[&body];

View File

@ -1,3 +1,8 @@
//////////////////////////////////////////////////
//Created by Erik and Linda of the GameLogic team
//////////////////////////////////////////////////
#ifndef REFMANAGER_H
#define REFMANAGER_H
@ -14,13 +19,19 @@ namespace GameLogic
RefManager(void);
~RefManager(void);
static RefManager* getInstance( );
void Release();
Object* GetMap(Oyster::Physics::ICustomBody &body); //returns the object of an rigidBody, mainly used for CollisionHandler
void AddMapping(Oyster::Physics::ICustomBody &body, Object &obj); //adds a mapping with body as key and the object as a value
private:
static RefManager* instance;
std::map<Oyster::Physics::ICustomBody*,Object*> mapper; //mapper points a rigidBody to an actual game object
};
}
#endif

View File

@ -1,3 +1,8 @@
//////////////////////////////////////////////////
//Created by Erik and Linda of the GameLogic team
//////////////////////////////////////////////////
#ifndef STATICOBJECT_H
#define STATICOBJECT_H

View File

@ -1,3 +1,8 @@
//////////////////////////////////////////////////
//Created by Erik and Linda of the GameLogic team
//////////////////////////////////////////////////
#ifndef WEAPON_H
#define WEAPON_H

View File

@ -149,7 +149,6 @@
<ClCompile Include="Core\Core.cpp" />
<ClCompile Include="Core\Init.cpp" />
<ClCompile Include="Core\ShaderManager.cpp" />
<ClCompile Include="DllInterfaces\GFXAPI.cpp" />
<ClCompile Include="FileLoader\ObjReader.cpp" />
<ClCompile Include="FileLoader\TextureLoader.cpp" />
@ -226,6 +225,8 @@
</FxCompile>
</ItemGroup>
<ItemGroup>
<None Include="OysterGraphics.vcxproj.filters.orig" />
<None Include="OysterGraphics.vcxproj.orig" />
<None Include="Shader\HLSL\Deffered Shaders\GatherGBuffer\GBufferHeader.hlsli" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -1,102 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Core\Buffer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Core\Core.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Core\ShaderManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Core\Init.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<<<<<<< HEAD
<ClCompile Include="Resources\Resources.cpp">
=======
<ClCompile Include="Render\Rendering\BasicRender.cpp">
>>>>>>> origin/Graphics
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Render\Preparations\BasicPreparations.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<<<<<<< HEAD
<ClCompile Include="Render\Rendering\BasicRender.cpp">
=======
<ClCompile Include="Render\Resources\Resources.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="FileLoader\ObjReader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="FileLoader\TextureLoader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DllInterfaces\GFXAPI.cpp">
>>>>>>> origin/Graphics
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Core\Core.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Render\Preparations\Preparations.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Render\Rendering\Render.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Model\ModelInfo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Model\Model.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Render\Resources\Resources.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Definitions\GraphicalDefinition.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="FileLoader\ObjReader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="FileLoader\TextureLoader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Core\Dx11Includes.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="DllInterfaces\GFXAPI.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugVertex.hlsl" />
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugPixel.hlsl" />
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugCameraVertex.hlsl" />
<FxCompile Include="Shader\HLSL\Deffered Shaders\GatherGBuffer\PixelGatherData.hlsl" />
<FxCompile Include="Shader\HLSL\Deffered Shaders\GatherGBuffer\VertexGatherData.hlsl" />
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugCameraVertex.hlsl" />
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugPixel.hlsl" />
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugVertex.hlsl" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Core\Buffer.cpp" />
<ClCompile Include="Core\Core.cpp" />
<ClCompile Include="Core\Init.cpp" />
<ClCompile Include="Core\ShaderManager.cpp" />
<ClCompile Include="DllInterfaces\GFXAPI.cpp" />
<ClCompile Include="FileLoader\ObjReader.cpp" />
<ClCompile Include="FileLoader\TextureLoader.cpp" />
<ClCompile Include="Render\Preparations\BasicPreparations.cpp" />
<ClCompile Include="Render\Rendering\BasicRender.cpp" />
<ClCompile Include="Render\Resources\Resources.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Core\Core.h" />
<ClInclude Include="Core\Dx11Includes.h" />
<ClInclude Include="DllInterfaces\GFXAPI.h" />
<ClInclude Include="FileLoader\ObjReader.h" />
<ClInclude Include="FileLoader\TextureLoader.h" />
<ClInclude Include="Model\Model.h" />
<ClInclude Include="Model\ModelInfo.h" />
<ClInclude Include="Render\Preparations\Preparations.h" />
<ClInclude Include="Render\Rendering\Render.h" />
<ClInclude Include="Definitions\GraphicalDefinition.h" />
<ClInclude Include="Render\Resources\Resources.h" />
</ItemGroup>
<ItemGroup>
<None Include="Shader\HLSL\Deffered Shaders\GatherGBuffer\GBufferHeader.hlsli" />
<None Include="OysterGraphics.vcxproj.filters.orig" />
<None Include="OysterGraphics.vcxproj.orig" />
</ItemGroup>
</Project>