Update editor main
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <nova/core/debug.h>
|
||||
#include <nova/platform/window_driver.h>
|
||||
#include <nova/render/render_device.h>
|
||||
#include <nova/render/render_driver.h>
|
||||
|
||||
#include <cstdlib>
|
||||
@@ -15,24 +16,27 @@ using namespace Nova;
|
||||
int main() {
|
||||
Debug::get_logger()->set_level(spdlog::level::trace);
|
||||
|
||||
auto wd = WindowDriver::create();
|
||||
auto rd = RenderDriver::create(RenderAPI::VULKAN, wd);
|
||||
try {
|
||||
auto wd = WindowDriver::create();
|
||||
auto rd = RenderDriver::create(RenderAPI::VULKAN, wd);
|
||||
|
||||
auto window = wd->create_window("Nova", 1280, 720);
|
||||
auto surface = rd->create_surface(window);
|
||||
auto window = wd->create_window("Nova", 1280, 720);
|
||||
auto surface = rd->create_surface(window);
|
||||
|
||||
// TODO: select_device should probably consider what surface is
|
||||
// being used as not all devices support all surfaces. alternatively
|
||||
// the caller chould check if the device supports the surface
|
||||
rd->select_device(RenderDevice::AUTO);
|
||||
auto device = RenderDevice::choose_device(rd, surface);
|
||||
rd->select_device(device);
|
||||
|
||||
while (wd->get_window_count() > 0) {
|
||||
wd->poll_events();
|
||||
while (wd->get_window_count() > 0) {
|
||||
wd->poll_events();
|
||||
}
|
||||
|
||||
rd->destroy_surface(surface);
|
||||
|
||||
delete rd;
|
||||
delete wd;
|
||||
return EXIT_SUCCESS;
|
||||
} catch (const std::exception& e) {
|
||||
NOVA_CRITICAL("Unhandled exception: {}", e.what());
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
rd->destroy_surface(surface);
|
||||
|
||||
delete rd;
|
||||
delete wd;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user