diff --git a/.gitignore b/.gitignore
index eb8e901..8f8888e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ build/
.vs/
.direnv/
.ccls-cache/
+/Folder.DotSettings.user
diff --git a/Folder.DotSettings.user b/Folder.DotSettings.user
deleted file mode 100644
index 1758e89..0000000
--- a/Folder.DotSettings.user
+++ /dev/null
@@ -1,5 +0,0 @@
-
- True
- (Doc Ln 10 Col 4)
- DB94C55F-6B9A-4AAE-80D7-29FD8153E6B5/d:aster/f:window.h
- NumberedBookmarkManager
\ No newline at end of file
diff --git a/aster/CMakeLists.txt b/aster/CMakeLists.txt
index 0e952f6..048f504 100644
--- a/aster/CMakeLists.txt
+++ b/aster/CMakeLists.txt
@@ -3,7 +3,7 @@
cmake_minimum_required(VERSION 3.13)
find_package(glm CONFIG REQUIRED)
-find_package(glfw3 CONFIG REQUIRED)
+find_package(SDL3 CONFIG REQUIRED)
find_path(SCOTTT_DEBUGBREAK_INCLUDE_DIRS "debugbreak.h")
find_package(Vulkan REQUIRED)
find_package(fmt CONFIG REQUIRED)
@@ -22,7 +22,7 @@ set(HEADER_FILES
swapchain.h
pipeline.h
queue_allocation.h
- buffer.h "surface.h" "size.h")
+ buffer.h "surface.h" "size.h" "timer.h")
set(SOURCE_FILES
logger.cpp
@@ -45,7 +45,7 @@ target_precompile_headers(aster_core PUBLIC global.h)
target_include_directories(aster_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(aster_core PUBLIC glm::glm-header-only)
-target_link_libraries(aster_core PRIVATE glfw)
+target_link_libraries(aster_core PRIVATE SDL3::SDL3)
target_include_directories(aster_core PRIVATE ${SCOTTT_DEBUGBREAK_INCLUDE_DIRS})
target_link_libraries(aster_core PRIVATE fmt::fmt)
target_link_libraries(aster_core PRIVATE EASTL)
diff --git a/aster/config.h b/aster/config.h
index 44b5bb4..ad2dc0c 100644
--- a/aster/config.h
+++ b/aster/config.h
@@ -21,6 +21,8 @@
#define EASTL_NO_EXCEPTIONS 1
+#define FMT_UNICODE 0
+
#if defined(ASTER_NDEBUG)
#define USE_OPTICK (0)
#else
diff --git a/aster/context.cpp b/aster/context.cpp
index 7b13b27..9be6f04 100644
--- a/aster/context.cpp
+++ b/aster/context.cpp
@@ -4,9 +4,14 @@
// =============================================
#include "context.h"
+
+#include "window.h"
+
#include
#include
+#include
+
VKAPI_ATTR b32 VKAPI_CALL
DebugCallback(const VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
const VkDebugUtilsMessageTypeFlagsEXT messageType,
@@ -34,7 +39,7 @@ DebugCallback(const VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
return false;
}
-Context::Context(const cstr appName, const Version version, bool enableValidation)
+Context::Context(Window *window, const cstr appName, const Version version, bool enableValidation)
{
INFO_IF(enableValidation, "Validation Layers enabled");
@@ -60,9 +65,7 @@ Context::Context(const cstr appName, const Version version, bool enableValidatio
.pUserData = nullptr,
};
- u32 glfwExtensionCount = 0;
- cstr *glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtensionCount);
- eastl::fixed_vector instanceExtensions(glfwExtensions, glfwExtensions + glfwExtensionCount);
+ eastl::vector instanceExtensions = window->GetRequiredExtensions();
if (enableValidation)
{
instanceExtensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
diff --git a/aster/context.h b/aster/context.h
index 9d73991..e2d443b 100644
--- a/aster/context.h
+++ b/aster/context.h
@@ -7,6 +7,8 @@
#include "global.h"
+struct Window;
+
/**
* @class Context
*
@@ -21,7 +23,7 @@ struct Context final
vk::DebugUtilsMessengerEXT m_DebugMessenger = nullptr;
// Ctor/Dtor
- Context(cstr appName, Version version, bool enableValidation = ENABLE_LAYER_MESSAGES_DEFAULT_VALUE);
+ Context(Window *window, cstr appName, Version version, bool enableValidation = ENABLE_LAYER_MESSAGES_DEFAULT_VALUE);
~Context();
// Move
diff --git a/aster/global.cpp b/aster/global.cpp
index 5176b46..1babfd5 100644
--- a/aster/global.cpp
+++ b/aster/global.cpp
@@ -56,19 +56,19 @@ struct fmt::formatter
// return format_to(ctx.out(), "({}, {})", foo.a, foo.b); // --== KEY LINE ==--
if (mem.m_Gigabytes > 0)
{
- return v10::format_to(ctx.out(), "{}.{} GB", mem.m_Gigabytes,
+ return v11::format_to(ctx.out(), "{}.{} GB", mem.m_Gigabytes,
Cast(mem.m_Megabytes / 1024.0));
}
if (mem.m_Megabytes > 0)
{
- return v10::format_to(ctx.out(), "{}.{} MB", mem.m_Megabytes, Cast(mem.m_Kilobytes / 1024.0));
+ return v11::format_to(ctx.out(), "{}.{} MB", mem.m_Megabytes, Cast(mem.m_Kilobytes / 1024.0));
}
if (mem.m_Kilobytes > 0)
{
- return v10::format_to(ctx.out(), "{}.{} KB", mem.m_Kilobytes, Cast(mem.m_Bytes / 1024.0));
+ return v11::format_to(ctx.out(), "{}.{} KB", mem.m_Kilobytes, Cast(mem.m_Bytes / 1024.0));
}
- return v10::format_to(ctx.out(), "{} Bytes", mem.m_Bytes);
+ return v11::format_to(ctx.out(), "{} Bytes", mem.m_Bytes);
}
};
diff --git a/aster/global.h b/aster/global.h
index a020475..eefd391 100644
--- a/aster/global.h
+++ b/aster/global.h
@@ -9,7 +9,6 @@
#include "constants.h"
#include "logger.h"
-#include
#include
#include
@@ -77,31 +76,6 @@ HashCombine(const usize hash0, const usize hash1)
return hash0 ^ tempVar;
}
-struct Time
-{
- static constexpr f64 MAX_DELTA = 0.1;
-
- inline static f64 m_Elapsed{Qnan};
- inline static f64 m_Delta{Qnan};
-
- static void
- Init()
- {
- WARN_IF(!std::isnan(m_Elapsed), "Time already init.");
- m_Elapsed = glfwGetTime();
- m_Delta = 1.0 / 60.0;
- }
-
- static void
- Update()
- {
- ERROR_IF(std::isnan(m_Elapsed), "Time not init.");
- const auto newElapsed = glfwGetTime();
- m_Delta = std::clamp(newElapsed - m_Elapsed, 0.0, MAX_DELTA);
- m_Elapsed = newElapsed;
- }
-};
-
[[nodiscard]] constexpr usize
ClosestMultiple(const usize val, const usize of)
{
@@ -177,7 +151,7 @@ struct fmt::formatter : nested_formatter
format(vk::Result result, format_context &ctx) const
{
return write_padded(ctx,
- [this, result](auto out) { return v10::format_to(out, "{}", nested(to_string(result))); });
+ [this, result](auto out) { return v11::format_to(out, "{}", nested(to_string(result))); });
}
};
@@ -188,6 +162,6 @@ struct fmt::formatter> : nested_fo
// ReSharper disable once CppInconsistentNaming
format(const eastl::fixed_string &str, format_context &ctx) const
{
- return write_padded(ctx, [this, str](auto out) { return v10::format_to(out, "{}", nested(str.c_str())); });
+ return write_padded(ctx, [this, str](auto out) { return v11::format_to(out, "{}", nested(str.c_str())); });
}
};
diff --git a/aster/surface.cpp b/aster/surface.cpp
index 55e8a83..b7d5fc5 100644
--- a/aster/surface.cpp
+++ b/aster/surface.cpp
@@ -5,6 +5,7 @@
#include "surface.h"
+#include "SDL3/SDL_vulkan.h"
#include "context.h"
#include "window.h"
@@ -12,11 +13,14 @@ Surface::Surface(Context *context, const Window *window, cstr name)
: m_Context(context)
{
VkSurfaceKHR surface;
- auto result = Cast(
- glfwCreateWindowSurface(Cast(m_Context->m_Instance), window->m_Window, nullptr, &surface));
- ERROR_IF(Failed(result), "Failed to create Surface with {}", result)
- THEN_ABORT(result)
- ELSE_DEBUG("Surface {} Created", m_Name);
+ if (!SDL_Vulkan_CreateSurface(window->m_Window, Cast(m_Context->m_Instance), nullptr, &surface))
+ {
+ const char *error = SDL_GetError();
+ ERROR("Failed to create Surface. Cause: {}", error)
+ THEN_ABORT(-1);
+ }
+
+ DEBUG("Surface {} Created", m_Name);
m_Surface = vk::SurfaceKHR(surface);
}
diff --git a/aster/swapchain.cpp b/aster/swapchain.cpp
index a03ba9e..f16e7c7 100644
--- a/aster/swapchain.cpp
+++ b/aster/swapchain.cpp
@@ -10,6 +10,8 @@
#include "surface.h"
#include "window.h"
+#include
+
[[nodiscard]] vk::Extent2D GetExtent(Size2D size, vk::SurfaceCapabilitiesKHR *surfaceCapabilities);
Swapchain::Swapchain(const Surface *surface, const Device *device, Size2D size, NameString &&name)
@@ -59,7 +61,8 @@ Swapchain::Create(const Surface *surface, Size2D size)
while (m_Extent.width == 0 || m_Extent.height == 0)
{
- glfwWaitEvents();
+ SDL_Event event;
+ SDL_WaitEvent(&event);
surfaceCapabilities = GetSurfaceCapabilities(m_Device->m_PhysicalDevice, surface->m_Surface);
m_Extent = GetExtent(size, &surfaceCapabilities);
}
diff --git a/aster/timer.h b/aster/timer.h
new file mode 100644
index 0000000..f20e308
--- /dev/null
+++ b/aster/timer.h
@@ -0,0 +1,42 @@
+// =============================================
+// Aster: logger.h
+// Copyright (c) 2020-2024 Anish Bhobe
+// =============================================
+
+#pragma once
+
+#include "constants.h"
+#include
+
+#include
+
+struct Time
+{
+ static constexpr f64 MAX_DELTA = 0.1;
+
+ inline static u64 m_PerfCounter;
+ inline static u64 m_BeginAtCounter;
+ inline static f64 m_Elapsed;
+ inline static f64 m_Delta;
+
+ inline static f64 m_SecondPerCount;
+
+ static void
+ Init()
+ {
+ m_SecondPerCount = 1.0 / Cast(SDL_GetPerformanceFrequency());
+ m_BeginAtCounter = SDL_GetPerformanceCounter();
+ m_PerfCounter = m_BeginAtCounter;
+ m_Elapsed = 0.0;
+ m_Delta = 1.0 / 60.0;
+ }
+
+ static void
+ Update()
+ {
+ u64 currentCounter = SDL_GetPerformanceCounter();
+ m_Elapsed = (currentCounter - m_BeginAtCounter) * m_SecondPerCount;
+ m_Delta = std::min(m_SecondPerCount * (currentCounter - m_PerfCounter), MAX_DELTA);
+ m_PerfCounter = currentCounter;
+ }
+};
\ No newline at end of file
diff --git a/aster/window.cpp b/aster/window.cpp
index 11ae077..99761ce 100644
--- a/aster/window.cpp
+++ b/aster/window.cpp
@@ -8,13 +8,32 @@
#include "context.h"
#include "logger.h"
+#include
+#include
+
std::atomic_uint64_t Window::m_WindowCount = 0;
std::atomic_bool Window::m_IsGlfwInit = false;
+bool
+Window::Poll() const noexcept
+{
+ SDL_Event event;
+ while (SDL_PollEvent(&event))
+ {
+ if (event.type == SDL_EVENT_WINDOW_CLOSE_REQUESTED)
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
void
Window::RequestExit() const noexcept
{
- glfwSetWindowShouldClose(m_Window, true);
+ SDL_Event *event = Cast(SDL_malloc(sizeof(SDL_Event)));
+ event->type = SDL_EVENT_WINDOW_CLOSE_REQUESTED;
+ SDL_PushEvent(event);
}
void
@@ -26,63 +45,53 @@ Window::SetWindowSize(const vk::Extent2D &extent) const noexcept
void
Window::SetWindowSize(const u32 width, const u32 height) const noexcept
{
- glfwSetWindowSize(m_Window, Cast(width), Cast(height));
+ SDL_SetWindowSize(m_Window, Cast(width), Cast(height));
}
Size2D
Window::GetSize() const
{
- int width;
- int height;
- glfwGetFramebufferSize(m_Window, &width, &height);
+ i32 width, height;
+
+ SDL_GetWindowSizeInPixels(m_Window, &width, &height);
return {Cast(width), Cast(height)};
}
+eastl::vector
+Window::GetRequiredExtensions()
+{
+ u32 count = 0;
+ auto extensions = SDL_Vulkan_GetInstanceExtensions(&count);
+ return eastl::vector{extensions, extensions + count};
+}
+
Window::Window(const cstr title, Size2D extent, const b8 isFullScreen)
{
m_Name = title;
if (!m_IsGlfwInit)
{
- if (!glfwInit())
+ if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS))
{
- const char *error = nullptr;
- const auto code = glfwGetError(&error);
- ERROR("GLFW Init failed. Cause: ({}) {}", code, error)
- THEN_ABORT(code);
+ const char *error = SDL_GetError();
+ ERROR("SDL Init failed. Cause: {}", error)
+ THEN_ABORT(-1);
}
m_WindowCount = 0;
m_IsGlfwInit = true;
}
- GLFWmonitor *monitor = glfwGetPrimaryMonitor();
- ERROR_IF(!monitor, "No monitor found");
-
- i32 windowX, windowY, windowWidth, windowHeight;
- glfwGetMonitorWorkarea(monitor, &windowX, &windowY, &windowWidth, &windowHeight);
-
- glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
- glfwWindowHint(GLFW_CENTER_CURSOR, GLFW_TRUE);
-
- m_Window = glfwCreateWindow(Cast(extent.m_Width), Cast(extent.m_Height), m_Name.c_str(),
- isFullScreen ? monitor : nullptr, nullptr);
+ m_Window =
+ SDL_CreateWindow(m_Name.c_str(), Cast(extent.m_Width), Cast(extent.m_Height), SDL_WINDOW_VULKAN);
ERROR_IF(m_Window == nullptr, "Window creation failed")
ELSE_DEBUG("Window '{}' created with resolution '{}x{}'", m_Name, extent.m_Width, extent.m_Height);
if (m_Window == nullptr)
{
- const char *error = nullptr;
- const auto code = glfwGetError(&error);
- ERROR("GLFW Window Creation failed. Cause: ({}) {}", code, error)
- THEN_ABORT(code);
+ const char *error = SDL_GetError();
+ ERROR("SDL Window Creation failed. Cause: {}", error)
+ THEN_ABORT(-1);
}
- if (isFullScreen == false)
- {
- glfwSetWindowPos(m_Window, Cast(windowWidth - extent.m_Width) / 2,
- Cast(windowHeight - extent.m_Height) / 2);
- }
- glfwSetInputMode(m_Window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
-
++m_WindowCount;
}
@@ -90,7 +99,7 @@ Window::~Window()
{
if (m_Window)
{
- glfwDestroyWindow(m_Window);
+ SDL_DestroyWindow(m_Window);
m_Window = nullptr;
--m_WindowCount;
@@ -98,7 +107,7 @@ Window::~Window()
if (m_WindowCount== 0 && m_IsGlfwInit)
{
- glfwTerminate();
+ SDL_Quit();
m_IsGlfwInit = false;
}
diff --git a/aster/window.h b/aster/window.h
index 1a06ac5..85a279d 100644
--- a/aster/window.h
+++ b/aster/window.h
@@ -8,14 +8,17 @@
#include "global.h"
#include "size.h"
+#include "EASTL/vector.h"
#include
#include
+struct SDL_Window;
+
struct Window final
{
// fields
- GLFWwindow *m_Window = nullptr;
+ SDL_Window *m_Window = nullptr;
NameString m_Name;
static std::atomic_uint64_t m_WindowCount;
@@ -23,17 +26,14 @@ struct Window final
// Methods
[[nodiscard]] bool
- Poll() const noexcept
- {
- glfwPollEvents();
- return !glfwWindowShouldClose(m_Window);
- }
+ Poll() const noexcept;
void RequestExit() const noexcept;
void SetWindowSize(const vk::Extent2D &extent) const noexcept;
void SetWindowSize(u32 width, u32 height) const noexcept;
/// Actual size of the framebuffer being used for the window render.
[[nodiscard]] Size2D GetSize() const;
+ eastl::vector GetRequiredExtensions();
// Ctor/Dtor
Window(cstr title, Size2D extent, b8 isFullScreen = false);
diff --git a/samples/00_util/gui.cpp b/samples/00_util/gui.cpp
index cbfedb4..3e465a7 100644
--- a/samples/00_util/gui.cpp
+++ b/samples/00_util/gui.cpp
@@ -10,8 +10,8 @@
#include "helpers.h"
#include "window.h"
-#include
#include
+#include
#include
namespace ImGui
@@ -58,12 +58,12 @@ Init(const Context *context, const Device *device, const Window *window, vk::For
CreateContext();
ImGuiIO &io = GetIO();
(void)io;
- // io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
+ io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
// io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Viewports bad
StyleColorsDark();
- ImGui_ImplGlfw_InitForVulkan(window->m_Window, true);
+ ImGui_ImplSDL3_InitForVulkan(window->m_Window);
vk::PipelineRenderingCreateInfo renderingCreateInfo = {
.colorAttachmentCount = 1,
@@ -95,7 +95,7 @@ Destroy(const Device *device)
{
ImGui_ImplVulkan_Shutdown();
- ImGui_ImplGlfw_Shutdown();
+ ImGui_ImplSDL3_Shutdown();
DestroyContext();
device->m_Device.destroy(Take(g_DescriptorPool), nullptr);
@@ -105,14 +105,14 @@ void
StartBuild()
{
ImGui_ImplVulkan_NewFrame();
- ImGui_ImplGlfw_NewFrame();
+ ImGui_ImplSDL3_NewFrame();
NewFrame();
- // static ImGuiDockNodeFlags dockspaceFlags = ImGuiDockNodeFlags_None | ImGuiDockNodeFlags_PassthruCentralNode;
+ static ImGuiDockNodeFlags dockspaceFlags = ImGuiDockNodeFlags_None | ImGuiDockNodeFlags_PassthruCentralNode;
// We are using the ImGuiWindowFlags_NoDocking flag to make the parent window not dockable into,
// because it would be confusing to have two docking targets within each others.
- ImGuiWindowFlags windowFlags = ImGuiWindowFlags_None; // ImGuiWindowFlags_NoDocking;
+ ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDocking;
const ImGuiViewport *viewport = GetMainViewport();
SetNextWindowPos(viewport->WorkPos);
@@ -130,18 +130,18 @@ StartBuild()
// all active windows docked into it will lose their parent and become undocked.
// We cannot preserve the docking relationship between an active window and an inactive docking, otherwise
// any change of dockspace/settings would lead to windows being stuck in limbo and never being visible.
- // PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
- // Begin("DockSpace Demo", nullptr, windowFlags);
- // PopStyleVar();
+ PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
+ Begin("DockSpace Demo", nullptr, windowFlags);
+ PopStyleVar();
- // PopStyleVar(2);
+ PopStyleVar(2);
// DockSpace
- // if (GetIO().ConfigFlags & ImGuiConfigFlags_DockingEnable)
- // {
- // const ImGuiID dockspaceId = GetID("MyDockSpace");
- // DockSpace(dockspaceId, ImVec2(0.0f, 0.0f), dockspaceFlags);
- // }
+ if (GetIO().ConfigFlags & ImGuiConfigFlags_DockingEnable)
+ {
+ const ImGuiID dockspaceId = GetID("MyDockSpace");
+ DockSpace(dockspaceId, ImVec2(0.0f, 0.0f), dockspaceFlags);
+ }
}
void
@@ -151,13 +151,6 @@ EndBuild()
Render();
EndFrame();
- // if (GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
- // {
- // GLFWwindow *backupCurrentContext = glfwGetCurrentContext();
- // UpdatePlatformWindows();
- // RenderPlatformWindowsDefault();
- // glfwMakeContextCurrent(backupCurrentContext);
- // }
}
void
diff --git a/samples/01_triangle/triangle.cpp b/samples/01_triangle/triangle.cpp
index e921e65..5a51d9d 100644
--- a/samples/01_triangle/triangle.cpp
+++ b/samples/01_triangle/triangle.cpp
@@ -14,6 +14,8 @@
#include "pipeline.h"
#include "swapchain.h"
+#include "timer.h"
+
#include "helpers.h"
#include
@@ -74,8 +76,8 @@ main(int, char **)
{
MIN_LOG_LEVEL(Logger::LogType::eInfo);
- Context context = {"Triangle", VERSION};
Window window = {"Triangle (Aster)", {640, 480}};
+ Context context = {&window, "Triangle", VERSION};
Surface surface = {&context, &window, "Primary"};
PhysicalDevices physicalDevices = {&surface, &context};
diff --git a/samples/02_box/box.cpp b/samples/02_box/box.cpp
index 6442ff6..779b7ee 100644
--- a/samples/02_box/box.cpp
+++ b/samples/02_box/box.cpp
@@ -19,6 +19,7 @@
#include "frame.h"
#include "image.h"
#include "stb_image.h"
+#include "timer.h"
#include
@@ -115,8 +116,8 @@ main(int, char **)
{
MIN_LOG_LEVEL(Logger::LogType::eInfo);
- Context context = {"Box", VERSION};
Window window = {"Box (Aster)", {640, 480}};
+ Context context = {&window, "Box", VERSION};
Surface surface = {&context, &window, "Primary"};
PhysicalDevices physicalDevices = {&surface, &context};
diff --git a/samples/03_model_render/model_render.cpp b/samples/03_model_render/model_render.cpp
index 206f6ea..e9ee31e 100644
--- a/samples/03_model_render/model_render.cpp
+++ b/samples/03_model_render/model_render.cpp
@@ -13,6 +13,7 @@
#include "pipeline.h"
#include "swapchain.h"
#include "window.h"
+#include "timer.h"
#include "frame.h"
#include "helpers.h"
@@ -22,6 +23,7 @@
#include "gpu_resource_manager.h"
#include "gui.h"
#include "ibl_helpers.h"
+#include "imgui_impl_sdl3.h"
#include "pipeline_utils.h"
#include
@@ -133,8 +135,8 @@ main(int, char **)
{
MIN_LOG_LEVEL(Logger::LogType::eInfo);
- Context context = {"ModelRender", VERSION};
Window window = {"ModelRender (Aster)", {INIT_WIDTH, INIT_HEIGHT}};
+ Context context = {&window, "ModelRender", VERSION};
Surface surface = {&context, &window, "Primary Surface"};
PhysicalDevices physicalDevices = {&surface, &context};
@@ -427,10 +429,23 @@ main(int, char **)
Time::Init();
INFO("Starting loop");
- while (window.Poll())
+ bool isRunning = true;
+ while (isRunning)
{
Time::Update();
+ // TODO: This needs fixing (after callbacks)
+ SDL_Event event;
+ while (SDL_PollEvent(&event))
+ {
+ if (event.type == SDL_EVENT_WINDOW_CLOSE_REQUESTED)
+ {
+ isRunning = false;
+ break;
+ }
+ ImGui_ImplSDL3_ProcessEvent(&event);
+ }
+
gui::StartBuild();
gui::Begin("Settings");
@@ -499,7 +514,7 @@ main(int, char **)
gui::PopItemWidth();
if (gui::Button("Exit"))
{
- window.RequestExit();
+ isRunning = false;
}
gui::End();
diff --git a/samples/04_scenes/main.cpp b/samples/04_scenes/main.cpp
index 7be38a9..9b7e6cc 100644
--- a/samples/04_scenes/main.cpp
+++ b/samples/04_scenes/main.cpp
@@ -10,6 +10,7 @@
#include "render_resource_manager.h"
#include "swapchain.h"
#include "window.h"
+#include "timer.h"
#include "asset_loader.h"
#include "camera.h"
@@ -38,7 +39,7 @@ main(int, char *[])
MIN_LOG_LEVEL(Logger::LogType::eInfo);
Window window = {"Scene Render [WIP] (Aster)", {INIT_WIDTH, INIT_HEIGHT}};
- Context context = {"Scene Render [WIP]", VERSION};
+ Context context = {&window, "Scene Render [WIP]", VERSION};
Surface surface = {&context, &window, "Primary Surface"};
PhysicalDevices physicalDevices = {&surface, &context};
diff --git a/vcpkg b/vcpkg
index b276513..0ca64b4 160000
--- a/vcpkg
+++ b/vcpkg
@@ -1 +1 @@
-Subproject commit b27651341123a59f7187b42ef2bc476284afb310
+Subproject commit 0ca64b4e1c70fa6d9f53b369b8f3f0843797c20c
diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json
index 15af179..8cd79f3 100644
--- a/vcpkg-configuration.json
+++ b/vcpkg-configuration.json
@@ -1,7 +1,7 @@
{
"default-registry": {
"kind": "git",
- "baseline": "b27651341123a59f7187b42ef2bc476284afb310",
+ "baseline": "6f29f12e82a8293156836ad81cc9bf5af41fe836",
"repository": "https://github.com/microsoft/vcpkg"
},
"registries": [
@@ -10,5 +10,8 @@
"location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
"name": "microsoft"
}
+ ],
+ "overlay-ports": [
+ "vcpkg-overlays"
]
}
diff --git a/vcpkg-overlays/imgui/CMakeLists.txt b/vcpkg-overlays/imgui/CMakeLists.txt
new file mode 100644
index 0000000..b658087
--- /dev/null
+++ b/vcpkg-overlays/imgui/CMakeLists.txt
@@ -0,0 +1,305 @@
+cmake_minimum_required(VERSION 3.16)
+project(imgui CXX)
+
+set(CMAKE_DEBUG_POSTFIX d)
+
+if(APPLE)
+ set(CMAKE_CXX_STANDARD 11)
+ enable_language(OBJCXX)
+endif()
+
+add_library(${PROJECT_NAME} "")
+add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
+target_include_directories(
+ ${PROJECT_NAME}
+ PUBLIC
+ "$"
+ $
+)
+
+target_sources(
+ ${PROJECT_NAME}
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/imgui.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/imgui_demo.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/imgui_draw.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/imgui_tables.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/imgui_widgets.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/misc/cpp/imgui_stdlib.cpp
+)
+
+target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11)
+
+if(IMGUI_BUILD_ALLEGRO5_BINDING)
+ find_package(Allegro CONFIG REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PRIVATE Allegro::allegro Allegro::allegro_ttf Allegro::allegro_font Allegro::allegro_main)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_allegro5.cpp)
+endif()
+
+if(IMGUI_BUILD_ANDROID_BINDING)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_android.cpp)
+endif()
+
+if(IMGUI_BUILD_DX9_BINDING)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_dx9.cpp)
+endif()
+
+if(IMGUI_BUILD_DX10_BINDING)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_dx10.cpp)
+endif()
+
+if(IMGUI_BUILD_DX11_BINDING)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_dx11.cpp)
+endif()
+
+if(IMGUI_BUILD_DX12_BINDING)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_dx12.cpp)
+endif()
+
+if(IMGUI_BUILD_GLFW_BINDING)
+ if(NOT EMSCRIPTEN)
+ find_package(glfw3 CONFIG REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PUBLIC glfw)
+ endif()
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_glfw.cpp)
+endif()
+
+if(IMGUI_BUILD_GLUT_BINDING)
+ find_package(GLUT REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PUBLIC GLUT::GLUT)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_glut.cpp)
+endif()
+
+if(IMGUI_BUILD_METAL_BINDING)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_metal.mm)
+ set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_metal.mm PROPERTIES COMPILE_FLAGS -fobjc-weak)
+endif()
+
+if(IMGUI_BUILD_OPENGL2_BINDING)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_opengl2.cpp)
+endif()
+
+if(IMGUI_BUILD_OPENGL3_BINDING)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp)
+endif()
+
+if(IMGUI_BUILD_OSX_BINDING)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_osx.mm)
+endif()
+
+if(IMGUI_BUILD_SDL2_BINDING AND NOT (IMGUI_BUILD_SDL3_BINDING OR IMGUI_BUILD_SDL3_RENDERER_BINDING))
+ find_package(SDL2 CONFIG REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PUBLIC SDL2::SDL2)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_sdl2.cpp)
+elseif(IMGUI_BUILD_SDL2_BINDING)
+ message(WARNING "Imgui: sdl2-binding backend not included. sdl2 features are mutually exclusive with sdl3 features with sdl3 taking priority.")
+endif()
+
+if(IMGUI_BUILD_SDL2_RENDERER_BINDING AND NOT (IMGUI_BUILD_SDL3_BINDING OR IMGUI_BUILD_SDL3_RENDERER_BINDING))
+ find_package(SDL2 CONFIG REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PUBLIC SDL2::SDL2)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_sdlrenderer2.cpp)
+elseif(IMGUI_BUILD_SDL2_RENDERER_BINDING)
+ message(WARNING "Imgui: sdl2-renderer-binding backend not included. sdl2 features are mutually exclusive with sdl3 features with sdl3 taking priority.")
+endif()
+
+if(IMGUI_BUILD_SDL3_BINDING)
+ find_package(SDL3 CONFIG REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PUBLIC SDL3::SDL3)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_sdl3.cpp)
+endif()
+
+if(IMGUI_BUILD_SDL3_RENDERER_BINDING)
+ find_package(SDL3 CONFIG REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PUBLIC SDL3::SDL3)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_sdlrenderer3.cpp)
+endif()
+
+if(IMGUI_BUILD_VULKAN_BINDING)
+ find_package(Vulkan REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PUBLIC Vulkan::Vulkan)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_vulkan.cpp)
+endif()
+
+if(IMGUI_BUILD_WIN32_BINDING)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_win32.cpp)
+endif()
+
+if(IMGUI_FREETYPE)
+ find_package(freetype CONFIG REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PUBLIC freetype)
+ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/misc/freetype/imgui_freetype.cpp)
+ target_compile_definitions(${PROJECT_NAME} PUBLIC IMGUI_ENABLE_FREETYPE)
+endif()
+
+if(IMGUI_FREETYPE_LUNASVG)
+ find_package(unofficial-lunasvg CONFIG REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PUBLIC unofficial::lunasvg::lunasvg)
+ target_compile_definitions(${PROJECT_NAME} PUBLIC IMGUI_ENABLE_FREETYPE_LUNASVG)
+endif()
+
+if(IMGUI_USE_WCHAR32)
+ target_compile_definitions(${PROJECT_NAME} PUBLIC IMGUI_USE_WCHAR32)
+endif()
+
+if(IMGUI_TEST_ENGINE)
+ find_package(Stb REQUIRED)
+ target_include_directories(${PROJECT_NAME} PRIVATE ${Stb_INCLUDE_DIR})
+ target_sources(
+ ${PROJECT_NAME}
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_capture_tool.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_te_context.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_te_coroutine.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_te_engine.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_te_exporters.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_te_perftool.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_te_ui.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_te_utils.cpp
+ )
+endif()
+
+list(REMOVE_DUPLICATES BINDINGS_SOURCES)
+
+install(
+ TARGETS ${PROJECT_NAME}
+ EXPORT ${PROJECT_NAME}_target
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin
+)
+
+foreach(BINDING_TARGET ${BINDING_TARGETS})
+ install(
+ TARGETS ${BINDING_TARGET}
+ EXPORT ${PROJECT_NAME}_target
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin
+ )
+endforeach()
+
+if(NOT IMGUI_SKIP_HEADERS)
+ install(FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/imgui.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/imconfig.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/imgui_internal.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/imstb_textedit.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/imstb_rectpack.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/imstb_truetype.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/misc/cpp/imgui_stdlib.h
+ DESTINATION include
+ )
+
+ if(IMGUI_BUILD_ALLEGRO5_BINDING)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_allegro5.h DESTINATION include)
+ endif()
+
+ if (IMGUI_BUILD_ANDROID_BINDING)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_android.h DESTINATION include)
+ endif()
+
+ if(IMGUI_BUILD_DX9_BINDING)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_dx9.h DESTINATION include)
+ endif()
+
+ if(IMGUI_BUILD_DX10_BINDING)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_dx10.h DESTINATION include)
+ endif()
+
+ if(IMGUI_BUILD_DX11_BINDING)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_dx11.h DESTINATION include)
+ endif()
+
+ if(IMGUI_BUILD_DX12_BINDING)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_dx12.h DESTINATION include)
+ endif()
+
+ if(IMGUI_BUILD_GLFW_BINDING)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_glfw.h DESTINATION include)
+ endif()
+
+ if(IMGUI_BUILD_GLUT_BINDING)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_glut.h DESTINATION include)
+ endif()
+
+ if(IMGUI_BUILD_METAL_BINDING)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_metal.h DESTINATION include)
+ endif()
+
+ if(IMGUI_BUILD_OPENGL2_BINDING)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_opengl2.h DESTINATION include)
+ endif()
+
+ if(IMGUI_BUILD_OPENGL3_BINDING)
+ install(
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_opengl3.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_opengl3_loader.h
+ DESTINATION
+ include
+ )
+ endif()
+
+ if(IMGUI_BUILD_OSX_BINDING)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_osx.h DESTINATION include)
+ endif()
+
+ if(IMGUI_BUILD_SDL2_BINDING)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_sdl2.h DESTINATION include)
+ endif()
+
+ if(IMGUI_BUILD_SDL2_RENDERER_BINDING)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_sdlrenderer2.h DESTINATION include)
+ endif()
+
+ if(IMGUI_BUILD_SDL3_BINDING)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_sdl3.h DESTINATION include)
+ endif()
+
+ if(IMGUI_BUILD_SDL3_RENDERER_BINDING)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_sdlrenderer3.h DESTINATION include)
+ endif()
+
+ if(IMGUI_BUILD_VULKAN_BINDING)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_vulkan.h DESTINATION include)
+ endif()
+
+ if(IMGUI_BUILD_WIN32_BINDING)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/backends/imgui_impl_win32.h DESTINATION include)
+ endif()
+
+ if(IMGUI_FREETYPE)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/misc/freetype/imgui_freetype.h DESTINATION include)
+ endif()
+
+ if(IMGUI_TEST_ENGINE)
+ install(
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_capture_tool.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_te_context.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_te_coroutine.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_te_engine.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_te_exporters.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_te_imconfig.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_te_internal.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_te_perftool.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_te_ui.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/test-engine/imgui_te_utils.h
+ DESTINATION
+ include
+ )
+ endif()
+endif()
+
+include(CMakePackageConfigHelpers)
+configure_package_config_file(imgui-config.cmake.in imgui-config.cmake INSTALL_DESTINATION share/imgui)
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/imgui-config.cmake DESTINATION share/imgui)
+
+install(
+ EXPORT ${PROJECT_NAME}_target
+ NAMESPACE ${PROJECT_NAME}::
+ FILE ${PROJECT_NAME}-targets.cmake
+ DESTINATION share/${PROJECT_NAME}
+)
\ No newline at end of file
diff --git a/vcpkg-overlays/imgui/imgui-config.cmake.in b/vcpkg-overlays/imgui/imgui-config.cmake.in
new file mode 100644
index 0000000..e44a16a
--- /dev/null
+++ b/vcpkg-overlays/imgui/imgui-config.cmake.in
@@ -0,0 +1,47 @@
+cmake_policy(SET CMP0012 NEW)
+
+@PACKAGE_INIT@
+
+include(CMakeFindDependencyMacro)
+
+if (@IMGUI_BUILD_GLFW_BINDING@)
+ if (NOT "@EMSCRIPTEN@")
+ find_dependency(glfw3 CONFIG)
+ endif()
+endif()
+
+if (@IMGUI_BUILD_GLUT_BINDING@)
+ find_dependency(GLUT)
+endif()
+
+if ((@IMGUI_BUILD_SDL2_BINDING@ OR @IMGUI_BUILD_SDL2_RENDERER_BINDING@) AND NOT (@IMGUI_BUILD_SDL3_BINDING@ OR @IMGUI_BUILD_SDL3_RENDERER_BINDING@))
+ find_dependency(SDL2 CONFIG)
+elseif(@IMGUI_BUILD_SDL2_BINDING@ OR @IMGUI_BUILD_SDL2_RENDERER_BINDING@)
+ message(WARNING "Imgui: sdl2 dependency not enforced. sdl2 features are mutually exclusive with sdl3 features with sdl3 taking priority.")
+endif()
+
+if (@IMGUI_BUILD_SDL3_BINDING@ OR @IMGUI_BUILD_SDL3_RENDERER_BINDING@)
+ find_dependency(SDL3 CONFIG)
+endif()
+
+if (@IMGUI_BUILD_VULKAN_BINDING@)
+ find_dependency(Vulkan)
+endif()
+
+if (@IMGUI_FREETYPE@)
+ find_dependency(freetype CONFIG)
+endif()
+
+if (@IMGUI_FREETYPE_LUNASVG@)
+ find_dependency(unofficial-lunasvg CONFIG)
+endif()
+
+if (@IMGUI_BUILD_ALLEGRO5_BINDING@)
+ find_dependency(Allegro CONFIG)
+endif()
+
+if (@IMGUI_TEST_ENGINE@)
+ find_dependency(Stb)
+endif()
+
+include("${CMAKE_CURRENT_LIST_DIR}/imgui-targets.cmake")
\ No newline at end of file
diff --git a/vcpkg-overlays/imgui/portfile.cmake b/vcpkg-overlays/imgui/portfile.cmake
new file mode 100644
index 0000000..aaa689e
--- /dev/null
+++ b/vcpkg-overlays/imgui/portfile.cmake
@@ -0,0 +1,105 @@
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+if ("docking-experimental" IN_LIST FEATURES)
+ vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO ocornut/imgui
+ REF "v${VERSION}-docking"
+ SHA512 5d1849867475c24dea51254bde945e919938b4fa2aac218e35a9371d3f48d8fc486ac4e459e9a0c3d36526f18972ac3ac292581aa831ca54efb3d640c6e156b1
+ HEAD_REF docking
+ )
+else()
+ vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO ocornut/imgui
+ REF "v${VERSION}"
+ SHA512 eef35ba9f7e39ddeff3e2df0eef77d3cd8602115cb42a6fad274aecf4d5e6922c43ea4fab37908729df00a3d3e69c5000b21b46b23ed18891fb899e6b9807feb
+ HEAD_REF master
+ )
+endif()
+
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/imgui-config.cmake.in" DESTINATION "${SOURCE_PATH}")
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ allegro5-binding IMGUI_BUILD_ALLEGRO5_BINDING
+ android-binding IMGUI_BUILD_ANDROID_BINDING
+ dx9-binding IMGUI_BUILD_DX9_BINDING
+ dx10-binding IMGUI_BUILD_DX10_BINDING
+ dx11-binding IMGUI_BUILD_DX11_BINDING
+ dx12-binding IMGUI_BUILD_DX12_BINDING
+ glfw-binding IMGUI_BUILD_GLFW_BINDING
+ glut-binding IMGUI_BUILD_GLUT_BINDING
+ metal-binding IMGUI_BUILD_METAL_BINDING
+ opengl2-binding IMGUI_BUILD_OPENGL2_BINDING
+ opengl3-binding IMGUI_BUILD_OPENGL3_BINDING
+ osx-binding IMGUI_BUILD_OSX_BINDING
+ sdl3-binding IMGUI_BUILD_SDL3_BINDING
+ sdl3-renderer-binding IMGUI_BUILD_SDL3_RENDERER_BINDING
+ vulkan-binding IMGUI_BUILD_VULKAN_BINDING
+ win32-binding IMGUI_BUILD_WIN32_BINDING
+ freetype IMGUI_FREETYPE
+ freetype-lunasvg IMGUI_FREETYPE_LUNASVG
+ wchar32 IMGUI_USE_WCHAR32
+ test-engine IMGUI_TEST_ENGINE
+)
+
+if ("libigl-imgui" IN_LIST FEATURES)
+ vcpkg_download_distfile(
+ IMGUI_FONTS_DROID_SANS_H
+ URLS
+ https://raw.githubusercontent.com/libigl/libigl-imgui/c3efb9b62780f55f9bba34561f79a3087e057fc0/imgui_fonts_droid_sans.h
+ FILENAME "imgui_fonts_droid_sans.h"
+ SHA512
+ abe9250c9a5989e0a3f2285bbcc83696ff8e38c1f5657c358e6fe616ff792d3c6e5ff2fa23c2eeae7d7b307392e0dc798a95d14f6d10f8e9bfbd7768d36d8b31
+ )
+
+ file(INSTALL "${IMGUI_FONTS_DROID_SANS_H}" DESTINATION "${CURRENT_PACKAGES_DIR}/include")
+endif()
+
+if ("test-engine" IN_LIST FEATURES)
+ vcpkg_from_github(
+ OUT_SOURCE_PATH TEST_ENGINE_SOURCE_PATH
+ REPO ocornut/imgui_test_engine
+ REF "v${VERSION}"
+ SHA512 b18d64732629f01eb4153c7f7dbc2184d7ad1d63d0dc1b4f42120209c673f20ebc202bf7bc6ab27ae1a23a9437d40cc9f77c3e100e0e6de3ed6eb0087c41b7a4
+ HEAD_REF master
+ )
+
+ file(REMOVE_RECURSE "${SOURCE_PATH}/test-engine")
+ file(COPY "${TEST_ENGINE_SOURCE_PATH}/imgui_test_engine/" DESTINATION "${SOURCE_PATH}/test-engine")
+ file(REMOVE_RECURSE "${SOURCE_PATH}/test-engine/thirdparty/stb")
+ vcpkg_replace_string("${SOURCE_PATH}/test-engine/imgui_capture_tool.cpp" "//#define IMGUI_STB_IMAGE_WRITE_FILENAME \"my_folder/stb_image_write.h\"" "#define IMGUI_STB_IMAGE_WRITE_FILENAME \n#define STB_IMAGE_WRITE_STATIC")
+ vcpkg_replace_string("${SOURCE_PATH}/imconfig.h" "#pragma once" "#pragma once\n\n#include \"imgui_te_imconfig.h\"")
+ vcpkg_replace_string("${SOURCE_PATH}/test-engine/imgui_te_imconfig.h" "#define IMGUI_TEST_ENGINE_ENABLE_COROUTINE_STDTHREAD_IMPL 0" "#define IMGUI_TEST_ENGINE_ENABLE_COROUTINE_STDTHREAD_IMPL 1")
+endif()
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ OPTIONS_DEBUG
+ -DIMGUI_SKIP_HEADERS=ON
+)
+
+vcpkg_cmake_install()
+
+if ("freetype" IN_LIST FEATURES)
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/imconfig.h" "//#define IMGUI_ENABLE_FREETYPE\n" "#define IMGUI_ENABLE_FREETYPE\n")
+endif()
+if ("freetype-lunasvg" IN_LIST FEATURES)
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/imconfig.h" "//#define IMGUI_ENABLE_FREETYPE_LUNASVG" "#define IMGUI_ENABLE_FREETYPE_LUNASVG")
+endif()
+if ("wchar32" IN_LIST FEATURES)
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/imconfig.h" "//#define IMGUI_USE_WCHAR32" "#define IMGUI_USE_WCHAR32")
+endif()
+
+vcpkg_copy_pdbs()
+vcpkg_cmake_config_fixup()
+
+if ("test-engine" IN_LIST FEATURES)
+ vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt" "${SOURCE_PATH}/test-engine/LICENSE.txt")
+else()
+ vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
+endif()
\ No newline at end of file
diff --git a/vcpkg-overlays/imgui/vcpkg.json b/vcpkg-overlays/imgui/vcpkg.json
new file mode 100644
index 0000000..c6e2038
--- /dev/null
+++ b/vcpkg-overlays/imgui/vcpkg.json
@@ -0,0 +1,133 @@
+{
+ "name": "imgui",
+ "version": "1.91.6",
+ "port-version": 1,
+ "description": "Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies.",
+ "homepage": "https://github.com/ocornut/imgui",
+ "license": "MIT",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "features": {
+ "allegro5-binding": {
+ "description": "Make available Allegro5 binding",
+ "dependencies": [
+ "allegro5"
+ ]
+ },
+ "android-binding": {
+ "description": "Make available Android native app support",
+ "supports": "android"
+ },
+ "docking-experimental": {
+ "description": "Build with docking support"
+ },
+ "dx10-binding": {
+ "description": "Make available DirectX10 binding",
+ "supports": "windows & !uwp"
+ },
+ "dx11-binding": {
+ "description": "Make available DirectX11 binding",
+ "supports": "windows & !uwp"
+ },
+ "dx12-binding": {
+ "description": "Make available DirectX12 binding",
+ "supports": "!x86 & windows & !uwp"
+ },
+ "dx9-binding": {
+ "description": "Make available DirectX9 binding",
+ "supports": "windows & !uwp"
+ },
+ "freetype": {
+ "description": "Build font atlases using FreeType instead of stb_truetype",
+ "dependencies": [
+ "freetype"
+ ]
+ },
+ "freetype-lunasvg": {
+ "description": "Add support to render OpenType SVG fonts using LunaSVG",
+ "dependencies": [
+ {
+ "name": "imgui",
+ "features": [
+ "freetype"
+ ]
+ },
+ "lunasvg"
+ ]
+ },
+ "glfw-binding": {
+ "description": "Make available GLFW binding",
+ "dependencies": [
+ {
+ "name": "glfw3",
+ "platform": "!emscripten"
+ }
+ ]
+ },
+ "glut-binding": {
+ "description": "Make available Glut binding",
+ "dependencies": [
+ "freeglut"
+ ]
+ },
+ "libigl-imgui": {
+ "description": "Install the libigl-imgui headers"
+ },
+ "metal-binding": {
+ "description": "Make available Metal binding",
+ "supports": "osx"
+ },
+ "opengl2-binding": {
+ "description": "Make available OpenGL (legacy) binding",
+ "supports": "!uwp"
+ },
+ "opengl3-binding": {
+ "description": "Make available OpenGL3/ES/ES2 (modern) binding"
+ },
+ "osx-binding": {
+ "description": "Make available OSX binding",
+ "supports": "osx"
+ },
+ "sdl3-binding": {
+ "description": "Make available SDL3 binding",
+ "dependencies": [
+ "sdl3"
+ ]
+ },
+ "sdl3-renderer-binding": {
+ "description": "Make available SDL3 Renderer binding",
+ "dependencies": [
+ "sdl3"
+ ]
+ },
+ "test-engine": {
+ "description": "Build test engine",
+ "supports": "!uwp",
+ "license": null,
+ "dependencies": [
+ "stb"
+ ]
+ },
+ "vulkan-binding": {
+ "description": "Make available Vulkan binding",
+ "dependencies": [
+ "vulkan"
+ ]
+ },
+ "wchar32": {
+ "description": "Use WCHAR32 instead of WCHAR16"
+ },
+ "win32-binding": {
+ "description": "Make available Win32 binding",
+ "supports": "windows & !uwp"
+ }
+ }
+}
\ No newline at end of file
diff --git a/vcpkg.json b/vcpkg.json
index fac4263..885bb13 100644
--- a/vcpkg.json
+++ b/vcpkg.json
@@ -1,20 +1,26 @@
{
"dependencies": [
"eastl",
+ "entt",
"fmt",
- "glfw3",
"glm",
{
"name": "imgui",
"features": [
"docking-experimental",
"glfw-binding",
- "vulkan-binding"
+ "vulkan-binding",
+ "sdl3-binding"
]
},
"scottt-debugbreak",
"tinygltf",
"vulkan-memory-allocator",
- "entt"
+ {
+ "name": "sdl3",
+ "features": [
+ "vulkan"
+ ]
+ }
]
}