From 059b3dd5e46e18b9c4e6611598dafd35f5fd00e0 Mon Sep 17 00:00:00 2001 From: Erik Persson Date: Fri, 10 Jan 2014 12:33:04 +0100 Subject: [PATCH] GameLogic - Basic game interface made (functions not yet implemented) --- Code/Game/GameLogic/Game.cpp | 71 +++++++++++++++++++++ Code/Game/GameLogic/Game.h | 88 +++++++++++++++++++++++++++ Code/Game/GameLogic/GameLogic.vcxproj | 2 + Code/Game/GameLogic/Object.cpp | 1 - Code/Game/GameLogic/Player.cpp | 4 +- Code/Game/GameLogic/Player.h | 2 +- 6 files changed, 164 insertions(+), 4 deletions(-) create mode 100644 Code/Game/GameLogic/Game.cpp create mode 100644 Code/Game/GameLogic/Game.h diff --git a/Code/Game/GameLogic/Game.cpp b/Code/Game/GameLogic/Game.cpp new file mode 100644 index 00000000..806ac6d2 --- /dev/null +++ b/Code/Game/GameLogic/Game.cpp @@ -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() +{ + +} \ No newline at end of file diff --git a/Code/Game/GameLogic/Game.h b/Code/Game/GameLogic/Game.h new file mode 100644 index 00000000..a70dc842 --- /dev/null +++ b/Code/Game/GameLogic/Game.h @@ -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 diff --git a/Code/Game/GameLogic/GameLogic.vcxproj b/Code/Game/GameLogic/GameLogic.vcxproj index 500f8bbc..c67ef3d9 100644 --- a/Code/Game/GameLogic/GameLogic.vcxproj +++ b/Code/Game/GameLogic/GameLogic.vcxproj @@ -173,6 +173,7 @@ + @@ -190,6 +191,7 @@ + diff --git a/Code/Game/GameLogic/Object.cpp b/Code/Game/GameLogic/Object.cpp index e824c1d5..49ff7780 100644 --- a/Code/Game/GameLogic/Object.cpp +++ b/Code/Game/GameLogic/Object.cpp @@ -50,7 +50,6 @@ Object::Object(void* collisionFunc, OBJECT_TYPE type) Object::~Object(void) { - } OBJECT_TYPE Object::GetType() diff --git a/Code/Game/GameLogic/Player.cpp b/Code/Game/GameLogic/Player.cpp index 626e565f..a3702a53 100644 --- a/Code/Game/GameLogic/Player.cpp +++ b/Code/Game/GameLogic/Player.cpp @@ -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) diff --git a/Code/Game/GameLogic/Player.h b/Code/Game/GameLogic/Player.h index 2cc703ac..e9ad03da 100644 --- a/Code/Game/GameLogic/Player.h +++ b/Code/Game/GameLogic/Player.h @@ -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