Danbias/Code/Game/GameLogic/Game.h

91 lines
2.4 KiB
C
Raw Normal View History

/////////////////////////////////////////////////////////////////////
// Created by [Erik Persson] [2013]
/////////////////////////////////////////////////////////////////////
#ifndef GAME_H
#define GAME_H
2014-01-20 15:47:52 +01:00
//Includes windows so we need to undef minmax
#define NOMINMAX
#include <vld.h>
#include "GameAPI.h"
#include "Player.h"
#include "Level.h"
#include <DynamicArray.h>
#include <GID.h>
#include <PhysicsAPI.h>
#include <WinTimer.h>
namespace GameLogic
{
2014-01-20 15:47:52 +01:00
class Game :public GameAPI
{
public:
2014-01-20 15:47:52 +01:00
class PlayerData :public IPlayerData
{
2014-01-20 15:47:52 +01:00
public:
PlayerData();
PlayerData(int playerID,int teamID);
~PlayerData();
2014-01-20 15:47:52 +01:00
void Move(const PLAYER_MOVEMENT &movement) override;
void UseWeapon(const WEAPON_FIRE &usage) override;
2014-01-20 15:47:52 +01:00
int GetTeamID() const override;
PLAYER_STATE GetState() const override;
Oyster::Math::Float3 GetPosition() override;
Oyster::Math::Float4x4 GetOrientation() override;
int GetID() const override;
OBJECT_TYPE GetObjectType() const override;
Player *player;
};
2014-01-20 15:47:52 +01:00
class LevelData :public ILevelData
{
2014-01-20 15:47:52 +01:00
public:
LevelData();
~LevelData();
2014-01-20 15:47:52 +01:00
Oyster::Math::Float3 GetPosition() override;
Oyster::Math::Float4x4 GetOrientation() override;
int GetID() const override;
OBJECT_TYPE GetObjectType() const override;
2014-01-20 15:47:52 +01:00
Level *level;
};
public:
2014-01-20 15:47:52 +01:00
Game();
~Game();
void GetAllPlayerPositions() const override;
PlayerData* CreatePlayer() override;
LevelData* CreateLevel() override;
void CreateTeam() override;
bool NewFrame() override;
void SetFPS( int FPS ) override;
void SetFrameTimeLength( float seconds ) override;
void SetSubscription(GameEvent::ObjectEventFunctionType type, GameEvent::ObjectEventFunction functionPointer) override;
bool Initiate() override;
float GetFrameTime() const;
private:
static void PhysicsOnMove(const Oyster::Physics::ICustomBody *object);
static void PhysicsOnDestroy(::Utility::DynamicMemory::UniquePointer<Oyster::Physics::ICustomBody> proto);
private:
2014-01-20 15:47:52 +01:00
Utility::DynamicMemory::DynamicArray<PlayerData*> players;
LevelData* level;
float frameTime;
bool initiated;
GameEvent::ObjectEventFunction onDeadFnc;
GameEvent::ObjectEventFunction onMoveFnc;
};
}
#endif