Suporte a IR, talvez...
[Projeto-PCG.git] / mapa.cpp
blob621899fc6bc10b6fa49658b1acc20238eafca735
1 #include "mapa.h"
2 #include "maploader.h"
4 Mapa::Mapa(std::string name, Game* g) {
5 game = g;
6 MapLoader loader;
7 loader.load(name,this);
10 Mapa::~Mapa() {
11 std::list<Platform*>::iterator it;
12 for (it = platforms.begin(); it != platforms.end(); it++)
13 delete (*it);
14 game->removePlatforms();
17 void Mapa::setTamanho(double width, double height) {
18 tamanho.x = width;
19 tamanho.y = height;
22 void Mapa::setSpawn(Ponto spawn) {
23 game->setSpawn(spawn);
26 void Mapa::novaPlataforma(double xmin, double ymin, double xmax, double ymax, bool pass) {
27 Linha l(xmin, ymin, xmax, ymax);
28 Platform *plat = new Platform(l, pass);
29 platforms.push_front(plat);
30 game->addPlatform(plat);
33 void Mapa::desenha() {
34 std::list<Platform*>::iterator it;
35 for (it = platforms.begin(); it != platforms.end(); it++)
36 (*it)->desenha();
39 double Mapa::xmax() {
40 return tamanho.x;
43 double Mapa::ymax() {
44 return tamanho.y;