light/modules/app/public/entrypoint.hpp

29 lines
629 B
C++
Raw Normal View History

2021-05-20 10:21:08 +04:30
#pragma once
#include <app/application.hpp>
#include <logger/logger.hpp>
#include <memory/scope.hpp>
2021-05-20 10:21:08 +04:30
auto main(int argc, char *argv[]) -> int32_t
2025-07-11 00:24:44 +03:30
try
2021-05-20 10:21:08 +04:30
{
2025-07-11 00:24:44 +03:30
std::ignore = argc;
std::ignore = argv;
auto application = lt::memory::Scope<lt::app::Application> {};
application = lt::app::create_application();
if (!application)
{
throw std::runtime_error { "Failed to create application\n" };
}
2025-07-11 00:24:44 +03:30
application->game_loop();
return EXIT_SUCCESS;
2021-05-20 10:21:08 +04:30
}
2025-07-11 00:24:44 +03:30
catch (const std::exception &exp)
2021-06-26 13:09:11 +04:30
{
lt::log::critical("Terminating due to uncaught exception:");
lt::log::critical("\texception.what(): {}", exp.what());
2025-07-11 00:24:44 +03:30
return EXIT_FAILURE;
2021-06-26 13:09:11 +04:30
}