.. _program_listing_file_Src_GraphicsEngineVulkan_app_App.cpp: Program Listing for File App.cpp ================================ |exhale_lsh| :ref:`Return to documentation for file ` (``Src/GraphicsEngineVulkan/app/App.cpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #include "app/App.hpp" #include #define GLFW_INCLUDE_NONE #define GLFW_INCLUDE_VULKAN #include #define GLM_FORCE_RADIANS #define GLM_FORCE_DEPTH_ZERO_TO_ONE #include #include #include #include #include #include #include "gui/GUI.hpp" #include "renderer/VulkanRenderer.hpp" #include "window/Window.hpp" Kataglyphis::App::App() {} int Kataglyphis::App::run() { int window_width = 1200; int window_height = 768; float delta_time = 0.0f; float last_time = 0.0f; std::unique_ptr window = std::make_unique(window_width, window_height); std::unique_ptr scene = std::make_unique(); std::unique_ptr gui = std::make_unique(window.get()); std::unique_ptr camera = std::make_unique(); Kataglyphis::VulkanRenderer vulkan_renderer{ window.get(), scene.get(), gui.get(), camera.get() }; while (!window->get_should_close()) { // poll all events incoming from user glfwPollEvents(); // handle events for the camera camera->key_control(window->get_keys(), delta_time); camera->mouse_control(window->get_x_change(), window->get_y_change()); float now = static_cast(glfwGetTime()); delta_time = now - last_time; last_time = now; scene->update_user_input(gui.get()); vulkan_renderer.updateStateDueToUserInput(gui.get()); vulkan_renderer.updateUniforms(scene.get(), camera.get(), window.get()); gui->render(); vulkan_renderer.drawFrame(); } vulkan_renderer.finishAllRenderCommands(); scene->cleanUp(); gui->cleanUp(); window->cleanUp(); vulkan_renderer.cleanUp(); return EXIT_SUCCESS; } Kataglyphis::App::~App() {}