Skip to content

Commit 17a238a

Browse files
committed
Implement glfwGetKey for a future plugin
Signed-off-by: falkTX <falktx@falktx.com>
1 parent 06591bd commit 17a238a

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/custom/glfw.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* DISTRHO Cardinal Plugin
3-
* Copyright (C) 2021-2024 Filipe Coelho <falktx@falktx.com>
3+
* Copyright (C) 2021-2025 Filipe Coelho <falktx@falktx.com>
44
*
55
* This program is free software; you can redistribute it and/or
66
* modify it under the terms of the GNU General Public License as
@@ -17,6 +17,7 @@
1717

1818
#include "Application.hpp"
1919
#include "CardinalPluginContext.hpp"
20+
#include "widget/event.hpp"
2021

2122
#include <GLFW/glfw3.h>
2223

@@ -207,3 +208,12 @@ GLFWAPI const char* glfwGetKeyName(const int key, int)
207208
default: return nullptr;
208209
}
209210
}
211+
212+
int glfwGetKey(GLFWwindow*, const int key)
213+
{
214+
CardinalPluginContext* const context = static_cast<CardinalPluginContext*>(APP);
215+
DISTRHO_SAFE_ASSERT_RETURN(context != nullptr, GLFW_RELEASE);
216+
DISTRHO_SAFE_ASSERT_RETURN(context->event != nullptr, GLFW_RELEASE);
217+
218+
return context->event->heldKeys.find(key) != context->event->heldKeys.end() ? GLFW_PRESS : GLFW_RELEASE;
219+
}

0 commit comments

Comments
 (0)