forked from juakofz/Age-of-Space
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ListaEdificios.cpp
52 lines (42 loc) · 987 Bytes
/
ListaEdificios.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "ListaEdificios.h"
ListaEdificios::ListaEdificios(void)
{
}
ListaEdificios::~ListaEdificios(void)
{
}
bool ListaEdificios::agregar (Edificio *edif)
{
lista.push_back(edif);
return true;
}
void ListaEdificios::render(Camera cam)
{
for(int i=0;i<lista.size();i++)
{
if (cam.isVisible(lista[i]->GetCen(), 20))
{
lista[i]->render(cam);
}
}
}
void ListaEdificios::eliminarEdificio(int ind)
{
if((ind<0)||(ind>=lista.size())) return;
delete lista[ind];
lista.erase(lista.begin()+ind);
}
void ListaEdificios::event(SDL_Event* e, SDL_Rect selection, SDL_Point xyrel)
{
for(int i=0;i<lista.size();i++) lista[i]->event(e, selection, xyrel);
}
bool ListaEdificios::getSel(int ind)
{
if(lista[ind]->getSel()) return true;
else return false;
}
int ListaEdificios::getSel()
{
for(int i=0;i<lista.size();i++) if(getSel(i)) return i+1;
return 0;
}