This commit is contained in:
Jorijn van der Graaf 2026-01-30 07:19:59 +01:00
commit 8275e01b6c
3 changed files with 62 additions and 26 deletions

View file

@ -376,7 +376,7 @@ void WindowVulkan::Render() {
.stageFlags = VK_SHADER_STAGE_ALL,
.layout = rtPipelineLayout,
.firstSet = 0,
.descriptorSetCount = 1,
.descriptorSetCount = static_cast<std::uint32_t>(descriptorsRt.size()),
.pDescriptorSets = descriptorsRt.data()
};
@ -472,10 +472,12 @@ void WindowVulkan::wl_surface_frame_done(void* data, struct wl_callback *cb, uin
#endif
if(window->updating) {
window->mouseDelta = {std::int64_t(window->currentMousePos.x)-window->lastMousePos.x, std::int64_t(window->currentMousePos.y)-window->lastMousePos.y};
cb = wl_surface_frame(window->surface);
wl_callback_add_listener(cb, &WindowVulkan::wl_callback_listener, window);
window->currentFrameTime = {start, start-window->lastFrameBegin};
window->onUpdate.Invoke({start, start-window->lastFrameBegin});
window->lastMousePos = window->currentMousePos;
#ifdef CRAFTER_TIMING
window->totalUpdate = std::chrono::nanoseconds(0);
window->updateTimings.clear();
@ -565,9 +567,7 @@ void WindowVulkan::pointer_handle_button(void* data, wl_pointer* pointer, std::u
void WindowVulkan::PointerListenerHandleMotion(void* data, wl_pointer* wl_pointer, uint time, wl_fixed_t surface_x, wl_fixed_t surface_y) {
WindowVulkan* window = reinterpret_cast<WindowVulkan*>(data);
MousePoint pos = {FractionalToMappedBoundless<std::uint32_t>((wl_fixed_to_double(surface_x) * window->scale) / window->width), FractionalToMappedBoundless<std::uint32_t>((wl_fixed_to_double(surface_y) * window->scale) / window->height)};
window->lastMousePos = window->currentMousePos;
window->currentMousePos = pos;
window->mouseDelta = {window->currentMousePos.x-window->lastMousePos.x, window->currentMousePos.y-window->lastMousePos.y};
window->onMouseMove.Invoke({window->lastMousePos, window->currentMousePos, window->mouseDelta});
for(MouseElement* element : window->mouseElements) {
if(element) {