Files
Destrum/lightkeeper/src/main.cpp
T

44 lines
1.1 KiB
C++

#include <cstdio>
#include <stdexcept>
#include <string>
#include <SDL.h>
#include "Lightkeeper.h"
#include "spdlog/spdlog.h"
int main(int argc, char* argv[]) {
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", SDL_GetError(), nullptr);
return 1;
}
try {
char* basePath = SDL_GetBasePath();
if (basePath == nullptr) {
throw std::runtime_error(std::string{"SDL_GetBasePath failed: "} + SDL_GetError());
}
const std::filesystem::path exeDir = basePath;
SDL_free(basePath);
spdlog::set_level(spdlog::level::debug);
LightKeeper app;
app.init({
.windowSize = {1200, 800},
.renderSize = {1200, 800},
.appName = "Destrum Engine",
.windowTitle = "Lightkeeper",
.exeDir = exeDir,
});
app.run();
app.cleanup();
} catch (const std::exception& exception) {
spdlog::critical("Lightkeeper terminated with an error: {}", exception.what());
SDL_Quit();
return 1;
}
SDL_Quit();
return 0;
}