diff --git a/plugins/Cardinal/CardinalPlugin.cpp b/plugins/Cardinal/CardinalPlugin.cpp index 277a43c..d04ad0b 100644 --- a/plugins/Cardinal/CardinalPlugin.cpp +++ b/plugins/Cardinal/CardinalPlugin.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -100,6 +101,9 @@ struct Initializer { midi::init(); // rtmidiInit(); keyboard::init(); +#ifndef DPF_AS_GLFW + gamepad::init(); +#endif plugin::init(); library::init(); // discord::init(); diff --git a/plugins/Cardinal/CardinalUI.cpp b/plugins/Cardinal/CardinalUI.cpp index e0631aa..1adfda6 100644 --- a/plugins/Cardinal/CardinalUI.cpp +++ b/plugins/Cardinal/CardinalUI.cpp @@ -27,11 +27,6 @@ #include "DistrhoUI.hpp" #include "ResizeHandle.hpp" -GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window) { return nullptr; } -GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char*) {} -GLFWAPI const char* glfwGetKeyName(int key, int scancode) { return nullptr; } -GLFWAPI int glfwGetKeyScancode(int key) { return 0; } - namespace rack { namespace network { std::string encodeUrl(const std::string&) { return {}; } @@ -40,6 +35,12 @@ namespace network { } } +#ifdef DPF_AS_GLFW +GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window) { return nullptr; } +GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char*) {} +GLFWAPI const char* glfwGetKeyName(int key, int scancode) { return nullptr; } +GLFWAPI int glfwGetKeyScancode(int key) { return 0; } + namespace rack { namespace window { DISTRHO_NAMESPACE::UI* lastUI = nullptr; @@ -49,6 +50,7 @@ namespace window { void scrollCallback(Window* win, double x, double y); } } +#endif START_NAMESPACE_DISTRHO @@ -95,7 +97,9 @@ public: */ // Initialize context INFO("Initializing context"); +#ifdef DPF_AS_GLFW window::lastUI = this; +#endif contextSet(new Context); APP->engine = new engine::Engine; APP->history = new history::State; @@ -106,7 +110,9 @@ public: /*if (!settings::headless)*/ { APP->window = new window::Window; } +#ifdef DPF_AS_GLFW window::lastUI = nullptr; +#endif APP->engine->startFallbackThread(); } @@ -143,6 +149,7 @@ protected: // ------------------------------------------------------------------------------------------------------- +#ifdef DPF_AS_GLFW bool onMouse(const MouseEvent& ev) override { int button; @@ -205,6 +212,7 @@ protected: scrollCallback(APP->window, ev.delta.getX(), ev.delta.getY()); return true; } +#endif #if 0 void onResize(const ResizeEvent& ev) override diff --git a/plugins/Cardinal/DistrhoPluginInfo.h b/plugins/Cardinal/DistrhoPluginInfo.h index 9fc88fb..7b4a845 100644 --- a/plugins/Cardinal/DistrhoPluginInfo.h +++ b/plugins/Cardinal/DistrhoPluginInfo.h @@ -33,6 +33,8 @@ // #define DISTRHO_UI_USE_NANOVG 1 #define DISTRHO_UI_USER_RESIZABLE 0 +#define DPF_AS_GLFW 1 + enum Parameters { kParameterCount }; diff --git a/plugins/Cardinal/Makefile b/plugins/Cardinal/Makefile index 94eb078..20f83d1 100644 --- a/plugins/Cardinal/Makefile +++ b/plugins/Cardinal/Makefile @@ -63,6 +63,10 @@ endif EXTRA_LIBS += Rack/dep/lib/libzstd.a +# for raw GLFW window +# EXTRA_LIBS += Rack/dep/lib/libglfw3.a +# FILES_DSP += Rack/src/gamepad.cpp Rack/src/window/Window.cpp + # -------------------------------------------------------------- # Do some magic