
#include <vector>

#include "Container.h"

itfzContainer::itfzContainer(SDL_Surface * screen, int minComponents) {
    scr = screen;
    components.reserve(minComponents);
}

void itfzContainer::flipscreen() {
    SDL_Flip(scr);
}

int itfzContainer::addComponent(int tipo, int x, int y, string titulo, float valuef, string values, bool updateable, string ID) {
    switch (tipo) {
        case 0:
            components.push_back(new itfzBG(x, y, scr));
            break;
        case 1:
            components.push_back(new itfzTXT(x, y, scr));
            break;
        case 2:
        {
            itfzMedS* MS = new itfzMedS(x, y, titulo, valuef, updateable, ID, scr);
            components.push_back(MS);
            if(updateable)
                updates.push_back(MS);
        }
        break;
        case 3:
        {
            itfzMedC* MC = new itfzMedC(x, y, titulo, valuef, updateable, ID, scr);
            components.push_back(MC);
            if(updateable)
                updates.push_back(MC);            
        }
        break;
        case 4:
        {
            itfzMedT* MT = new itfzMedT(x, y, titulo, valuef, updateable, ID, scr);
            components.push_back(MT);
            if(updateable)
                updates.push_back(MT);            
        }
        break;
        case 5:
        {
            itfzTxtBox* TB = new itfzTxtBox(x, y, titulo, values, updateable, ID, scr);
            components.push_back(TB);
            if(updateable)
                updates.push_back(TB);            
        }
            break;
        case 6:
        {
            itfzPanicB* PB = new itfzPanicB(x, y, titulo, scr);
            components.push_back(PB);
            clicks.push_back(PB);
        }
        break;
        case 7:
        {
            itfzAcel* AC = new itfzAcel(x, y, titulo, scr);
            components.push_back(AC);
            clicks.push_back(AC);
        }
        break;
    }
}
