GL starting commenting

This commit is contained in:
Linda Andersson 2013-11-29 09:05:01 +01:00
parent 5ab1c39e3a
commit 017efd55e5
7 changed files with 53 additions and 43 deletions

View File

@ -176,8 +176,10 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClInclude Include="CollisionManager.h" />
<ClInclude Include="DynamicObject.h" />
<ClInclude Include="Game.h" />
<ClInclude Include="GameMode.h" />
<ClInclude Include="IGame.h" />
<ClInclude Include="Level.h" />
<ClInclude Include="Object.h" />
@ -187,8 +189,10 @@
<ClInclude Include="Weapon.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="CollisionManager.cpp" />
<ClCompile Include="DynamicObject.cpp" />
<ClCompile Include="Game.cpp" />
<ClCompile Include="GameMode.cpp" />
<ClCompile Include="IGame.cpp" />
<ClCompile Include="Level.cpp" />
<ClCompile Include="Object.cpp" />

View File

@ -42,6 +42,12 @@
<ClInclude Include="RefManager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameMode.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CollisionManager.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Game.cpp">
@ -74,5 +80,11 @@
<ClCompile Include="TestGLMain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GameMode.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="CollisionManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -8,16 +8,14 @@ BOOL WINAPI DllMain(
_In_ LPVOID lpvReserved
)
{
return TRUE;
}
using namespace GameLogic;
IGame::IGame()
{
gameModule = new Game();
}
IGame::~IGame()
{
delete gameModule;

View File

@ -43,7 +43,6 @@ void Object::Render()
{
this->rigidBody->GetOrientation(model->WorldMatrix);
Oyster::Graphics::API::RenderScene(model, 1);
}
Object::OBJECT_TYPE Object::GetType()

View File

@ -1,54 +1,53 @@
#include "Player.h"
#include "OysterMath.h"
using namespace GameLogic;
using namespace Oyster::Physics;
using namespace Utility::DynamicMemory;
Player::Player(void)
:Object()
{
life = 100;
}
Player::~Player(void)
{
delete this->rigidBody;
}
void Player::Update(keyInput keyPressed)
{
if(keyPressed != keyInput_none)
{
Move();
if(keyPressed == keyInput_A)
{
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
pos.x -= 0.1;
rigidBody->SetCenter(pos);
}
if(keyPressed == keyInput_D)
{
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
pos.x += 0.1;
rigidBody->SetCenter(pos);
}
Move(keyPressed);
}
}
void Player::Move()
void Player::Move(keyInput keyPressed)
{
//API::Instance().Update();
/*Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
pos.x += 0.1;
rigidBody->SetCenter(pos);*/
//API::Instance().SetCenter(rigidBody, pos);
if(keyPressed == keyInput_A)
{
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
pos.x -= 0.1;
rigidBody->SetCenter(pos);
}
if(keyPressed == keyInput_D)
{
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
pos.x += 0.1;
rigidBody->SetCenter(pos);
}
if(keyPressed == keyInput_S)
{
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
pos.y -= 0.1;
rigidBody->SetCenter(pos);
}
if(keyPressed == keyInput_W)
{
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
pos.y += 0.1;
rigidBody->SetCenter(pos);
}
}
void Player::Shoot()
{

View File

@ -13,27 +13,25 @@
namespace GameLogic
{
class Player : public Object
{
public:
Player(void);
~Player(void);
/********************************************************
* Update the position of the rigid body
* This will be done with physics later
********************************************************/
void Update(keyInput keyPressed);
void Move();
void Move(keyInput keyPressed);
void Shoot();
private:
int life;
Weapon *weapon;
};
}
#endif

View File

@ -272,10 +272,10 @@ HRESULT Render(float deltaTime)
}
// test view and projection matrix
Oyster::Math::Float3 dir = Oyster::Math::Float3(0,0,-1);
Oyster::Math::Float3 up =Oyster::Math::Float3(0,1,0);
Oyster::Math::Float3 dir = Oyster::Math::Float3(0, 0, -1);
Oyster::Math::Float3 up = Oyster::Math::Float3(0, 1, 0);
Oyster::Math::Float3 pos = Oyster::Math::Float3(0, 0, 100);
Oyster::Math::Float4x4 view =Oyster::Math3D::OrientationMatrix_LookAtDirection(dir, up, pos);
view = view.GetInverse();