44 lines
1.2 KiB
C++

#include "./0_triangle_with_texcoords/app.hpp"
#include "./1_textured_quad/app.hpp"
#include "./2_textured_cube/app.hpp"
#include <mijin/debug/stacktrace.hpp>
#include <spdlog/spdlog.h>
#include <mijin/util/winundef.hpp>
int main(int argc, char* argv[])
{
if (argc < 1)
{
return 1;
}
if (SDL_Init(0) != SDL_TRUE)
{
spdlog::error("Error initializing SDL.");
return 1;
}
try
{
// make sure app is destructed before shutting down SDL
// std::unique_ptr<sdl_gpu_test::Application> app = std::make_unique<sdl_gpu_test::TriangleWithTexcoordsApp>();
// std::unique_ptr<sdl_gpu_test::Application> app = std::make_unique<sdl_gpu_test::TexturedQuadApp>();
std::unique_ptr<sdl_gpu_test::Application> app = std::make_unique<sdl_gpu_test::TexturedCubeApp>();
app->run(std::span(const_cast<const char**>(argv), argc));
}
catch (std::exception& exception)
{
spdlog::error("Exception while running application: {}", exception.what());
mijin::getExceptionStacktrace().then([](const mijin::Stacktrace& stacktrace)
{
spdlog::error("{}", stacktrace);
});
}
SDL_Quit();
return 0;
}