#ifndef GAMESTATE_HH
#define GAMESTATE_HH
class GameState;
#include "PhysicsWorld.hh"
#include "PhysicsObject.hh"
#include "Player.hh"
#include "Projectile.hh"
#include "Input.hh"
#include "Config.hh"
#include <list>
#include <stdexcept>
#include <cmath>
class GameState : public PhysicsWorld {
public:
std::list<Player*> player_list;
// only one local player is supported
LocalPlayer *local_player;
GameState (void) : PhysicsWorld(Vector(0, MAP_GRAVITY), Vector(MAP_WIDTH, MAP_HEIGHT)), local_player(NULL) {
}
/*
* This will return NULL if we don't have a local player - yet
*/
LocalPlayer *getLocalPlayer (void) {
return local_player;
}
void newLocalPlayer (LocalPlayer *player) {
if (local_player)
throw std::logic_error("newLocalPlayer called even though we already have a local player");
player_list.push_back(player);
local_player = player;
}
void newRemotePlayer (RemotePlayer *player) {
player_list.push_back(player);
}
void removePlayer (Player *player) {
player_list.remove(player);
}
};
#endif