diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 8ec8561..24ea456 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -1,37 +1,174 @@ -# engine add_subdirectory(./std) +add_library_module( + NAME + test + INTERFACES + test.cppm + expects.cppm + PRIVATE_INTERFACES + registry.cppm + SOURCES + entrypoint.cpp + DEPENDENCIES + logger +) -add_subdirectory(test) +add_library_module(NAME logger INTERFACES logger.cppm) -add_subdirectory(./logger) +add_library_module(NAME bitwise INTERFACES operations.cppm) -add_subdirectory(./bitwise) +add_library_module(NAME env INTERFACES constants.cppm) -add_subdirectory(./env) +add_library_module( + NAME memory INTERFACES null_on_move.cppm reference.cppm scope.cppm +) -add_subdirectory(./memory) +add_library_module(NAME time INTERFACES timer.cppm) -add_subdirectory(./time) +add_library_module( + NAME + lt_debug + ROOT_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/debug + INTERFACES + instrumentor.cppm + assertions.cppm + DEPENDENCIES + logger +) -add_subdirectory(./debug) +add_library_module( + NAME + math + INTERFACES + algebra.cppm + mat4.cppm + trig.cppm + vec2.cppm + vec3.cppm + vec4.cppm + components/transform.cppm +) -add_subdirectory(./math) +add_library_module( + NAME + assets + INTERFACES + shader.cppm + metadata.cppm + DEPENDENCIES + logger + lt_debug +) -add_subdirectory(./assets) +add_library_module( + NAME + libasset_baker + ROOT_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/asset_baker + INTERFACES + bakers.cppm + DEPENDENCIES + assets + logger + lt_debug +) -add_subdirectory(./asset_baker) +# add_executable(asset_baker entrypoint.cpp) target_link_libraries(asset_baker +# PRIVATE libasset_baker) -add_subdirectory(./camera) +add_library_module(NAME camera INTERFACES components.cppm DEPENDENCIES math) -add_subdirectory(./app) -add_subdirectory(./ecs) +add_library_module( + NAME + app + INTERFACES + application.cppm + system.cppm + SOURCES + entrypoint.cpp + DEPENDENCIES + memory + PRIVATE_DEPENDENCIES + lt_debug +) -add_subdirectory(./surface) +add_library_module( + NAME + ecs + INTERFACES + sparse_set.cppm + registry.cppm + entity.cppm + DEPENDENCIES + logger + lt_debug + memory +) -add_subdirectory(./input) +if(NOT WIN32) + add_library_module( + NAME + surface + INTERFACES + system.cppm + requests.cppm + events.cppm + components.cppm + SOURCES + platform_linux.cpp + DEPENDENCIES + ecs + app + math + memory + tbb + PRIVATE_DEPENDENCIES + X11 + logger + lt_debug + time + ) +else() -# add_subdirectory(./ui) +endif() -# add_subdirectory(./renderer) +add_library_module( + NAME + input + INTERFACES + system.cppm + codes.cppm + components.cppm + events.cppm + DEPENDENCIES + surface + math + logger +) + +add_library_module( + NAME + renderer + INTERFACES + frontends.cppm + factory.cppm + backends/vk/library_wrapper.cppm + backends/vk/context/device.cppm + backends/vk/context/gpu.cppm + backends/vk/context/instance.cppm + backends/vk/context/surface.cppm + backends/vk/context/swapchain.cppm + backends/vk/data/buffer.cppm + DEPENDENCIES + app + ecs + memory + assets + time + bitwise + camera + PRIVATE_DEPENDENCIES + surface +) -# # add_subdirectory(./mirror) diff --git a/modules/app/CMakeLists.txt b/modules/app/CMakeLists.txt deleted file mode 100644 index 50919ba..0000000 --- a/modules/app/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -add_library_module( - NAME - app - INTERFACES - application.cppm - system.cppm - SOURCES - entrypoint.cpp) - -target_link_libraries( - app - PUBLIC memory - PRIVATE lt_debug) diff --git a/modules/asset_baker/CMakeLists.txt b/modules/asset_baker/CMakeLists.txt deleted file mode 100644 index 126f652..0000000 --- a/modules/asset_baker/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_library_module(NAME libasset_baker INTERFACES bakers.cppm) -target_link_libraries(libasset_baker PUBLIC assets logger lt_debug) - -add_executable(asset_baker entrypoint.cpp) -target_link_libraries(asset_baker PRIVATE libasset_baker) diff --git a/modules/assets/CMakeLists.txt b/modules/assets/CMakeLists.txt deleted file mode 100644 index 5e5ac08..0000000 --- a/modules/assets/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library_module(NAME assets INTERFACES shader.cppm metadata.cppm) -target_link_libraries(assets PUBLIC logger lt_debug) -add_test_module(assets shader.test.cpp) diff --git a/modules/bitwise/CMakeLists.txt b/modules/bitwise/CMakeLists.txt deleted file mode 100644 index 0a9b300..0000000 --- a/modules/bitwise/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_library_module(NAME bitwise INTERFACES operations.cppm) diff --git a/modules/bitwise/operations.cppm b/modules/bitwise/operations.cppm index 965b2b5..dd66a76 100644 --- a/modules/bitwise/operations.cppm +++ b/modules/bitwise/operations.cppm @@ -4,7 +4,7 @@ import std; namespace lt::bitwise { /* bit-wise */ -constexpr auto bit(std::uint32_t x) -> std::uint32_t +export constexpr auto bit(std::uint32_t x) -> std::uint32_t { return 1u << x; } diff --git a/modules/camera/CMakeLists.txt b/modules/camera/CMakeLists.txt deleted file mode 100644 index 7ee19f6..0000000 --- a/modules/camera/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library_module(NAME camera INTERFACES components.cppm) - -target_link_libraries(camera PUBLIC math) diff --git a/modules/debug/CMakeLists.txt b/modules/debug/CMakeLists.txt deleted file mode 100644 index fe7f651..0000000 --- a/modules/debug/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_library_module(NAME lt_debug INTERFACES instrumentor.cppm assertions.cppm) -target_link_libraries(lt_debug PUBLIC logger) diff --git a/modules/ecs/CMakeLists.txt b/modules/ecs/CMakeLists.txt deleted file mode 100644 index c0d5944..0000000 --- a/modules/ecs/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_library_module(NAME ecs INTERFACES sparse_set.cppm registry.cppm - entity.cppm) -target_link_libraries(ecs PUBLIC logger lt_debug memory) - -add_test_module(ecs sparse_set.test.cpp registry.test.cpp) diff --git a/modules/env/CMakeLists.txt b/modules/env/CMakeLists.txt deleted file mode 100644 index 4dfdd37..0000000 --- a/modules/env/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_library_module(NAME env INTERFACES constants.cppm) diff --git a/modules/input/CMakeLists.txt b/modules/input/CMakeLists.txt deleted file mode 100644 index 5ccfefc..0000000 --- a/modules/input/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -add_library_module( - NAME - input - INTERFACES - system.cppm - codes.cppm - components.cppm - events.cppm) -target_link_libraries(input PUBLIC surface math logger) - -# add_test_module(input system.test.cpp) diff --git a/modules/logger/CMakeLists.txt b/modules/logger/CMakeLists.txt deleted file mode 100644 index 3dd8e00..0000000 --- a/modules/logger/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_library_module(NAME logger INTERFACES logger.cppm) -# add_test_module(logger logger.test.cpp) diff --git a/modules/math/CMakeLists.txt b/modules/math/CMakeLists.txt deleted file mode 100644 index 7e091f4..0000000 --- a/modules/math/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -add_library_module( - NAME - math - INTERFACES - algebra.cppm - mat4.cppm - trig.cppm - vec2.cppm - vec3.cppm - vec4.cppm - components/transform.cppm) diff --git a/modules/memory/CMakeLists.txt b/modules/memory/CMakeLists.txt deleted file mode 100644 index 0861266..0000000 --- a/modules/memory/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_library_module(NAME memory INTERFACES null_on_move.cppm reference.cppm - scope.cppm) diff --git a/modules/memory/null_on_move.cppm b/modules/memory/null_on_move.cppm index 039d6a7..875e81a 100644 --- a/modules/memory/null_on_move.cppm +++ b/modules/memory/null_on_move.cppm @@ -9,7 +9,7 @@ namespace lt::memory { * @note For avoiding the need to explicitly implement the move constructor for objects that hold * Vulkan objects. But may serve other purposes, hence why I kept the implementation generic. */ -template +export template class NullOnMove { public: @@ -84,7 +84,12 @@ public: return (std::uint64_t)m_value; } - [[nodiscard]] auto get() -> Underlying_T + [[nodiscard]] auto get() -> Underlying_T & + { + return m_value; + } + + [[nodiscard]] auto get() const -> const Underlying_T & { return m_value; } diff --git a/modules/mirror/CMakeLists.txt b/modules/mirror/CMakeLists.txt deleted file mode 100644 index d79fae4..0000000 --- a/modules/mirror/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -add_library_module(libmirror) -target_link_libraries(libmirror INTERFACE app time input surface renderer - camera) - -add_test_module( - libmirror layers/editor_layer.test.cpp panels/asset_browser.test.cpp - panels/properties.test.cpp panels/scene_hierarchy.test.cpp) - -add_executable_module(mirror entrypoint/mirror.cpp) -target_link_libraries(mirror PRIVATE libmirror input) diff --git a/modules/renderer/CMakeLists.txt b/modules/renderer/CMakeLists.txt deleted file mode 100644 index ff310fb..0000000 --- a/modules/renderer/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -add_library_module( - NAME - renderer - INTERFACES - # system.cppm Vulkan - backend - frontends.cppm - factory.cppm - # backends/vk/messenger.cppm backends/vk/library_loader.cppm - backends/vk/library_wrapper.cppm - backends/vk/context/device.cppm - backends/vk/context/gpu.cppm - backends/vk/context/instance.cppm - backends/vk/context/surface.cppm - backends/vk/context/swapchain.cppm - backends/vk/data/buffer.cppm - # backends/vk/renderer/pass.cppm backends/vk/renderer/renderer.cppm frontend -) - -target_link_libraries( - renderer - PUBLIC app - ecs - memory - assets - time - bitwise - camera - PRIVATE surface pthread) - -return() - -add_test_module( - renderer - test/utils.cpp - system.test.cpp - # general backend tests through the frontend - frontend/messenger.test.cpp - frontend/context/surface.test.cpp - frontend/context/device.test.cpp - frontend/context/swapchain.test.cpp - frontend/data/buffer.test.cpp - # frontend/renderer/pass.test.cpp - frontend/renderer/renderer.test.cpp - # backend specific tests -- vk - backend/vk/context/instance.test.cpp) - -target_link_libraries(renderer_tests PRIVATE surface pthread) diff --git a/modules/renderer/backends/vk/library_wrapper.cppma b/modules/renderer/backends/vk/library_wrapper.cppma deleted file mode 100644 index 81b27b3..0000000 --- a/modules/renderer/backends/vk/library_wrapper.cppma +++ /dev/null @@ -1,102 +0,0 @@ -module; -#define VK_NO_PROTOTYPES -#define VK_USE_PLATFORM_XLIB_KHR -#include -#include -#include - -export module renderer.backend.vk.library_wrapper; -import std; -// import renderer.backend.vk.library_loader; - -namespace lt::renderer::vk { - -class Device -{ -public: - struct CreateInfo - { - std::vector queue_create_infos; - - std::vector layers; - - std::vector extensions; - - VkPhysicalDeviceFeatures2 features; - }; - - Device() = default; - - Device(CreateInfo info) - { - } - - ~Device() - { - if (m_device) - { - vk_destroy_device(m_device, nullptr); - } - } - -private: - VkDevice m_device {}; -}; - -}; // namespace lt::renderer::vk - -export namespace lt::renderer::vk { - -using Version_T = uint32_t; - -struct ApplicationInfo -{ - std::string_view name; - - Version_T version; - - std::string_view *engine_name; - - Version_T engine_version; - - Version_T api_version; -}; - -[[nodiscard]] -auto enumerate_instance_extension_properties() -> std::vector -{ - auto count = 0u; - vkc(vk_enumerate_instance_extension_properties(nullptr, &count, nullptr)); - - auto extensions = std::vector(count); - std::memset(extensions.data(), 0, extensions.size() * sizeof(VkExtensionProperties)); - vkc(vk_enumerate_instance_extension_properties(nullptr, &count, extensions.data())); - - return extensions; -} - -struct VkInstanceCreateInfo -{ - VkInstanceCreateFlags flags; - - ApplicationInfo application_info; - - std::vector layers; - - std::vector extensions; - - const void *next; -}; - -class Instance -{ -}; - -[[nodiscard]] auto create_instance() -> VkInstance -{ - return VkInstanceCreateInfo - { - } -} - -} // namespace lt::renderer::vk diff --git a/modules/surface/CMakeLists.txt b/modules/surface/CMakeLists.txt deleted file mode 100644 index b349396..0000000 --- a/modules/surface/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -if(NOT WIN32) - add_library_module( - NAME - surface - INTERFACES - system.cppm - requests.cppm - events.cppm - components.cppm - SOURCES - platform_linux.cpp) - target_link_libraries(surface PRIVATE X11) - -else(WIN32) - add_library_module( - NAME - surface - INTERFACES - system.cppm - requests.cppm - system.cppm - requests.cppm - events.cppm - components.cppm - SOURCES - platform_windows.cpp) - -endif() - -target_link_libraries( - surface - PUBLIC ecs app math memory tbb - PRIVATE logger lt_debug time) - -add_test_module(surface system.test.cpp) - -# add_fuzz_module(surface system.fuzz.cpp) diff --git a/modules/surface/system.test.cpp b/modules/surface/system.test.cpp index 271cf3a..2b5b07d 100644 --- a/modules/surface/system.test.cpp +++ b/modules/surface/system.test.cpp @@ -12,7 +12,6 @@ import app.system; import std; -using ::std::ignore; using ::lt::surface::SurfaceComponent; using ::lt::surface::System; using ::lt::test::Case; @@ -21,6 +20,7 @@ using ::lt::test::expect_ne; using ::lt::test::expect_not_nullptr; using ::lt::test::expect_throw; using ::lt::test::Suite; +using ::std::ignore; using ::lt::test::operator""_suite; [[nodiscard]] auto tick_info() -> lt::app::TickInfo @@ -44,7 +44,6 @@ struct overloads: Ts... using Ts::operator()...; }; - class Fixture { public: diff --git a/modules/test/CMakeLists.txt b/modules/test/CMakeLists.txt deleted file mode 100644 index 875a311..0000000 --- a/modules/test/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -add_library_module( - NAME - test - INTERFACES - test.cppm - expects.cppm - PRIVATE_INTERFACES - registry.cppm - SOURCES - entrypoint.cpp) -# add_library_module(fuzz_test test.cpp fuzz.cpp) - -target_link_libraries(test PUBLIC logger) -# target_link_libraries(fuzz_test PUBLIC logger) - -add_test_module(test test.test.cpp) diff --git a/modules/time/CMakeLists.txt b/modules/time/CMakeLists.txt deleted file mode 100644 index 14afb6d..0000000 --- a/modules/time/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library_module(NAME time INTERFACES timer.cppm) - -add_test_module(time timer.test.cpp) diff --git a/modules/ui/CMakeLists.txt b/modules/ui/CMakeLists.txt deleted file mode 100644 index d371081..0000000 --- a/modules/ui/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_library_module(ui ui.cpp) -target_link_libraries(ui PUBLIC imgui renderer logger lt_debug) diff --git a/modules/ui/private/system.test.cpp b/modules/ui/private/system.test.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/modules/ui/private/ui.cpp b/modules/ui/private/ui.cpp deleted file mode 100644 index e33c967..0000000 --- a/modules/ui/private/ui.cpp +++ /dev/null @@ -1,223 +0,0 @@ -#include -#include -#include -#include - -#ifdef LIGHT_PLATFORM_WINDOWS - #include -#endif - -#include -#include -#include -#include -#include -#include -#include - - -inline ImGuiDockNodeFlags_ operator|(ImGuiDockNodeFlags_ a, ImGuiDockNodeFlags_ b) -{ - return static_cast(std::to_underlying(a) | std::to_underlying(b)); -} - -namespace lt { - -UserInterface *UserInterface::s_context = nullptr; - -auto UserInterface::create(memory::Ref sharedContext) -> memory::Scope -{ - auto scopeUserInterface = memory::Scope { nullptr }; - - switch (GraphicsContext::get_graphics_api()) - { - case GraphicsAPI::OpenGL: scopeUserInterface = memory::create_scope(); break; - - case GraphicsAPI::DirectX: - lt_win(scopeUserInterface = memory::create_scope();) break; - - default: - ensure( - false, - "UserInterface::create: invalid/unsupported 'GraphicsAPI' {}", - static_cast(GraphicsContext::get_graphics_api()) - ); - return nullptr; - } - - scopeUserInterface->init(windowHandle, std::move(sharedContext)); - return std::move(scopeUserInterface); -} - -UserInterface::UserInterface() - // NOLINTBEGIN - : m_dockspace_flags( - ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoTitleBar - | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove - | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus - ) -// NOLINTEND -{ - ensure( - !s_context, - "UserInterface::UserInterface: an instance of 'UserInterface' already exists, do not " - "construct this class!" - ); - s_context = this; -} - -void UserInterface::init(memory::Ref sharedContext) -{ - // create context - IMGUI_CHECKVERSION(); - ImGui::CreateContext(); - - // configure io - ImGuiIO &io = ImGui::GetIO(); - // NOLINTBEGIN - io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; - io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; - io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; - io.ConfigFlags |= ImGuiBackendFlags_PlatformHasViewports; - io.ConfigFlags |= ImGuiBackendFlags_RendererHasViewports; - // NOLINTEND - - // #todo: handle this in a better way - if (std::filesystem::exists("user_gui_layout.ini")) - { - io.IniFilename = "user_gui_layout.ini"; - } - else - { - io.IniFilename = "default_gui_layout.ini"; - } - - // style - ImGui::StyleColorsDark(); - - platform_implementation(windowHandle, std::move(sharedContext)); - - io.Fonts->AddFontFromFileTTF("data/assets/fonts/open_sans/OpenSans-Bold.ttf", 18.0f); - io.FontDefault = io.Fonts->AddFontFromFileTTF( - "data/assets/fonts/open_sans/OpenSans-Regular.ttf", - 18.0f - ); - - set_dark_theme_colors(); -} - -void UserInterface::dockspace_begin() -{ - ImGuiViewport *viewport = ImGui::GetMainViewport(); - ImGui::SetNextWindowPos(viewport->Pos); - ImGui::SetNextWindowSize(viewport->Size); - ImGui::SetNextWindowViewport(viewport->ID); - - ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); - ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); - ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); - ImGui::Begin("Dockspace", (bool *)nullptr, s_context->m_dockspace_flags); - ImGui::PopStyleVar(3); - - ImGuiStyle &style = ImGui::GetStyle(); - float const minWinSizeX = style.WindowMinSize.x; - style.WindowMinSize.x = 370.0f; - ImGui::DockSpace( - ImGui::GetID("MyDockSpace"), - ImVec2(0.0f, 0.0f), - ImGuiDockNodeFlags_None | ImGuiWindowFlags_NoBackground // NOLINT - ); - - style.WindowMinSize.x = minWinSizeX; -} - -void UserInterface::dockspace_end() -{ - ImGui::End(); -} - -void UserInterface::set_dark_theme_colors() -{ - ImGuiStyle &style = ImGui::GetStyle(); - ImVec4(&colors)[60] = style.Colors; - - style.WindowPadding = ImVec2(0.0f, 0.0f); - - colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); - colors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f); - - colors[ImGuiCol_WindowBg] = ImVec4(0.10f, 0.10f, 0.11f, 1.00f); - colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); - colors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f); - - colors[ImGuiCol_Border] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f); - colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); - - colors[ImGuiCol_FrameBg] = ImVec4(0.20f, 0.20f, 0.21f, 1.00f); - colors[ImGuiCol_FrameBgHovered] = ImVec4(0.30f, 0.31f, 0.31f, 1.00f); - colors[ImGuiCol_FrameBgActive] = ImVec4(0.15f, 0.15f, 0.15f, 1.00f); - - colors[ImGuiCol_TitleBg] = ImVec4(0.15f, 0.15f, 0.15f, 1.00f); - colors[ImGuiCol_TitleBgActive] = ImVec4(0.15f, 0.15f, 0.15f, 1.00f); - colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.15f, 0.15f, 0.15f, 1.00f); - - colors[ImGuiCol_MenuBarBg] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f); - - colors[ImGuiCol_ScrollbarBg] = ImVec4(0.02f, 0.02f, 0.02f, 0.53f); - colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.31f, 0.31f, 0.31f, 1.00f); - colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f); - colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.51f, 0.51f, 0.51f, 1.00f); - - colors[ImGuiCol_CheckMark] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); - - colors[ImGuiCol_SliderGrab] = ImVec4(0.24f, 0.52f, 0.88f, 1.00f); - colors[ImGuiCol_SliderGrabActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); - - colors[ImGuiCol_Button] = ImVec4(0.20f, 0.20f, 0.21f, 1.00f); - colors[ImGuiCol_ButtonHovered] = ImVec4(0.30f, 0.31f, 0.31f, 1.00f); - colors[ImGuiCol_ButtonActive] = ImVec4(0.15f, 0.15f, 0.15f, 1.00f); - - colors[ImGuiCol_Header] = ImVec4(0.20f, 0.20f, 0.21f, 1.00f); - colors[ImGuiCol_HeaderHovered] = ImVec4(0.30f, 0.31f, 0.31f, 1.00f); - colors[ImGuiCol_HeaderActive] = ImVec4(0.15f, 0.15f, 0.15f, 1.00f); - - colors[ImGuiCol_Separator] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f); - colors[ImGuiCol_SeparatorHovered] = ImVec4(0.10f, 0.40f, 0.75f, 0.78f); - colors[ImGuiCol_SeparatorActive] = ImVec4(0.10f, 0.40f, 0.75f, 1.00f); - - colors[ImGuiCol_ResizeGrip] = ImVec4(0.26f, 0.59f, 0.98f, 0.20f); - colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f); - colors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f); - - colors[ImGuiCol_Tab] = ImVec4(0.15f, 0.15f, 0.15f, 1.00f); - colors[ImGuiCol_TabHovered] = ImVec4(0.38f, 0.38f, 0.38f, 1.00f); - colors[ImGuiCol_TabActive] = ImVec4(0.28f, 0.28f, 0.28f, 1.00f); - colors[ImGuiCol_TabUnfocused] = ImVec4(0.15f, 0.15f, 0.15f, 1.00f); - colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.20f, 0.20f, 0.21f, 1.00f); - - colors[ImGuiCol_DockingPreview] = ImVec4(0.26f, 0.59f, 0.98f, 0.70f); - colors[ImGuiCol_DockingEmptyBg] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); - - colors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f); - colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f); - colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); - colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f); - - colors[ImGuiCol_TableHeaderBg] = ImVec4(0.19f, 0.19f, 0.20f, 1.00f); - colors[ImGuiCol_TableBorderStrong] = ImVec4(0.31f, 0.31f, 0.35f, 1.00f); - colors[ImGuiCol_TableBorderLight] = ImVec4(0.23f, 0.23f, 0.25f, 1.00f); - colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); - colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.06f); - - colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f); - - colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f); - - colors[ImGuiCol_NavHighlight] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); - colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f); - colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f); - - colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f); -} - -} // namespace lt diff --git a/modules/ui/public/system.hpp b/modules/ui/public/system.hpp deleted file mode 100644 index fbef99f..0000000 --- a/modules/ui/public/system.hpp +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -namespace lt::ui { - -struct ButtonComponent -{ - std::function on_activate; - - std::function on_hover; -}; - -struct TransformComponent -{ - float x, y; - - float w, h; -}; - -class System: public app::ISystem -{ -public: - System(memory::Ref registry): m_registry(std::move(registry)) - { - m_registry->each( - [](auto id, auto &button, auto &transform) { - // trigger `button`'s callbacksbased on input's state... - } - ); - } - -private: - memory::Ref m_registry; - - input::InputAction button_press_action; -}; - -} // namespace lt::ui diff --git a/modules/ui/public/ui.hpp b/modules/ui/public/ui.hpp deleted file mode 100644 index b23345e..0000000 --- a/modules/ui/public/ui.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include -#include - -namespace lt { - -class Event; -class SharedContext; - -class UserInterface -{ -public: - static auto create(memory::Ref sharedContext) -> memory::Scope; - - static void dockspace_begin(); - - static void dockspace_end(); - - UserInterface(const UserInterface &) = delete; - - auto operator=(const UserInterface &) -> UserInterface & = delete; - - virtual ~UserInterface() = default; - - void init(memory::Ref sharedContext); - - virtual void platform_implementation(memory::Ref sharedContext) = 0; - - virtual void begin() = 0; - - virtual void end() = 0; - - virtual void log_debug_data() = 0; - -protected: - UserInterface(); - -private: - static UserInterface *s_context; - - void set_dark_theme_colors(); -}; - -} // namespace lt