Rework tracing system and enum creators

- Rework tracing system, now using "{}" for formatting instead of the
  standard %s,%d,%f formatting that C++ uses.
- Rework enums creators to not take in namespace
- Fix single use CommandBuffers sometimes failing due to indexing them
  with the current frame in flight
- Add DropEvent to Window
This commit is contained in:
Thraix
2026-05-03 12:40:47 +02:00
parent 9d5a5314a7
commit 9a3b3aa13c
48 changed files with 476 additions and 277 deletions
+13 -1
View File
@@ -3,6 +3,7 @@
#include <GLFW/glfw3.h>
#include "copium/core/Vulkan.h"
#include "copium/event/DropEvent.h"
#include "copium/event/EventDispatcher.h"
#include "copium/event/Input.h"
#include "copium/event/KeyPressEvent.h"
@@ -101,7 +102,7 @@ namespace Copium
break;
}
default:
CP_ABORT("Unreachable switch case: %s", ToString(mode).c_str());
CP_ABORT("Unreachable switch case: {}", mode);
}
CP_ASSERT(window, "Failed to initialize glfw window");
@@ -113,6 +114,7 @@ namespace Copium
glfwSetCursorPosCallback(window, MouseMoveCallback);
glfwSetWindowFocusCallback(window, WindowFocusCallback);
glfwSetScrollCallback(window, MouseScrollCallback);
glfwSetDropCallback(window, DropCallback);
}
void Window::InitializeSurface()
@@ -192,4 +194,14 @@ namespace Copium
{
EventDispatcher::QueueEvent(MouseScrollEvent{(int)xoffset, (int)yoffset});
}
void Window::DropCallback(GLFWwindow* window, int pathCount, const char* paths[])
{
std::vector<std::string> filePaths;
for (int i = 0; i < pathCount; i++)
{
filePaths.emplace_back(paths[i]);
}
EventDispatcher::QueueEvent(DropEvent{filePaths});
}
}