This commit is contained in:
zack 2025-05-23 21:13:53 -04:00
commit 444f800536
No known key found for this signature in database
GPG key ID: EE8A2B709E2401D1
122 changed files with 17137 additions and 0 deletions

View file

@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.19)
project(Chapter02)
include(../../CMake/CommonMacros.txt)
SETUP_APP(Ch02_01_Swapchain "Chapter 02")
target_include_directories(Ch02_01_Swapchain PUBLIC ${CMAKE_SOURCE_DIR})
target_link_libraries(Ch02_01_Swapchain SharedUtils)

View file

@ -0,0 +1,26 @@
#include "LVK.h"
#include "minilog/minilog.h"
#include <memory>
#include <shared/HelpersGLFW.h>
int main(int argc, char *argv[]) {
minilog::initialize(nullptr, {.threadNames = false});
int width = 960;
int height = 540;
GLFWwindow *window = lvk::initWindow("Simple Example", width, height);
std::unique_ptr<lvk::IContext> ctx =
lvk::createVulkanContextWithSwapchain(window, width, height, {});
while (!glfwWindowShouldClose(window)) {
glfwPollEvents();
glfwGetFramebufferSize(window, &width, &height);
if (!width || !height)
continue;
lvk::ICommandBuffer &buf = ctx->acquireCommandBuffer();
ctx->submit(buf, ctx->getCurrentSwapchainTexture());
}
ctx.reset();
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}