Files
oatmeal/examples/createContext/main.cpp
Lyra 2f1f196d6b
All checks were successful
Build / Build (push) Successful in 1m47s
bleh
2026-05-24 12:13:08 -04:00

46 lines
1.3 KiB
C++

// createContext
// Still in progress, although I'm 95% sure this wont get changed.
// Come back later!
// - Firewire
#include <cstdlib>
#include <exception>
#include <memory>
#include "GLFW/glfw3.h"
#include "shared/logger.h"
#include "shared/window.h"
#include "ctx.h"
int main() {
OatmealUtils::initLogging();
OatmealUtils::createLogger("context", nullptr);
GLFWwindow *window = OatmealUtils::initWindow("Oatmeal - createContext", 800, 600);
std::shared_ptr<Oatmeal::ctx> ctx = nullptr;
OatmealUtils::getLogger("context")->info("Creating context");
try {
ctx = std::make_shared<Oatmeal::ctx>(window, Oatmeal::CtxCfg{.backend = Oatmeal::BACKEND_VULKAN});
} catch (const std::exception &e) {
OatmealUtils::getLogger("context")->critical("{}", e.what());
return EXIT_FAILURE;
}
// OatmealUtils::getLogger("context")->info("Device name: {}", ctx->getDeviceName());
// OatmealUtils::getLogger("context")->info("Device Type: {}", ctx->getDeviceType());
OatmealUtils::getLogger("context")->info("Starting main loop");
while (!glfwWindowShouldClose(window)) {
glfwPollEvents();
}
OatmealUtils::getLogger("window")->info("Cleaning up");
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}