#include "App.h"

App* App::instance = nullptr;

App::App(const int& argc, char* argv[]) {

    if(instance != nullptr) {
        std::cout << "App already exists\nThere can only be one!\n";
        std::abort();
    }

    std::cout << "Initializing...\n";

    instance = this;

    handleArgs(argc, argv);

}

App::~App() {

    std::cout << "\nExiting...";
}

void App::run() {
    std::cout << "\nTesting...\n";

    // Main loop
    while (!done) {
        end();
    }
}

void App::load(std::string lib) {

}

void App::handleArgs(const int& argc, char* argv[]) {

    int i = 0;
    
    while(i < argc) {
        if(strcmp(argv[i], "-h") == 0) {
            printHelp();
            end();
        } else {
            break;
        }
        i++;
    }

    while(i < argc) {
        
        load(argv[i]);

        i++;
    }
}
