GameLogic - Basic game interface made (functions not yet implemented)

This commit is contained in:
Erik Persson 2014-01-10 12:33:04 +01:00
parent f6ba81cd44
commit 059b3dd5e4
6 changed files with 164 additions and 4 deletions

View File

@ -0,0 +1,71 @@
#include "Game.h"
#include "Player.h"
#include "Level.h"
using namespace GameLogic;
struct Game::PrivateData
{
PrivateData()
{
}
~PrivateData()
{
}
Player **players;
Level *level;
}myData;
Game::Game(void)
{
myData = new PrivateData();
}
Game::~Game(void)
{
if(myData)
{
delete myData;
}
}
void Game::MovePlayer(int playerID, const PLAYER_MOVEMENT &movement)
{
}
void Game::PlayerUseWeapon(int playerID, const WEAPON_FIRE &Usage)
{
}
void Game::GetPlayerPos(int playerID)
{
}
void Game::GetAllPlayerPos()
{
}
Game::PlayerData Game::CreatePlayer()
{
}
void Game::CreateTeam()
{
}
void Game::NewFrame()
{
}

View File

@ -0,0 +1,88 @@
#ifndef GAME_H
#define GAME_H
#include "GameLogicStates.h"
namespace GameLogic
{
class Game
{
public:
struct PlayerData
{
int playerID;
int teamID;
PlayerData()
{
playerID = 0;
teamID = 0;
}
PlayerData(int playerID,int teamID)
{
this->playerID = playerID;
this->teamID = teamID;
}
~PlayerData()
{
}
};
public:
Game(void);
~Game(void);
/********************************************************
* Moves the chosen player based on input
* @param playerID: ID of the player you want to recieve the message
* @param movement: enum value on what kind of action is to be taken
********************************************************/
void MovePlayer(int playerID, const PLAYER_MOVEMENT &movement);
/********************************************************
* Uses the chosen players weapon based on input
* @param playerID: ID of the player you want to recieve the message
* @param Usage: enum value on what kind of action is to be taken
********************************************************/
void PlayerUseWeapon(int playerID, const WEAPON_FIRE &Usage);
/********************************************************
* Gets a specific players position
* @param playerID: ID of the player whos position you want
********************************************************/
void GetPlayerPos(int playerID);
/********************************************************
* Gets the position of all players currently in the game
********************************************************/
void GetAllPlayerPos();
/********************************************************
* Creates a player and returns PlayerData containing ID of the player
********************************************************/
PlayerData CreatePlayer();
/********************************************************
* Creates a team
********************************************************/
void CreateTeam();
/********************************************************
* Runs a update of the gamelogic and physics
********************************************************/
void NewFrame();
private:
struct PrivateData;
PrivateData *myData;
};
}
#endif

View File

@ -173,6 +173,7 @@
<ClInclude Include="AttatchmentSocket.h" />
<ClInclude Include="CollisionManager.h" />
<ClInclude Include="DynamicObject.h" />
<ClInclude Include="Game.h" />
<ClInclude Include="GameLogicDef.h" />
<ClInclude Include="GameLogicStates.h" />
<ClInclude Include="GameMode.h" />
@ -190,6 +191,7 @@
<ClCompile Include="AttatchmentSocket.cpp" />
<ClCompile Include="CollisionManager.cpp" />
<ClCompile Include="DynamicObject.cpp" />
<ClCompile Include="Game.cpp" />
<ClCompile Include="GameMode.cpp" />
<ClCompile Include="IAttatchment.cpp" />
<ClCompile Include="Level.cpp" />

View File

@ -50,7 +50,6 @@ Object::Object(void* collisionFunc, OBJECT_TYPE type)
Object::~Object(void)
{
}
OBJECT_TYPE Object::GetType()

View File

@ -94,9 +94,9 @@ void Player::MoveLeft()
state.ApplyLinearImpulse(-r * 100);
}
void Player::UseWeapon(const WEAPON_FIRE &fireInput)
void Player::UseWeapon(const WEAPON_FIRE &Usage)
{
myData->weapon->Use(fireInput);
myData->weapon->Use(Usage);
}
void Player::Respawn(Oyster::Math::Float3 spawnPoint)

View File

@ -33,7 +33,7 @@ namespace GameLogic
* Uses the weapon based on input
* @param fireInput: enum value on what kind of action is to be taken
********************************************************/
void UseWeapon(const WEAPON_FIRE &fireInput);
void UseWeapon(const WEAPON_FIRE &Usage);
/********************************************************
* Respawns the player, this resets several stats and settings on the player