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