Moved from GLFW3 to SDL3.
This commit is contained in:
parent
ec1fc0570d
commit
4d5cffa3d7
|
|
@ -4,3 +4,4 @@ build/
|
|||
.vs/
|
||||
.direnv/
|
||||
.ccls-cache/
|
||||
/Folder.DotSettings.user
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/Housekeeping/Bookmarks/NumberedBookmarks/=Bookmark5/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:String x:Key="/Default/Housekeeping/Bookmarks/NumberedBookmarks/=Bookmark5/Coords/@EntryValue">(Doc Ln 10 Col 4)</s:String>
|
||||
<s:String x:Key="/Default/Housekeeping/Bookmarks/NumberedBookmarks/=Bookmark5/FileId/@EntryValue">DB94C55F-6B9A-4AAE-80D7-29FD8153E6B5/d:aster/f:window.h</s:String>
|
||||
<s:String x:Key="/Default/Housekeeping/Bookmarks/NumberedBookmarks/=Bookmark5/Owner/@EntryValue">NumberedBookmarkManager</s:String></wpf:ResourceDictionary>
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#define EASTL_NO_EXCEPTIONS 1
|
||||
|
||||
#define FMT_UNICODE 0
|
||||
|
||||
#if defined(ASTER_NDEBUG)
|
||||
#define USE_OPTICK (0)
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -4,9 +4,14 @@
|
|||
// =============================================
|
||||
|
||||
#include "context.h"
|
||||
|
||||
#include "window.h"
|
||||
|
||||
#include <EASTL/array.h>
|
||||
#include <EASTL/fixed_vector.h>
|
||||
|
||||
#include <SDL3/SDL_vulkan.h>
|
||||
|
||||
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<cstr, 3> instanceExtensions(glfwExtensions, glfwExtensions + glfwExtensionCount);
|
||||
eastl::vector<cstr> instanceExtensions = window->GetRequiredExtensions();
|
||||
if (enableValidation)
|
||||
{
|
||||
instanceExtensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -56,19 +56,19 @@ struct fmt::formatter<MemorySize>
|
|||
// 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<u16>(mem.m_Megabytes / 1024.0));
|
||||
}
|
||||
if (mem.m_Megabytes > 0)
|
||||
{
|
||||
return v10::format_to(ctx.out(), "{}.{} MB", mem.m_Megabytes, Cast<u16>(mem.m_Kilobytes / 1024.0));
|
||||
return v11::format_to(ctx.out(), "{}.{} MB", mem.m_Megabytes, Cast<u16>(mem.m_Kilobytes / 1024.0));
|
||||
}
|
||||
if (mem.m_Kilobytes > 0)
|
||||
{
|
||||
return v10::format_to(ctx.out(), "{}.{} KB", mem.m_Kilobytes, Cast<u16>(mem.m_Bytes / 1024.0));
|
||||
return v11::format_to(ctx.out(), "{}.{} KB", mem.m_Kilobytes, Cast<u16>(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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
#include "constants.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
|
@ -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<f64>};
|
||||
inline static f64 m_Delta{Qnan<f64>};
|
||||
|
||||
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<vk::Result> : nested_formatter<std::string>
|
|||
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<eastl::fixed_string<TType, TCount, TOverflow>> : nested_fo
|
|||
// ReSharper disable once CppInconsistentNaming
|
||||
format(const eastl::fixed_string<TType, TCount, TOverflow> &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())); });
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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<vk::Result>(
|
||||
glfwCreateWindowSurface(Cast<VkInstance>(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<VkInstance>(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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
#include "surface.h"
|
||||
#include "window.h"
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
[[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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
// =============================================
|
||||
// Aster: logger.h
|
||||
// Copyright (c) 2020-2024 Anish Bhobe
|
||||
// =============================================
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "constants.h"
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
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<f64>(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;
|
||||
}
|
||||
};
|
||||
|
|
@ -8,13 +8,32 @@
|
|||
#include "context.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_vulkan.h>
|
||||
|
||||
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_Event*>(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<i32>(width), Cast<i32>(height));
|
||||
SDL_SetWindowSize(m_Window, Cast<i32>(width), Cast<i32>(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<u32>(width), Cast<u32>(height)};
|
||||
}
|
||||
|
||||
eastl::vector<cstr>
|
||||
Window::GetRequiredExtensions()
|
||||
{
|
||||
u32 count = 0;
|
||||
auto extensions = SDL_Vulkan_GetInstanceExtensions(&count);
|
||||
return eastl::vector<cstr>{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<i32>(extent.m_Width), Cast<i32>(extent.m_Height), m_Name.c_str(),
|
||||
isFullScreen ? monitor : nullptr, nullptr);
|
||||
m_Window =
|
||||
SDL_CreateWindow(m_Name.c_str(), Cast<i32>(extent.m_Width), Cast<i32>(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<i32>(windowWidth - extent.m_Width) / 2,
|
||||
Cast<i32>(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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,14 +8,17 @@
|
|||
#include "global.h"
|
||||
|
||||
#include "size.h"
|
||||
#include "EASTL/vector.h"
|
||||
|
||||
#include <EASTL/fixed_string.h>
|
||||
#include <atomic>
|
||||
|
||||
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<cstr> GetRequiredExtensions();
|
||||
|
||||
// Ctor/Dtor
|
||||
Window(cstr title, Size2D extent, b8 isFullScreen = false);
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
#include "helpers.h"
|
||||
#include "window.h"
|
||||
|
||||
#include <imgui_impl_glfw.h>
|
||||
#include <imgui_impl_vulkan.h>
|
||||
#include <imgui_impl_sdl3.h>
|
||||
#include <imgui_internal.h>
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
#include "pipeline.h"
|
||||
#include "swapchain.h"
|
||||
|
||||
#include "timer.h"
|
||||
|
||||
#include "helpers.h"
|
||||
|
||||
#include <EASTL/array.h>
|
||||
|
|
@ -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};
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include "frame.h"
|
||||
#include "image.h"
|
||||
#include "stb_image.h"
|
||||
#include "timer.h"
|
||||
|
||||
#include <EASTL/array.h>
|
||||
|
||||
|
|
@ -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};
|
||||
|
|
|
|||
|
|
@ -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 <EASTL/array.h>
|
||||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
|
|
|
|||
2
vcpkg
2
vcpkg
|
|
@ -1 +1 @@
|
|||
Subproject commit b27651341123a59f7187b42ef2bc476284afb310
|
||||
Subproject commit 0ca64b4e1c70fa6d9f53b369b8f3f0843797c20c
|
||||
|
|
@ -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"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/test-engine>"
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
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}
|
||||
)
|
||||
|
|
@ -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")
|
||||
|
|
@ -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 <stb_image_write.h>\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()
|
||||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
12
vcpkg.json
12
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"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue