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

View File

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

View File

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

View File

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

View File

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

View File

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