TallerGrupo4/TPWorms

Falta usar un archivo de configuración

Closed this issue · 0 comments

solo en este caso pueden usar un singleton. Algo asi:

#include <iostream>

class Singleton {
    Singleton(): atributo_const_pub(5) {
        std::cout << "Se llama al constructor" << std::endl;
    }

public:
    const int atributo_const_pub;
    
    static Singleton& getInstance() {
        static Singleton instance; // se llama solo en la primera llamada a getInstance. Por que?
        return instance;
    }
    
private:
    Singleton(const Singleton&) = delete;
    Singleton& operator=(const Singleton&) = delete;
};

int main() {
    std::cout << "Arranca el programa" << std::endl;
    Singleton& instance = Singleton::getInstance(); // aca se llama al constructor de Singleton
    Singleton& other = Singleton::getInstance(); // aca no se llama al constructor
    return 0;
}

#define START_LIFE 100
#define NO_WEAPON 0
#define NULL_STATE 0
#define INITIAL_WORMS_TURN 0
#define TURN_TIME 60 * FPS * 2 // SET to 60 seconds!!!