#include "sender_app.h"


int main(int argc, char **argv) {
    testing::InitGoogleTest(&argc, argv);
    auto result = RUN_ALL_TESTS();
    if (result) {
        exit(result);
    }

    try {
        nanogui::init();

        // scoped variables
        {
            nanogui::ref<SenderApp> app = new SenderApp();
            app->dec_ref();
            app->draw_all();
            app->set_visible(true);

            nanogui::mainloop(1 / 60.f * 1000);
        }

        nanogui::shutdown();
    } catch (const std::exception &e) {
        std::string error_msg = std::string("Caught a fatal error: ") + std::string(e.what());
        std::cerr << error_msg << std::endl;
        return -1;
    } catch (...) {
        std::cerr << "Caught an unknown error!" << std::endl;
        return -2;
    }

    return 0;
}
